:root {
  --bg: #0e1116; --panel: #161b22; --panel2: #1c232d; --line: #2a323d;
  --ink: #e6edf3; --mut: #8b98a5; --accent: #4c8dff; --accent2: #2d6ae0;
  --ok: #3fb950; --warn: #d29922; --bad: #f85149; --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
button { font: inherit; cursor: pointer; border: 0; border-radius: 8px;
  padding: 9px 14px; background: var(--accent); color: #fff; }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
button.sm { padding: 5px 10px; font-size: 13px; }
button.danger { background: transparent; border: 1px solid var(--bad); color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
input, textarea, select { font: inherit; width: 100%; padding: 10px; border-radius: 8px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--ink); }
label { display: block; font-size: 13px; color: var(--mut); margin: 10px 0 4px; }
.muted { color: var(--mut); }
.row { display: flex; gap: 10px; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--mut); }
.hidden { display: none !important; }

/* ── Auth ── */
.auth-wrap { position: relative; min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px; overflow: hidden;
  background:
    radial-gradient(1100px 500px at 50% -10%, #18324f 0%, transparent 60%),
    var(--bg); }
.auth-glow { position: absolute; width: 520px; height: 520px; border-radius: 50%;
  top: -160px; filter: blur(90px); opacity: .35;
  background: conic-gradient(from 0deg, var(--accent), #7b5cff, #2bd4c0, var(--accent)); }
.auth-card { position: relative; width: 380px; max-width: 92vw; background: rgba(22,27,34,.92);
  border: 1px solid var(--line); border-radius: 16px; padding: 30px 28px;
  box-shadow: 0 24px 60px -20px #000a, 0 0 0 1px #ffffff08 inset; backdrop-filter: blur(6px); }
.auth-logo { width: 56px; height: 56px; margin: 0 auto 12px; display: grid; place-items: center;
  font-size: 28px; border-radius: 14px; color: #fff;
  background: linear-gradient(160deg, var(--accent), var(--accent2));
  box-shadow: 0 8px 24px -8px var(--accent); }
.auth-brand { text-align: center; font-size: 26px; }
.auth-tag { text-align: center; color: var(--mut); font-size: 13px; margin-top: 2px; }
.auth-sub { text-align: center; color: var(--ink); font-size: 14px; margin: 14px 0 6px; opacity: .85; }
.brand { font-size: 22px; font-weight: 700; letter-spacing: .5px; }
.brand span { color: var(--accent); }
.err { color: var(--bad); font-size: 13px; min-height: 18px; }

/* ── Footer ── */
.app-footer { color: var(--mut); font-size: 12px; text-align: center; padding: 14px 8px 4px; }
.app-footer a { color: var(--accent); text-decoration: none; }
.app-footer a:hover { text-decoration: underline; }
.auth-wrap .app-footer { position: relative; margin-top: 22px; }
.sidebar > .app-footer { border-top: 1px solid var(--line); }

/* ── Settings ── */
.modal.wide { width: 460px; max-width: 94vw; max-height: 88vh; overflow: auto; }
.set-h { margin: 20px 0 4px; padding-bottom: 6px; border-bottom: 1px solid var(--line);
  font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--mut); }

/* ── Shell ── */
.shell { display: grid; grid-template-columns: 300px 1fr; height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; }
.sidebar header { padding: 16px; border-bottom: 1px solid var(--line); }
.case-list { overflow: auto; flex: 1; padding: 8px; }
.case-item { padding: 11px 12px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.case-item:hover { background: var(--panel2); }
.case-item.active { background: var(--panel2); border-color: var(--accent); }
.case-item .t { font-weight: 600; }
.case-item .m { font-size: 12px; color: var(--mut); }
.sidebar footer { padding: 12px 16px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; font-size: 13px; }

.main { overflow: auto; min-height: 0; padding: 22px 26px; }
.empty { display: grid; place-items: center; height: 100%; color: var(--mut); text-align: center; }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 14px 0 18px; }
.tab { padding: 9px 14px; cursor: pointer; color: var(--mut); border-bottom: 2px solid transparent; }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }

/* ── Cards ── */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px; }
.grid { display: grid; gap: 12px; }
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px;
  text-align: center; color: var(--mut); }
.drop.over { border-color: var(--accent); color: var(--ink); }
.file { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); }
.file:last-child { border: 0; }
.status { font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.status.queued { background: #21262d; color: var(--mut); }
.status.processing { background: #1f2d3d; color: var(--accent); }
.status.done { background: #15301c; color: var(--ok); }
.status.error { background: #3a1b1b; color: var(--bad); }

/* ── Transcript ── */
.seg { padding: 6px 0; }
.seg .spk { color: var(--accent); font-weight: 600; margin-right: 8px; }
.seg .ts { color: var(--mut); font-size: 12px; margin-right: 6px; }

/* ── Findings ── */
.finding { border-left: 3px solid var(--line); padding: 8px 12px; margin: 8px 0; background: var(--panel2); border-radius: 0 8px 8px 0; }
.finding.high { border-left-color: var(--bad); }
.finding.medium { border-left-color: var(--warn); }
.finding.low { border-left-color: var(--mut); }
.finding .q { color: var(--mut); font-style: italic; border-left: 2px solid var(--line); padding-left: 8px; margin: 4px 0; }

/* ── Chat ── */
.chat { display: flex; flex-direction: column; height: calc(100vh - 200px); }
.msgs { flex: 1; overflow: auto; padding: 6px; }
.msg { max-width: 80%; padding: 10px 13px; border-radius: 12px; margin: 8px 0; white-space: pre-wrap; }
.msg.user { background: var(--accent2); margin-left: auto; }
.msg.assistant { background: var(--panel2); border: 1px solid var(--line); }
.chat-input { display: flex; gap: 8px; margin-top: 10px; }
.chat-input textarea { resize: none; height: 46px; }

/* ── Modal ── */
.modal-bg { position: fixed; inset: 0; background: #0008; display: grid; place-items: center; z-index: 50; padding: 12px; }
.modal { width: 420px; max-width: 94vw; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; }

/* ── Mobile top bar (hidden on desktop) ── */
.mobtop { display: none; }
.scrim { display: none; }

@media (max-width: 760px) {
  .mobtop { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30;
    padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
  .mobtop .burger { font-size: 20px; background: transparent; border: 1px solid var(--line);
    color: var(--ink); padding: 6px 11px; border-radius: 8px; }
  .mobtop .brand { font-size: 18px; }

  .shell { grid-template-columns: 1fr; height: auto; min-height: calc(100vh - 49px); }

  /* sidebar becomes a slide-in drawer */
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; width: 84vw; max-width: 320px;
    z-index: 45; transform: translateX(-100%); transition: transform .22s ease;
    border-right: 1px solid var(--line); }
  .sidebar.show { transform: translateX(0); }
  .scrim.show { display: block; position: fixed; inset: 0; background: #0007; z-index: 40; }

  .main { padding: 16px 14px; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .tab { white-space: nowrap; }
  .chat { height: calc(100vh - 230px); }
  .chat-input textarea { height: 52px; }
  .msg { max-width: 90%; }
  button, .tab { min-height: 40px; }
  input, textarea, select { font-size: 16px; } /* prevents iOS zoom-on-focus */
  h2 { font-size: 20px; }
}
