/*!**********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[13].oneOf[2].use[1]!./node_modules/next/dist/build/webpack/loaders/next-font-loader/index.js??ruleSet[1].rules[13].oneOf[2].use[2]!./node_modules/next/font/google/target.css?{"path":"src/app/layout.tsx","import":"Sora","arguments":[{"subsets":["latin"],"variable":"--font-display"}],"variableName":"sora"} ***!
  \**********************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/* latin-ext */
@font-face {
  font-family: '__Sora_ce197d';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url(/_next/static/media/1d4eaed977255102-s.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: '__Sora_ce197d';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url(/_next/static/media/f3f7e95f2dbc4fe4-s.p.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}@font-face {font-family: '__Sora_Fallback_ce197d';src: local("Arial");ascent-override: 85.29%;descent-override: 25.50%;line-gap-override: 0.00%;size-adjust: 113.73%
}.__className_ce197d {font-family: '__Sora_ce197d', '__Sora_Fallback_ce197d';font-style: normal
}.__variable_ce197d {--font-display: '__Sora_ce197d', '__Sora_Fallback_ce197d'
}

/*!************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[13].oneOf[2].use[1]!./node_modules/next/dist/build/webpack/loaders/next-font-loader/index.js??ruleSet[1].rules[13].oneOf[2].use[2]!./node_modules/next/font/google/target.css?{"path":"src/app/layout.tsx","import":"DM_Sans","arguments":[{"subsets":["latin"],"variable":"--font-body"}],"variableName":"dmSans"} ***!
  \************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/* latin-ext */
@font-face {
  font-family: '__DM_Sans_0d7163';
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url(/_next/static/media/7ab938503e4547a1-s.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: '__DM_Sans_0d7163';
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url(/_next/static/media/13971731025ec697-s.p.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}@font-face {font-family: '__DM_Sans_Fallback_0d7163';src: local("Arial");ascent-override: 94.90%;descent-override: 29.66%;line-gap-override: 0.00%;size-adjust: 104.53%
}.__className_0d7163 {font-family: '__DM_Sans_0d7163', '__DM_Sans_Fallback_0d7163';font-style: normal
}.__variable_0d7163 {--font-body: '__DM_Sans_0d7163', '__DM_Sans_Fallback_0d7163'
}

/*!*****************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[13].oneOf[12].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[13].oneOf[12].use[3]!./src/app/globals.css ***!
  \*****************************************************************************************************************************************************************************************************************************************************************/
/* ── Google Fonts ─────────────────────────────────────────────────── */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Plus+Jakarta+Sans:wght@500;600;700&display=swap");

/* ── CSS Variables — Light Mode (default) ─────────────────────────── */
:root {
    color-scheme: light;
    /* Layout */
    --sidebar-width: 248px;

    /* Backgrounds */
    --bg-app: #f0f2f5;
    --bg-sidebar: #ffffff;
    --bg-main: #f0f2f5;
    --bg-bubble-user: #1a7f5a;
    --bg-bubble-ai: #ffffff;
    --bg-input: #ffffff;
    --bg-surface: #f7f8fa;
    --bg-surface-2: #eef0f4;
    --bg-hover: #f0f2f5;
    --bg-active: #e8f5ef;

    /* Text */
    --text-primary: #111827;
    --text-secondary: #374151;
    --text-muted: #6b7280;
    --text-faint: #9ca3af;
    --text-on-user: #ffffff;
    --text-brand: #1a7f5a;

    /* Borders */
    --border: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.14);

    /* Citation / Source accent — teal-green */
    --cite-bg: rgba(20, 184, 116, 0.12);
    --cite-border: rgba(20, 184, 116, 0.35);
    --cite-text: #0d7a50;
    --cite-hover-bg: rgba(20, 184, 116, 0.22);

    /* Section title accent */
    --section-accent: #0d7a50;

    /* Source panel */
    --src-header-bg: #f7f8fa;
    --src-header-hover: #eef0f4;
    --src-body-bg: #f3f5f7;
    --src-open-border: rgba(20, 184, 116, 0.4);
    --rel-track-bg: rgba(0, 0, 0, 0.08);
    --rel-fill: #14b874;

    /* Scrollbar */
    --scrollbar-thumb: rgba(0, 0, 0, 0.15);
    --scrollbar-track: transparent;

    /* Shadows */
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-input: 0 2px 8px rgba(0, 0, 0, 0.08);

    /* Radius */
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 18px;
    --r-pill: 999px;
}

/* ── CSS Variables — Dark Mode ────────────────────────────────────── */
[data-theme="dark"],
.dark {
    color-scheme: dark;
    --bg-app: #0f1117;
    --bg-sidebar: #161b22;
    --bg-main: #0f1117;
    --bg-bubble-user: #1a7f5a;
    --bg-bubble-ai: #1c2130;
    --bg-input: #1c2130;
    --bg-surface: #1c2130;
    --bg-surface-2: #242b3a;
    --bg-hover: #1e2537;
    --bg-active: #1a2e25;

    --text-primary: #f0f4f8;
    --text-secondary: #c8d3df;
    --text-muted: #8b96a5;
    --text-faint: #5a6475;
    --text-on-user: #ffffff;
    --text-brand: #34d399;

    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.12);

    --cite-bg: rgba(52, 211, 153, 0.13);
    --cite-border: rgba(52, 211, 153, 0.3);
    --cite-text: #34d399;
    --cite-hover-bg: rgba(52, 211, 153, 0.22);

    --section-accent: #34d399;

    --src-header-bg: rgba(255, 255, 255, 0.03);
    --src-header-hover: rgba(255, 255, 255, 0.06);
    --src-body-bg: rgba(0, 0, 0, 0.25);
    --src-open-border: rgba(52, 211, 153, 0.3);
    --rel-track-bg: rgba(255, 255, 255, 0.08);
    --rel-fill: #34d399;

    --scrollbar-thumb: rgba(255, 255, 255, 0.1);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-input: 0 2px 12px rgba(0, 0, 0, 0.35);
}

/* ── Reset & Base ─────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: "Inter", system-ui, sans-serif;
    background: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ── Scrollbars ───────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 5px;
}
::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 99px;
}

/* ═══════════════════════════════════════════════════════════════════
   LAYOUT
═══════════════════════════════════════════════════════════════════ */
.chat-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition:
        width 0.22s ease,
        min-width 0.22s ease;
}
.sidebar.collapsed {
    width: 0;
    min-width: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--text-brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}
.sidebar-brand {
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}
.sidebar-brand span {
    color: var(--text-brand);
}

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 12px 8px;
    padding: 9px 14px;
    background: var(--bg-active);
    color: var(--text-brand);
    border: 1px solid var(--cite-border);
    border-radius: var(--r-md);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.new-chat-btn:hover {
    background: var(--cite-hover-bg);
}

/* ── Library selector label ──────────────────────────────────────── */
.conv-section-label {
    padding: 8px 16px 4px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-faint);
}

