*, *::before, *::after { box-sizing: border-box; }

html, body {
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #f0f2f5;
    color: #1a1f2e;
    -webkit-font-smoothing: antialiased;
}

/* ── Navbar ── */
header {
    height: 60px;
    background: #fff;
    border-bottom: 1px solid #e4e7ec;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    flex-shrink: 0;
}

.header-left {
    flex: 1;
    display: flex;
    align-items: center;
}

.header-center {
    flex: 2.5;
    display: flex;
    align-items: center;
}

.header-logo-img {
    height: 50px;
    width: auto;
    flex-shrink: 0;
    display: block;
}

.btn-new-convo {
    background: #1e3a5f;
    color: #fff;
    border: none;
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 30px;
    cursor: pointer;
    transition: background 0.12s;
    white-space: nowrap;
}

.btn-new-convo:hover { background: #162d4a; }

.btn-text {
    background: none;
    border: none;
    font-family: 'Open Sans', sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.12s, color 0.12s;
}

.btn-text:hover { background: #f3f4f6; color: #1a1f2e; }

.btn-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    transition: background 0.12s;
}

.btn-profile:hover { background: #f3f4f6; }

.btn-profile-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #1e3a5f;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.03em;
}

.btn-profile-name {
    font-family: 'Open Sans', sans-serif;
    font-size: 18px;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
}

.btn-bell {
    background: none;
    border: none;
    color: #d93025;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    border-radius: 50%;
    transition: background 0.12s;
}

.btn-bell:hover { background: #fce8e6; }

.header-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.btn {
    font-family: 'Open Sans', sans-serif;
    font-size: 15px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    background: none;
    color: #6b7280;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
}

.btn:hover { background: #f3f4f6; color: #1a1f2e; }

.btn-primary {
    background: #1e3a5f;
    color: #fff;
    border-radius: 30px;
    padding: 8px 18px;
}

.btn-primary:hover { background: #162d4a; }

/* ── Layout ── */
.grid-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
    overflow: hidden;
    padding: 12px;
    gap: 0;
    background: #f0f2f5;
}

.grid-panels {
    display: flex;
    flex: 1;
    gap: 10px;
    min-height: 0;
}

/* ── Panels ── */
.panel {
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
    min-width: 0;
}

/* Chat panel gets more weight */
.insight-panel {
    flex: 2.5;
}

/* Collapsible side panels */
#sourcesPanel,
#studioPanel {
    position: relative;
    max-width: 800px;
    flex-shrink: 0;
    transition: max-width 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

#sourcesPanel.collapsed,
#studioPanel.collapsed {
    max-width: 52px;
}

/* Fade out header + body when collapsed */
.panel-header,
.panel-body {
    transition: opacity 0.12s ease;
}

.panel.collapsed .panel-header,
.panel.collapsed .panel-body {
    opacity: 0;
    pointer-events: none;
}

/* Icon bar — absolutely positioned so it doesn't affect layout */
.panel-icon-bar {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    gap: 2px;
    overflow-y: auto;
    overflow-x: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
}

.panel.collapsed .panel-icon-bar {
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.18s ease 0.18s;
}

.sources-icon-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
}

.panel-icon-item {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.panel-icon-item:hover { background: #f3f4f6; }

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 46px;
    padding: 0 16px;
    border-bottom: 1px solid #e4e7ec;
    flex-shrink: 0;
    border-radius: 14px 14px 0 0;
}

.panel-title {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9ca3af;
    margin: 0;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 5px;
    line-height: 1;
    transition: background 0.12s, color 0.12s;
}

.icon-btn:hover { background: #f3f4f6; color: #1a1f2e; }

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}

/* ── Sources ── */
.add-sources-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px;
    border: 1.5px dashed #d1d5db;
    border-radius: 30px;
    background: none;
    font-family: 'Open Sans', sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: #9ca3af;
    cursor: pointer;
    transition: border-color 0.12s, color 0.12s;
}

.add-sources-btn:hover { border-color: #1e3a5f; color: #1e3a5f; }

.search-box {
    font-family: 'Open Sans', sans-serif;
    font-size: 15px;
    padding: 10px 14px;
    border: 1px solid #e4e7ec;
    border-radius: 30px;
    background: #f9fafb;
    width: 100%;
    outline: none;
    color: #1a1f2e;
    transition: border-color 0.12s, background 0.12s;
}

.search-box::placeholder { color: #d1d5db; }
.search-box:focus { border-color: #1e3a5f; background: #fff; }

.drag-drop {
    font-size: 13px;
    border: 1.5px dashed #d1d5db;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    color: #9ca3af;
    cursor: pointer;
    transition: border-color 0.12s;
}

.drag-drop:hover { border-color: #1e3a5f; }

.link { color: #1e3a5f; font-weight: 500; cursor: pointer; }

.no-disp { display: none; }

.doc-toggle {
    font-family: 'Open Sans', sans-serif;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.03em;
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    background: #eef2f8;
    color: #1e3a5f;
    border: none;
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 15px;
    color: #6b7280;
}

.file-item:hover { background: #f3f4f6; }

/* ── Chat welcome ── */
#chat-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    padding: 40px 20px;
    pointer-events: none;
    user-select: none;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

#chat-welcome.welcome-loaded {
    opacity: 1;
    transform: translateY(0);
}

.welcome-logo {
    width: 300px;
    height: auto;
    margin-bottom: 8px;
}

.welcome-name {
    font-size: 52px;
    font-weight: 700;
    letter-spacing: 0.14em;
    color: #1e3a5f;
}

.welcome-subtitle {
    font-size: 20px;
    color: #9ca3af;
}

/* ── Empty state ── */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #9ca3af;
    text-align: center;
    padding: 40px 20px;
}

.empty-icon { font-size: 36px; opacity: 0.5; }

.empty-state p {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
}

/* ── Chat ── */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.msg-user {
    align-self: flex-end;
    background: #1e3a5f;
    color: #fff;
    padding: 11px 17px;
    border-radius: 16px 16px 4px 16px;
    max-width: 78%;
    font-size: 17px;
    line-height: 1.6;
}

.msg-ai {
    align-self: flex-start;
    background: #f3f4f6;
    padding: 11px 17px;
    border-radius: 16px 16px 16px 4px;
    max-width: 78%;
    font-size: 17px;
    line-height: 1.6;
}

.msg-ai strong {
    display: block;
    font-size: 14px;
    color: #1e3a5f;
    margin-bottom: 4px;
}

.input-bar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    border: 1.5px solid #e4e7ec;
    border-radius: 14px;
    padding: 10px 10px 10px 14px;
    flex-shrink: 0;
    transition: border-color 0.15s;
}

.input-bar:focus-within {
    border-color: #1e3a5f;
}

.chat-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: 'Open Sans', sans-serif;
    font-size: 17px;
    color: #1a1f2e;
    resize: none;
    line-height: 1.6;
    min-height: 48px;
    max-height: 160px;
    overflow-y: auto;
    align-self: center;
}

.chat-input::placeholder { color: #d1d5db; }

.input-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.voice-btn {
    background: none;
    color: #9ca3af;
    border: 1px solid #e4e7ec;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.12s, color 0.12s;
    padding: 0;
}

.voice-btn svg {
    width: 13px;
    height: 13px;
}

.voice-btn:hover { border-color: #1e3a5f; color: #1e3a5f; }
.voice-btn.recording { background: #fce8e6; border-color: #d93025; color: #d93025; }

.send-btn {
    background: #1e3a5f;
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, transform 0.1s;
    padding: 0;
}

.send-btn svg {
    width: 14px;
    height: 14px;
}

.send-btn:hover { background: #162d4a; }
.send-btn:active { transform: scale(0.93); }

/* ── Studio ── */
.studio-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    flex-shrink: 0;
}

.studio-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 13px;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    background: #fff;
    font-family: 'Open Sans', sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.12s, color 0.12s;
}

.studio-btn:hover { border-color: #1e3a5f; color: #1a1f2e; }
.studio-btn-icon { font-size: 20px; }

.add-note-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 9px;
    border: 1.5px dashed #d1d5db;
    border-radius: 30px;
    background: none;
    font-family: 'Open Sans', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #9ca3af;
    cursor: pointer;
    margin-top: auto;
    flex-shrink: 0;
    transition: border-color 0.12s, color 0.12s;
}

.add-note-btn:hover { border-color: #1e3a5f; color: #1e3a5f; }

/* ── Agent Buttons ── */
.agent-btn-stack {
    display: flex;
    flex-direction: column;
    gap: 7px;
    flex: 1;
    min-height: 0;
}

.agent-btn {
    flex: 1;
    border: none;
    border-radius: 10px;
    font-family: 'Open Sans', sans-serif;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.12s, transform 0.1s;
    min-height: 56px;
}

.agent-btn:hover { filter: brightness(0.95); }
.agent-btn:active { transform: scale(0.98); }

.agent-btn-1 { background: #dce8f5; color: #1e3a5f; }
.agent-btn-2 { background: #c5d8ef; color: #1e3a5f; }
.agent-btn-3 { background: #a8c4e4; color: #1e3a5f; }
.agent-btn-4 { background: #1e3a5f; color: #fff; }

/* ── Notes panel ── */
.notesPanel {
    position: fixed;
    top: 0;
    right: -340px;
    width: 320px;
    height: 100vh;
    background: #fff;
    border-left: 1px solid #e4e7ec;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    padding: 16px;
    box-sizing: border-box;
    transition: right 0.3s ease;
    z-index: 1000;
}

.notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.notes-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9ca3af;
}

.notes-input {
    flex: 1;
    resize: none;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    padding: 12px;
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    color: #1a1f2e;
    box-sizing: border-box;
    outline: none;
}

.notes-input:focus { border-color: #1e3a5f; }

.notes-clear-btn {
    margin-top: 10px;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Open Sans', sans-serif;
    font-size: 15px;
    border: 1px solid #e4e7ec;
    background: none;
    color: #6b7280;
    transition: background 0.12s, color 0.12s;
}

.notes-clear-btn:hover { background: #f3f4f6; color: #1a1f2e; }

/* ── Profile / Settings Modal ── */
.profile-modal-card {
    background: #fff;
    border-radius: 16px;
    width: 820px;
    max-width: 96vw;
    height: 620px;
    max-height: 92vh;
    position: relative;
    box-shadow: 0 12px 48px rgba(0,0,0,0.15);
    display: flex;
    overflow: hidden;
}

.modal-overlay.open .profile-modal-card {
    animation: cardIn 0.25s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
}

.modal-overlay.closing .profile-modal-card {
    animation: cardOut 0.18s ease forwards;
}

.profile-nav {
    width: 220px;
    flex-shrink: 0;
    background: #f9fafb;
    border-right: 1px solid #e4e7ec;
    display: flex;
    flex-direction: column;
    padding: 22px 14px;
    gap: 2px;
}

.profile-nav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 4px 16px;
    border-bottom: 1px solid #e4e7ec;
    margin-bottom: 8px;
    flex-shrink: 0;
}

.profile-avatar-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #1e3a5f;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    flex-shrink: 0;
}

.profile-nav-user-info { min-width: 0; }

.profile-nav-user-name {
    font-size: 15px;
    font-weight: 600;
    color: #1a1f2e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-nav-user-email {
    font-size: 13px;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-nav-item {
    background: none;
    border: none;
    border-radius: 8px;
    padding: 11px 14px;
    font-family: 'Open Sans', sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s, color 0.12s;
}

.profile-nav-item:hover { background: #f3f4f6; color: #1a1f2e; }

.profile-nav-item.active {
    background: #eef2f8;
    color: #1e3a5f;
    font-weight: 600;
}

.profile-nav-spacer { flex: 1; }

.profile-nav-help { color: #6b7280; }
.profile-nav-help:hover { background: #f3f4f6; color: #1a1f2e; }

.profile-nav-logout { color: #d93025; }
.profile-nav-logout:hover { background: #fce8e6; color: #b71c1c; }

.profile-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px 32px;
    min-width: 0;
}

.profile-section-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e4e7ec;
}

.profile-section-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1f2e;
    margin: 0 0 6px;
}

.profile-section-subtitle {
    font-size: 15px;
    color: #9ca3af;
    margin: 0;
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-avatar-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.profile-avatar-large {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    background: #1e3a5f;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    flex-shrink: 0;
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.profile-field-label {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
}

.profile-field-input {
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    padding: 11px 14px;
    border: 1.5px solid #e4e7ec;
    border-radius: 8px;
    outline: none;
    color: #1a1f2e;
    background: #fff;
    transition: border-color 0.12s;
}

.profile-field-input:focus { border-color: #1e3a5f; }
.profile-field-input:disabled { background: #f9fafb; color: #9ca3af; cursor: default; }

.profile-field-hint {
    font-size: 14px;
    color: #9ca3af;
    margin: 0;
}

.profile-save-btn {
    align-self: flex-start;
    padding: 11px 24px;
    background: #1e3a5f;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s;
}

.profile-save-btn:hover { background: #162d4a; }

.profile-divider {
    border: none;
    border-top: 1px solid #e4e7ec;
    margin: 4px 0;
}

.profile-group-label {
    font-size: 15px;
    font-weight: 600;
    color: #374151;
    margin: 0;
}

.profile-danger-label { color: #d93025; }

.profile-danger-btn {
    align-self: flex-start;
    padding: 11px 24px;
    background: none;
    color: #d93025;
    border: 1.5px solid #d93025;
    border-radius: 8px;
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.profile-danger-btn:hover { background: #d93025; color: #fff; }

/* ── General section: Theme picker ─────────────────────────── */
.theme-picker {
    display: flex;
    gap: 12px;
}

.theme-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 22px 12px;
    border: 1.5px solid #e4e7ec;
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    font-family: 'Open Sans', sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: #374151;
    transition: border-color 0.12s, background 0.12s, color 0.12s;
}

.theme-card:hover { border-color: #b0bec5; }

.theme-card.active {
    border-color: #1e3a5f;
    background: #eef2f8;
    color: #1e3a5f;
}

.theme-card-soon {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}

.theme-soon-badge {
    font-size: 12px;
    font-weight: 600;
    color: #9ca3af;
    background: #f3f4f6;
    border-radius: 4px;
    padding: 3px 7px;
    letter-spacing: 0.02em;
}

/* ── General section: Language dropdown ─────────────────────── */
.lang-dropdown-wrap { position: relative; }

.lang-dropdown-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    border: 1.5px solid #e4e7ec;
    border-radius: 8px;
    background: #fff;
    font-family: 'Open Sans', sans-serif;
    font-size: 16px;
    color: #1a1f2e;
    cursor: pointer;
    transition: border-color 0.12s;
}

.lang-dropdown-btn:hover { border-color: #b0bec5; }

.lang-dropdown-list {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    width: 100%;
    min-width: 200px;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 10px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.11);
    z-index: 200;
    padding: 4px 0;
}

.lang-dropdown-list.open { display: block; }

.lang-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    font-size: 15px;
    color: #1a1f2e;
    cursor: pointer;
    transition: background 0.1s;
}

.lang-option:hover { background: #f3f4f6; }
.lang-option.lang-option-active { font-weight: 600; }

.lang-option.lang-option-soon {
    color: #9ca3af;
    cursor: default;
    pointer-events: none;
}

.lang-divider {
    border: none;
    border-top: 1px solid #e4e7ec;
    margin: 4px 0;
}

.profile-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 4px 0;
}

.profile-toggle-label {
    font-size: 15px;
    font-weight: 500;
    color: #1a1f2e;
    margin-bottom: 2px;
}

.profile-toggle {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
    width: 40px;
    height: 22px;
    cursor: pointer;
}

.profile-toggle input { opacity: 0; width: 0; height: 0; }

.profile-toggle-slider {
    position: absolute;
    inset: 0;
    background: #d1d5db;
    border-radius: 22px;
    transition: background 0.18s;
}

.profile-toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.18s;
}

.profile-toggle input:checked + .profile-toggle-slider { background: #1e3a5f; }
.profile-toggle input:checked + .profile-toggle-slider::before { transform: translateX(18px); }

.profile-privacy-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.profile-outline-btn {
    flex-shrink: 0;
    padding: 10px 20px;
    background: none;
    color: #1a1f2e;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    font-family: 'Open Sans', sans-serif;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
}

.profile-outline-btn:hover { background: #f3f4f6; border-color: #d1d5db; }

.profile-outline-btn--danger { color: #dc2626; border-color: #fca5a5; }
.profile-outline-btn--danger:hover { background: #fef2f2; border-color: #f87171; }


/* ── Source Modal ── */
@keyframes overlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes overlayOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(18px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes cardOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(18px) scale(0.97); }
}

@keyframes subInputIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open {
    display: flex;
    animation: overlayIn 0.2s ease forwards;
}

.modal-overlay.closing {
    display: flex;
    animation: overlayOut 0.18s ease forwards;
}

.modal-card {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    width: 560px;
    max-width: 94vw;
    position: relative;
    box-shadow: 0 12px 48px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-overlay.open .modal-card {
    animation: cardIn 0.25s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
}

.modal-overlay.closing .modal-card {
    animation: cardOut 0.18s ease forwards;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 20px;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 5px;
    transition: background 0.12s, color 0.12s;
}

.modal-close:hover { background: #f3f4f6; color: #1a1f2e; }

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1f2e;
    margin: 0;
}

.modal-subtitle {
    margin: -8px 0 0;
    font-size: 13px;
    color: #9ca3af;
}

.modal-drop-zone {
    border: 1.5px dashed #d1d5db;
    border-radius: 12px;
    padding: 32px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: default;
    transition: border-color 0.12s, background 0.12s;
}

.modal-drop-zone.dragover {
    border-color: #1e3a5f;
    background: #eef2f8;
}

.modal-drop-text {
    font-size: 15px;
    font-weight: 500;
    color: #1a1f2e;
    margin: 0;
}

.modal-drop-sub {
    font-size: 13px;
    color: #9ca3af;
    margin: 0;
}

.modal-actions {
    display: flex;
    gap: 8px;
}

.modal-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 14px;
    border: 1px solid #e4e7ec;
    border-radius: 30px;
    background: #fff;
    font-family: 'Open Sans', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.1s;
    white-space: nowrap;
}

.modal-action-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #1a1f2e;
}

.modal-action-btn:active { transform: scale(0.95); }

.modal-action-btn.active {
    background: #eef2f8;
    border-color: #1e3a5f;
    color: #1e3a5f;
}

.modal-action-btn.active svg { stroke: #1e3a5f; }

/* Smooth expand/collapse for sub-inputs */
.modal-sub-input {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s ease,
                margin-top 0.28s ease;
    margin-top: 0;
}

.modal-sub-input.expanded {
    max-height: 160px;
    opacity: 1;
    margin-top: 0;
}

.source-input {
    flex: 1;
    font-family: 'Open Sans', sans-serif;
    font-size: 13px;
    padding: 9px 13px;
    border: 1.5px solid #e4e7ec;
    border-radius: 10px;
    outline: none;
    color: #1a1f2e;
    resize: none;
    min-height: 38px;
    transition: min-height 0.28s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.12s;
    overflow-y: hidden;
}

.source-input.copied-mode {
    min-height: 90px;
    overflow-y: auto;
}

.source-input:focus { border-color: #1e3a5f; }

.modal-confirm-btn {
    padding: 9px 20px;
    background: #1e3a5f;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: 'Open Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.12s;
}

.modal-confirm-btn:hover { background: #162d4a; }

/* ── Insight action bar (FILE / KNOWLEDGE / DESTROY) ── */
.insight-action-bar {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-shrink: 0;
    padding: 6px 0 8px;
}

.insight-action-btn {
    flex: 1;
    padding: 10px 0;
    border-radius: 30px;
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: opacity 0.12s;
    border: 1px solid #e4e7ec;
    background: #fff;
    color: #6b7280;
}

.insight-action-btn:hover { opacity: 0.75; }

.insight-action-file {
    background: #2a6496;
    color: #fff;
    border-color: #2a6496;
}

.insight-action-destroy {
    background: #000;
    color: #fff;
    border-color: #000;
}

.insight-action-share {
    background: #fff;
    color: #6b7280;
    border-color: #e4e7ec;
}
