:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #6f7974;
  --faint: #9ca5a1;
  --line: #e6ebe8;
  --panel: #f7f9f7;
  --green: #176b52;
  --green-2: #24916d;
  --mint: #e9f5ef;
  --cream: #fbfcfa;
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-height: 100%; margin: 0; }
body { color: var(--ink); background: var(--cream); -webkit-font-smoothing: antialiased; }
button, textarea { font: inherit; }
button { color: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 294px minmax(0, 1fr); }
.sidebar { position: relative; z-index: 2; display: flex; min-height: 100vh; flex-direction: column; padding: 26px 18px 18px; border-right: 1px solid var(--line); background: rgba(250, 251, 249, .96); }
.brand-row { display: flex; align-items: center; gap: 12px; padding: 0 8px 25px; }
.brand-row strong { display: block; font-size: 16px; letter-spacing: .04em; }
.brand-row small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.brand-mark { position: relative; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 13px; background: linear-gradient(145deg, #166a51, #2b9a74); box-shadow: 0 8px 22px rgba(23, 107, 82, .2); }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; width: 14px; height: 20px; top: 8px; background: #fff; }
.brand-mark::before { left: 7px; border-radius: 10px 2px 10px 3px; transform: rotate(-17deg); }
.brand-mark::after { right: 7px; border-radius: 2px 10px 3px 10px; transform: rotate(17deg); }
.brand-mark span { position: absolute; z-index: 1; width: 4px; height: 17px; left: 17px; top: 10px; border-radius: 9px; background: var(--green); }
.icon-button, .section-label button { border: 0; background: transparent; cursor: pointer; }
.collapse-button { margin-left: auto; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font-size: 22px; line-height: 1; }

.primary-nav { display: grid; gap: 7px; }
.nav-button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 11px 13px; border: 0; border-radius: 12px; background: transparent; color: #4d5953; text-align: left; cursor: pointer; transition: .18s ease; }
.nav-button:hover { background: #f0f4f1; }
.nav-button.is-active { color: #fff; background: var(--green); box-shadow: 0 9px 18px rgba(23, 107, 82, .16); }
.nav-icon { width: 22px; text-align: center; font-size: 20px; }

.history { min-height: 0; flex: 1; margin-top: 27px; border-top: 1px solid var(--line); padding-top: 20px; }
.section-label { display: flex; align-items: center; justify-content: space-between; padding: 0 9px 10px; color: var(--faint); font-size: 12px; }
.section-label button { color: var(--faint); font-size: 18px; }
.history-item { width: 100%; padding: 11px 12px; border: 0; border-radius: 11px; background: transparent; text-align: left; cursor: pointer; }
.history-item:hover, .history-item.is-current { background: #eef3f0; }
.history-item span { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.history-item small { display: block; margin-top: 5px; color: var(--faint); font-size: 10px; }
.sidebar-footer { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.admin-entry { display: flex; align-items: center; gap: 9px; width: 100%; padding: 10px 11px; border: 0; border-radius: 11px; background: transparent; cursor: pointer; font-size: 12px; }
.admin-entry:hover { background: #eef3f0; }
.admin-entry em { margin-left: auto; padding: 3px 7px; border-radius: 999px; color: var(--green); background: var(--mint); font-size: 9px; font-style: normal; }
.profile-button { display: flex; align-items: center; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; text-align: left; }
.avatar { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border-radius: 50%; color: #fff; background: linear-gradient(145deg, #d2a46d, #8b5d37); font-size: 13px; }
.avatar-small { width: 29px; height: 29px; flex-basis: 29px; font-size: 11px; }
.profile-copy { min-width: 0; margin-left: 9px; }
.profile-copy strong, .profile-copy small { display: block; }
.profile-copy strong { font-size: 12px; }
.profile-copy small { margin-top: 3px; color: var(--faint); font-size: 10px; }
.profile-more { margin-left: auto; color: var(--faint); letter-spacing: 2px; }

.workspace { position: relative; min-width: 0; min-height: 100vh; overflow: hidden; background: radial-gradient(circle at 70% 12%, rgba(220, 241, 230, .44), transparent 28%), #fbfcfa; }
.workspace::before { content: ""; position: absolute; width: 500px; height: 500px; right: -210px; bottom: -260px; border-radius: 50%; border: 76px solid rgba(28, 113, 84, .025); }
.topbar { position: sticky; top: 0; z-index: 12; display: flex; min-height: 76px; align-items: center; justify-content: space-between; padding: 0 32px; background: linear-gradient(180deg, rgba(251,252,250,.96), rgba(251,252,250,.72) 76%, transparent); backdrop-filter: blur(10px); }
.status-pill { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: #36a275; box-shadow: 0 0 0 4px #e1f3e9; }
.status-pill b { padding-left: 8px; border-left: 1px solid var(--line); color: var(--faint); font-weight: 500; }
.account-button { display: inline-flex; align-items: center; gap: 8px; padding: 5px 8px 5px 5px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, .76); cursor: pointer; font-size: 11px; }
.mobile-menu { display: none; border: 0; background: transparent; font-size: 20px; }

.welcome { position: relative; z-index: 1; width: min(850px, calc(100% - 64px)); margin: clamp(40px, 8vh, 108px) auto 96px; text-align: center; }
.knowledge-emblem { position: relative; width: 78px; height: 67px; margin: 0 auto 18px; }
.book { position: absolute; top: 9px; width: 35px; height: 43px; border: 2px solid var(--green); background: linear-gradient(145deg, #fff, #e3f2ea); }
.book-left { left: 7px; border-radius: 11px 2px 9px 4px; transform: rotate(-9deg); }
.book-right { right: 7px; border-radius: 2px 11px 4px 9px; transform: rotate(9deg); }
.knowledge-emblem i { position: absolute; z-index: 2; width: 12px; height: 12px; left: 34px; bottom: 0; border-radius: 50%; background: #d9a858; box-shadow: 0 0 0 7px #f9f2e7; }
.eyebrow { margin: 0 0 13px; color: var(--green); font-size: 10px; font-weight: 700; letter-spacing: .18em; }
.welcome h1 { margin: 0; font-family: "Songti SC", "STSong", serif; font-size: clamp(34px, 4vw, 50px); font-weight: 700; letter-spacing: -.02em; }
.welcome-copy { margin: 17px 0 0; color: var(--muted); font-size: 14px; }
.suggestions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 34px 0 17px; }
.suggestions button { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, .76); cursor: pointer; text-align: left; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.suggestions button:hover { transform: translateY(-2px); border-color: #b9d4c9; box-shadow: 0 10px 26px rgba(35, 67, 54, .07); }
.suggestions b { font-size: 11px; font-weight: 600; line-height: 1.45; }
.suggestions i { color: var(--green); font-style: normal; }
.chip-icon { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; color: var(--green); background: var(--mint); font-size: 9px; font-weight: 700; }

.composer { position: relative; overflow: hidden; border: 1px solid #dce4df; border-radius: 22px; background: rgba(255, 255, 255, .9); box-shadow: 0 18px 55px rgba(42, 67, 56, .09), 0 2px 5px rgba(42, 67, 56, .04); text-align: left; }
.composer:focus-within { border-color: #8db9a8; box-shadow: 0 18px 55px rgba(42, 67, 56, .11), 0 0 0 3px rgba(36, 145, 109, .08); }
.composer label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.composer textarea { display: block; width: 100%; min-height: 104px; resize: none; border: 0; outline: 0; padding: 24px 25px 12px; color: var(--ink); background: transparent; font-size: 15px; line-height: 1.65; }
.composer textarea::placeholder { color: #afb7b3; }
.composer-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 12px 17px; }
.composer-tools { display: flex; align-items: center; gap: 8px; }
.composer-tools > button { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font-size: 20px; line-height: 1; }
.mode-pill, .scope-pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 999px; font-size: 10px; }
.mode-pill { color: var(--green); background: var(--mint); }
.mode-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--green-2); }
.scope-pill { color: var(--muted); background: #f5f7f5; }
.send-button { width: 42px; height: 42px; border: 0; border-radius: 50%; color: #fff; background: var(--green); box-shadow: 0 8px 18px rgba(23, 107, 82, .22); cursor: pointer; font-size: 21px; }
.send-button:hover { background: #115a44; }
.trust-row { display: flex; justify-content: center; gap: 24px; margin-top: 16px; color: var(--faint); font-size: 10px; }
.trust-row i { color: var(--green-2); font-style: normal; }
.legal-note { position: absolute; z-index: 1; left: 0; right: 0; bottom: 20px; color: #adb5b1; text-align: center; font-size: 9px; }

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 232px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .suggestions { grid-template-columns: 1fr; }
  .suggestions button:nth-child(n+3) { display: none; }
  .welcome { margin-top: 30px; }
}

@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .topbar { min-height: 64px; padding: 0 17px; }
  .mobile-menu { display: block; }
  .status-pill b, .account-button > span:not(.avatar) { display: none; }
  .welcome { width: calc(100% - 28px); margin: 36px auto 80px; }
  .welcome h1 { font-size: 34px; }
  .welcome-copy { padding: 0 20px; font-size: 13px; line-height: 1.7; }
  .suggestions { margin-top: 25px; }
  .suggestions button:nth-child(n+2) { display: none; }
  .trust-row { flex-wrap: wrap; gap: 7px 16px; }
  .scope-pill { display: none; }
  .legal-note { position: relative; bottom: auto; margin: -42px 20px 18px; }
}

/* Authentication */
.is-hidden { display: none !important; }
.auth-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(480px, 1.08fr) minmax(460px, .92fr); background: #f8faf8; }
.auth-visual { position: relative; display: flex; min-height: 100vh; flex-direction: column; overflow: hidden; padding: 38px clamp(42px, 6vw, 92px) 34px; color: #f7fbf8; background: linear-gradient(145deg, #143f34 0%, #1b604a 52%, #27785c 100%); }
.auth-visual::before { content: ""; position: absolute; width: 620px; height: 620px; right: -350px; top: -260px; border: 92px solid rgba(255,255,255,.045); border-radius: 50%; }
.auth-visual::after { content: ""; position: absolute; width: 380px; height: 380px; left: -230px; bottom: -150px; border: 64px solid rgba(255,255,255,.035); border-radius: 50%; }
.auth-brand { position: relative; z-index: 1; display: inline-flex; width: fit-content; align-items: center; gap: 13px; color: inherit; text-decoration: none; }
.auth-brand .brand-mark { background: rgba(255,255,255,.96); box-shadow: 0 10px 25px rgba(5,31,23,.24); }
.auth-brand .brand-mark::before, .auth-brand .brand-mark::after { background: var(--green); }
.auth-brand .brand-mark span { background: #fff; }
.auth-brand strong, .auth-brand small { display: block; }
.auth-brand strong { font-size: 17px; letter-spacing: .08em; }
.auth-brand small { margin-top: 3px; color: rgba(255,255,255,.62); font-size: 10px; letter-spacing: .12em; }
.auth-story { position: relative; z-index: 1; width: min(570px, 100%); margin: auto 0; padding: 55px 0; }
.auth-story .eyebrow { color: #a7dbc6; }
.auth-story h1 { margin: 0; font-family: "Songti SC", "STSong", serif; font-size: clamp(40px, 3.6vw, 54px); font-weight: 600; line-height: 1.15; letter-spacing: -.055em; }
.auth-story > p:not(.eyebrow) { width: min(490px, 100%); margin: 26px 0 0; color: rgba(244,250,247,.68); font-size: 15px; line-height: 1.9; }
.auth-preview-card { width: min(500px, 100%); margin-top: 46px; padding: 20px 22px; border: 1px solid rgba(255,255,255,.16); border-radius: 18px; background: rgba(255,255,255,.09); box-shadow: 0 30px 60px rgba(5,31,23,.16); backdrop-filter: blur(16px); }
.preview-top { display: flex; align-items: center; gap: 10px; }
.preview-top b { font-size: 12px; }
.preview-top em { margin-left: auto; padding: 4px 8px; border-radius: 999px; color: #c5f2dd; background: rgba(106,217,168,.13); font-size: 10px; font-style: normal; }
.mini-emblem { position: relative; width: 24px; height: 24px; border-radius: 8px; background: #ecf8f2; }
.mini-emblem::before, .mini-emblem::after { content: ""; position: absolute; width: 6px; height: 12px; top: 6px; border: 1.5px solid var(--green); }
.mini-emblem::before { left: 5px; transform: rotate(-8deg); }
.mini-emblem::after { right: 5px; transform: rotate(8deg); }
.auth-preview-card > p { margin: 17px 0; color: rgba(255,255,255,.82); font-family: "Songti SC", serif; font-size: 14px; line-height: 1.75; }
.preview-source { display: flex; align-items: center; gap: 10px; border-top: 1px solid rgba(255,255,255,.12); padding-top: 14px; }
.preview-source > span { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 8px; color: #174f3c; background: #d9efe5; font-size: 9px; font-weight: 800; }
.preview-source b, .preview-source small { display: block; }
.preview-source b { font-size: 10px; }
.preview-source small { margin-top: 3px; color: rgba(255,255,255,.5); font-size: 9px; }
.auth-trust { position: relative; z-index: 1; display: flex; align-items: center; gap: 13px; color: rgba(255,255,255,.5); font-size: 9px; letter-spacing: .05em; }
.auth-trust i { width: 3px; height: 3px; border-radius: 50%; background: rgba(255,255,255,.35); }
.auth-panel { display: flex; min-height: 100vh; align-items: center; justify-content: center; flex-direction: column; padding: 44px clamp(34px, 6vw, 82px) 28px; background: radial-gradient(circle at 70% 20%, rgba(212,238,225,.36), transparent 36%), #fbfcfa; }
.auth-card { width: min(450px, 100%); }
.auth-heading p { margin: 0 0 9px; color: var(--green); font-size: 10px; font-weight: 700; letter-spacing: .14em; }
.auth-heading h2 { margin: 0; font-family: "Songti SC", serif; font-size: 36px; letter-spacing: -.025em; }
.auth-heading > span { display: block; margin-top: 12px; color: var(--muted); font-size: 12px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 32px 0 24px; padding: 4px; border-radius: 12px; background: #edf1ee; }
.auth-tabs button { height: 38px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; font-size: 12px; }
.auth-tabs button.is-active { color: var(--ink); background: #fff; box-shadow: 0 5px 15px rgba(41,62,53,.08); font-weight: 650; }
.auth-form { display: grid; gap: 16px; }
.auth-form > label:not(.agreement), .field-grid > label { display: grid; gap: 7px; }
.auth-form label > span:first-child { color: #4e5954; font-size: 11px; font-weight: 600; }
.auth-form input, .auth-form select, .upload-fields input, .upload-fields select, .upload-fields textarea { width: 100%; border: 1px solid #dfe5e1; border-radius: 11px; outline: 0; color: var(--ink); background: rgba(255,255,255,.9); }
.auth-form input { height: 47px; padding: 0 13px; font-size: 12px; }
.auth-form input:focus, .upload-fields input:focus, .upload-fields select:focus, .upload-fields textarea:focus { border-color: #77aa96; box-shadow: 0 0 0 3px rgba(35,145,107,.08); }
.password-field { position: relative; display: block; }
.password-field input { padding-right: 60px; }
.password-field button { position: absolute; right: 9px; top: 8px; height: 31px; border: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 10px; }
.auth-options { display: flex; align-items: center; justify-content: space-between; margin-top: -2px; }
.auth-options > button { border: 0; color: var(--green); background: transparent; cursor: pointer; font-size: 10px; }
.remember, .agreement { display: flex !important; align-items: center; gap: 7px !important; color: var(--muted); font-size: 10px; }
.remember input, .agreement input { width: 14px; height: 14px; accent-color: var(--green); }
.auth-submit { display: flex; height: 49px; align-items: center; justify-content: center; gap: 12px; margin-top: 3px; border: 0; border-radius: 12px; color: #fff; background: var(--green); box-shadow: 0 10px 24px rgba(23,107,82,.2); cursor: pointer; font-size: 12px; font-weight: 650; }
.auth-submit:hover { background: #115a44; }
.auth-submit:disabled { cursor: wait; opacity: .65; }
.auth-submit i { font-size: 16px; font-style: normal; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-message { min-height: 16px; margin: -4px 0 0; color: #bb423b; font-size: 10px; text-align: center; }
.form-message.is-success { color: var(--green); }
.security-note { display: flex; gap: 10px; margin-top: 23px; padding: 12px 14px; border: 1px solid #e5eae7; border-radius: 12px; color: var(--muted); background: rgba(245,248,246,.8); }
.security-note > span { color: var(--green); font-size: 18px; }
.security-note p { margin: 0; font-size: 9px; line-height: 1.65; }
.security-note b { display: block; margin-bottom: 2px; color: #4b5751; }
.auth-footer { margin: auto 0 0; color: #a3aca7; font-size: 9px; }

/* Workspace states */
.pane { display: none; }
.pane.is-active { display: block; }
.workspace { height: 100vh; }
.app-shell.sidebar-collapsed { grid-template-columns: 82px minmax(0, 1fr); }
.app-shell.sidebar-collapsed .sidebar { padding-inline: 12px; }
.app-shell.sidebar-collapsed .brand-copy, .app-shell.sidebar-collapsed .nav-button > span:last-child, .app-shell.sidebar-collapsed .history, .app-shell.sidebar-collapsed .admin-entry, .app-shell.sidebar-collapsed .profile-copy, .app-shell.sidebar-collapsed .profile-more { display: none; }
.app-shell.sidebar-collapsed .brand-row { padding-inline: 9px; }
.app-shell.sidebar-collapsed .collapse-button { position: absolute; right: -12px; top: 32px; margin: 0; z-index: 2; background: #fff; transform: rotate(180deg); }
.app-shell.sidebar-collapsed .nav-button, .app-shell.sidebar-collapsed .profile-button { justify-content: center; }
.profile-menu { position: absolute; left: 18px; right: 18px; bottom: 84px; z-index: 8; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 18px 45px rgba(31,50,42,.16); }
.profile-menu div { padding: 13px; border-bottom: 1px solid var(--line); }
.profile-menu b, .profile-menu span { display: block; }
.profile-menu b { font-size: 11px; }
.profile-menu span { overflow: hidden; margin-top: 4px; color: var(--faint); font-size: 9px; text-overflow: ellipsis; }
.profile-menu button { width: 100%; padding: 11px 13px; border: 0; color: #a23c38; background: #fff; cursor: pointer; text-align: left; font-size: 10px; }
.empty-history { padding: 16px 9px; color: var(--faint); font-size: 10px; line-height: 1.6; }

/* Chat */
.chat-pane.is-active { display: flex; height: calc(100vh - 76px); flex-direction: column; }
.chat-scroll { width: min(920px, calc(100% - 48px)); flex: 1; margin: 0 auto; overflow-y: auto; padding: 28px 8px 180px; scrollbar-width: thin; scrollbar-color: #ccd7d1 transparent; }
.message { display: flex; gap: 14px; margin: 0 0 28px; }
.message.user { justify-content: flex-end; }
.message-avatar { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border-radius: 11px; color: #fff; background: var(--green); font-size: 10px; font-weight: 700; }
.message.user .message-avatar { order: 2; border-radius: 50%; background: #8b684b; }
.message-body { max-width: min(720px, calc(100% - 50px)); }
.message-label { margin-bottom: 7px; color: var(--faint); font-size: 9px; }
.message.user .message-label { text-align: right; }
.message-content { padding: 15px 17px; border: 1px solid var(--line); border-radius: 5px 17px 17px 17px; color: #334039; background: #fff; font-size: 13px; line-height: 1.8; white-space: pre-wrap; }
.message.user .message-content { border: 0; border-radius: 17px 5px 17px 17px; color: #fff; background: var(--green); }
.message.is-loading .message-content { min-width: 92px; color: var(--faint); }
.thinking-dots { display: inline-flex; gap: 4px; }
.thinking-dots i { width: 5px; height: 5px; border-radius: 50%; background: #8ca39a; animation: kb-pulse 1s ease-in-out infinite; }
.thinking-dots i:nth-child(2) { animation-delay: .15s; }
.thinking-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes kb-pulse { 0%, 70%, 100% { opacity: .3; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }
.citation-list { display: grid; gap: 7px; margin-top: 10px; }
.citation-card { display: grid; grid-template-columns: 27px 1fr auto; gap: 9px; align-items: center; width: 100%; padding: 9px 11px; border: 1px solid #dfe8e3; border-radius: 11px; color: #4b5751; background: #f8fbf9; cursor: pointer; text-align: left; }
.citation-card > span { display: grid; width: 27px; height: 27px; place-items: center; border-radius: 8px; color: var(--green); background: var(--mint); font-size: 9px; font-weight: 700; }
.citation-card b, .citation-card small { display: block; }
.citation-card b { font-size: 10px; }
.citation-card small { overflow: hidden; margin-top: 3px; color: var(--faint); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.citation-card > i { color: var(--green); font-style: normal; }
.chat-composer { position: absolute; z-index: 5; left: 50%; bottom: 34px; width: min(850px, calc(100% - 64px)); transform: translateX(-50%); }
.chat-composer textarea { min-height: 72px; padding-top: 17px; }

/* Search and document library */
.library-pane, .admin-pane { height: calc(100vh - 76px); overflow-y: auto; padding: 22px clamp(28px, 4vw, 62px) 70px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-heading p, .modal-heading p { margin: 0 0 8px; color: var(--green); font-size: 9px; font-weight: 750; letter-spacing: .18em; }
.page-heading h2, .modal-heading h2 { margin: 0; font-family: "Songti SC", serif; font-size: 30px; }
.page-heading > div > span { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; }
.primary-action, .secondary-action { height: 38px; padding: 0 16px; border-radius: 10px; cursor: pointer; font-size: 10px; }
.primary-action { border: 0; color: #fff; background: var(--green); box-shadow: 0 7px 16px rgba(23,107,82,.16); }
.secondary-action { border: 1px solid var(--line); color: var(--muted); background: #fff; }
.search-bar { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; max-width: 980px; padding: 8px 8px 8px 17px; border: 1px solid #dfe6e2; border-radius: 15px; background: #fff; box-shadow: 0 9px 30px rgba(42,67,56,.05); }
.search-bar > span { color: var(--green); font-size: 20px; }
.search-bar input, .search-bar select { height: 38px; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 12px; }
.search-bar select { min-width: 110px; border-left: 1px solid var(--line); padding-left: 12px; color: var(--muted); }
.search-bar button { height: 38px; padding: 0 20px; border: 0; border-radius: 10px; color: #fff; background: var(--green); cursor: pointer; font-size: 10px; }
.result-summary { margin: 18px 0 12px; color: var(--muted); font-size: 10px; }
.search-results { display: grid; gap: 10px; max-width: 980px; }
.search-result { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: start; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.82); cursor: pointer; text-align: left; transition: .18s ease; }
.search-result:hover { border-color: #afd0c1; transform: translateY(-1px); box-shadow: 0 12px 28px rgba(42,67,56,.06); }
.result-rank { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; color: var(--green); background: var(--mint); font-size: 11px; font-weight: 800; }
.search-result h3 { margin: 0; font-size: 13px; }
.search-result p { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.7; }
.result-meta { display: flex; gap: 8px; margin-top: 9px; color: var(--faint); font-size: 8px; }
.result-score { padding: 4px 7px; border-radius: 999px; color: var(--green); background: #eef7f2; font-size: 8px; white-space: nowrap; }
.library-empty { display: grid; min-height: 300px; place-items: center; align-content: center; text-align: center; }
.library-empty > span { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 16px; color: var(--green); background: var(--mint); font-size: 24px; }
.library-empty h3 { margin: 15px 0 0; font-size: 14px; }
.library-empty p { max-width: 400px; margin: 7px 0 0; color: var(--faint); font-size: 10px; line-height: 1.6; }
.document-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.filter-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.filter-pills button { height: 30px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #fff; cursor: pointer; font-size: 9px; }
.filter-pills button.is-active { border-color: var(--green); color: #fff; background: var(--green); }
.inline-search { display: flex; min-width: 210px; align-items: center; gap: 7px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.inline-search input { width: 100%; height: 34px; border: 0; outline: 0; font-size: 10px; }
.document-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.document-card { position: relative; min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: #fff; cursor: pointer; transition: .18s ease; }
.document-card:hover { border-color: #acd0bf; transform: translateY(-2px); box-shadow: 0 14px 28px rgba(42,67,56,.07); }
.document-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.file-badge { display: grid; width: 37px; height: 42px; place-items: center; border-radius: 9px 9px 12px 9px; color: var(--green); background: #e9f4ee; font-size: 8px; font-weight: 800; text-transform: uppercase; }
.document-card-head > span:last-child { padding: 4px 7px; border-radius: 999px; color: var(--green); background: #f0f7f3; font-size: 8px; }
.document-card h3 { overflow: hidden; height: 38px; margin: 14px 0 8px; font-size: 12px; line-height: 1.55; }
.document-card > p { display: -webkit-box; overflow: hidden; min-height: 45px; margin: 0; color: var(--muted); font-size: 9px; line-height: 1.7; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.tag-row { display: flex; overflow: hidden; gap: 5px; margin-top: 13px; white-space: nowrap; }
.tag-row span { padding: 3px 6px; border-radius: 6px; color: #718078; background: #f3f6f4; font-size: 7px; }
.document-meta { display: flex; justify-content: space-between; margin-top: 14px; padding-top: 11px; border-top: 1px solid #edf0ee; color: var(--faint); font-size: 8px; }
.load-more { display: block; margin: 22px auto 0; padding: 9px 20px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: #fff; cursor: pointer; font-size: 9px; }

/* Admin */
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.metric-grid article { padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.metric-grid span, .metric-grid small { display: block; color: var(--faint); font-size: 9px; }
.metric-grid b { display: block; margin: 10px 0 5px; font-family: Georgia, serif; font-size: 27px; font-weight: 500; }
.admin-grid { display: grid; grid-template-columns: 1.18fr .82fr; gap: 14px; }
.admin-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.card-heading { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.card-heading h3 { margin: 0; font-size: 12px; }
.card-heading span { display: block; margin-top: 4px; color: var(--faint); font-size: 8px; }
.card-heading > button { border: 0; color: var(--green); background: transparent; cursor: pointer; font-size: 9px; }
.admin-list { max-height: 480px; overflow-y: auto; }
.admin-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px 17px; border-bottom: 1px solid #edf0ee; }
.admin-row:last-child { border-bottom: 0; }
.admin-row-main { min-width: 0; }
.admin-row-main b { display: block; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.admin-row-main span { display: block; overflow: hidden; margin-top: 4px; color: var(--faint); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; gap: 5px; }
.row-actions button, .row-actions select { height: 27px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: #fff; cursor: pointer; font-size: 8px; }
.row-actions button { padding: 0 8px; }
.row-actions button.danger { color: #b3423c; }
.readonly-badge { display: inline-flex; height: 27px; align-items: center; padding: 0 9px; border-radius: 8px; color: var(--green); background: #eef6f2; font-size: 8px; }

/* Drawer and modal */
.drawer-backdrop, .modal-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(21,34,28,.36); backdrop-filter: blur(3px); }
.document-drawer { position: fixed; top: 0; right: 0; z-index: 31; width: min(520px, 100%); height: 100vh; overflow-y: auto; padding: 38px 34px; border-left: 1px solid var(--line); background: #fff; box-shadow: -25px 0 60px rgba(22,39,31,.12); }
.drawer-close { position: absolute; top: 16px; right: 18px; width: 31px; height: 31px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: #fff; cursor: pointer; }
.drawer-kicker { color: var(--green); font-size: 9px; font-weight: 700; letter-spacing: .14em; }
.document-drawer h2 { margin: 12px 35px 0 0; font-family: "Songti SC", serif; font-size: 25px; line-height: 1.35; }
.drawer-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 22px; color: var(--faint); font-size: 8px; }
.drawer-summary { padding: 17px; border-radius: 13px; background: #f4f8f5; color: #45534c; font-size: 11px; line-height: 1.85; }
.sample-block { margin-top: 20px; }
.sample-block h3 { margin: 0 0 10px; font-size: 11px; }
.sample-block p { margin: 0 0 8px; padding: 12px 14px; border-left: 2px solid #8db9a8; color: var(--muted); background: #fafcfb; font-size: 9px; line-height: 1.75; }
.drawer-actions { display: flex; gap: 8px; margin-top: 20px; }
.drawer-actions a, .drawer-actions button { display: inline-flex; height: 36px; align-items: center; padding: 0 13px; border-radius: 9px; text-decoration: none; font-size: 9px; }
.drawer-actions a { color: #fff; background: var(--green); }
.drawer-actions button { border: 1px solid var(--line); color: var(--muted); background: #fff; cursor: pointer; }
.modal-backdrop { display: grid; place-items: center; padding: 22px; }
.upload-dialog { width: min(650px, 100%); max-height: calc(100vh - 44px); overflow-y: auto; padding: 24px; border-radius: 19px; background: #fff; box-shadow: 0 30px 80px rgba(19,37,29,.22); }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.modal-heading h2 { font-size: 25px; }
.modal-heading > button { width: 31px; height: 31px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: #fff; cursor: pointer; }
.drop-zone { display: grid; min-height: 138px; place-items: center; align-content: center; border: 1.5px dashed #aac8bb; border-radius: 14px; background: #f6faf8; cursor: pointer; text-align: center; }
.drop-zone.is-dragging { border-color: var(--green); background: var(--mint); }
.drop-zone > span { display: grid; width: 36px; height: 36px; place-items: center; margin-bottom: 9px; border-radius: 11px; color: #fff; background: var(--green); font-size: 18px; }
.drop-zone b { font-size: 11px; }
.drop-zone small { margin-top: 6px; color: var(--faint); font-size: 8px; }
.upload-fields { display: grid; grid-template-columns: 1.25fr .75fr; gap: 13px; margin-top: 18px; }
.upload-fields label { display: grid; gap: 6px; }
.upload-fields label > span { color: #59645f; font-size: 9px; font-weight: 650; }
.upload-fields input, .upload-fields select { height: 40px; padding: 0 11px; font-size: 10px; }
.upload-fields textarea { resize: vertical; padding: 10px 11px; font-size: 10px; line-height: 1.6; }
.wide-field { grid-column: 1 / -1; }
.upload-progress { display: flex; align-items: center; gap: 9px; margin-top: 14px; padding: 10px 12px; border-radius: 10px; color: var(--green); background: var(--mint); font-size: 9px; }
.upload-progress i { width: 13px; height: 13px; border: 2px solid #9bc9b6; border-top-color: var(--green); border-radius: 50%; animation: kb-spin .8s linear infinite; }
@keyframes kb-spin { to { transform: rotate(360deg); } }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 50; display: grid; gap: 8px; }
.toast { min-width: 220px; max-width: 360px; padding: 12px 14px; border: 1px solid #dbe6e0; border-radius: 11px; color: #3d4b44; background: #fff; box-shadow: 0 15px 35px rgba(28,46,37,.16); font-size: 10px; animation: toast-in .2s ease-out; }
.toast.is-error { border-color: #f0d0cd; color: #9b3834; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1100px) {
  .auth-screen { grid-template-columns: 1fr 1fr; }
  .auth-visual { padding-inline: 42px; }
  .auth-story h1 { font-size: 44px; }
  .document-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .auth-screen { display: block; background: #fbfcfa; }
  .auth-visual { min-height: 280px; padding: 28px 24px 36px; }
  .auth-story { padding: 48px 0 0; }
  .auth-story h1 { font-size: 37px; }
  .auth-story > p:not(.eyebrow), .auth-preview-card, .auth-trust { display: none; }
  .auth-panel { min-height: auto; padding: 36px 24px 28px; }
  .auth-footer { margin-top: 30px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .sidebar.is-mobile-open { position: fixed; inset: 0 auto 0 0; z-index: 25; display: flex; width: min(290px, 86vw); box-shadow: 25px 0 55px rgba(27,45,36,.18); }
  .library-pane, .admin-pane { padding: 16px 16px 70px; }
  .page-heading { align-items: flex-start; }
  .page-heading h2 { font-size: 25px; }
  .document-toolbar { align-items: stretch; flex-direction: column; }
  .inline-search { min-width: 0; }
  .document-grid { grid-template-columns: 1fr; }
  .search-bar { grid-template-columns: auto 1fr auto; }
  .search-bar select { display: none; }
  .search-result { grid-template-columns: 38px 1fr; }
  .result-score { display: none; }
  .chat-scroll { width: calc(100% - 16px); padding-inline: 0; }
  .chat-composer { width: calc(100% - 22px); bottom: 14px; }
  .message-body { max-width: calc(100% - 43px); }
  .upload-fields { grid-template-columns: 1fr; }
  .wide-field { grid-column: auto; }
  .metric-grid { gap: 8px; }
  .auth-heading h2 { font-size: 31px; }
}