/* ── Conversation list ───────────────────────────────────────────── */
.conv-list {
    flex: 1 1;
    overflow-y: auto;
    padding: 4px 8px 8px;
}
.conv-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--r-md);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13px;
    transition: background 0.12s;
    position: relative;
}
.conv-item:hover {
    background: var(--bg-hover);
}
.conv-item.active {
    background: var(--bg-active);
    color: var(--text-primary);
}
.conv-item-title {
    flex: 1 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.conv-delete-btn {
    opacity: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    padding: 2px;
    border-radius: 4px;
    transition:
        opacity 0.12s,
        color 0.12s;
}
.conv-item:hover .conv-delete-btn {
    opacity: 1;
}
.conv-delete-btn:hover {
    color: #ef4444;
}

/* ── Sidebar footer ──────────────────────────────────────────────── */
.sidebar-footer {
    padding: 10px 12px 14px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.user-pill {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: var(--r-md);
    background: var(--bg-surface);
}
.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--text-brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}
.user-name {
    flex: 1 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.logout-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    padding: 3px;
    border-radius: 4px;
    transition: color 0.12s;
}
.logout-btn:hover {
    color: #ef4444;
}

/* ═══════════════════════════════════════════════════════════════════
   MAIN CHAT AREA
═══════════════════════════════════════════════════════════════════ */
.chat-main {
    flex: 1 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-main);
}

