:root {
  --bg: #0f1115; --panel: #151823; --text: #e7e9ee; --muted: #9aa3b2;
  --primary: #5cc8ff; --danger: #ff6b6b; --border: #2a2f3a; --accent: #a0e46b; --focus: #ffd166;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); }
.app-header, .app-footer { display:flex; align-items:center; justify-content:space-between; padding:14px 18px; border-bottom:1px solid var(--border); }
.app-footer { border-top:1px solid var(--border); border-bottom:none; color:var(--muted); }
h1 { font-size:20px; margin:0; } h2 { font-size:16px; margin:0 0 8px 0; }
.badge { font-size:12px; padding:4px 8px; border:1px solid var(--border); border-radius:999px; color:var(--muted); }
.container { max-width:1100px; margin:18px auto; padding:0 14px; display:grid; gap:14px; }
.panel { background:var(--panel); border:1px solid var(--border); border-radius:12px; padding:12px; }
.controls .control-row { display:flex; gap:10px; align-items:center; }
.controls .wrap { flex-wrap:wrap; }
.file-button { background:#243048; color:var(--text); border:1px dashed var(--border); padding:8px 12px; border-radius:10px; cursor:pointer; }
#pdf-input { display:none; }
button, select, input[type="text"], input[type="range"] { background:#1b2030; color:var(--text); border:1px solid var(--border); border-radius:10px; padding:8px 10px; }
input[type="range"] { width:180px; }
button.primary { background:var(--primary); color:#0f1115; border-color:transparent; }
button.secondary { background:#2a3348; }
button.danger { background:var(--danger); color:#0f1115; border-color:transparent; }
button[disabled], button[aria-disabled="true"] { opacity:.5; cursor:not-allowed; }
.ask { flex:1; min-width:260px; }
.model-load { display:flex; flex-direction:column; gap:8px; width:100%; max-width:540px; margin-top:8px; }
.progress-wrap { width:100%; height:10px; background:#111622; border:1px solid var(--border); border-radius:999px; overflow:hidden; }
.progress-bar { height:100%; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .2s ease; }
.answer { min-height:90px; white-space:pre-wrap; }
.sources { display:grid; gap:8px; }
.source-chunk { background:#111622; border:1px solid var(--border); border-radius:10px; padding:8px; }
.source-chunk.highlight { outline:2px solid var(--focus); }
.log { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color:var(--muted); white-space:pre-wrap; }
.sr-only { position:absolute; left:-9999px; }
.muted { color:var(--muted); }
:focus-visible { outline:2px solid var(--focus); outline-offset:2px; }
.hidden { display:none; }

/* Busy overlay */
.busy {
  position: fixed; inset: 0; background: rgba(0,0,0,0.35);
  display: grid; place-items: center; z-index: 9999;
}
.busy .busy-text { margin-top: 10px; color: var(--text); }
.spinner {
  width: 40px; height: 40px; border-radius: 999px;
  border: 4px solid #1b2030; border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
