:root {
    color: #171923;
    background: #f6f7fb;
    color-scheme: light;
    font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    letter-spacing: 0;
    --ink: #171923;
    --muted: #717684;
    --line: #e6e8ef;
    --line-strong: #d9dce6;
    --surface: #ffffff;
    --surface-soft: #f8f9fc;
    --canvas: #f6f7fb;
    --accent: #5147e5;
    --accent-hover: #4338ca;
    --violet-soft: #eeedff;
    --cyan: #0ea5c6;
    --cyan-soft: #e6f8fc;
    --green: #159a67;
    --green-soft: #e8f8f0;
    --orange: #e67e22;
    --orange-soft: #fff3e7;
    --danger: #dc4c64;
    --warning: #d97706;
    --shadow: 0 16px 38px rgba(31, 35, 48, .1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--canvas); }
body { margin: 0; min-width: 320px; min-height: 100dvh; background: var(--canvas); }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; transition: border-color .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease; }
button:hover:not(:disabled) { transform: translateY(-1px); }
button:active:not(:disabled) { transform: translateY(0); }
button:disabled { cursor: not-allowed; opacity: .5; }
input, select, textarea {
    width: 100%; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--ink);
    padding: 10px 12px; outline: none; transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
input::placeholder, textarea::placeholder { color: #737987; }
input:hover, select:hover, textarea:hover { border-color: #b9becc; }
input:focus, select:focus, textarea:focus { border-color: #7168ed; box-shadow: 0 0 0 3px rgba(81, 71, 229, .12); }
label { display: grid; gap: 7px; color: #4f5462; font-size: 12px; font-weight: 650; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 38px; line-height: 1.2; }
h2 { font-size: 20px; margin-bottom: 6px; }
h3 { font-size: 15px; margin-bottom: 16px; }
::selection { color: #fff; background: var(--accent); }

.brand-mark {
    display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; color: #fff;
    border: 1px solid #6e65ed; border-radius: 8px; background: var(--accent); font-size: 13px; font-weight: 850;
    box-shadow: 0 12px 26px rgba(81, 71, 229, .24);
}
.brand-mark.compact { width: 40px; height: 40px; font-size: 11px; box-shadow: none; }
.brand-mark.small { width: 34px; height: 34px; font-size: 10px; box-shadow: none; }

.login-shell { height: 100dvh; display: grid; grid-template-columns: minmax(400px, 46%) minmax(480px, 54%); overflow: hidden; background: #f8f9fc; }
.login-intro {
    position: relative; isolation: isolate; display: flex; flex-direction: column; overflow: hidden; padding: 42px 50px;
    color: #fff; background: #171923;
    background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
    background-size: 64px 64px;
}
.login-intro::before {
    content: "AI"; position: absolute; z-index: -1; right: -20px; bottom: -42px; color: #252837;
    font-size: min(42vw, 510px); line-height: .8; font-weight: 900;
}
.login-intro::after { content: ""; position: absolute; left: 50px; bottom: 116px; width: 74px; height: 8px; background: #ff7657; box-shadow: 86px 0 0 #39c6d8, 172px 0 0 #8a7df0; }
.login-intro-brand { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.login-statement { position: relative; margin: auto 0; max-width: 530px; }
.login-statement > span { color: #9b94ff; font-size: 10px; font-weight: 800; }
.login-statement h1 { margin: 14px 0 20px; font-size: 52px; }
.login-statement p { color: #aeb2c1; font-size: 15px; }
.login-domain { color: #b9bdc9; font-size: 11px; font-weight: 750; }
.login-form-area { display: grid; place-items: center; padding: 40px; background: #f8f9fc; }
.login-panel { width: min(390px, 100%); padding: 30px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.login-form-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 28px; }
.login-form-heading div { display: grid; gap: 3px; }
.login-form-heading div > span { color: var(--muted); font-size: 11px; }
.login-form-heading h2 { margin: 0; color: var(--ink); font-size: 24px; }
.login-panel form, .stack-form { display: grid; gap: 16px; }
.login-panel input { min-height: 46px; }
.login-footnote { margin: 18px 0 0; color: #5f6573; font-size: 11px; text-align: center; }
.form-error { min-height: 18px; margin: -3px 0 0; color: var(--danger); font-size: 12px; }

.primary, .quiet, .danger { min-height: 38px; border-radius: 8px; padding: 7px 14px; border: 1px solid transparent; font-weight: 700; }
.primary { color: #fff; background: var(--accent); border-color: var(--accent); box-shadow: 0 8px 18px rgba(81, 71, 229, .18); }
.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: 0 10px 24px rgba(81, 71, 229, .24); }
.quiet { color: #565b69; background: #fff; border-color: var(--line-strong); }
.quiet:hover { color: var(--ink); background: #f8f9fc; border-color: #bfc3cf; }
.danger { color: var(--danger); background: #fff; border-color: #f2c8cf; }
.danger:hover { color: #fff; background: var(--danger); border-color: var(--danger); }
.full { width: 100%; min-height: 46px; }

.app-shell { min-height: 100dvh; display: grid; grid-template-columns: 236px minmax(0, 1fr); grid-template-rows: 66px minmax(0, 1fr); background: var(--canvas); }
.sidebar { grid-row: 1 / -1; display: flex; flex-direction: column; min-height: 100dvh; padding: 16px 12px; background: #fff; border-right: 1px solid var(--line); }
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 9px 22px; }
.sidebar-brand div { display: grid; gap: 2px; }
.sidebar-brand strong { color: #20232d; font-size: 14px; }
.sidebar-brand div span { color: #686e7c; font-size: 10px; font-weight: 700; }
.nav-tabs { display: grid; gap: 4px; }
.nav-label { padding: 15px 10px 5px; color: #707684; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.nav-tab {
    position: relative; display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 11px;
    border: 1px solid transparent; border-radius: 8px; background: transparent; color: #626776; text-align: left; font-size: 13px; font-weight: 650;
}
.nav-tab span { display: grid; place-items: center; width: 22px; height: 22px; color: #858a98; font-size: 15px; }
.nav-tab:hover { color: #282c36; background: #f6f7fb; }
.nav-tab.active { color: #443ad4; background: var(--violet-soft); border-color: #dedbff; }
.nav-tab.active span { color: var(--accent); }
.sidebar-status { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 13px 11px; background: #f7faf8; border: 1px solid #e2eee8; border-radius: 8px; }
.sidebar-status > span { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(21, 154, 103, .1); }
.sidebar-status div { display: grid; gap: 2px; }
.sidebar-status strong { color: #385047; font-size: 10px; }
.sidebar-status small { color: #5f7068; font-size: 10px; }
.sidebar-status.ai-warning { background: #fff8ed; border-color: #f2dfbe; }
.sidebar-status.ai-warning > span { background: var(--warning); box-shadow: 0 0 0 4px rgba(217, 119, 6, .1); }
.sidebar-status.ai-warning strong, .sidebar-status.ai-pending strong { color: #795d2d; }
.sidebar-status.ai-pending { background: #f1f9fb; border-color: #d7edf2; }
.sidebar-status.ai-pending > span { background: var(--cyan); box-shadow: 0 0 0 4px rgba(14, 165, 198, .1); }
.sidebar-status.ai-error { background: #fff2f4; border-color: #f2d6dc; }
.sidebar-status.ai-error > span { background: var(--danger); box-shadow: 0 0 0 4px rgba(220, 76, 100, .1); }
.sidebar-status.ai-error strong { color: #8f3546; }
.sidebar-status.ai-unknown > span, .sidebar-status.ai-checking > span { background: #9ca3af; box-shadow: 0 0 0 4px rgba(156, 163, 175, .1); }

.topbar {
    grid-column: 2; grid-row: 1; position: relative; display: flex; align-items: center; justify-content: space-between; gap: 18px;
    padding: 0 28px; background: rgba(255,255,255,.92); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px);
}
.page-title { display: grid; gap: 2px; }
.page-title span { color: #686e7b; font-size: 10px; }
.page-title strong { color: #232630; font-size: 15px; }
.account { display: flex; align-items: center; gap: 9px; font-size: 12px; }
.account-avatar { display: grid; place-items: center; width: 32px; height: 32px; color: #fff; background: #171923; border-radius: 50%; font-size: 12px; font-weight: 800; }
.account-copy { display: grid; gap: 1px; margin-right: 6px; }
#accountName { color: #343842; font-weight: 700; }
#accountMeta { color: #676d7a; font-size: 10px; }
.account .quiet { min-height: 32px; padding: 4px 10px; font-size: 11px; }

.view { grid-column: 2; grid-row: 2; width: min(1320px, 100%); min-height: calc(100dvh - 66px); margin: 0 auto; padding: 26px 32px 34px; animation: viewIn .2s ease-out both; }
.welcome-band { display: flex; align-items: center; justify-content: space-between; gap: 26px; min-height: 150px; padding: 26px 30px; overflow: hidden; color: #fff; background: #171923; border-radius: 8px; box-shadow: 0 14px 32px rgba(30, 32, 43, .14); }
.welcome-band::after { content: "✦"; flex: 0 0 auto; display: grid; place-items: center; width: 112px; height: 88px; color: #171923; background: #b9f0dd; border-radius: 8px; font-size: 54px; transform: rotate(5deg); }
.welcome-kicker { display: block; margin-bottom: 10px; color: #c5c1ff; font-size: 10px; font-weight: 800; }
.welcome-band h1 { margin-bottom: 8px; font-size: 30px; }
.welcome-band p { margin: 0; color: #aeb2bf; }
.home-ask { margin-left: auto; white-space: nowrap; }
.home-ask span { margin-right: 6px; }
.quick-section, .overview-section { margin-top: 26px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 16px; }
.section-heading h2 { color: #252832; }
.section-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.section-heading.compact { margin-bottom: 13px; }
.section-heading.compact h3 { margin: 0; }
.quick-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.quick-card { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 96px; padding: 15px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 14px rgba(31,35,48,.04); }
.quick-card:hover { border-color: #c9cbd7; box-shadow: 0 12px 26px rgba(31,35,48,.09); }
.quick-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 8px; font-size: 18px; font-weight: 800; }
.quick-card div { display: grid; gap: 5px; min-width: 0; }
.quick-card strong { color: #292d37; font-size: 13px; }
.quick-card small { overflow: hidden; color: #656b79; font-size: 11px; line-height: 1.45; }
.quick-card b { color: #a7abb6; font-size: 24px; font-weight: 400; }
.quick-card.violet .quick-icon { color: var(--accent); background: var(--violet-soft); }
.quick-card.cyan .quick-icon { color: var(--cyan); background: var(--cyan-soft); }
.quick-card.green .quick-icon { color: var(--green); background: var(--green-soft); }
.quick-card.orange .quick-icon { color: var(--orange); background: var(--orange-soft); }
.overview-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric-card { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 12px; min-height: 92px; padding: 16px 18px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.metric-card div { display: grid; gap: 2px; }
.metric-card small { color: #666c79; font-size: 11px; }
.metric-card strong { color: #232630; font-size: 23px; }
.metric-card em { align-self: end; color: #6f7481; font-size: 10px; font-style: normal; }
.metric-dot { width: 8px; height: 34px; border-radius: 4px; }
.metric-dot.violet { background: var(--accent); }
.metric-dot.cyan { background: var(--cyan); }
.metric-dot.green { background: var(--green); }
.metric-dot.orange { background: var(--orange); }
.metric-dot.ai-online { background: var(--green); }
.metric-dot.ai-warning { background: var(--warning); }
.metric-dot.ai-pending { background: var(--cyan); }
.metric-dot.ai-error { background: var(--danger); }
.metric-dot.ai-unknown, .metric-dot.neutral { background: #9ca3af; }
.ai-status-card.ai-online strong { color: var(--green); }
.ai-status-card.ai-warning strong { color: var(--warning); }
.ai-status-card.ai-pending strong { color: var(--cyan); }
.ai-status-card.ai-error strong { color: var(--danger); }
.ai-status-card.ai-unknown strong { color: #6b7280; }
.home-note { display: flex; align-items: center; gap: 12px; margin-top: 22px; padding: 15px 18px; background: #eef7ff; border: 1px solid #d8ebfb; border-radius: 8px; }
.home-note > span { display: grid; place-items: center; flex: 0 0 auto; width: 28px; height: 28px; color: #fff; background: var(--cyan); border-radius: 50%; font-weight: 800; }
.home-note div { display: grid; gap: 3px; }
.home-note strong { color: #28536a; font-size: 11px; }
.home-note p { margin: 0; color: #4f6f82; font-size: 11px; }

#chatView { display: grid; grid-template-rows: auto minmax(0, 1fr); width: 100%; height: calc(100dvh - 66px); padding: 0 0 18px; }
.chat-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 64px; padding: 10px 24px; background: rgba(255,255,255,.75); border-bottom: 1px solid var(--line); }
.conversation-toggle { display: none; align-items: center; gap: 6px; }
.chat-current { display: grid; gap: 2px; min-width: 0; }
.chat-current span { color: #6b7180; font-size: 10px; font-weight: 700; }
.chat-current strong { overflow: hidden; color: #272b35; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.new-conversation { display: inline-flex; align-items: center; justify-self: end; gap: 5px; white-space: nowrap; }
.chat-workspace { position: relative; display: grid; grid-template-columns: 238px minmax(0, 1fr); min-height: 0; }
.chat-main { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-width: 0; min-height: 0; padding: 0 24px; }
.conversation-panel { min-width: 0; overflow-y: auto; padding: 14px 10px; background: rgba(255,255,255,.58); border-right: 1px solid var(--line); scrollbar-color: #c7cad3 transparent; }
.conversation-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 8px 12px; }
.conversation-panel-heading div { display: grid; gap: 2px; }
.conversation-panel-heading span { color: #686e7b; font-size: 10px; font-weight: 800; }
.conversation-panel-heading strong { color: #343842; font-size: 12px; }
.conversation-close { display: none; place-items: center; width: 34px; height: 34px; padding: 0; color: #737886; background: transparent; border: 0; border-radius: 7px; font-size: 20px; }
.conversation-close:hover { color: var(--ink); background: #f0f1f5; }
.conversation-list { display: grid; gap: 4px; }
.conversation-empty { margin: 22px 8px; color: #666c79; font-size: 11px; text-align: center; }
.conversation-row { display: grid; grid-template-columns: minmax(0, 1fr) 30px; align-items: center; border: 1px solid transparent; border-radius: 7px; }
.conversation-row:hover { background: rgba(255,255,255,.75); border-color: var(--line); }
.conversation-row.active { background: var(--violet-soft); border-color: #dedbff; }
.conversation-open { display: grid; gap: 4px; min-width: 0; min-height: 72px; padding: 10px 8px 10px 10px; color: #4f5462; background: transparent; border: 0; text-align: left; }
.conversation-open:hover { transform: none; }
.conversation-open strong, .conversation-open span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-open strong { color: #30343f; font-size: 11px; }
.conversation-open span { color: #656b78; font-size: 10px; }
.conversation-open small { color: #707684; font-size: 10px; }
.conversation-delete { width: 28px; height: 34px; padding: 0; color: #9a9eaa; background: transparent; border: 0; border-radius: 6px; font-size: 17px; }
.conversation-delete:hover { color: var(--danger); background: #fff1f3; }
.conversation-backdrop { display: none; }
.messages { min-width: 0; overflow-y: auto; padding: 16px max(0px, calc((100% - 900px) / 2)) 24px; scrollbar-color: #c7cad3 transparent; }
.empty-state { width: min(900px, 100%); margin: min(10vh, 82px) auto 0; text-align: left; }
.empty-kicker { display: inline-flex; margin-bottom: 12px; padding: 5px 8px; color: #4d44d2; background: var(--violet-soft); border-radius: 4px; font-size: 10px; font-weight: 800; }
.empty-state h2 { margin-bottom: 8px; color: #20232d; font-size: 32px; }
.empty-state > p { margin-bottom: 26px; color: var(--muted); }
.prompt-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.prompt-list button { min-height: 90px; display: grid; align-content: space-between; gap: 12px; padding: 15px; overflow: hidden; color: #555b68; background: #fff; border: 1px solid var(--line); border-radius: 8px; text-align: left; line-height: 1.45; box-shadow: 0 4px 14px rgba(31,35,48,.04); }
.prompt-list button:hover { color: #272b35; border-color: #c9cbd7; box-shadow: 0 12px 26px rgba(31,35,48,.08); }
.prompt-list button span { color: #5147e5; font-size: 10px; font-weight: 800; }
.message { display: grid; gap: 7px; margin: 0 0 20px; animation: messageIn .2s ease-out both; }
.message.user { justify-items: end; }
.message-label { color: #676d79; font-size: 11px; font-weight: 700; }
.message-body { min-width: 0; max-width: 88%; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; padding: 14px 16px; border-radius: 8px; background: #fff; border: 1px solid var(--line); box-shadow: 0 3px 12px rgba(31,35,48,.04); }
.message.assistant .message-body { width: min(88%, 780px); max-width: 100%; padding: 6px 0 10px; background: transparent; border: 0; box-shadow: none; }
.message.user .message-body { color: #fff; background: #272936; border-color: #272936; }
.markdown-body { color: #252936; white-space: normal; font-size: 14px; line-height: 1.78; }
.markdown-body > :first-child { margin-top: 0; }
.markdown-body > :last-child { margin-bottom: 0; }
.markdown-body p { margin: 0 0 13px; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { color: #1d2029; line-height: 1.4; }
.markdown-body h1 { margin: 24px 0 12px; font-size: 19px; }
.markdown-body h2 { margin: 22px 0 10px; font-size: 16px; }
.markdown-body h3 { margin: 18px 0 8px; font-size: 14px; }
.markdown-body ul, .markdown-body ol { margin: 0 0 15px; padding-left: 23px; }
.markdown-body li { margin: 5px 0; padding-left: 2px; }
.markdown-body li::marker { color: var(--accent); font-weight: 750; }
.markdown-body strong { color: #171923; font-weight: 750; }
.markdown-body a { color: #443ad4; text-underline-offset: 3px; }
.markdown-body blockquote { margin: 15px 0; padding: 9px 13px; color: #555c69; background: #f1f5f7; border-left: 3px solid var(--cyan); }
.markdown-body code { padding: 2px 5px; color: #9b3b58; background: #f4edf1; border-radius: 4px; font: .9em Consolas, monospace; }
.markdown-body pre { max-width: 100%; margin: 15px 0; overflow: auto; padding: 14px 16px; color: #eef0f6; background: #20232d; border-radius: 8px; line-height: 1.6; }
.markdown-body pre code { padding: 0; color: inherit; background: transparent; }
.markdown-body hr { margin: 22px 0; border: 0; border-top: 1px solid var(--line); }
.markdown-table { max-width: 100%; margin: 14px 0 18px; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.markdown-table table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 12px; line-height: 1.55; }
.markdown-table th, .markdown-table td { padding: 10px 12px; border-bottom: 1px solid #eceef3; text-align: left; vertical-align: top; }
.markdown-table th { color: #454a57; background: #f4f5f9; font-weight: 750; }
.markdown-table tr:last-child td { border-bottom: 0; }
.markdown-table tbody tr:hover { background: #fafafe; }
.thinking-panel { width: min(88%, 780px); overflow: hidden; color: #575c69; background: #f0f7fa; border: 1px solid #d7e9ee; border-radius: 8px; }
.thinking-summary { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 9px 12px; overflow-wrap: anywhere; cursor: pointer; color: #315d68; font-size: 11px; font-weight: 750; list-style: none; }
.thinking-summary::-webkit-details-marker { display: none; }
.thinking-summary::before { content: ""; flex: 0 0 auto; width: 8px; height: 8px; border: 2px solid #9dcbd5; border-top-color: var(--cyan); border-radius: 50%; animation: thinkingSpin .8s linear infinite; }
.message:not(.streaming) .thinking-summary::before { border: 0; background: var(--green); animation: none; }
.message.stream-failed .thinking-summary::before { background: var(--danger); }
.thinking-steps { display: grid; gap: 7px; padding: 0 12px 11px 29px; overflow-wrap: anywhere; color: #566b72; font-size: 11px; line-height: 1.5; }
.thinking-step { position: relative; }
.thinking-step::before { content: ""; position: absolute; top: .55em; left: -15px; width: 5px; height: 5px; border-radius: 50%; background: #9cc8d1; }
.thinking-result { padding-top: 7px; color: #3d6b59; border-top: 1px solid #d7e9ee; }
.stream-error { padding-top: 7px; color: var(--danger); border-top: 1px solid #eecbd2; }
.message.streaming .message-body::after { content: ""; display: inline-block; width: 2px; height: 1.05em; margin-left: 3px; vertical-align: -.12em; background: var(--accent); animation: streamCursor .8s steps(1) infinite; }
.message.stream-failed .message-body { border-left-color: var(--danger); }
.sources { width: min(88%, 780px); display: grid; gap: 7px; }
.sources-title { margin: 3px 0 1px; color: #626875; font-size: 11px; font-weight: 750; }
.source { display: flex; align-items: center; gap: 12px; min-height: 58px; border-left: 3px solid var(--orange); padding: 9px 10px 9px 12px; background: #fff8ef; border-radius: 0 8px 8px 0; }
.source-meta { display: grid; min-width: 0; flex: 1; gap: 4px; }
.source-file { overflow: hidden; color: #4f453a; font-size: 11px; font-weight: 750; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.source-file:hover { color: #9b5318; text-decoration: underline; }
.source-detail { color: #6b5b4d; font-size: 11px; line-height: 1.4; }
.source-download { display: grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; color: #9b5318; background: #fff; border: 1px solid #efd9c2; border-radius: 8px; font-size: 17px; font-weight: 800; text-decoration: none; }
.source-download:hover { color: #fff; background: var(--orange); border-color: var(--orange); }
.message-feedback { width: min(88%, 780px); display: flex; gap: 5px; margin-top: -3px; }
.message-feedback-button { min-height: 30px; padding: 4px 8px; color: #646a77; background: transparent; border: 1px solid transparent; border-radius: 6px; font-size: 11px; font-weight: 650; }
.message-feedback-button:hover { color: #474c58; background: #fff; border-color: var(--line); }
.message-feedback-button.active { color: #4037c6; background: var(--violet-soft); border-color: #dcd8ff; }
.composer { width: min(900px, 100%); margin: 0 auto; display: grid; grid-template-columns: 1fr 100px; gap: 8px; align-items: stretch; padding: 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.chat-options { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 1px 4px 7px; border-bottom: 1px solid #eef0f4; }
.chat-options label { display: flex; align-items: center; gap: 7px; min-width: 0; color: #666c79; font-size: 11px; white-space: nowrap; }
.chat-options select { width: auto; max-width: 260px; min-height: 30px; padding: 4px 26px 4px 8px; border-color: transparent; background: #f3f4f8; color: #4d5260; font-size: 11px; font-weight: 650; }
.composer textarea { min-height: 58px; max-height: 150px; resize: vertical; border-color: transparent; background: transparent; }
.composer textarea:focus { box-shadow: none; }
.composer .primary { display: flex; align-items: center; justify-content: center; gap: 6px; }
.composer .primary span { font-size: 17px; }
.composer .primary.stop { color: #fff; background: #343744; border-color: #343744; box-shadow: none; }

.documents-heading-actions { display: flex; align-items: center; gap: 8px; }
.documents-heading-actions button { display: flex; align-items: center; gap: 6px; }
.documents-heading .quiet span { color: var(--accent); font-size: 16px; }
.document-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 14px; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.document-stats div { display: grid; gap: 5px; min-height: 76px; padding: 14px 18px; border-right: 1px solid var(--line); }
.document-stats div:last-child { border-right: 0; }
.document-stats span { color: #656b78; font-size: 11px; }
.document-stats strong { color: #292d37; font-size: 22px; }
.document-stats div:nth-child(2) strong { color: var(--green); }
.document-stats div:nth-child(3) strong { color: var(--warning); }
.folder-tree-mobile-toggle { display: none; }
.document-library-layout { display: grid; grid-template-columns: 244px minmax(0, 1fr); align-items: start; gap: 14px; }
.document-library-content { min-width: 0; }
.folder-tree-panel { position: sticky; top: 18px; max-height: calc(100dvh - 104px); overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.folder-tree-heading { display: flex; align-items: center; justify-content: space-between; min-height: 55px; padding: 11px 13px; border-bottom: 1px solid var(--line); }
.folder-tree-heading div { display: grid; gap: 3px; }
.folder-tree-heading strong { color: #30343f; font-size: 12px; }
.folder-tree-heading span { color: #676d79; font-size: 10px; }
.folder-tree { padding: 7px; }
.folder-tree-row { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; min-height: 38px; padding-left: calc(var(--tree-depth) * 14px); border-radius: 6px; }
.folder-tree-row:hover { background: #f7f8fb; }
.folder-tree-row.active { background: var(--violet-soft); }
.folder-tree-expand, .folder-tree-expand-spacer { display: grid; place-items: center; width: 24px; height: 32px; }
.folder-tree-expand { padding: 0; color: #8b8f9b; background: transparent; border: 0; font-size: 12px; }
.folder-tree-expand:hover { color: var(--accent); }
.folder-tree-open { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 36px; padding: 4px 3px; color: #4e5360; background: transparent; border: 0; text-align: left; }
.folder-tree-open:hover, .folder-tree-open[aria-current="page"] { color: #3830b4; }
.folder-tree-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 680; }
.folder-tree-icon { position: relative; flex: 0 0 auto; width: 16px; height: 12px; margin-top: 2px; background: #918bf0; border-radius: 2px; }
.folder-tree-icon::before { content: ""; position: absolute; top: -3px; left: 1px; width: 7px; height: 4px; background: #918bf0; border-radius: 2px 2px 0 0; }
.folder-tree-root-icon { display: grid; place-items: center; flex: 0 0 auto; width: 16px; color: var(--accent); font-size: 13px; }
.folder-tree-actions { display: flex; opacity: .35; transition: opacity .15s ease; }
.folder-tree-row:hover .folder-tree-actions, .folder-tree-row.active .folder-tree-actions { opacity: 1; }
.folder-tree-actions button { display: grid; place-items: center; width: 25px; height: 32px; padding: 0; color: #858a97; background: transparent; border: 0; border-radius: 5px; font-size: 13px; }
.folder-tree-actions button:hover { color: var(--accent); background: #fff; }
.folder-tree-actions .folder-tree-delete:hover { color: var(--danger); background: #fff1f3; }
.folder-breadcrumb { display: flex; align-items: center; gap: 4px; min-height: 38px; margin-bottom: 10px; overflow-x: auto; scrollbar-width: none; }
.folder-breadcrumb::-webkit-scrollbar { display: none; }
.folder-breadcrumb button { flex: 0 0 auto; min-height: 30px; padding: 4px 7px; color: #616674; background: transparent; border-color: transparent; font-size: 11px; font-weight: 700; }
.folder-breadcrumb button:hover { color: var(--accent); background: var(--violet-soft); }
.folder-breadcrumb button[aria-current="page"] { color: #262a34; }
.folder-breadcrumb span { flex: 0 0 auto; color: #adb0ba; font-size: 13px; }
.document-filters { display: grid; grid-template-columns: minmax(220px, 1fr) 170px auto; align-items: end; gap: 10px; margin-bottom: 10px; padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.document-filters label { gap: 4px; }
.document-filters label > span { color: #646a77; font-size: 11px; }
.document-filters input, .document-filters select { min-height: 36px; padding-top: 7px; padding-bottom: 7px; }
.document-filter-count { align-self: center; min-width: 112px; color: #646a77; font-size: 11px; text-align: right; }
.upload-panel { margin-bottom: 14px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.upload-drop { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; align-items: center; gap: 13px; min-height: 104px; padding: 18px; border-bottom: 1px dashed var(--line-strong); background: #fafbfe; transition: border-color .16s ease, background .16s ease; }
.upload-drop.dragging { background: var(--violet-soft); box-shadow: inset 0 0 0 1px #918af3; }
.upload-symbol { display: grid; place-items: center; width: 46px; height: 46px; color: var(--accent); background: var(--violet-soft); border: 1px solid #dedbff; border-radius: 8px; font-size: 20px; font-weight: 800; }
.upload-copy { display: grid; gap: 4px; min-width: 0; }
.upload-copy strong { overflow: hidden; color: #353944; text-overflow: ellipsis; white-space: nowrap; }
.upload-copy span { color: #656b78; font-size: 11px; }
.upload-copy .upload-location { color: #5c55c7; font-weight: 700; }
.upload-settings { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(200px, 1fr) 150px; align-items: end; gap: 10px; padding: 14px 16px; }
.upload-button { display: flex; align-items: center; justify-content: center; gap: 6px; }
.upload-button span { font-size: 16px; }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { text-align: left; border-bottom: 1px solid #eceef3; padding: 12px 14px; font-size: 12px; }
th { color: #626875; background: #fafbfc; font-size: 11px; font-weight: 750; }
.document-location { display: block; max-width: 360px; margin-top: 5px; overflow: hidden; padding: 0; color: #5f6573; background: transparent; border: 0; font-size: 11px; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.document-location:hover { color: var(--accent); text-decoration: underline; transform: none; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: #fafbfe; }
tr:last-child td { border-bottom: 0; }
.document-empty { height: 160px; text-align: center; }
.document-empty strong, .document-empty span { display: block; }
.document-empty strong { margin-bottom: 6px; color: #555a67; font-size: 13px; }
.document-empty span { color: #686e7b; font-size: 11px; }
.status { display: inline-flex; align-items: center; min-width: 58px; font-weight: 700; }
.status::before { content: ""; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: currentColor; }
.status.ready { color: var(--green); }
.status.failed { color: var(--danger); }
.status.pending, .status.processing, .status.deleting { color: var(--warning); }
.row-action { display: inline-flex; align-items: center; justify-content: center; min-height: 28px; padding: 3px 8px; text-decoration: none; white-space: nowrap; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.admin-section { background: #fff; border: 1px solid var(--line); padding: 19px; border-radius: 8px; }
.admin-section.wide { margin-top: 16px; }
.admin-heading { margin-bottom: 12px; }
.admin-tabs { display: flex; gap: 4px; margin-bottom: 16px; padding: 4px; overflow-x: auto; background: #ebeef4; border-radius: 8px; scrollbar-width: none; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab { flex: 0 0 auto; min-height: 36px; padding: 7px 16px; border: 1px solid transparent; border-radius: 6px; color: #6a6f7d; background: transparent; font-size: 12px; font-weight: 700; }
.admin-tab:hover { color: #292d37; background: rgba(255,255,255,.58); }
.admin-tab.active { color: #443ad4; background: #fff; border-color: #dedfe7; box-shadow: 0 2px 7px rgba(31,35,48,.07); }
.admin-panel { animation: viewIn .18s ease-out both; }
.ai-settings-section { border-top: 3px solid var(--accent); }
.ai-settings-section .section-heading { margin-bottom: 16px; }
.config-badge { display: inline-flex; align-items: center; min-height: 26px; padding: 3px 9px; border-radius: 999px; color: #5f6573; background: #f2f3f6; font-size: 11px; font-weight: 750; }
.config-badge.configured { color: #11734e; background: var(--green-soft); }
.config-badge.incomplete { color: #9a5a07; background: var(--orange-soft); }
.ai-settings-form { display: grid; grid-template-columns: 1.15fr 1fr .75fr; gap: 0 22px; }
.ai-settings-form fieldset { min-width: 0; margin: 0; padding: 0 22px 0 0; border: 0; border-right: 1px solid var(--line); }
.ai-settings-form fieldset:nth-child(2) { padding: 0 22px 0 0; }
.ai-settings-form fieldset:nth-child(3) { padding: 0; border-right: 0; }
.ai-settings-form legend { margin-bottom: 12px; color: #292d37; font-size: 13px; font-weight: 800; }
.ai-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ai-field-grid .wide-field { grid-column: 1 / -1; }
.model-field { grid-column: 1 / -1; }
.model-picker { display: grid; grid-template-columns: minmax(0, 1fr) 72px; gap: 6px; }
.model-refresh { width: 72px; min-height: 38px; padding: 0 8px; white-space: nowrap; }
.model-test-row { display: flex; align-items: center; gap: 10px; min-height: 38px; }
.model-test-row .quiet { flex: 0 0 auto; }
.model-test-result { color: #747987; font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.model-test-result.success { color: var(--green); }
.model-test-result.error { color: var(--danger); }
.allowed-models { display: grid; gap: 8px; }
.allowed-models-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #4f5462; font-size: 12px; font-weight: 650; }
.allowed-models-heading .quiet { min-height: 32px; padding: 4px 9px; font-size: 11px; }
.allowed-model-rows { display: grid; gap: 7px; }
.allowed-model-row { display: grid; grid-template-columns: minmax(0, 1fr) 54px 38px; gap: 6px; }
.allowed-model-row .quiet { min-height: 38px; padding: 0 8px; }
.allowed-model-remove { color: var(--danger); font-size: 18px; }
.allowed-model-row .model-test-result { grid-column: 1 / -1; }
.allowed-models > p { margin: 0; color: #646a77; font-size: 11px; line-height: 1.55; }
.ai-field-note { margin: 0; color: #646a77; font-size: 11px; line-height: 1.55; }
.clear-key { display: flex; align-items: center; align-self: end; min-height: 39px; color: #606674; font-size: 11px; font-weight: 600; }
.clear-key input { width: 16px; height: 16px; margin: 0; accent-color: var(--danger); }
.ai-settings-save { grid-column: 1 / -1; justify-self: end; margin-top: 16px; }
.prompt-settings { display: grid; gap: 12px; }
.prompt-settings-rows { display: grid; gap: 12px; }
.prompt-setting-row { display: grid; grid-template-columns: 140px minmax(0, 1fr) 38px; gap: 12px; align-items: end; }
.prompt-remove { width: 38px; min-height: 38px; padding: 0; color: var(--danger); font-size: 18px; }
.prompt-settings-actions { display: flex; justify-content: space-between; gap: 10px; }
.prompt-settings-actions button { min-width: 118px; }
.toast { position: fixed; z-index: 20; top: 86px; right: auto; left: 50%; max-width: min(420px, calc(100vw - 40px)); padding: 12px 15px; color: #fff; background: #272936; border: 1px solid #3d4050; border-radius: 8px; box-shadow: 0 14px 38px rgba(31,35,48,.2); animation: toastIn .2s ease-out both; }
.toast.error { background: #9d3548; border-color: #ba5365; }
dialog { width: min(400px, calc(100vw - 30px)); color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-top: 3px solid var(--accent); border-radius: 8px; padding: 22px; box-shadow: 0 24px 70px rgba(31,35,48,.25); }
dialog::backdrop { background: rgba(31,35,48,.48); backdrop-filter: blur(3px); }
.confirm-dialog { width: min(440px, calc(100vw - 30px)); overflow: hidden; padding: 0; border-top: 1px solid var(--line-strong); }
.confirm-dialog[open] { animation: dialogIn .16s ease-out both; }
.confirm-dialog-body { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; padding: 24px 24px 20px; }
.confirm-dialog-icon { display: grid; place-items: center; width: 44px; height: 44px; color: var(--danger); background: #fff1f3; border: 1px solid #f4cbd2; border-radius: 50%; font-size: 20px; font-weight: 800; }
.confirm-dialog.confirm-safe .confirm-dialog-icon { color: var(--accent); background: #f1f5ff; border-color: #d8e1ff; }
.confirm-dialog-copy { min-width: 0; }
.confirm-dialog-kicker { display: block; margin-bottom: 5px; color: #b83f54; font-size: 10px; font-weight: 800; }
.confirm-dialog.confirm-safe .confirm-dialog-kicker { color: var(--accent); }
.confirm-dialog-copy h3 { margin-bottom: 7px; color: #242731; font-size: 18px; }
.confirm-dialog-copy p { margin: 0; color: #737885; font-size: 11px; line-height: 1.6; }
.confirm-dialog-target { display: block; margin-top: 13px; padding: 10px 11px; overflow-wrap: anywhere; color: #414651; background: #f7f8fb; border: 1px solid #e8eaf0; border-radius: 7px; font-size: 11px; }
.confirm-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 20px; background: #fafbfc; border-top: 1px solid var(--line); }
.confirm-danger { min-height: 38px; padding: 7px 15px; color: #fff; background: var(--danger); border: 1px solid var(--danger); border-radius: 8px; font-weight: 700; }
.confirm-danger:hover { background: #c94057; border-color: #c94057; box-shadow: 0 8px 18px rgba(220,76,100,.2); }
.folder-scope-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dialog-hint { margin: 0; color: #7b808d; font-size: 11px; line-height: 1.55; overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.table-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

@keyframes viewIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes messageIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -7px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes dialogIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes thinkingSpin { to { transform: rotate(360deg); } }
@keyframes streamCursor { 50% { opacity: 0; } }

@media (max-width: 1100px) {
    .quick-grid, .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .document-library-layout { grid-template-columns: 220px minmax(0, 1fr); }
    .ai-settings-form { grid-template-columns: 1fr 1fr; row-gap: 20px; }
    .ai-settings-form fieldset:nth-child(2) { padding: 0; border-right: 0; }
    .ai-settings-form fieldset:nth-child(3) { grid-column: 1 / -1; padding: 18px 0 0; border-top: 1px solid var(--line); }
}

@media (max-width: 760px) {
    .login-shell { display: block; height: 100dvh; }
    .login-intro { display: none; }
    .login-form-area { height: 100%; padding: 22px; }
    .login-panel { padding: 24px 20px; }
    .login-form-heading { margin-bottom: 26px; }
    .app-shell { display: block; min-height: 100dvh; padding: 56px 0 calc(64px + env(safe-area-inset-bottom)); }
    .sidebar { display: contents; }
    .sidebar-brand, .sidebar-status, .nav-label { display: none; }
    .topbar { position: fixed; z-index: 12; inset: 0 0 auto; justify-content: flex-end; min-height: 56px; padding: 7px 12px; }
    .toast { top: 68px; max-width: calc(100vw - 24px); text-align: center; }
    .page-title, #accountMeta, #accountName, .account-avatar { display: none; }
    .account { gap: 6px; }
    .account .quiet { min-height: 30px; padding: 4px 8px; }
    .nav-tabs { position: fixed; z-index: 12; inset: auto 0 0; display: flex; gap: 3px; height: calc(64px + env(safe-area-inset-bottom)); padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.97); border-top: 1px solid var(--line); box-shadow: 0 -8px 26px rgba(31,35,48,.08); }
    .nav-tab { flex: 1; justify-content: center; min-height: 46px; padding: 0 7px; font-size: 11px; }
    .nav-tab span { width: 18px; }
    .view { width: 100%; min-height: calc(100dvh - 120px); padding: 16px 12px 24px; }
    .welcome-band { align-items: flex-start; min-height: 154px; padding: 18px; }
    .welcome-band::after { display: none; }
    .welcome-band h1 { font-size: 23px; line-height: 1.25; }
    .welcome-band p { max-width: 270px; line-height: 1.6; }
    .home-ask { align-self: flex-end; margin-left: 0; }
    .quick-section, .overview-section { margin-top: 18px; }
    .quick-grid, .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .quick-card { grid-template-columns: 36px minmax(0, 1fr); min-height: 72px; gap: 9px; padding: 11px; }
    .quick-icon { width: 36px; height: 36px; }
    .quick-card small, .quick-card b { display: none; }
    .metric-card { grid-template-columns: 6px minmax(0, 1fr); min-height: 72px; gap: 10px; padding: 12px; }
    .metric-card em { display: none; }
    .metric-dot { width: 6px; height: 30px; }
    #chatView { height: calc(100dvh - 120px); padding: 0 0 12px; }
    .chat-heading { grid-template-columns: auto minmax(0, 1fr) auto; min-height: 54px; padding: 7px 12px; }
    .conversation-toggle { display: inline-flex; min-height: 34px; padding: 5px 8px; font-size: 11px; }
    .conversation-toggle span { font-size: 14px; }
    .chat-current span { display: none; }
    .chat-current strong { font-size: 11px; text-align: center; }
    .new-conversation { min-height: 34px; padding: 5px 8px; font-size: 11px; }
    .chat-workspace { display: block; min-height: 0; }
    .chat-main { height: 100%; padding: 0 12px; }
    .conversation-panel { position: fixed; z-index: 15; inset: 56px auto calc(64px + env(safe-area-inset-bottom)) 0; width: min(340px, 88vw); padding: 14px 10px; background: #fff; border-right: 1px solid var(--line); box-shadow: 18px 0 42px rgba(31,35,48,.16); transform: translateX(-102%); transition: transform .2s ease; }
    .conversation-panel.open { transform: translateX(0); }
    .conversation-close { display: grid; }
    .conversation-backdrop { position: fixed; z-index: 14; inset: 56px 0 calc(64px + env(safe-area-inset-bottom)); display: block; width: 100%; padding: 0; background: rgba(31,35,48,.28); border: 0; }
    .messages { padding-left: 0; padding-right: 0; }
    .empty-state { margin-top: 4vh; text-align: center; }
    .empty-state h2 { font-size: 27px; }
    .empty-state > p { margin-bottom: 20px; }
    .prompt-list { grid-template-columns: 1fr; }
    .prompt-list button { min-height: 56px; display: flex; align-items: center; gap: 11px; }
    .message-body, .sources { max-width: 94%; width: auto; }
    .message.assistant .message-body, .message.assistant .sources, .message-feedback, .thinking-panel { width: 100%; max-width: 100%; }
    .composer { grid-template-columns: minmax(0, 1fr) 72px; padding: 6px; }
    .chat-options { justify-content: space-between; gap: 8px; padding: 1px 2px 6px; }
    .chat-options label { flex: 1; display: grid; gap: 3px; }
    .chat-options select { width: 100%; min-width: 0; max-width: none; overflow: hidden; text-overflow: ellipsis; }
    .composer .primary span { display: none; }
    .document-stats div { min-height: 66px; padding: 11px; }
    .documents-heading h2 { display: none; }
    .documents-heading p { font-size: 11px; }
    .documents-heading-actions { gap: 5px; }
    .documents-heading-actions button { min-height: 34px; padding: 5px 8px; }
    .folder-tree-mobile-toggle { display: grid; grid-template-columns: 18px auto minmax(0, 1fr); align-items: center; gap: 8px; width: 100%; margin-bottom: 10px; text-align: left; }
    .folder-tree-mobile-toggle strong { font-size: 11px; }
    .folder-tree-mobile-toggle small { overflow: hidden; color: #646a77; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
    .folder-tree-mobile-icon { color: var(--accent); font-size: 17px; transition: transform .16s ease; }
    .folder-tree-mobile-toggle[aria-expanded="true"] .folder-tree-mobile-icon { transform: rotate(90deg); }
    .document-library-layout { display: block; }
    .folder-tree-panel { display: none; position: static; max-height: min(52dvh, 420px); margin-bottom: 12px; }
    .folder-tree-panel.open { display: block; }
    .folder-tree-row { padding-left: calc(var(--tree-depth) * 16px); }
    .folder-tree-open, .folder-tree-expand { min-height: 42px; }
    .folder-tree-actions { opacity: 1; }
    .folder-tree-actions button { width: 29px; height: 42px; }
    .folder-breadcrumb { margin: -2px 0 8px; }
    .document-filters { grid-template-columns: minmax(0, 1fr) 132px; padding: 9px; }
    .document-filter-count { grid-column: 1 / -1; min-width: 0; text-align: left; }
    .upload-drop { grid-template-columns: 42px minmax(0, 1fr); min-height: 98px; padding: 14px; }
    .upload-symbol { width: 42px; height: 42px; }
    .upload-copy span { line-height: 1.45; }
    .upload-drop .quiet { grid-column: 1 / -1; width: 100%; }
    .upload-settings { grid-template-columns: 1fr 1fr; padding: 12px; }
    .upload-button { grid-column: 1 / -1; }
    .folder-scope-fields { grid-template-columns: 1fr; }
    .confirm-dialog { width: calc(100vw - 24px); }
    .confirm-dialog-body { grid-template-columns: 38px minmax(0, 1fr); gap: 12px; padding: 20px 18px 18px; }
    .confirm-dialog-icon { width: 38px; height: 38px; font-size: 17px; }
    .confirm-dialog-actions { padding: 12px; }
    .confirm-dialog-actions button { flex: 1; }
    .admin-grid { grid-template-columns: 1fr; }
    .admin-tabs { margin: 0 -12px 14px; padding: 4px 12px; border-radius: 0; }
    .admin-tab { padding: 7px 13px; }
    .ai-settings-form { grid-template-columns: 1fr; gap: 18px; }
    .ai-settings-form fieldset { padding: 0 0 18px; border-right: 0; border-bottom: 1px solid var(--line); }
    .ai-settings-form fieldset:nth-child(2) { padding: 0 0 18px; border-bottom: 1px solid var(--line); }
    .ai-settings-form fieldset:nth-child(3) { grid-column: auto; padding: 0; border-top: 0; border-bottom: 0; }
    .model-field { grid-column: 1 / -1; }
    .ai-settings-save { width: 100%; margin-top: 0; }
    #userForm { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    #userForm label:nth-child(3), #userForm .primary { grid-column: 1 / -1; }
    .prompt-setting-row { grid-template-columns: 80px minmax(0, 1fr) 36px; gap: 8px; }
    .prompt-remove { width: 36px; }
    .prompt-settings-actions button { flex: 1; min-width: 0; }
    .admin-section.table-section { padding: 0; border: 0; background: transparent; }
    .table-wrap { overflow: visible; border: 0; background: transparent; }
    .table-wrap thead { display: none; }
    .table-wrap tbody { display: grid; gap: 10px; }
    .table-wrap tbody tr { display: grid; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
    .table-wrap td { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 10px 12px; white-space: normal; text-align: right; }
    .table-wrap td::before { content: attr(data-label); flex: 0 0 auto; color: #656b78; font-size: 11px; font-weight: 700; }
    .table-wrap td:empty { display: none; }
    .table-wrap td > strong { max-width: 72%; overflow-wrap: anywhere; }
    .table-wrap .document-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; width: 100%; min-height: 130px; text-align: center; }
    .table-wrap .document-empty strong { max-width: 100%; margin-bottom: 0; }
    .table-wrap .document-empty::before { display: none; }
    .table-actions { justify-content: flex-end; }
    .document-actions .row-action { min-height: 44px; padding: 8px 12px; }
}

@media (max-width: 480px) {
    .welcome-band { display: grid; }
    .home-ask { width: 100%; }
    .nav-tab { display: grid; justify-items: center; align-content: center; gap: 1px; }
    .nav-tab span { height: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