/* ── Top bar ──────────────────────────────────────────────────────── */
.chat-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.topbar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    padding: 5px;
    border-radius: var(--r-sm);
    transition:
        color 0.12s,
        background 0.12s;
}
.topbar-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.topbar-title {
    flex: 1 1;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.topbar-edit {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    padding: 5px;
    border-radius: var(--r-sm);
    transition:
        color 0.12s,
        background 0.12s;
}
.topbar-edit:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.title-input {
    flex: 1 1;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    padding: 5px 10px;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
}
.title-input:focus {
    border-color: var(--text-brand);
}

/* ── Theme toggle button (add to topbar) ─────────────────────────── */
.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--r-sm);
    transition:
        color 0.12s,
        background 0.12s,
        border-color 0.12s;
}
.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

/* ═══════════════════════════════════════════════════════════════════
   MESSAGES
═══════════════════════════════════════════════════════════════════ */
.messages-area {
    flex: 1 1;
    overflow-y: auto;
    padding: 24px 16px;
}
.messages-inner {
    max-width: 780px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ── Message row ──────────────────────────────────────────────────── */
.msg-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: msgIn 0.22s ease both;
}
.msg-row.user {
    flex-direction: row-reverse;
}
@keyframes msgIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
}
.msg-avatar.guru {
    background: var(--text-brand);
    color: #fff;
    font-family: "Plus Jakarta Sans", sans-serif;
}
.msg-avatar.user-av {
    background: var(--bg-active);
    color: var(--text-brand);
    border: 1px solid var(--border-strong);
}

/* ── Bubbles ──────────────────────────────────────────────────────── */
.msg-bubble {
    max-width: 76%;
    padding: 16px 20px;
    border-radius: var(--r-xl);
    font-size: 16.5px;
    line-height: 1.72;
    word-break: break-word;
}
.msg-bubble.user {
    background: var(--bg-bubble-user);
    color: var(--text-on-user);
    border-radius: var(--r-xl) var(--r-xl) var(--r-sm) var(--r-xl);
}
.msg-bubble.assistant {
    background: var(--bg-bubble-ai);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--r-xl) var(--r-xl) var(--r-xl) var(--r-sm);
    box-shadow: var(--shadow-card);
    max-width: 88%;
}

/* ── Prose inside assistant bubble ──────────────────────────────── */
.msg-bubble.assistant p {
    margin: 0 0 8px;
    color: var(--text-primary);
}
.msg-bubble.assistant p:last-of-type {
    margin-bottom: 0;
}

.msg-bubble.assistant ul,
.msg-bubble.assistant ol {
    padding-left: 20px;
    margin: 6px 0 10px;
    color: var(--text-primary);
}
.msg-bubble.assistant li {
    margin-bottom: 5px;
}

.msg-bubble.assistant strong {
    font-weight: 600;
    color: var(--text-brand);
}
.msg-bubble.assistant .answer-heading {
    margin: 2px 0 10px;
    font-weight: 700;
    line-height: 1.4;
    color: var(--section-accent);
    font-family: "Plus Jakarta Sans", sans-serif;
}
.msg-bubble.assistant .answer-heading.h1 {
    font-size: 18px;
}
.msg-bubble.assistant .answer-heading.h2 {
    font-size: 16px;
}
.msg-bubble.assistant .answer-heading.h3 {
    font-size: 15px;
}
.msg-bubble.assistant .answer-callout {
    color: var(--cite-text);
    font-weight: 700;
}
.msg-bubble.assistant em {
    font-style: italic;
    color: var(--text-secondary);
}
.msg-bubble.assistant code {
    font-family: "Fira Code", "Cascadia Code", monospace;
    font-size: 12.5px;
    background: var(--bg-surface-2);
    padding: 1px 5px;
    border-radius: 4px;
    color: var(--text-secondary);
}
.msg-bubble.assistant br {
    display: block;
    margin: 3px 0;
    content: "";
}

