/* ================================================================
    志愿咨询室 — local counseling demo UI
    ================================================================ */

:root {
     --bg-000: hsl(0, 0%, 100%);
     --bg-100: hsl(220, 20%, 98%);
     --bg-200: hsl(220, 16%, 94%);
     --bg-300: hsl(220, 12%, 90%);
     --bg-400: hsl(220, 10%, 82%);

     --text-000: hsl(0, 0%, 7%);
     --text-100: hsl(0, 0%, 10%);
     --text-200: hsl(220, 8%, 24%);
     --text-300: hsl(220, 7%, 34%);
     --text-400: hsl(220, 6%, 46%);
     --text-500: hsl(220, 5%, 58%);

     --accent-000: hsl(357, 76%, 46%);
     --accent-100: hsl(357, 82%, 54%);
     --accent-200: hsl(40, 92%, 50%);
     --accent-900: hsl(357, 82%, 96%);

     --border-100: hsl(220, 13%, 86%);
     --border-200: hsl(220, 10%, 78%);
     --border-300: hsl(220, 9%, 68%);

    /* ── Semantic aliases ── */
    --page-bg: hsl(220, 14%, 97%);
    --canvas-bg: var(--bg-000);
    --sidebar-bg: hsl(20, 8%, 10%);
    --sidebar-panel: hsl(20, 8%, 15%);
    --sidebar-text: hsl(0, 0%, 96%);
    --sidebar-muted: hsl(35, 8%, 65%);
    --hover-bg: var(--bg-300);
    --active-bg: var(--bg-400);

    --text-primary: var(--text-100);
    --text-secondary: var(--text-200);
    --text-muted: var(--text-400);

    --border: var(--border-100);
    --border-strong: var(--border-200);

    --accent: var(--accent-000);
    --accent-hover: var(--accent-100);
    --accent-light: var(--accent-900);

    --accent-green: hsl(158, 68%, 32%);
    --accent-red: hsl(0, 65%, 48%);
    --accent-orange: hsl(38, 92%, 48%);

    /* ── Shadows ── */
    --shadow-sm: 0 1px 2px hsla(0, 0%, 0%, 0.08);
    --shadow-md: 0 4px 12px hsla(0, 0%, 0%, 0.07);
    --shadow-lg: 0 12px 30px hsla(0, 0%, 0%, 0.12);
    --shadow-input: 0 0 0 3px hsla(357, 82%, 54%, 0.12);

    /* ── Radius ── */
    --r-xs: 4px;
    --r-sm: 8px;
    --r-md: 8px;
    --r-lg: 8px;
    --r-xl: 8px;
    --r-2xl: 8px;

        /* ── Font ── */
        --font-ui: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-serif: Georgia, "Times New Roman", serif;
    --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Fira Code", Consolas, monospace;

    /* ── Layout ── */
    --sidebar-w: 260px;
    --content-w: 44rem;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; }
body {
    font-family: var(--font-ui);
    background: var(--page-bg);
    color: var(--text-primary);
    height: 100%;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-weight: 430;
    line-height: 1.4;
}

/* ── Layout shell ── */
.app { display: flex; height: 100%; }
.app.sidebar-resizing,
.app.sidebar-resizing * {
    cursor: col-resize !important;
    user-select: none !important;
}

