:root {
  --bg: #080b10;
  --panel: #10151d;
  --panel-2: #151c26;
  --line: #263141;
  --text: #edf2f7;
  --muted: #91a0b4;
  --blue: #78a9ff;
  --rose: #ff7aae;
  --green: #56d59a;
  --amber: #f1bc63;
  --danger: #ff707b;
  --shadow: 0 24px 80px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(circle at 70% -10%, rgba(80,89,160,.18), transparent 34%), var(--bg);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
}
button, textarea, input, select { font: inherit; }
button { cursor: pointer; }
.shell { display: grid; grid-template-columns: 272px 1fr; height: 100%; }
.sidebar {
  display: flex; flex-direction: column; min-width: 0; padding: 22px 16px 16px;
  background: rgba(10,14,20,.92); border-right: 1px solid var(--line); backdrop-filter: blur(16px);
}
.brand { display: flex; gap: 12px; align-items: center; margin: 0 8px 24px; }
.brand strong { display: block; font-size: 17px; letter-spacing: .02em; }
.brand span { display: block; color: var(--muted); font-size: 12px; }
.brand-logo {
  width: 44px; height: 44px; flex: 0 0 44px; object-fit: contain;
  mix-blend-mode: screen; filter: drop-shadow(0 0 10px rgba(40,139,255,.5));
}
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 13px;
  font-weight: 800; color: white; background: linear-gradient(135deg, var(--blue), var(--rose));
  box-shadow: 0 0 28px rgba(119,137,255,.24);
}
.brand-mark.large { width: 52px; height: 52px; border-radius: 17px; margin: 0 auto; }
.primary, .secondary, .send {
  border: 0; border-radius: 10px; color: white; transition: .16s ease;
}
.primary { padding: 10px 14px; background: linear-gradient(135deg, #587dea, #a75ca0); font-weight: 650; }
.primary:hover { filter: brightness(1.12); transform: translateY(-1px); }
.secondary { padding: 8px 12px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); }
.secondary:hover { border-color: #42526a; }
.full { width: 100%; }
nav { display: grid; gap: 4px; margin: 18px 0; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 11px;
  border: 0; border-radius: 9px; color: var(--muted); background: transparent; text-align: left;
}
.nav-item span { display: grid; place-items: center; width: 23px; height: 23px; font-size: 12px; border: 1px solid #344154; border-radius: 7px; }
.nav-item:hover, .nav-item.active { color: white; background: #171e29; }
.sidebar-heading { margin: 10px 9px 8px; color: #627087; font-size: 11px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.session-list { flex: 1; min-height: 0; overflow: auto; }
.session-item {
  width: 100%; padding: 9px 10px; border: 0; border-radius: 8px; color: #aab6c7;
  background: transparent; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.session-item:hover, .session-item.active { color: white; background: #151c26; }
.session-item small { display: block; color: #5f6c7d; }
.sidebar-footer { display: flex; gap: 8px; align-items: center; padding: 12px 8px 0; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 10px currentColor; }
.status-dot.online { background: var(--green); }
.status-dot.offline { background: var(--danger); }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.menu-toggle, .sidebar-backdrop { display: none; }
.menu-toggle {
  flex: 0 0 42px; width: 42px; height: 42px; padding: 10px; border: 1px solid var(--line);
  border-radius: 10px; color: var(--text); background: var(--panel-2);
}
.menu-toggle span { display: block; height: 2px; margin: 4px 0; border-radius: 2px; background: currentColor; transition: .2s ease; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 82px; padding: 18px 30px; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 0; font-size: 20px; }
.topbar p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.pill { padding: 5px 9px; border: 1px solid #345345; border-radius: 20px; color: var(--green); font-size: 12px; background: rgba(55,130,90,.12); }
.view { display: none; flex: 1; min-height: 0; }
.view.active { display: flex; }
#chat-view { position: relative; flex-direction: column; }
.empty-state { display: grid; place-items: center; margin: auto; max-width: 520px; padding: 40px; text-align: center; }
.empty-state h2 { margin: 18px 0 4px; font-size: 24px; }
.empty-state p { margin: 0 0 22px; color: var(--muted); }
.welcome-logo {
  width: min(290px, 54vw); height: min(290px, 54vw); object-fit: contain;
  mix-blend-mode: screen; filter: drop-shadow(0 0 26px rgba(37,132,255,.36));
}
.messages { flex: 1; overflow: auto; padding: 30px max(28px, calc((100% - 900px)/2)); }
.message { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 13px; margin-bottom: 25px; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; background: #1c2532; color: var(--blue); font-size: 12px; font-weight: 800; }
.message.user .avatar { color: var(--rose); }
.message-head { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.message-body { color: #e1e8f0; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.thinking .message-body::after { content: ""; display: inline-block; width: 7px; height: 15px; margin-left: 3px; background: var(--blue); animation: blink 1s infinite; vertical-align: -2px; }
@keyframes blink { 50% { opacity: .15; } }
.citation { padding: 1px 4px; border: 1px solid #40577d; border-radius: 5px; color: #a9c5ff; background: #162238; }
.citation:hover { border-color: var(--blue); }
.message-meta { margin-top: 8px; color: #657389; font-size: 11px; }
.composer { width: min(900px, calc(100% - 56px)); margin: 0 auto 24px; padding: 11px 58px 25px 14px; position: relative; background: #121923; border: 1px solid #2b394c; border-radius: 16px; box-shadow: var(--shadow); }
.composer:focus-within { border-color: #506d9f; }
.composer textarea { width: 100%; max-height: 180px; resize: none; border: 0; outline: 0; color: white; background: transparent; }
.send { position: absolute; right: 12px; bottom: 20px; width: 35px; height: 35px; background: #6b88e8; font-size: 20px; }
.send:disabled { opacity: .4; cursor: wait; }
.composer-note { position: absolute; left: 14px; bottom: 5px; color: #566276; font-size: 10px; }
.library-view, .system-view { flex-direction: column; overflow: auto; padding: 24px 30px; }
.library-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.library-toolbar p { margin: 0; color: var(--muted); }
select, input { color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.review-panel { margin-bottom: 22px; padding: 18px; border: 1px solid #3e4058; border-radius: 14px; background: rgba(33,31,51,.48); }
.review-panel.empty .review-grid::after { content: "No claims are waiting for review."; color: var(--muted); font-size: 13px; }
.review-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.review-heading h2 { margin: 0; font-size: 16px; }.review-heading p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.count-badge { min-width: 28px; padding: 4px 8px; border-radius: 999px; color: #ffe0b2; background: rgba(241,188,99,.16); text-align: center; font-weight: 750; }
.review-grid { display: grid; gap: 12px; }
.review-card { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: rgba(12,17,25,.76); }
.review-claims { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.review-claim { padding: 12px; border-radius: 9px; background: var(--panel-2); }.review-claim p { margin: 8px 0 0; color: #bdc8d6; }
.review-claim-label { margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.review-meta { margin: 11px 0 0; color: #66758a; font-size: 11px; }.review-rationale { margin: 6px 0 12px; color: #aab6c7; }
.review-evidence { margin-top: 7px; color: #718097; font-size: 11px; }
.review-actions { display: flex; flex-wrap: wrap; gap: 8px; }.review-actions button { padding: 7px 10px; font-size: 12px; }
.record-card { padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(145deg, rgba(24,31,43,.9), rgba(14,19,27,.9)); text-align: left; color: inherit; }
.record-card:hover { border-color: #44536a; transform: translateY(-1px); }
.record-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.record-id { color: var(--blue); font: 700 12px ui-monospace, Consolas, monospace; }
.record-status { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.record-card h3 { margin: 0 0 8px; font-size: 15px; }
.record-card p { display: -webkit-box; margin: 0; color: #aab6c7; overflow: hidden; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.record-foot { margin-top: 13px; color: #637188; font-size: 11px; }
.service-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.service-card, .panel, .security-note { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.service-card span { display: block; margin-top: 8px; font-size: 22px; font-weight: 700; }
.service-card span.ok { color: var(--green); }.service-card span.bad { color: var(--danger); }
.service-label { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.gpu-name { margin-top: 13px; color: #dce6f3; font-weight: 650; }
.model-name { min-height: 36px; margin-top: 3px; color: #68778b; font-size: 11px; overflow-wrap: anywhere; }
.vram { margin-top: 15px; }
.vram-label { margin-bottom: 7px; color: #aab7c8; font: 12px ui-monospace, Consolas, monospace; }
.vram-track { height: 6px; overflow: hidden; border-radius: 999px; background: #253041; }
.vram-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--rose)); }
.shared-note { margin-top: 8px; color: #65748a; font-size: 10px; }
.temperature { margin-top: 10px; color: var(--green); font: 12px ui-monospace, Consolas, monospace; }
.temperature.warm { color: var(--amber); }
.temperature.hot { color: var(--danger); }
.panel-title { display: flex; justify-content: space-between; align-items: center; }.panel h2 { margin: 0; font-size: 17px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.storage-status { margin-top: 18px; padding: 15px; border-radius: 11px; background: var(--panel-2); }
.storage-top { display: flex; justify-content: space-between; gap: 14px; }.storage-top strong { color: var(--green); }.storage-top span { color: var(--muted); font-size: 12px; }
.storage-track { height: 8px; margin-top: 10px; overflow: hidden; border-radius: 999px; background: #273244; }
.storage-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--rose)); }
.storage-path { margin-top: 8px; color: #66758a; font: 11px ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.supersession-detail { padding: 13px; border: 1px solid #4a3e28; border-radius: 10px; background: rgba(94,68,28,.13); }.supersession-detail p { margin-bottom: 0; color: #c4b99f; }
.stat { padding: 14px; border-radius: 10px; background: var(--panel-2); }.stat strong { display: block; font-size: 23px; }.stat span { color: var(--muted); font-size: 12px; }
.security-note { margin-top: 18px; border-color: #4a3e28; background: rgba(94,68,28,.13); }.security-note p { margin-bottom: 0; color: #b7aa90; }
dialog { width: min(680px, calc(100% - 30px)); max-height: 85vh; overflow: auto; color: var(--text); background: #111821; border: 1px solid #334156; border-radius: 16px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(2,4,8,.75); backdrop-filter: blur(4px); }
.dialog-close { float: right; width: 32px; height: 32px; border: 0; border-radius: 8px; color: var(--muted); background: #1a2330; font-size: 20px; }
.detail-title { padding-right: 45px; }.detail-title h2 { margin: 4px 0; }.detail-title span { color: var(--blue); font-family: ui-monospace, Consolas, monospace; }
.detail-section { margin-top: 20px; }.detail-section h3 { margin: 0 0 7px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }.detail-section ul { margin: 0; padding-left: 20px; }
.auth-dialog { max-width: 400px; text-align: center; }.auth-dialog form { display: grid; gap: 14px; }.auth-dialog h2, .auth-dialog p { margin: 0; }.auth-dialog p { color: var(--muted); }
.toast { position: fixed; right: 24px; bottom: 24px; padding: 11px 15px; border-radius: 9px; color: white; background: #27354a; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; box-shadow: var(--shadow); }.toast.show { opacity: 1; transform: none; }
.hidden { display: none !important; }
code { color: #adc8ff; }
@media (max-width: 760px) {
  body.menu-open { overflow: hidden; }
  .shell { display: block; height: 100%; }
  .sidebar {
    position: fixed; z-index: 50; inset: 0 auto 0 0; display: flex; width: min(86vw, 320px);
    transform: translateX(-105%); transition: transform .22s ease; box-shadow: 18px 0 50px rgba(0,0,0,.48);
  }
  body.menu-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed; z-index: 40; inset: 0; width: 100%; height: 100%; border: 0;
    background: rgba(2,5,9,.7); backdrop-filter: blur(3px);
  }
  body.menu-open .sidebar-backdrop { display: block; }
  .main { height: 100%; }
  .menu-toggle { display: block; }
  body.menu-open .menu-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  body.menu-open .menu-toggle span:nth-child(2) { opacity: 0; }
  body.menu-open .menu-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  .topbar { justify-content: flex-start; gap: 12px; padding: 12px 14px; }.topbar p { display: none; }
  .top-actions { margin-left: auto; }.top-actions .pill { display: none; }
  .messages { padding: 22px 18px; }.composer { width: calc(100% - 26px); margin-bottom: 13px; }
  .library-view, .system-view { padding: 18px; }.service-cards, .stats-grid, .review-claims { grid-template-columns: 1fr; }
  .library-toolbar { align-items: flex-start; gap: 12px; }.library-toolbar p { font-size: 13px; }
  .card-grid { grid-template-columns: minmax(0, 1fr); }
}