/* ═══════════════════════════════════════════════════════════════════
   CITATION BUBBLES  (inline [N] superscripts)
═══════════════════════════════════════════════════════════════════ */
sup.cite-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--cite-bg);
    color: var(--cite-text);
    font-size: 10px;
    font-weight: 600;
    font-style: normal;
    cursor: pointer;
    vertical-align: super;
    margin: 0 2px;
    line-height: 1;
    border: 1px solid var(--cite-border);
    transition:
        background 0.15s,
        transform 0.12s;
    -webkit-user-select: none;
       -moz-user-select: none;
            user-select: none;
    font-family: "Inter", sans-serif;
}
sup.cite-bubble:hover {
    background: var(--cite-hover-bg);
    transform: scale(1.2);
}

/* ═══════════════════════════════════════════════════════════════════
   SOURCES PANEL
═══════════════════════════════════════════════════════════════════ */
.sources-panel {
    margin-top: 14px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}
.sources-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-bottom: 8px;
}

/* ── Source row ───────────────────────────────────────────────────── */
.source-item {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    margin-bottom: 5px;
    overflow: hidden;
    transition: border-color 0.15s;
}
.source-item.open {
    border-color: var(--src-open-border);
}

.source-header {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 11px;
    cursor: pointer;
    background: var(--src-header-bg);
    transition: background 0.12s;
    -webkit-user-select: none;
       -moz-user-select: none;
            user-select: none;
}
.source-header:hover {
    background: var(--src-header-hover);
}

.source-num {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--cite-bg);
    color: var(--cite-text);
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--cite-border);
    font-family: "Inter", sans-serif;
}
.source-name {
    flex: 1 1;
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary); /* ← was grey, now clearly readable */
}
.source-meta {
    flex-shrink: 0;
    font-size: 11px;
    color: var(--text-muted);
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

/* ── Expanded chunk body ──────────────────────────────────────────── */
.source-body {
    padding: 10px 13px 13px;
    border-top: 1px solid var(--border);
    background: var(--src-body-bg);
}
.source-section-title {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--section-accent);
    margin-bottom: 7px;
    letter-spacing: 0.01em;
}
pre.chunk-text {
    font-family: "Inter", system-ui, sans-serif;
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary); /* ← clearly readable in both modes */
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}
p.chunk-empty {
    font-size: 13px;
    color: var(--text-muted);
    font-style: italic;
    margin: 0;
}

/* ── Relevance bar ────────────────────────────────────────────────── */
.relevance-bar {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 10px;
}
.rel-label {
    font-size: 10.5px;
    color: var(--text-muted);
    white-space: nowrap;
}
.rel-track {
    flex: 1 1;
    height: 3px;
    background: var(--rel-track-bg);
    border-radius: 99px;
    overflow: hidden;
}
.rel-fill {
    height: 100%;
    background: var(--rel-fill);
    border-radius: 99px;
    transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}
.rel-score {
    font-size: 10.5px;
    color: var(--text-muted);
    min-width: 32px;
    text-align: right;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════════════════
   TYPING INDICATOR
═══════════════════════════════════════════════════════════════════ */
.typing-dots {
    display: flex;
    gap: 5px;
    padding: 4px 2px;
}
.typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-faint);
    animation: dot-bounce 1.3s infinite ease-in-out;
}
.typing-dots span:nth-child(2) {
    animation-delay: 0.18s;
}
.typing-dots span:nth-child(3) {
    animation-delay: 0.36s;
}
@keyframes dot-bounce {
    0%,
    80%,
    100% {
        transform: scale(0.7);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   EMPTY / WELCOME STATE
═══════════════════════════════════════════════════════════════════ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    padding: 0 24px;
}
.empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--text-brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 16px;
}
.empty-heading {
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}
.empty-heading span {
    color: var(--text-brand);
}
.empty-sub {
    font-size: 14.5px;
    color: var(--text-muted);
    max-width: 460px;
    line-height: 1.65;
    margin-bottom: 28px;
}
.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-width: 560px;
}
.suggestion-chip {
    padding: 8px 14px;
    background: var(--bg-bubble-ai);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-pill);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition:
        background 0.14s,
        border-color 0.14s,
        color 0.14s;
}
.suggestion-chip:hover {
    background: var(--bg-active);
    border-color: var(--cite-border);
    color: var(--text-brand);
}

/* ═══════════════════════════════════════════════════════════════════
   INPUT AREA
═══════════════════════════════════════════════════════════════════ */
.input-area {
    padding: 14px 20px 18px;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.input-inner {
    max-width: 860px;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-xl);
    padding: 12px 14px;
    box-shadow: var(--shadow-input);
    transition: border-color 0.15s;
}
.input-inner:focus-within {
    border-color: var(--text-brand);
}