/* ================================================================
   LOGIN OVERLAY
   ================================================================ */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background:
        radial-gradient(circle at 20% 12%, hsla(357, 82%, 54%, 0.12), transparent 28%),
        radial-gradient(circle at 82% 80%, hsla(158, 68%, 32%, 0.10), transparent 28%),
        linear-gradient(135deg, hsl(220, 16%, 96%), hsl(0, 0%, 100%));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.login-shell {
    width: min(980px, calc(100vw - 48px));
    display: grid;
    grid-template-columns: minmax(0, 1.18fr) 390px;
    gap: 0;
    align-items: stretch;
    min-height: 560px;
    background: var(--canvas-bg);
    border: 1px solid hsla(220, 13%, 70%, 0.55);
    border-radius: 8px;
    box-shadow: 0 28px 70px hsla(220, 20%, 20%, 0.18);
    overflow: hidden;
}
.login-promo {
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(135deg, hsla(357, 76%, 36%, 0.92), hsla(20, 10%, 11%, 0.98)),
        hsl(20, 8%, 10%);
    color: #fff;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 44px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 0;
}
.login-promo::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(hsla(0, 0%, 100%, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, hsla(0, 0%, 100%, 0.06) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(110deg, black 0%, transparent 78%);
    pointer-events: none;
}
.promo-brand,
.login-promo h1,
.login-promo p,
.promo-metrics,
.promo-points,
.promo-note {
    position: relative;
}
.promo-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: hsla(0, 0%, 100%, 0.86);
    font-size: 13px;
    font-weight: 750;
    margin-bottom: 44px;
}
.promo-logo {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    color: hsl(357, 76%, 42%);
    font-size: 16px;
    font-weight: 900;
}
.login-promo h1 {
    max-width: 34rem;
    font-size: 42px;
    line-height: 1.08;
    font-weight: 800;
    color: #fff;
    margin-bottom: 18px;
}
.login-promo p {
    max-width: 31rem;
    color: hsla(0, 0%, 100%, 0.76);
    font-size: 16px;
    line-height: 1.7;
    margin-bottom: 28px;
}
.promo-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 26px;
}
.promo-metrics div {
    padding: 13px 12px;
    border: 1px solid hsla(0, 0%, 100%, 0.16);
    background: hsla(0, 0%, 100%, 0.08);
    border-radius: 8px;
}
.promo-metrics strong,
.promo-metrics span {
    display: block;
}
.promo-metrics strong {
    color: #fff;
    font-size: 19px;
    line-height: 1;
}
.promo-metrics span {
    margin-top: 6px;
    color: hsla(0, 0%, 100%, 0.68);
    font-size: 12px;
}
.promo-points {
    display: grid;
    gap: 10px;
}
.promo-points div {
    padding: 12px 0 0;
    border: 0;
    border-top: 1px solid hsla(0, 0%, 100%, 0.14);
    border-radius: var(--r-sm);
    background: transparent;
}
.promo-points strong,
.promo-points span {
    display: block;
}
.promo-points strong {
    color: #fff;
    font-size: 14px;
    margin-bottom: 3px;
}
.promo-points span {
    color: hsla(0, 0%, 100%, 0.64);
    font-size: 12px;
    line-height: 1.45;
}
.promo-note {
    margin-top: 18px;
    color: hsla(0, 0%, 100%, 0.55);
    font-size: 12px;
}
.login-box {
    text-align: center;
    width: 100%;
    padding: 44px 38px;
    background: var(--canvas-bg);
    border: 0;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.login-box h2 {
    font-size: 1.5rem;
    font-weight: 750;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}
.login-box p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}
.login-box form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.auth-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.login-box input {
    width: 100%;
    height: 42px;
    padding: 0 0.875rem;
    font-size: 0.9375rem;
    font-family: var(--font-ui);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--canvas-bg);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.login-box input:focus {
    border-color: var(--accent);
    box-shadow: var(--shadow-input);
}
.captcha-row {
    display: grid;
    grid-template-columns: 1fr 112px;
    gap: 8px;
}
.captcha-btn,
.secondary-auth-btn {
    border: 1px solid var(--border);
    background: var(--bg-100);
    color: var(--text-secondary);
    border-radius: var(--r-sm);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    padding: 0 10px;
}
.captcha-btn:hover,
.secondary-auth-btn:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
}
.login-btn {
    height: 42px;
    padding: 0 1rem;
    font-size: 0.9375rem;
    font-family: var(--font-ui);
    font-weight: 500;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background 0.15s;
}
.login-btn:hover { background: var(--accent-hover); }
.login-error {
    font-size: 0.8125rem;
    color: var(--accent-red);
    min-height: 1.2em;
    margin-top: 0.25rem;
    margin-bottom: 0 !important;
}
.auth-links {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 12px;
}
.auth-links button {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
}
.auth-links button:hover {
    color: var(--accent);
}
.security-question {
    min-height: 20px;
    text-align: left;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.4;
}
.auth-note {
    text-align: left;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
}

/* ================================================================
    SIDEBAR
   ================================================================ */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.2s ease;
    overflow: hidden;
    border-right: 1px solid hsl(20, 8%, 18%);
    position: relative;
}

.sidebar.collapsed {
    width: 0;
    min-width: 0;
}

.sidebar-resizer {
    position: absolute;
    top: 0;
    right: -4px;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    z-index: 5;
}

.sidebar-resizer::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 3px;
    width: 1px;
    background: transparent;
    transition: background 0.15s;
}

.sidebar-resizer:hover::after,
.app.sidebar-resizing .sidebar-resizer::after {
    background: hsl(357, 76%, 48%);
}

.sidebar.collapsed .sidebar-resizer {
    display: none;
}

.sidebar-backdrop {
    display: none;
}

.sidebar-top { padding: 12px; }

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--r-sm);
    border: 1px solid hsl(20, 7%, 24%);
    background: var(--sidebar-panel);
    color: var(--sidebar-text);
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.new-chat-btn:hover {
    background: hsl(20, 7%, 20%);
    border-color: hsl(357, 76%, 42%);
}

.sidebar-history {
    flex: 1;
    overflow-y: auto;
    padding: 4px 12px;
}

