@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=PT+Serif:wght@400;700&display=swap');

:root {
  --ink: #162528;
  --muted: #657477;
  --faint: #657477;
  --line: #dce3df;
  --line-soft: #e9eeeb;
  --paper: #f7f8f5;
  --surface: #ffffff;
  --surface-soft: #f0f4f0;
  --deep: #0e2e31;
  --deep-2: #173d40;
  --teal: #167b75;
  --teal-soft: #dff1ed;
  --mint: #62b9a9;
  --amber: #bd7a22;
  --amber-soft: #fbecd3;
  --rose: #b15d63;
  --rose-soft: #f8e3e2;
  --blue: #537a9f;
  --shadow: 0 18px 55px rgba(17, 45, 47, .10);
  --font-caption: .8125rem;
  --font-small: .9375rem;
  --font-ui: 1rem;
  --font-body: 1.125rem;
  font-family: "Manrope", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { min-height: 100vh; background: var(--paper); font-size: var(--font-body); line-height: 1.5; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 8px; color: var(--teal); font-size: var(--font-caption); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }

.login-page { min-height: 100vh; display: grid; place-items: center; overflow: hidden; position: relative; padding: 32px; background: #e9f0ec; }
.login-page::before { content: ""; position: absolute; inset: 0; opacity: .35; background-image: linear-gradient(rgba(18, 74, 71, .07) 1px, transparent 1px), linear-gradient(90deg, rgba(18, 74, 71, .07) 1px, transparent 1px); background-size: 40px 40px; mask-image: radial-gradient(circle at center, black, transparent 72%); }
.login-ambient { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .85; }
.ambient-one { width: 420px; height: 420px; background: rgba(95, 183, 166, .24); top: -160px; right: 8%; }
.ambient-two { width: 340px; height: 340px; background: rgba(246, 203, 133, .22); bottom: -140px; left: 12%; }
.login-card { position: relative; width: min(440px, 100%); padding: 42px 44px 34px; border: 1px solid rgba(255,255,255,.8); border-radius: 26px; background: rgba(255,255,255,.88); box-shadow: 0 28px 90px rgba(17, 52, 51, .16); backdrop-filter: blur(18px); }
.login-card h1 { font: 700 46px/1 "PT Serif", Georgia, serif; letter-spacing: -.03em; margin: 12px 0 14px; color: var(--deep); }
.login-lead { color: var(--muted); line-height: 1.55; margin: 0 0 30px; }
.brand-mark { display: flex; align-items: end; gap: 3px; width: 38px; height: 38px; padding: 8px; border-radius: 12px; background: var(--deep); }
.brand-mark span { width: 5px; border-radius: 4px; background: #dff4ee; }
.brand-mark span:nth-child(1) { height: 9px; }
.brand-mark span:nth-child(2) { height: 20px; background: #70c4b2; }
.brand-mark span:nth-child(3) { height: 14px; }
.brand-mark.small { width: 30px; height: 30px; border-radius: 9px; padding: 6px; }
.brand-mark.small span { width: 4px; }
.brand-mark.small span:nth-child(2) { height: 16px; }
.field-label { display: block; margin: 20px 0 8px; color: #536366; font-size: var(--font-ui); font-weight: 700; }
.identity-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.identity { display: flex; align-items: center; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 13px; background: white; color: var(--ink); text-align: left; }
.identity:hover { border-color: #9ebeb8; }
.identity.active { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(22,123,117,.12); background: #f7fcfa; }
.identity strong, .identity small { display: block; }
.identity strong { font-size: var(--font-ui); }
.identity small { font-size: var(--font-caption); color: var(--muted); margin-top: 2px; }
.avatar { display: grid; flex: 0 0 auto; place-items: center; width: 36px; height: 36px; border-radius: 11px; color: #fff; font-size: var(--font-caption); font-weight: 700; letter-spacing: .02em; }
.avatar-anton { background: linear-gradient(145deg, #287c75, #133f43); }
.avatar-vlad { background: linear-gradient(145deg, #7795ad, #354f6c); }
.password-wrap { position: relative; }
.password-wrap input { width: 100%; height: 48px; padding: 0 48px 0 14px; border: 1px solid var(--line); border-radius: 12px; outline: 0; background: white; }
.password-wrap input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(22,123,117,.10); }
.icon-button { display: grid; place-items: center; border: 0; background: transparent; color: inherit; }
.reveal { position: absolute; right: 7px; top: 7px; width: 34px; height: 34px; color: var(--muted); }
.primary-button { border: 0; border-radius: 12px; background: var(--deep); color: white; font-weight: 700; }
.login-button { width: 100%; height: 50px; margin-top: 20px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; }
.login-button:hover { background: var(--deep-2); }
.form-error { min-height: 18px; margin: 8px 0 -8px; color: #a9444c; font-size: var(--font-caption); }
.login-footnote { display: flex; align-items: center; gap: 8px; justify-content: center; margin: 24px 0 0; color: var(--faint); font-size: var(--font-caption); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: #4ca895; box-shadow: 0 0 0 4px #e3f3ef; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 320px minmax(0, 1fr) 430px; }
.sidebar { height: 100vh; position: sticky; top: 0; display: flex; flex-direction: column; background: var(--deep); color: #d8e7e4; border-right: 1px solid rgba(255,255,255,.05); padding: 18px 14px 14px; overflow: hidden; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px 18px; }
.mini-brand { display: flex; align-items: center; gap: 10px; }
.mini-brand strong { color: white; letter-spacing: -.02em; }
.version { font-size: var(--font-caption); color: #8eb0aa; padding: 2px 5px; border: 1px solid rgba(255,255,255,.12); border-radius: 5px; }
.sidebar-collapse { color: #81a09d; width: 28px; height: 28px; font-size: 21px; }
.patient-card { display: flex; align-items: center; gap: 10px; padding: 11px; margin-bottom: 14px; border: 1px solid rgba(255,255,255,.09); border-radius: 13px; background: rgba(255,255,255,.045); }
.patient-card > div { min-width: 0; flex: 1; }
.patient-card small, .patient-card strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.patient-card small { color: #8eaaa6; font-size: var(--font-caption); text-transform: uppercase; letter-spacing: .09em; margin-bottom: 3px; }
.patient-card strong { color: #eef7f4; font-size: var(--font-ui); }
.chevron { color: #789793; font-size: var(--font-caption); }
.main-nav { display: grid; gap: 3px; }
.nav-item { width: 100%; min-height: 48px; display: grid; grid-template-columns: 30px 1fr auto; align-items: center; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: #a9bfbc; text-align: left; font-size: var(--font-ui); }
.nav-item:hover { color: white; background: rgba(255,255,255,.045); }
.nav-item.active { color: white; background: rgba(111, 194, 177, .15); }
.nav-icon { width: 20px; font-size: 17px; color: #7da49f; }
.nav-item.active .nav-icon { color: #6fc2b1; }
.nav-count { color: #779692; font-size: var(--font-caption); }
.sidebar-section-head { display: flex; justify-content: space-between; align-items: center; margin: 24px 10px 8px; color: #8eaaa6; font-size: var(--font-caption); font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.sidebar-section-head button { color: #87a6a2; font-size: 17px; }
.sidebar-chats { min-height: 0; flex: 1; overflow-y: auto; display: grid; align-content: start; gap: 2px; }
.sidebar-chat { padding: 13px 12px; border: 0; border-radius: 9px; background: transparent; color: #9fb7b3; text-align: left; }
.sidebar-chat:hover, .sidebar-chat.active { background: rgba(255,255,255,.055); color: white; }
.sidebar-chat strong { display: block; font-size: var(--font-small); font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-chat small { display: block; margin-top: 4px; font-size: var(--font-caption); color: #8eaaa6; }
.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.07); }
.api-budget { margin: 0 0 7px; padding: 11px; border: 1px solid rgba(255,255,255,.10); border-radius: 11px; background: rgba(255,255,255,.055); }
.api-budget-head { display: flex; align-items: center; justify-content: space-between; color: #9db7b3; font-size: var(--font-caption); font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.api-budget-head span:last-child { padding: 2px 6px; border-radius: 6px; background: rgba(106,194,177,.12); color: #8fd0c3; letter-spacing: 0; text-transform: none; }
.api-budget-values { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 9px; }
.api-budget-values > div + div { padding-left: 9px; border-left: 1px solid rgba(255,255,255,.08); }
.api-budget-values small, .api-budget-values strong { display: block; }
.api-budget-values small { color: #91aaa6; font-size: var(--font-caption); }
.api-budget-values strong { margin-top: 2px; color: #f1f8f6; font-size: 1.0625rem; letter-spacing: -.01em; }
.api-budget-note { display: block; margin-top: 8px; overflow: hidden; color: #8eaaa6; font-size: var(--font-caption); line-height: 1.4; white-space: nowrap; text-overflow: ellipsis; }
.api-budget.ready { border-color: rgba(101,186,168,.25); }
.api-budget.unavailable .api-budget-values strong { color: #b6c7c4; }
.model-state { display: flex; gap: 9px; align-items: center; padding: 9px 10px 13px; }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: #65baa8; box-shadow: 0 0 0 4px rgba(101,186,168,.10); }
.model-state strong, .model-state small { display: block; }
.model-state strong { color: #cfe0dd; font-size: var(--font-caption); }
.model-state small { color: #8eaaa6; font-size: var(--font-caption); margin-top: 2px; }
.user-row { width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px 9px; border: 0; border-radius: 10px; background: rgba(255,255,255,.04); color: white; text-align: left; }
.user-row > span:nth-child(2) { flex: 1; }
.user-row strong, .user-row small { display: block; }
.user-row strong { font-size: var(--font-small); }
.user-row small { color: #99b3af; font-size: var(--font-caption); margin-top: 2px; }
.logout-button { width: 100%; margin-top: 6px; padding: 9px; border: 1px solid rgba(255,255,255,.08); border-radius: 8px; background: transparent; color: #a8bfbb; font-size: var(--font-small); }

.workspace { min-width: 0; height: 100vh; display: flex; flex-direction: column; background: var(--paper); }
.topbar { height: 76px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0 32px; border-bottom: 1px solid var(--line); background: rgba(247,248,245,.88); backdrop-filter: blur(12px); }
.crumb { min-width: 0; display: flex; gap: 8px; align-items: center; font-size: var(--font-small); color: var(--faint); }
.crumb strong { min-width: 0; overflow: hidden; color: var(--ink); white-space: nowrap; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 8px; }
.secondary-button, .context-button { height: 40px; display: flex; align-items: center; gap: 7px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: white; color: #425457; font-size: var(--font-small); font-weight: 700; }
.secondary-button:hover, .context-button:hover { border-color: #abc2bc; }
.context-button { background: var(--deep); color: white; border-color: var(--deep); }
.context-button b { display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: rgba(255,255,255,.12); font-size: var(--font-caption); }
.context-spark { color: #72c6b5; }
.view { min-height: 0; flex: 1; }
.scroll-area { overflow-y: auto; padding: 34px 40px 58px; }
.page-intro { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-intro h1 { font: 700 32px/1.2 "PT Serif", Georgia, serif; color: var(--deep); margin: 0 0 8px; letter-spacing: -.02em; }
.page-intro p { color: var(--muted); margin: 0; font-size: var(--font-ui); line-height: 1.6; }
.date-pill { flex: 0 0 auto; padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--muted); font-size: var(--font-caption); }
.priority-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin-bottom: 24px; }
.priority-card { position: relative; min-height: 176px; padding: 22px; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.priority-card::after { content: ""; position: absolute; width: 70px; height: 70px; right: -20px; bottom: -24px; border-radius: 50%; background: var(--wash, var(--teal-soft)); }
.priority-card.amber { --wash: var(--amber-soft); }
.priority-card.rose { --wash: var(--rose-soft); }
.card-kicker { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: var(--font-caption); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.mini-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }
.amber .mini-dot { background: var(--amber); }
.rose .mini-dot { background: var(--rose); }
.priority-card h3 { margin: 17px 0 9px; font-size: 1.125rem; }
.priority-card p { margin: 0; color: var(--muted); font-size: var(--font-ui); line-height: 1.6; max-width: 92%; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr); gap: 14px; }
.panel { border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.panel-head { min-height: 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 19px; border-bottom: 1px solid var(--line-soft); }
.panel-head h2 { margin: 0; font-size: var(--font-ui); }
.panel-head small { color: var(--faint); font-size: var(--font-caption); }
.focus-list { padding: 4px 17px 9px; }
.focus-row { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: start; padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.focus-row:last-child { border-bottom: 0; }
.focus-number { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--surface-soft); color: var(--teal); font-size: var(--font-caption); font-weight: 700; }
.focus-row strong { display: block; margin-bottom: 5px; font-size: var(--font-ui); }
.focus-row p { margin: 0; color: var(--muted); font-size: var(--font-ui); line-height: 1.6; }
.tag { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 7px; background: var(--teal-soft); color: #31746d; font-size: var(--font-caption); font-weight: 700; white-space: nowrap; }
.tag.warning { background: var(--amber-soft); color: #95601d; }
.tag.risk { background: var(--rose-soft); color: #9f4f55; }
.document-health { padding: 17px; }
.donut-row { display: flex; gap: 16px; align-items: center; margin-bottom: 17px; }
.donut { --value: 20; width: 74px; height: 74px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: conic-gradient(var(--teal) calc(var(--value) * 1%), #e8eeeb 0); position: relative; }
.donut::before { content: ""; position: absolute; width: 56px; height: 56px; border-radius: 50%; background: white; }
.donut strong { position: relative; font-size: 1.125rem; }
.donut-label strong, .donut-label small { display: block; }
.donut-label strong { font-size: var(--font-ui); margin-bottom: 4px; }
.donut-label small { color: var(--muted); font-size: var(--font-caption); line-height: 1.5; }
.meter-list { display: grid; gap: 10px; }
.meter-row { display: grid; grid-template-columns: 1fr auto; gap: 6px; font-size: var(--font-small); color: var(--muted); }
.meter-track { grid-column: 1 / -1; height: 4px; background: #edf1ef; border-radius: 4px; overflow: hidden; }
.meter-track span { display: block; height: 100%; border-radius: inherit; background: var(--teal); }
.meter-row:nth-child(2) .meter-track span { background: var(--amber); }
.meter-row:nth-child(3) .meter-track span { background: var(--blue); }

.chat-layout { display: flex; flex-direction: column; position: relative; }
.chat-messages { flex: 1; overflow-y: auto; padding: 38px max(36px, calc((100% - 940px)/2)) 198px; }
.chat-date { text-align: center; color: var(--faint); font-size: var(--font-caption); margin: 4px 0 28px; }
.message { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 13px; margin-bottom: 30px; }
.message.user { margin-left: 8%; }
.message.user .message-body { background: #e7f0ed; border-radius: 14px 14px 3px 14px; padding: 15px 17px; }
.message-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--deep); color: white; font-size: var(--font-caption); font-weight: 700; }
.message.user .message-avatar { background: #6f8e91; }
.message-meta { display: flex; align-items: center; gap: 7px; margin-bottom: 9px; font-size: var(--font-caption); color: var(--faint); }
.message-meta strong { color: var(--ink); font-size: var(--font-small); }
.message-body { font-size: var(--font-body); line-height: 1.72; color: #26383a; }
.message-body p { margin: 0 0 12px; }
.message-body p:last-child { margin-bottom: 0; }
.message-body h2, .message-body h3 { margin: 21px 0 9px; color: var(--deep); font-size: 1.125rem; }
.message-body ul, .message-body ol { padding-left: 23px; margin: 8px 0 14px; }
.message-body code { padding: 2px 4px; background: var(--surface-soft); border-radius: 4px; }
.source-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.source-chip { min-height: 30px; display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border: 1px solid var(--line); border-radius: 7px; background: white; color: var(--muted); font-size: var(--font-caption); }
.source-chip:hover { color: var(--teal); border-color: #a7c9c1; }
.composer-wrap { position: absolute; left: 0; right: 0; bottom: 0; padding: 46px max(36px, calc((100% - 940px)/2)) 20px; background: linear-gradient(transparent, var(--paper) 26%); }
.composer { min-height: 66px; display: grid; grid-template-columns: 38px minmax(0,1fr) 40px; align-items: end; gap: 9px; padding: 11px; border: 1px solid #cdd8d4; border-radius: 16px; background: white; box-shadow: 0 14px 36px rgba(26, 55, 55, .10); }
.composer textarea { min-height: 40px; max-height: 180px; resize: none; padding: 8px 3px; border: 0; outline: 0; color: var(--ink); font-size: var(--font-body); line-height: 1.55; }
.composer textarea::placeholder { color: #9aa6a6; }
.attach-button, .send-button { width: 38px; height: 38px; border-radius: 10px; }
.attach-button { border: 1px solid var(--line); background: white; color: var(--muted); font-size: 18px; }
.send-button { border: 0; background: var(--deep); color: white; font-size: 17px; }
.send-button:disabled { opacity: .4; cursor: wait; }
.composer-meta { display: flex; justify-content: space-between; padding: 8px 4px 0; color: var(--faint); font-size: var(--font-caption); }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; background: white; padding: 1px 3px; font-size: var(--font-caption); }
.typing { display: flex; gap: 4px; padding: 6px 0; }
.typing span { width: 5px; height: 5px; border-radius: 50%; background: #8ba5a1; animation: bounce 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }

.context-panel { height: 100vh; position: sticky; top: 0; overflow-y: auto; border-left: 1px solid var(--line); background: var(--surface); }
.context-head { min-height: 88px; display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border-bottom: 1px solid var(--line-soft); }
.context-head h2 { margin: 0; font: 700 24px/1.25 "PT Serif", Georgia, serif; color: var(--deep); }
.context-content { padding: 22px; }
.empty-context { min-height: 55vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); }
.empty-context > span { width: 44px; height: 44px; display: grid; place-items: center; margin-bottom: 13px; border-radius: 14px; background: var(--teal-soft); color: var(--teal); font-size: 18px; }
.empty-context strong { color: var(--ink); font-size: var(--font-ui); }
.empty-context p { max-width: 260px; font-size: var(--font-small); line-height: 1.6; }
.context-summary { display: flex; gap: 7px; margin-bottom: 18px; }
.context-stat { flex: 1; padding: 10px; border-radius: 10px; background: var(--surface-soft); }
.context-stat strong, .context-stat small { display: block; }
.context-stat strong { font-size: 1.125rem; color: var(--deep); }
.context-stat small { margin-top: 3px; color: var(--muted); font-size: var(--font-caption); }
.context-section { margin-top: 20px; }
.context-section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; color: var(--faint); font-size: var(--font-caption); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.domain-pills { display: flex; gap: 5px; flex-wrap: wrap; }
.domain-pill { padding: 6px 9px; border-radius: 7px; background: var(--teal-soft); color: #2d726b; font-size: var(--font-caption); font-weight: 700; }
.context-fact, .context-source { padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.context-fact strong, .context-source strong { display: block; font-size: var(--font-ui); line-height: 1.45; }
.context-fact p, .context-source p { margin: 5px 0 0; color: var(--muted); font-size: var(--font-small); line-height: 1.55; }
.context-source { display: grid; grid-template-columns: 24px 1fr; gap: 8px; }
.source-index { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--deep); color: white; font-size: var(--font-caption); }
.context-source a { color: inherit; text-decoration: none; }
.context-source a:hover strong { color: var(--teal); }
.quality { display: inline-flex; margin-top: 6px; font-size: var(--font-caption); color: #568079; }

.toolbar { display: flex; gap: 8px; margin-bottom: 14px; }
.search-input, .filter-select { height: 42px; border: 1px solid var(--line); border-radius: 10px; background: white; outline: 0; color: var(--ink); font-size: var(--font-ui); }
.search-input { flex: 1; padding: 0 13px; }
.filter-select { padding: 0 10px; }
.document-table { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: white; }
.table-head, .document-row { display: grid; grid-template-columns: minmax(260px, 1.7fr) 135px 130px 125px; align-items: center; gap: 14px; padding: 0 18px; }
.table-head { height: 44px; color: var(--faint); background: #f3f6f3; font-size: var(--font-caption); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.document-row { min-height: 72px; border-top: 1px solid var(--line-soft); font-size: var(--font-ui); }
.doc-name { min-width: 0; }
.doc-name a { display: block; overflow: hidden; color: var(--ink); font-weight: 700; text-decoration: none; white-space: nowrap; text-overflow: ellipsis; }
.doc-name small { color: var(--faint); font-size: var(--font-caption); }
.status-badge { width: max-content; padding: 5px 8px; border-radius: 6px; background: var(--surface-soft); color: var(--muted); font-size: var(--font-caption); }
.status-badge.indexed { background: var(--teal-soft); color: #35776f; }
.status-badge.pending_text_extraction, .status-badge.needs_ocr, .status-badge.ready_for_import, .status-badge.queued { background: var(--amber-soft); color: #93611e; }
.status-badge.duplicate, .status-badge.metadata_only, .status-badge.archive_only { background: #eef1f1; color: #6a7775; }
.task-list { display: grid; gap: 9px; }
.task-card { display: grid; grid-template-columns: 30px 1fr auto; gap: 11px; align-items: start; padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.task-check { width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--teal); }
.task-card strong { font-size: var(--font-ui); }
.task-card p { margin: 6px 0 9px; color: var(--muted); font-size: var(--font-small); line-height: 1.55; }
.task-meta { display: flex; gap: 6px; }
.priority-badge { padding: 4px 7px; border-radius: 5px; background: var(--rose-soft); color: var(--rose); font-size: var(--font-caption); font-weight: 700; }
.priority-badge.p2 { background: var(--amber-soft); color: var(--amber); }
.task-owner { color: var(--faint); font-size: var(--font-caption); }
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 50; display: grid; gap: 8px; }
.toast { max-width: 380px; padding: 13px 15px; border-radius: 11px; background: var(--deep); color: white; box-shadow: var(--shadow); font-size: var(--font-small); animation: toast-in .2s ease-out; }
.toast.error { background: #793f45; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
.mobile-only { display: none; }

@media (max-width: 1600px) {
  .app-shell { grid-template-columns: 300px minmax(0, 1fr); }
  .context-panel { position: fixed; z-index: 20; right: 0; width: 430px; box-shadow: -14px 0 45px rgba(17,45,47,.15); transform: translateX(101%); transition: transform .2s ease; }
  .context-panel.open { transform: translateX(0); }
  .mobile-only#closeContext { display: grid; }
}
@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 30; width: 300px; left: 0; transform: translateX(-101%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .workspace { height: 100vh; }
  .mobile-only { display: grid; }
  .topbar { padding: 0 14px; }
  .secondary-button { display: none; }
  .scroll-area { padding: 22px 16px 42px; }
  .priority-grid, .content-grid { grid-template-columns: 1fr; }
  .chat-messages { padding: 22px 16px 170px; }
  .composer-wrap { padding-left: 16px; padding-right: 16px; }
  .composer-meta span:first-child { display: none; }
  .table-head { display: none; }
  .document-row { grid-template-columns: 1fr auto; padding: 12px; }
  .document-row > :nth-child(3), .document-row > :nth-child(4) { display: none; }
}
@media (max-width: 520px) {
  .login-page { padding: 14px; }
  .login-card { padding: 30px 22px 26px; border-radius: 20px; }
  .identity-switch { grid-template-columns: 1fr; }
  .context-panel { width: 100%; }
  .crumb > span { display: none; }
  .context-button > span:nth-child(2) { display: none; }
}
