:root {
  --bg: #0b0f14;
  --sidebar: #0d1219;
  --panel: #121923;
  --panel-2: #151e2a;
  --line: #243040;
  --line-soft: #1b2532;
  --text: #e9eef5;
  --muted: #8b9aad;
  --accent: #d6a35d;
  --accent-soft: rgba(214,163,93,.12);
  --green: #5fca9c;
  --red: #e57575;
  --blue: #72a7e8;
  --radius: 16px;
  --shadow: 0 16px 50px rgba(0,0,0,.25);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
button, input, select { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 250px; background: var(--sidebar); border-right: 1px solid var(--line-soft); padding: 22px 16px; display: flex; flex-direction: column; z-index: 20; }
.brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 26px; }
.brand-mark { width: 40px; height: 40px; border: 1px solid #9b7542; background: linear-gradient(145deg,#1d2734,#121821); color: #f1c98f; display: grid; place-items: center; border-radius: 11px; font-weight: 800; letter-spacing: -.5px; }
.brand-name { font-weight: 750; letter-spacing: -.3px; }
.brand-sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
nav { display: grid; gap: 5px; }
.nav-item { appearance: none; border: 0; background: transparent; padding: 11px 12px; border-radius: 10px; display: flex; gap: 11px; align-items: center; color: #9aa8b9; cursor: pointer; text-align: left; }
.nav-item:hover { background: #121a24; color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: #f0c888; }
.sidebar-footer { margin-top: auto; padding: 14px 8px 2px; display: grid; gap: 9px; }
.local-chip { display: inline-flex; align-items: center; gap: 8px; color: #abc9bd; font-size: 12px; }
.dot { width: 7px; height: 7px; background: var(--green); border-radius: 50%; box-shadow: 0 0 0 4px rgba(95,202,156,.08); }
.muted { color: var(--muted); font-size: 12px; }
.main { margin-left: 250px; min-height: 100vh; padding: 34px 42px 70px; max-width: 1600px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 28px; }
.eyebrow { color: var(--muted); text-transform: uppercase; letter-spacing: .11em; font-size: 10px; font-weight: 700; }
h1 { font-size: 30px; margin: 5px 0 0; letter-spacing: -.8px; }
h2 { font-size: 18px; margin: 5px 0 0; letter-spacing: -.3px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.btn { border: 1px solid var(--line); border-radius: 9px; padding: 9px 14px; background: var(--panel); cursor: pointer; }
.btn:hover { border-color: #415167; }
.btn.primary { background: #c58e49; border-color: #c58e49; color: #111; font-weight: 750; }
.btn.ghost { color: #bcc7d5; }
.health-pill { border: 1px solid var(--line); border-radius: 999px; padding: 7px 11px; font-size: 12px; }
.health-pill.good { color: var(--green); border-color: rgba(95,202,156,.3); background: rgba(95,202,156,.06); }
.health-pill.bad { color: var(--red); border-color: rgba(229,117,117,.3); background: rgba(229,117,117,.06); }
.health-pill.neutral { color: var(--muted); }
.view { display: none; }
.view.active { display: block; }
.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-bottom: 16px; }
.metric { background: linear-gradient(180deg,#131b26,#101720); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 20px; min-height: 120px; }
.metric-label { color: var(--muted); font-size: 12px; }
.metric-value { font-size: 32px; font-weight: 750; letter-spacing: -1px; margin-top: 10px; }
.metric-note { color: #7f90a4; font-size: 11px; margin-top: 7px; }
.grid-two { display: grid; grid-template-columns: 1.45fr 1fr; gap: 16px; margin-bottom: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 20px; box-shadow: 0 1px 0 rgba(255,255,255,.01); }
.panel + .panel { margin-top: 16px; }
.grid-two .panel + .panel { margin-top: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.text-btn { border: 0; background: none; color: #9eb2c8; cursor: pointer; font-size: 12px; }
.source-row, .import-row { padding: 13px 0; border-top: 1px solid var(--line-soft); display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; }
.source-row:first-child, .import-row:first-child { border-top: 0; }
.source-title { font-weight: 650; }
.source-meta { font-size: 11px; color: var(--muted); margin-top: 5px; }
.badge { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: #1b2531; color: #aebac8; font-size: 10px; border: 1px solid #283647; }
.badge.good { color: #8fd4b5; border-color: rgba(95,202,156,.24); background: rgba(95,202,156,.06); }
.badge.warn { color: #e6bd7b; border-color: rgba(214,163,93,.25); background: rgba(214,163,93,.06); }
.lifecycle-list { display: grid; gap: 12px; }
.lifecycle-item { display: grid; gap: 6px; }
.lifecycle-line { display:flex;justify-content:space-between;color:#b7c1cd;font-size:12px; }
.bar { height: 6px; border-radius: 99px; background: #1a2430; overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg,#5989c8,#75c5aa); border-radius: 99px; }
.search-panel { padding: 16px; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.search-input, input, select { width: 100%; border: 1px solid var(--line); background: #0d141c; color: var(--text); border-radius: 9px; padding: 10px 12px; outline: none; }
.search-input { font-size: 15px; padding: 12px 14px; }
input:focus, select:focus { border-color: #5d7088; box-shadow: 0 0 0 3px rgba(87,112,141,.12); }
.filter-row { display: grid; grid-template-columns: 150px 150px 1fr 1fr auto; gap: 9px; margin-top: 10px; align-items: center; }
.check { display: flex; gap: 7px; align-items: center; color: var(--muted); font-size: 12px; white-space: nowrap; }
.check input { width: auto; }
.search-summary { color: var(--muted); font-size: 12px; margin: 14px 3px 10px; }
.result-list { display: grid; gap: 10px; }
.result-card { border: 1px solid var(--line-soft); background: #111923; border-radius: 13px; padding: 16px 17px; cursor: pointer; transition: border-color .15s, transform .15s; }
.result-card:hover { border-color: #36475c; transform: translateY(-1px); }
.result-top { display:flex;align-items:center;justify-content:space-between;gap:12px; }
.result-origin { display:flex;align-items:center;gap:8px;color:#9aabba;font-size:11px; }
.result-content { margin: 12px 0; line-height: 1.65; font-size: 14px; white-space: pre-wrap; overflow-wrap:anywhere; }
.result-foot { color: #74859a; font-size: 10px; display:flex;gap:12px;flex-wrap:wrap; }
.card-grid { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px; }
.info-card { border:1px solid var(--line-soft);background:var(--panel);border-radius:var(--radius);padding:18px; }
.info-card h3 { margin:5px 0 12px;font-size:16px; }
.kv { display:grid;grid-template-columns:120px 1fr;gap:8px 12px;font-size:11px;padding:5px 0; }
.kv .k { color:var(--muted); }
.kv .v { color:#c4ced9;overflow-wrap:anywhere; }
.compact-filter { display:grid;grid-template-columns:1fr 180px;gap:10px;margin-bottom:14px; }
.conversation-list { display:grid;gap:9px; }
.conversation-row { background:var(--panel);border:1px solid var(--line-soft);border-radius:12px;padding:15px 17px;display:grid;grid-template-columns:1fr auto;gap:20px; }
.conversation-name { font-weight:650; }
.conversation-meta { color:var(--muted);font-size:11px;margin-top:5px; }
.conversation-stats { display:flex;gap:16px;align-items:center;color:#9dabbc;font-size:11px; }
.drawer { position:fixed;right:-570px;top:0;bottom:0;width:min(570px,94vw);background:#0f161f;border-left:1px solid var(--line);z-index:60;transition:right .22s ease;box-shadow:var(--shadow);display:flex;flex-direction:column; }
.drawer.open { right:0; }
.drawer-head { padding:22px;display:flex;justify-content:space-between;align-items:flex-start;border-bottom:1px solid var(--line-soft); }
.icon-btn { width:34px;height:34px;border-radius:9px;border:1px solid var(--line);background:#141e29;font-size:22px;cursor:pointer; }
.drawer-tabs { padding:0 22px;border-bottom:1px solid var(--line-soft);display:flex;gap:18px; }
.drawer-tab { border:0;background:none;padding:13px 0;color:var(--muted);cursor:pointer;border-bottom:2px solid transparent;font-size:12px; }
.drawer-tab.active { color:#edc68d;border-color:var(--accent); }
.drawer-body { padding:20px 22px 50px;overflow:auto; }
.drawer-backdrop { position:fixed;inset:0;background:rgba(0,0,0,.3);opacity:0;pointer-events:none;z-index:50;transition:opacity .2s; }
.drawer-backdrop.open { opacity:1;pointer-events:auto; }
.evidence-block { border:1px solid var(--line-soft);border-radius:12px;padding:14px;margin-bottom:11px;background:#111a24; }
.evidence-block pre { white-space:pre-wrap;overflow-wrap:anywhere;color:#b9c6d4;font:11px/1.6 ui-monospace,SFMono-Regular,Consolas,monospace;margin:8px 0 0; }
.version-card, .timeline-card { border-left:2px solid #33455a;padding:5px 0 15px 14px;margin-left:3px; }
.version-card.current { border-color:var(--accent); }
.version-content { white-space:pre-wrap;margin:8px 0;line-height:1.55;font-size:13px; }
.timeline-time { color:var(--muted);font-size:10px; }
.timeline-type { color:#bdc9d6;font-size:12px;font-weight:650;margin:3px 0 5px; }
.toast { position:fixed;left:50%;bottom:28px;transform:translate(-50%,20px);background:#18222e;border:1px solid #334256;color:#dce5ef;padding:10px 14px;border-radius:9px;font-size:12px;opacity:0;pointer-events:none;transition:.2s;z-index:100; }
.toast.show { opacity:1;transform:translate(-50%,0); }
.empty { border:1px dashed #2a3747;border-radius:12px;padding:35px;text-align:center;color:var(--muted);font-size:12px; }
.error { color:#e99191; }
@media (max-width:1100px){ .metric-grid{grid-template-columns:repeat(2,1fr)} .grid-two{grid-template-columns:1fr} .card-grid{grid-template-columns:repeat(2,1fr)} .filter-row{grid-template-columns:repeat(2,1fr)} }
@media (max-width:760px){ .sidebar{width:72px;padding:16px 8px}.brand>div:last-child,.nav-item:not(.active) span+*,.brand-name,.brand-sub,.sidebar-footer{display:none}.brand{padding-left:8px}.nav-item{justify-content:center;font-size:0}.nav-item span{font-size:17px}.main{margin-left:72px;padding:24px 16px}.topbar{align-items:flex-start}.top-actions{flex-direction:column;align-items:flex-end}.metric-grid,.card-grid{grid-template-columns:1fr}.filter-row,.compact-filter{grid-template-columns:1fr}.conversation-row{grid-template-columns:1fr}.conversation-stats{flex-wrap:wrap} }


.ai-grid { align-items: stretch; }
.ai-compose { min-height: 320px; }
.ai-question { width:100%; min-height:145px; resize:vertical; border:1px solid var(--line); background:#0d141c; color:var(--text); border-radius:10px; padding:13px 14px; font:14px/1.6 inherit; outline:none; }
.ai-question:focus { border-color:#5d7088; box-shadow:0 0 0 3px rgba(87,112,141,.12); }
.ai-options { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:8px; margin-top:10px; }
.cloud-consent { display:flex; gap:9px; align-items:flex-start; color:#a7b4c3; font-size:11px; line-height:1.5; margin-top:14px; padding:11px 12px; border:1px solid #2b394a; border-radius:10px; background:#101822; }
.cloud-consent input { width:auto; margin-top:2px; }
.ai-actions { display:flex; gap:9px; margin-top:12px; }
.ai-answer-panel { margin-bottom:16px; }
.ai-answer { white-space:pre-wrap; line-height:1.75; font-size:14px; }
.ai-claims { display:grid; gap:8px; margin-top:16px; }
.ai-claim { border-left:2px solid #33455a; padding:7px 0 7px 12px; font-size:12px; color:#b8c5d3; }
.ai-ref { display:inline-flex; border:1px solid #37516c; background:#132131; color:#9fc1e3; border-radius:6px; padding:2px 6px; margin-left:5px; cursor:pointer; font-size:10px; }
.ai-evidence-card { border:1px solid var(--line-soft); background:#111923; border-radius:12px; padding:14px 15px; }
.ai-evidence-head { display:flex; justify-content:space-between; gap:10px; align-items:center; }
.ai-egress-stat { display:grid; grid-template-columns:120px 1fr; gap:8px 10px; font-size:12px; }
@media (max-width:1100px){ .ai-options{grid-template-columns:repeat(2,1fr)} }
@media (max-width:760px){ .ai-options{grid-template-columns:1fr} .ai-actions{flex-direction:column} }


/* Private deployment login */
.login-body{margin:0;min-height:100vh;background:radial-gradient(circle at 50% 0,#162233 0,#0b1118 42%,#080d12 100%);display:grid;place-items:center;color:var(--text);}
.login-shell{width:min(440px,calc(100% - 32px));}
.login-card{border:1px solid var(--line);background:rgba(15,23,33,.96);border-radius:18px;padding:28px;box-shadow:0 24px 80px rgba(0,0,0,.38);}
.login-brand{padding:0;margin-bottom:30px;}
.login-card h1{margin:8px 0 10px;font-size:28px;}
.login-card form{display:grid;gap:12px;margin-top:24px;}
.login-submit{width:100%;justify-content:center;}
.login-error{min-height:22px;margin-top:12px;color:#ff8585;font-size:12px;}