.sidebar-history::-webkit-scrollbar { width: 4px; }
.sidebar-history::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.history-item {
    padding: 10px 14px;
    border-radius: var(--r-sm);
    font-size: 13px;
    color: var(--sidebar-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    overflow: hidden;
    margin-bottom: 2px;
    position: relative;
}

.history-delete-btn {
    position: absolute;
    top: 8px;
    right: 6px;
    background: none;
    border: none;
    color: var(--text-faint, #999);
    cursor: pointer;
    font-size: 12px;
    padding: 2px 5px;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.history-item:hover .history-delete-btn { opacity: 1; }
.history-delete-btn:hover { color: #fff; background: hsla(357, 76%, 46%, 0.24); }

.history-item-query {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-meta {
    font-size: 11px;
    color: hsl(35, 8%, 52%);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item:hover {
    background: hsl(20, 7%, 18%);
    color: var(--sidebar-text);
}

.history-item.active {
    background: hsl(357, 72%, 22%);
    color: var(--sidebar-text);
}

.sidebar-history-empty {
    padding: 16px 14px;
    font-size: 12px;
    color: var(--sidebar-muted);
    text-align: center;
}

.sidebar-bottom {
    padding: 12px 16px;
    border-top: 1px solid hsl(20, 8%, 20%);
}

.sidebar-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--sidebar-muted);
}

.status-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-red);
    transition: background 0.3s;
}

.status-indicator.connected {
    background: var(--accent-green);
}

/* ================================================================
   MAIN CONTENT
   ================================================================ */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--canvas-bg);
}

/* ── Top bar ── */
.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--canvas-bg);
    color: var(--text-primary);
}

.topbar-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    transition: background 0.15s, color 0.15s;
}

.topbar-toggle:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.topbar-title {
    font-size: 14px;
    font-weight: 550;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.topbar-link {
    height: 28px;
    display: inline-flex;
    align-items: center;
    padding: 0 9px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 12px;
}

.topbar-link:hover {
    border-color: var(--border-strong);
    color: var(--accent);
    background: var(--bg-100);
}

.topbar-live {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 7px;
    border-radius: 4px;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 850;
}

.topbar-model {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: auto;
}

.topbar-user {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    cursor: pointer;
    border-radius: var(--r-sm);
    padding: 2px 4px;
}
.topbar-user:hover {
    background: var(--bg-100);
}
.user-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--text-primary);
    color: var(--canvas-bg);
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}
.user-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: var(--text-secondary);
}
.credit-pill {
    height: 24px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-100);
    color: var(--text-secondary);
    font-size: 12px;
    white-space: nowrap;
}
.logout-btn {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 4px 2px;
}
.logout-btn:hover {
    color: var(--accent);
}

.account-panel-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: hsla(0, 0%, 0%, 0.28);
    align-items: flex-start;
    justify-content: flex-end;
    padding: 56px 18px 18px;
}
.account-panel {
    width: min(390px, calc(100vw - 36px));
    max-height: calc(100vh - 74px);
    overflow-y: auto;
    background: var(--canvas-bg);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    padding: 16px;
}
.account-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.account-panel-title {
    font-size: 16px;
    font-weight: 650;
    color: var(--text-primary);
}
.account-panel-subtitle {
    margin-top: 2px;
    font-size: 12px;
    color: var(--text-muted);
}
.icon-close-btn {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}
.icon-close-btn:hover {
    background: var(--bg-100);
    color: var(--text-primary);
}
.account-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--bg-100);
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 14px;
}
.account-summary strong {
    color: var(--text-primary);
    white-space: nowrap;
}
.account-form {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 14px 0;
    border-top: 1px solid var(--border);
}
.account-section-title {
    font-size: 13px;
    font-weight: 650;
    color: var(--text-primary);
}
.account-form input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    font-family: var(--font-ui);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--canvas-bg);
    color: var(--text-primary);
    outline: none;
}
.account-form input:focus {
    border-color: var(--accent);
    box-shadow: var(--shadow-input);
}
.account-submit-btn {
    min-height: 38px;
}
.account-error {
    text-align: left;
}
.logout-wide-btn {
    width: 100%;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--canvas-bg);
    color: var(--text-secondary);
    cursor: pointer;
    font: inherit;
}
.logout-wide-btn:hover {
    border-color: var(--border-strong);
    color: var(--accent);
}

/* ================================================================
   CONVERSATION
   ================================================================ */
.conversation {
    flex: 1;
    overflow-y: auto;
    background: var(--canvas-bg);
}

.conversation::-webkit-scrollbar { width: 6px; }
.conversation::-webkit-scrollbar-track { background: transparent; }
.conversation::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
.conversation::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ================================================================
   WELCOME SCREEN
   ================================================================ */
.welcome {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 32px 24px;
}

.welcome-content {
    text-align: left;
    max-width: 620px;
    width: 100%;
}