.input-box {
    flex: 1 1;
    background: none;
    border: none;
    outline: none;
    resize: none;
    font-family: "Inter", sans-serif;
    font-size: 15.5px;
    color: var(--text-primary);
    line-height: 1.55;
    max-height: 160px;
    overflow-y: auto;
}
.input-box::placeholder {
    color: var(--text-faint);
}

.send-btn {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--text-brand);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        background 0.15s,
        transform 0.1s;
}
.send-btn:hover:not(:disabled) {
    background: #0d6e4a;
    transform: scale(1.07);
}
.send-btn:disabled {
    background: var(--bg-surface-2);
    color: var(--text-faint);
    cursor: not-allowed;
}

.input-hint {
    max-width: 780px;
    margin: 5px auto 0;
    font-size: 11px;
    color: var(--text-faint);
    text-align: center;
}

/* ═══════════════════════════════════════════════════════════════════
   ERROR BANNER
═══════════════════════════════════════════════════════════════════ */
.error-banner {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--r-md);
    padding: 10px 14px;
    font-size: 13.5px;
    color: #b91c1c;
}
.dark .error-banner {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

/* ═══════════════════════════════════════════════════════════════════
   LIBRARY SELECTOR (DATA SOURCES)
═══════════════════════════════════════════════════════════════════ */
.library-section {
    padding: 8px 12px 4px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.library-label {
    width: 100%;
    padding: 0;
    background: none;
    border: none;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-brand);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    text-align: left;
}
.library-count {
    background: var(--cite-bg);
    color: var(--cite-text);
    border: 1px solid var(--cite-border);
    border-radius: 99px;
    font-size: 10px;
    font-weight: 600;
    padding: 0 6px;
    line-height: 16px;
}
.library-options {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 4px;
}
.library-option {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 6px 8px;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background 0.12s;
    font-size: 13px;
    color: var(--text-secondary);
    -webkit-user-select: none;
       -moz-user-select: none;
            user-select: none;
}
.library-option:hover {
    background: var(--bg-hover);
}
.library-option input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--text-brand);
    background: var(--bg-sidebar);
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    -webkit-appearance: auto;
       -moz-appearance: auto;
            appearance: auto;
    cursor: pointer;
    flex-shrink: 0;
}
.library-option > span {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.library-sync-date {
    font-size: 10px;
    color: var(--text-faint);
}
.library-hint {
    margin: 0;
    font-size: 10px;
    color: var(--text-faint);
}
.library-option.selected {
    color: var(--text-primary);
    font-weight: 500;
}
.library-all-none {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
}
.library-all-none button {
    font-size: 11px;
    color: var(--cite-text);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.library-all-none button:hover {
    opacity: 0.75;
}

/* ═══════════════════════════════════════════════════════════════════
   AUTH PAGES
═══════════════════════════════════════════════════════════════════ */
.auth-bg {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg-main);
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 28px 24px;
    box-shadow: var(--shadow-card);
}
.auth-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
}
.auth-logo-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: var(--text-brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-weight: 700;
    font-size: 18px;
}
.auth-title {
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}
.auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.field-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-faint);
}
.field-input {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 14px;
}
.field-input::placeholder {
    color: var(--text-faint);
}
.field-input:focus {
    outline: none;
    border-color: var(--text-brand);
    box-shadow: 0 0 0 2px var(--cite-bg);
}
.btn-primary {
    background: var(--text-brand);
    color: #fff;
    border: none;
    border-radius: var(--r-md);
    padding: 10px 14px;
    font-family: "Plus Jakarta Sans", sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.12s;
}
.btn-primary:hover:not(:disabled) {
    opacity: 0.9;
}
.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.auth-switch {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}
.auth-switch a {
    color: var(--text-brand);
    text-decoration: none;
}
.auth-switch a:hover {
    text-decoration: underline;
}
.success-banner {
    background: var(--cite-bg);
    border: 1px solid var(--cite-border);
    color: var(--cite-text);
    border-radius: var(--r-md);
    padding: 10px 14px;
    font-size: 13px;
}

