:root {
  --bg: #0b1220;
  --surface: #121c2f;
  --surface-2: #18253d;
  --border: #253655;
  --text: #eef4ff;
  --muted: #98abc9;
  --accent: #38e8b0;
  --accent-dark: #07291f;
  --danger: #ff7a8a;
  --warn: #ffd166;
  color-scheme: dark;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 5px; font-size: 0.9em; }

.shell { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 18px; }
.bar { position: sticky; top: 0; z-index: 10; background: rgba(11, 18, 32, 0.88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.nav { display: flex; align-items: center; justify-content: space-between; min-height: 58px; gap: 12px; }
.nav-right { display: flex; align-items: center; gap: 10px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.15rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.mark { color: var(--accent); font-size: 1.25rem; }

.pill { font-size: 0.78rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.pill.ok { color: var(--accent); border-color: rgba(56, 232, 176, 0.4); background: rgba(56, 232, 176, 0.1); }
.pill.warn { color: var(--warn); border-color: rgba(255, 209, 102, 0.4); background: rgba(255, 209, 102, 0.08); }

.hero { padding: 28px 0 20px; }
.route { font-size: 0.82rem; font-weight: 600; color: var(--accent); letter-spacing: 0.02em; margin-bottom: 6px; }
.route span { opacity: 0.5; margin: 0 5px; }
.hero h1 { margin: 0 0 6px; font-size: clamp(1.6rem, 3vw, 2.2rem); }
.hero p { margin: 0; color: var(--muted); max-width: 68ch; }

.grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, 1fr); gap: 18px; padding-bottom: 48px; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 18px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px; }
.card h2 { margin: 0 0 10px; font-size: 1.12rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.login { max-width: 420px; margin: 16px 0 40px; }

.muted { color: var(--muted); font-size: 0.92rem; }
.small { font-size: 0.8rem; }
.badge { font-size: 0.78rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--accent); border: 1px solid var(--border); }
.notice { background: rgba(255, 209, 102, 0.09); border: 1px solid rgba(255, 209, 102, 0.35); color: #ffe7a8; padding: 10px 12px; border-radius: 10px; font-size: 0.88rem; }

label { display: block; font-size: 0.86rem; font-weight: 600; margin: 10px 0 5px; color: var(--muted); }
input, textarea, select { width: 100%; font: inherit; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; }

fieldset { border: 1px dashed var(--border); border-radius: 12px; padding: 14px; margin: 0; }
legend { padding: 0 6px; font-size: 0.86rem; color: var(--muted); font-weight: 600; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 0.9rem; font-weight: 700;
  padding: 9px 15px; border-radius: 9px; cursor: pointer; border: 1px solid transparent;
  transition: transform 0.06s ease, opacity 0.15s ease;
}
button:disabled { opacity: 0.45; cursor: not-allowed; }
.primary { background: var(--accent); color: var(--accent-dark); }
.primary:hover:not(:disabled) { opacity: 0.92; }
.secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.secondary:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.quiet { background: transparent; color: var(--muted); border-color: transparent; padding: 6px 10px; }
.quiet:hover:not(:disabled) { color: var(--danger); }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.dropzone {
  margin-top: 12px; padding: 22px 16px; border: 2px dashed var(--border); border-radius: 12px;
  text-align: center; background: rgba(24, 37, 61, 0.35); transition: border-color 0.15s, background 0.15s;
}
.dropzone.drag { border-color: var(--accent); background: rgba(56, 232, 176, 0.09); }
.dropzone p { margin: 0 0 10px; color: var(--muted); font-size: 0.92rem; }

.materials { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 8px; }
.materials li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px;
}
.mat-left { display: flex; flex-direction: column; min-width: 0; }
.mat-left a { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mat-meta { font-size: 0.78rem; color: var(--muted); display: flex; gap: 8px; align-items: center; margin-top: 2px; }
.tag { font-size: 0.72rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.tag.synced { background: rgba(56, 232, 176, 0.14); color: var(--accent); }
.tag.local { background: rgba(152, 171, 201, 0.14); color: var(--muted); }
.tag.progress { background: rgba(255, 209, 102, 0.15); color: var(--warn); }

.result .chip { display: inline-block; font-size: 0.78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: rgba(56, 232, 176, 0.14); color: var(--accent); margin: 0 0 8px; }
.answer { font-size: 1.25rem; font-weight: 750; white-space: pre-line; margin: 0 0 10px; color: #fff; }
.citation-quote { margin: 10px 0; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--bg); color: #cdd9ee; font-size: 0.9rem; border-radius: 0 8px 8px 0; }
.bank-summary { font-weight: 700; margin: 8px 0 12px; }
.message { min-height: 1.2em; margin: 10px 0 0; font-size: 0.88rem; color: var(--accent); }
.message[data-error="true"] { color: var(--danger); }

figure { margin: 12px 0; }
figure img { max-width: 100%; max-height: 260px; border-radius: 10px; border: 1px solid var(--border); display: block; }
figcaption { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }
details summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.mt-sm { margin-top: 12px; }
.mt-md { margin-top: 16px; }