.live-stage {
    display: grid;
    grid-template-columns: minmax(280px, 1.35fr) minmax(220px, 0.75fr);
    gap: 14px;
    align-items: stretch;
    margin: 0 auto 18px;
    width: min(100%, 820px);
    text-align: left;
}

.live-screen {
    position: relative;
    min-height: 260px;
    overflow: hidden;
    border-radius: var(--r-lg);
    background:
        radial-gradient(circle at 72% 24%, hsla(357, 84%, 52%, 0.32), transparent 30%),
        linear-gradient(135deg, hsl(0, 0%, 8%) 0%, hsl(0, 0%, 14%) 54%, hsl(20, 10%, 18%) 100%);
    border: 1px solid hsl(0, 0%, 12%);
    box-shadow: var(--shadow-lg);
    color: #fff;
}

.live-screen::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(hsla(0, 0%, 100%, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, hsla(0, 0%, 100%, 0.05) 1px, transparent 1px);
    background-size: 34px 34px;
    opacity: 0.22;
}

.live-screen-top,
.lower-third,
.host-portrait {
    position: relative;
    z-index: 1;
}

.live-screen-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    color: hsl(0, 0%, 78%);
    font-size: 12px;
    font-weight: 700;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 24px;
    padding: 0 9px;
    border-radius: 4px;
    background: var(--accent);
    color: #fff;
    font-weight: 850;
}

.host-portrait {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 150px;
}

.host-portrait > span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: linear-gradient(135deg, hsl(357, 76%, 48%), hsl(38, 92%, 50%));
    color: #fff;
    font-size: 42px;
    font-weight: 900;
    box-shadow: 0 0 0 8px hsla(0, 0%, 100%, 0.08), 0 20px 40px hsla(0, 0%, 0%, 0.24);
}

.audio-bars {
    display: flex;
    align-items: end;
    gap: 5px;
    height: 28px;
    margin-top: 18px;
}

.audio-bars i {
    display: block;
    width: 5px;
    min-height: 7px;
    border-radius: 999px;
    background: hsl(40, 92%, 54%);
    animation: audioBeat 1.1s ease-in-out infinite;
}

.audio-bars i:nth-child(2) { animation-delay: 0.12s; }
.audio-bars i:nth-child(3) { animation-delay: 0.24s; }
.audio-bars i:nth-child(4) { animation-delay: 0.36s; }
.audio-bars i:nth-child(5) { animation-delay: 0.48s; }

@keyframes audioBeat {
    0%, 100% { height: 8px; opacity: 0.65; }
    50% { height: 28px; opacity: 1; }
}

.lower-third {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 13px;
    border-radius: var(--r-sm);
    background: hsla(0, 0%, 100%, 0.10);
    border: 1px solid hsla(0, 0%, 100%, 0.18);
    backdrop-filter: blur(12px);
}

.lower-third strong {
    font-size: 16px;
    font-weight: 850;
}

.lower-third span {
    color: hsl(0, 0%, 78%);
    font-size: 12px;
}

.caller-panel {
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
    background: var(--canvas-bg);
    padding: 16px;
    box-shadow: var(--shadow-md);
}

.caller-panel-title {
    font-size: 12px;
    font-weight: 850;
    color: var(--accent);
    margin-bottom: 10px;
}

.caller-row {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 10px;
    align-items: center;
    padding: 12px 0;
    border-top: 1px solid var(--border);
}

.caller-row:first-of-type { border-top: none; }

.caller-row span {
    color: var(--text-muted);
    font-size: 12px;
}

.caller-row strong {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.35;
}

.welcome-content h1 {
    font-family: var(--font-ui);
    font-size: 30px;
    font-weight: 760;
    color: var(--text-primary);
    margin-bottom: 10px;
    letter-spacing: 0;
    line-height: 1.22;
}

.welcome-kicker {
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 560;
}

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-red);
    box-shadow: 0 0 0 3px hsla(357, 76%, 46%, 0.16);
}

.welcome-sub {
    font-size: 15px;
    color: var(--text-secondary);
    margin: 0 0 16px;
    line-height: 1.6;
    max-width: 560px;
}

.intake-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 22px;
}

.intake-strip span {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 10px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--bg-100);
    color: var(--text-secondary);
    font-size: 13px;
}

.welcome-studio {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 0 auto 18px;
    width: min(100%, 720px);
}

.studio-card {
    text-align: left;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--canvas-bg);
    padding: 12px 13px;
    min-height: 82px;
}

.studio-card.strong {
    border-color: hsl(357, 70%, 68%);
    background: hsl(357, 82%, 97%);
}

.studio-label {
    display: block;
    color: hsl(357, 76%, 38%);
    font-size: 11px;
    font-weight: 800;
    margin-bottom: 7px;
}

.studio-card strong {
    display: block;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.45;
}

.welcome-callout {
    text-align: left;
    width: min(100%, 650px);
    margin: 0 auto 28px;
    padding: 13px 16px;
    border-left: 4px solid var(--accent-orange);
    background: hsl(40, 90%, 96%);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 650;
    line-height: 1.55;
}

@media (max-width: 760px) {
    .live-stage {
        grid-template-columns: 1fr;
    }

    .live-screen {
        min-height: 230px;
    }

    .welcome-studio {
        grid-template-columns: 1fr;
    }

    .welcome-content h1 {
        font-size: 30px;
    }
}

.suggestions {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.suggestion {
    width: 100%;
    text-align: left;
    padding: 11px 13px;
    background: var(--canvas-bg);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.45;
}

.suggestion:hover {
    border-color: var(--border-strong);
    background: var(--bg-100);
    color: var(--text-primary);
}

/* ================================================================
   MESSAGES
   ================================================================ */
.messages {
    max-width: var(--content-w);
    margin: 0 auto;
    padding: 22px 24px 34px;
    width: 100%;
}

/* ── User message ── */
.msg-user {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 24px;
}

.msg-user-bubble {
    background: hsl(0, 0%, 11%);
    padding: 12px 18px;
    border-radius: var(--r-xl);
    font-size: 15px;
    line-height: 1.55;
    max-width: 80%;
    color: #fff;
}

/* ── Assistant message ── */
.msg-assistant {
    margin-bottom: 32px;
}

.assistant-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.assistant-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-200);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 800;
}

.assistant-avatar-plain {
    background: hsl(205, 42%, 92%);
    color: hsl(205, 48%, 28%);
}

.assistant-avatar-sharp {
    background: hsl(357, 82%, 94%);
    color: hsl(357, 76%, 36%);
}

.assistant-avatar-gentle {
    background: hsl(330, 52%, 94%);
    color: hsl(330, 42%, 36%);
}

.assistant-avatar-senior {
    background: hsl(158, 48%, 92%);
    color: hsl(158, 56%, 28%);
}

.assistant-avatar-analyst {
    background: hsl(245, 36%, 93%);
    color: hsl(245, 34%, 34%);
}

.assistant-avatar-strict {
    background: hsl(38, 80%, 92%);
    color: hsl(32, 72%, 30%);
}

.assistant-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.assistant-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.assistant-subtitle {
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Prose ── */
.assistant-prose {
    font-size: 15px;
    line-height: 1.62;
    color: var(--text-100);
}

.assistant-prose h1 {
    font-family: var(--font-ui);
    font-size: 20px;
    font-weight: 740;
    margin: 22px 0 10px;
    color: var(--text-000);
}
.assistant-prose h2 {
    font-family: var(--font-ui);
    font-size: 16px;
    font-weight: 720;
    margin: 18px 0 8px;
    color: var(--text-000);
}
.assistant-prose h3 {
    font-size: 15px;
    font-weight: 580;
    margin: 18px 0 8px;
    color: var(--text-000);
}

.assistant-prose p { margin-bottom: 10px; }
.assistant-prose p:last-child { margin-bottom: 0; }

.assistant-prose a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: hsla(357, 76%, 46%, 0.28);
    text-underline-offset: 2px;
    transition: text-decoration-color 0.15s;
}
.assistant-prose a:hover {
    text-decoration-color: var(--accent);
}

.assistant-prose .citation-ref {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 17px;
    height: 17px;
    margin: 0 2px;
    padding: 0 5px;
    border-radius: 999px;
    background: hsl(210, 22%, 94%);
    border: 1px solid hsl(210, 16%, 84%);
    color: hsl(210, 36%, 30%);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    vertical-align: super;
    transform: translateY(-1px);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.assistant-prose .citation-ref:hover {
    background: hsl(357, 82%, 96%);
    border-color: hsl(357, 58%, 78%);
    color: var(--accent);
    text-decoration: none;
}

.citation-cluster {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    white-space: nowrap;
}

.assistant-prose strong { font-weight: 600; }

.assistant-prose code {
    font-family: var(--font-mono);
    font-size: 13px;
    background: var(--bg-200);
    padding: 2px 6px;
    border-radius: var(--r-xs);
    color: var(--text-200);
}

.assistant-prose pre {
    background: var(--bg-100);
    border-radius: var(--r-sm);
    padding: 16px 18px;
    overflow-x: auto;
    margin: 14px 0;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.55;
    border: 1px solid var(--border);
}

.assistant-prose pre code {
    background: none;
    padding: 0;
    font-size: inherit;
}

.assistant-prose blockquote {
    border-left: 3px solid var(--border-strong);
    padding-left: 16px;
    color: var(--text-secondary);
    margin: 14px 0;
    font-style: italic;
}

.assistant-prose ul, .assistant-prose ol { margin: 10px 0 10px 22px; }
.assistant-prose li { margin-bottom: 4px; }

.assistant-prose hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 14px 0;
}

.assistant-prose table {
    border-collapse: collapse;
    width: 100%;
    margin: 14px 0;
    font-size: 14px;
}

.assistant-prose th,
.assistant-prose td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}

.assistant-prose th {
    background: var(--bg-100);
    font-weight: 580;
}

.assistant-prose td {
    background: var(--canvas-bg);
}

/* ── Streaming cursor ── */
.streaming-cursor {
    display: inline-block;
    width: 2px;
    height: 16px;
    background: var(--text-primary);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 1s step-end infinite;
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* ================================================================
   TOOL BLOCKS (inline)
   ================================================================ */
.tool-block {
    margin: 14px 0;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: hsl(220, 20%, 98%);
    overflow: hidden;
    transition: border-color 0.15s;
}

.tool-block:hover {
    border-color: var(--border-strong);
}

.tool-block-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    color: var(--text-secondary);
    transition: background 0.1s;
}

.tool-block-header:hover {
    background: hsl(357, 82%, 97%);
}

.tool-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 13px;
}

.tool-icon.search  { background: hsl(357, 82%, 94%); color: hsl(357, 76%, 42%); }
.tool-icon.fetch   { background: hsl(40, 90%, 92%); color: hsl(32, 86%, 34%); }
.tool-icon.read    { background: hsl(158, 45%, 90%); color: hsl(158, 68%, 30%); }
.tool-icon.cite    { background: hsl(40, 90%, 92%);  color: hsl(32, 86%, 34%); }
.tool-icon.academic { background: hsl(251, 34%, 91%); color: hsl(251, 34%, 45%); }
.tool-icon.news    { background: hsl(0, 55%, 92%);   color: hsl(0, 65%, 45%); }
.tool-icon.database { background: hsl(205, 68%, 92%); color: hsl(205, 68%, 34%); }

.tool-name {
    font-weight: 550;
    color: var(--text-primary);
}

.tool-query {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
    font-size: 12px;
}

.tool-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--text-secondary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Persistent "思考中" indicator (kept at the bottom of the assistant block) */
.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 2px 3px;
    color: var(--text-secondary, #666);
    font-size: 13px;
}
.thinking-spinner {
    width: 15px;
    height: 15px;
    border: 2px solid var(--border, #e0e0e0);
    border-top-color: var(--accent, #c0392b);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}
.thinking-label {
    opacity: 0.85;
    animation: thinkingFade 1.4s ease-in-out infinite;
}
@keyframes thinkingFade { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }

.tool-check { color: var(--accent-green); flex-shrink: 0; }
.tool-error-mark { color: var(--accent-red); flex-shrink: 0; }

.tool-chevron {
    flex-shrink: 0;
    color: var(--text-muted);
    transition: transform 0.15s;
    font-size: 10px;
}

.tool-block.expanded .tool-chevron { transform: rotate(90deg); }

.tool-block-body {
    display: none;
    padding: 12px 14px;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.55;
    color: var(--text-secondary);
    max-height: 200px;
    overflow-y: auto;
    border-top: 1px solid var(--border);
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--bg-200);
}

.tool-block.expanded .tool-block-body { display: block; }

.db-audit-panel {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    margin: 14px 0;
    padding: 12px 14px;
    border: 1px solid hsl(205, 34%, 84%);
    border-radius: var(--r-sm);
    background:
        linear-gradient(180deg, hsl(205, 48%, 98%) 0%, hsl(210, 38%, 96%) 100%);
}

.db-audit-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: hsl(205, 70%, 91%);
    color: hsl(205, 76%, 30%);
    font-size: 16px;
}

.db-audit-main {
    min-width: 0;
}

.db-audit-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.db-audit-subtitle {
    margin-top: 3px;
    font-size: 12px;
    color: var(--text-secondary);
}

.db-audit-count {
    min-width: 44px;
    text-align: right;
    font-size: 12px;
    font-weight: 700;
    color: hsl(205, 68%, 34%);
}

.db-audit-progress {
    display: flex;
    gap: 5px;
    margin-top: 8px;
}

.db-audit-progress span {
    height: 3px;
    flex: 1;
    border-radius: 2px;
    background: hsl(205, 62%, 74%);
    animation: dbAuditPulse 1.1s ease-in-out infinite;
}

.db-audit-progress span:nth-child(2) { animation-delay: 0.16s; }
.db-audit-progress span:nth-child(3) { animation-delay: 0.32s; }

.db-audit-panel.is-done .db-audit-progress span {
    animation: none;
    background: hsl(145, 45%, 46%);
}

.db-audit-panel.has-error {
    border-color: hsl(0, 60%, 82%);
    background: hsl(0, 65%, 98%);
}

@keyframes dbAuditPulse {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 1; }
}

/* ================================================================
   STATUS INLINE
   ================================================================ */
.status-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 13px;
    color: var(--text-muted);
}

.status-pulse {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

/* ================================================================
   ERROR
   ================================================================ */
.error-block {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 14px;
    background: hsl(0, 55%, 96%);
    border: 1px solid hsl(0, 55%, 88%);
    border-radius: var(--r-sm);
    margin: 12px 0;
    font-size: 13px;
    color: var(--accent-red);
}

/* ================================================================
   SOURCES PANEL
   ================================================================ */
.sources-panel {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.sources-title {
    font-size: 12px;
    font-weight: 580;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.source-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 5px 0;
    border-radius: var(--r-sm);
    transition: background 0.1s;
    margin-bottom: 1px;
}

.source-item:hover {
    background: transparent;
}

.source-item.source-highlight {
    background: hsl(40, 92%, 95%);
    box-shadow: inset 2px 0 0 var(--accent-orange);
    padding-left: 8px;
}

.source-item.is-extra {
    display: none;
}

.sources-panel.expanded .source-item.is-extra {
    display: flex;
}

.source-num {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 18px;
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
}

.source-info { flex: 1; min-width: 0; }

.source-title-link,
.source-info a {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    line-height: 1.4;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.source-title-link:hover,
.source-info a:hover { color: var(--accent); }

.source-snippet {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
    margin-top: 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.source-domain {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.sources-toggle {
    margin-top: 6px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--accent);
    font: inherit;
    font-size: 12px;
    font-weight: 560;
    cursor: pointer;
}

.sources-toggle:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ================================================================
   STATS BAR
   ================================================================ */
.stats-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: var(--text-muted);
    padding-top: 12px;
    margin-top: 14px;
    border-top: 1px solid var(--border);
}

.stats-bar-copy-only {
    justify-content: flex-end;
    gap: 0;
    padding-top: 10px;
    margin-top: 10px;
    border-top: none;
}

/* ── Copy button (in stats bar) ── */
.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--canvas-bg);
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.copy-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.copy-btn.copied {
    color: var(--accent-green);
    border-color: var(--accent-green);
}

.copy-btn svg {
    flex-shrink: 0;
}

/* ================================================================
   RESEARCH PLAN CHECKLIST
   ================================================================ */
.plan-checklist {
    margin: 14px 0;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--bg-100);
    overflow: hidden;
}

.plan-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

.plan-title {
    font-size: 13px;
    font-weight: 580;
    color: var(--text-primary);
}

.plan-progress {
    font-size: 12px;
    color: var(--text-muted);
}

.plan-progress-bar {
    height: 3px;
    background: var(--bg-300);
}

.plan-progress-fill {
    height: 100%;
    background: var(--accent-green);
    border-radius: 2px;
    transition: width 0.4s ease;
}

.plan-tasks {
    list-style: none;
    padding: 6px 0;
    margin: 0;
}

.plan-task {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 7px 14px;
    font-size: 13px;
    line-height: 1.45;
    transition: background 0.1s;
}

.plan-task:hover {
    background: var(--bg-200);
}

.plan-task-icon {
    flex-shrink: 0;
    width: 16px;
    text-align: center;
    font-size: 12px;
    padding-top: 1px;
}

.plan-task-pending .plan-task-icon { color: var(--text-muted); }
.plan-task-in_progress .plan-task-icon { color: var(--accent-orange); }
.plan-task-completed .plan-task-icon { color: var(--accent-green); }

.plan-task-title {
    flex: 1;
    min-width: 0;
    color: var(--text-secondary);
}

.plan-task-completed .plan-task-title {
    color: var(--text-muted);
    text-decoration: line-through;
    text-decoration-color: var(--border);
}

.plan-task-findings {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 400px;
}

/* Tool icon for research_plan */
.tool-icon.plan { background: hsl(40, 90%, 92%); color: hsl(32, 86%, 34%); }

/* ================================================================
   INPUT AREA
   ================================================================ */
.input-area {
    padding: 0 24px 16px;
    background: var(--canvas-bg);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.input-form {
    max-width: var(--content-w);
    margin: 0 auto;
}

.input-box {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--canvas-bg);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 8px 10px 8px 20px;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-box:focus-within {
    border-color: var(--accent);
    box-shadow: var(--shadow-input);
}

#queryInput {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-ui);
    font-size: 15px;
    color: var(--text-primary);
    resize: none;
    max-height: 160px;
    line-height: 1.5;
    padding: 6px 0;
}

#queryInput::placeholder { color: var(--text-muted); }

.send-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--r-sm);
    border: none;
    background: var(--accent);
    color: var(--canvas-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) { background: var(--accent-hover); }
.send-btn:disabled { opacity: 0.15; cursor: default; }

.input-hint {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    padding-top: 7px;
}

/* Voice (tone) picker under the input box */
.input-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}
.input-controls .input-hint {
    padding-top: 0;
}
.voice-picker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    padding-top: 7px;
}
.voice-picker-label {
    white-space: nowrap;
}
.voice-picker select {
    font-size: 12px;
    color: var(--text-primary, #222);
    background: var(--surface, #fff);
    border: 1px solid var(--border, #d6d6d6);
    border-radius: 7px;
    padding: 3px 8px;
    cursor: pointer;
    outline: none;
}
.voice-picker select:hover {
    border-color: var(--accent, #c0392b);
}

/* ================================================================
   USER QUESTION (ask_user tool)
   ================================================================ */
.user-question-block {
    --uq-warm: hsl(357, 76%, 46%);
    --uq-warm-hover: hsl(357, 82%, 40%);
    --uq-warm-light: hsl(357, 82%, 97%);
    --uq-warm-border: hsl(357, 42%, 78%);
    background: var(--uq-warm-light);
    border: 1px solid var(--uq-warm);
    border-radius: var(--r-sm);
    padding: 16px 18px;
    margin: 12px 0;
}

.uq-question {
    font-weight: 600;
    font-size: 0.97em;
    margin-bottom: 12px;
    color: var(--text-primary);
    line-height: 1.5;
}

.uq-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.uq-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    border: 1px solid var(--uq-warm-border);
    border-radius: 8px;
    background: var(--canvas-bg);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    text-align: left;
    font-family: inherit;
    font-size: inherit;
}

.uq-option:hover:not(:disabled) {
    border-color: var(--uq-warm);
    background: var(--uq-warm-light);
    box-shadow: 0 0 0 1px var(--uq-warm-light);
}

.uq-option.selected {
    border-color: var(--uq-warm);
    background: var(--uq-warm-light);
    box-shadow: 0 0 0 2px var(--uq-warm-light);
}

.uq-option:disabled:not(.selected) {
    opacity: 0.45;
    cursor: default;
}

.uq-option-label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.93em;
}

.uq-option-desc {
    font-size: 0.82em;
    color: var(--text-muted);
    margin-top: 3px;
    line-height: 1.4;
}

.uq-other-input {
    display: flex;
    width: 100%;
    box-sizing: border-box;
    gap: 8px;
    align-items: center;
}

.uq-other-text {
    flex: 1;
    padding: 9px 12px;
    border: 1px solid var(--uq-warm-border);
    border-radius: 8px;
    background: var(--canvas-bg);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.93em;
    outline: none;
    transition: border-color 0.15s;
}

.uq-other-text:focus {
    border-color: var(--uq-warm);
}

.uq-other-text:disabled {
    opacity: 0.45;
    cursor: default;
}

.uq-other-submit {
    padding: 9px 16px;
    border: none;
    border-radius: 8px;
    background: var(--uq-warm);
    color: #fff;
    font-family: inherit;
    font-size: 0.93em;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.uq-other-submit:hover:not(:disabled) {
    background: var(--uq-warm-hover);
}

.uq-other-submit:disabled {
    opacity: 0.45;
    cursor: default;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
    .login-overlay {
        padding: 12px;
        align-items: flex-start;
        overflow-y: auto;
    }
    .login-shell {
        width: 100%;
        grid-template-columns: 1fr;
        min-height: 0;
        border-radius: 8px;
    }
    .login-promo {
        min-height: auto;
        padding: 20px;
    }
    .promo-brand {
        margin-bottom: 18px;
    }
    .login-promo h1 {
        font-size: 26px;
        max-width: 24rem;
    }
    .login-promo p {
        font-size: 13px;
        margin-bottom: 12px;
    }
    .promo-metrics {
        margin-bottom: 0;
        gap: 6px;
    }
    .promo-metrics div {
        padding: 9px 8px;
    }
    .promo-metrics strong {
        font-size: 15px;
    }
    .promo-metrics span {
        font-size: 10px;
    }
    .promo-points {
        display: none;
    }
    .promo-note {
        margin-top: 12px;
    }
    .login-box {
        padding: 1.35rem 1.25rem 1.45rem;
    }
    .app.sidebar-open .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 99;
        background: hsla(0, 0%, 0%, 0.28);
    }
    .sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        z-index: 100;
        box-shadow: var(--shadow-lg);
        width: min(84vw, 320px) !important;
        min-width: min(84vw, 320px) !important;
    }
    .sidebar.collapsed {
        width: 0 !important;
        min-width: 0 !important;
        box-shadow: none;
    }
    .sidebar-resizer {
        display: none;
    }
    .messages { padding: 16px; }
    .input-area { padding: 0 12px 14px; }
    .topbar {
        padding: 8px 10px;
        gap: 8px;
    }
    .topbar-link,
    .user-name {
        display: none;
    }
    .credit-pill {
        padding: 0 6px;
    }
}
