/* LEAP Platform branding (leapplatform.io): navy ink, light surface, indigo→violet
   gradient pills, pink accents. Articulat CF is a licensed Typekit face, so Inter
   (also loaded by leapplatform.io) stands in. */
:root {
  --navy: #03021c; --ink: #1a1944; --indigo: #3339a9; --royal: #733694; --plum: #8d4fac;
  --pink: #ff6f8d; --lilac: #be8ad9; --haze: #5a568d;
  --grad: linear-gradient(90deg, var(--indigo) 0%, var(--royal) 100%);
  --bg: #f6f8fc; --surface: #fff; --text: #1a1944; --muted: #5a568d;
  --border: rgba(28, 25, 68, .12); --field: #f6f8fc;
  --accent: #3339a9; --accent-ink: #fff; --danger: #c0354f;
  --shadow: 0 1px 2px rgba(26, 25, 68, .04), 0 6px 24px rgba(26, 25, 68, .06);
  --high: #17724a; --high-bg: #dff3ea; --med: #8a5a00; --med-bg: #fdf0d2;
  --low: #b23a55; --low-bg: #fce3e8; --none: #5a568d; --none-bg: #ebeaf4;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #07061f; --surface: #12113a; --text: #ecebf8; --muted: #aaa7d6;
    --border: rgba(255, 255, 255, .1); --field: #0c0b2b;
    --accent: #9da2ff; --accent-ink: #fff; --danger: #ff8aa2;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 24px rgba(0, 0, 0, .25);
    --high: #74dba8; --high-bg: #123526; --med: #f3c862; --med-bg: #362a0c;
    --low: #ff9ab0; --low-bg: #3d1424; --none: #aaa7d6; --none-bg: #22204d;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }

/* ---------- header band (navy hero with arc glow) ---------- */
.top { position: sticky; top: 0; z-index: 2; color: #fff; padding: 16px 24px 0;
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
  background:
    radial-gradient(120% 180% at 100% 0%, rgba(255, 111, 141, .28) 0%, rgba(115, 54, 148, .22) 30%, transparent 55%),
    radial-gradient(90% 160% at 0% 100%, rgba(51, 57, 169, .45) 0%, transparent 60%),
    linear-gradient(180deg, #13124a 0%, var(--ink) 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06), 0 8px 24px rgba(3, 2, 28, .25); }
.brand { display: flex; gap: 16px; align-items: center; max-width: 1100px; margin: 0 auto; }
.brand img { height: 34px; width: auto; display: block; }
.brand .divider { width: 1px; align-self: stretch; background: rgba(255, 255, 255, .22); }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--lilac); margin: 0; }
h1 { font-size: 19px; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.sub { margin: 2px 0 0; color: rgba(255, 255, 255, .7); font-size: 13px; }
.tabs { display: flex; gap: 6px; max-width: 1100px; margin: 14px auto 0; }
.tabs button { border: 0; background: none; padding: 10px 14px 12px; color: rgba(255, 255, 255, .68);
  border-radius: 0; font-weight: 600; font-size: 13px; letter-spacing: .08em; text-transform: uppercase;
  position: relative; }
.tabs button:hover { color: #fff; border: 0; }
.tabs button.active { color: #fff; }
.tabs button.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px;
  border-radius: 3px 3px 0 0; background: linear-gradient(90deg, var(--pink), var(--lilac)); }
.signout { margin-left: auto; align-self: center; color: #fff; font-size: 12px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; text-decoration: none;
  border: 1px solid rgba(255, 255, 255, .45); border-radius: 999px; padding: 6px 14px; }
.signout:hover { background: rgba(255, 255, 255, .1); }

/* ---------- layout ---------- */
main { max-width: 1100px; margin: 0 auto; padding: 24px 24px 60px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
label { display: block; font-weight: 700; font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--plum); margin: 4px 0 8px; }
@media (prefers-color-scheme: dark) { label { color: var(--lilac); } }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
textarea, input, select { width: 100%; font: inherit; color: inherit; background: var(--field);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
textarea { resize: vertical; }
textarea:focus, input:focus, select:focus { outline: 2px solid var(--indigo); outline-offset: -1px; }
.row { display: flex; gap: 10px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.row > select { width: auto; min-width: 220px; flex: 0 1 auto; }
.row > input[type=search] { flex: 1 1 260px; width: auto; }
.between { justify-content: space-between; }

/* ---------- buttons: LEAP pills ---------- */
button { font: inherit; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  border: 1.5px solid var(--indigo); background: transparent; color: var(--indigo);
  border-radius: 999px; padding: 9px 18px; cursor: pointer; transition: filter .15s, background .15s; }
@media (prefers-color-scheme: dark) { button { border-color: var(--accent); color: var(--accent); } }
button:hover { background: rgba(51, 57, 169, .07); }
button.primary { background: var(--grad); border-color: transparent; color: #fff; }
button.primary:hover { filter: brightness(1.12); }
button.danger { color: var(--danger); border-color: var(--danger); margin-left: auto; }
button:disabled { opacity: .55; cursor: progress; }

/* ---------- results ---------- */
.badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.c-high { color: var(--high); background: var(--high-bg); }
.c-medium { color: var(--med); background: var(--med-bg); }
.c-low { color: var(--low); background: var(--low-bg); }
.c-none { color: var(--none); background: var(--none-bg); }
.result { border-top: 3px solid transparent; background-clip: padding-box;
  background-image: linear-gradient(var(--surface), var(--surface)), linear-gradient(90deg, var(--pink), var(--lilac), var(--indigo));
  background-origin: border-box; background-clip: padding-box, border-box; }
.mode { color: var(--muted); font-size: 12px; }
.answer { white-space: pre-wrap; margin: 14px 0 4px; font-size: 15.5px; }
.gaps { color: var(--muted); font-size: 13px; margin: 8px 0 0; font-style: italic; }
.gaps::before { content: "Reviewer note: "; font-weight: 700; font-style: normal; color: var(--plum); }
.matches summary { cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; margin-top: 14px; }
.matches ol { padding-left: 20px; margin: 10px 0 0; }
.matches li { margin-bottom: 12px; }
.matches .mq { font-weight: 600; }
.matches .meta, .kb-item .meta { color: var(--muted); font-size: 12px; }
.matches .ma { white-space: pre-wrap; font-size: 14px; color: var(--muted); max-height: 9em; overflow: auto; }
.src { font-weight: 700; color: var(--pink); }
.drop { border: 2px dashed rgba(115, 54, 148, .35); border-radius: 14px; padding: 38px; text-align: center;
  color: var(--muted); cursor: pointer; background: linear-gradient(135deg, rgba(51, 57, 169, .04), rgba(255, 111, 141, .05)); }
.drop strong { color: var(--text); }
.drop.over { border-color: var(--pink); color: var(--text); }
.samples { display: flex; flex-wrap: wrap; gap: 10px 22px; align-items: center; margin-top: 14px; }
.samples > .legend { flex-basis: 100%; }
.sample { display: inline-flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sample a { color: var(--accent); font-size: 13px; font-weight: 600; }
.bar { height: 8px; background: var(--field); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.bar div { height: 100%; width: 0; background: linear-gradient(90deg, var(--indigo), var(--royal), var(--pink)); transition: width .3s; }
.legend { color: var(--muted); font-size: 13px; }
.tbl-wrap { overflow-x: auto; border-radius: 14px; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden; font-size: 14px; }
th, td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid var(--border); }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: #fff; background: var(--ink); }
td.ans { white-space: pre-wrap; min-width: 320px; }
td.q { min-width: 220px; font-weight: 500; }
.kb-item { cursor: pointer; transition: border-color .15s, transform .15s; }
.kb-item:hover { border-color: rgba(115, 54, 148, .45); transform: translateY(-1px); }
.kb-item h3 { font-size: 15px; margin: 0 0 6px; }
.kb-item p { margin: 6px 0 0; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }
.toast { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 10;
  box-shadow: 0 8px 24px rgba(3, 2, 28, .3); }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(60% 70% at 85% 15%, rgba(255, 111, 141, .35) 0%, rgba(115, 54, 148, .25) 35%, transparent 65%),
    radial-gradient(60% 70% at 10% 90%, rgba(51, 57, 169, .55) 0%, transparent 65%),
    linear-gradient(180deg, #13124a 0%, var(--navy) 100%); }
.login { width: 100%; max-width: 380px; }
.login .head { text-align: center; color: #fff; margin-bottom: 22px; }
.login .head img { height: 44px; }
.login .head .eyebrow { margin-top: 18px; }
.login .head h1 { font-size: 26px; margin-top: 6px; }
.login .card { padding: 24px; }
.login button { width: 100%; margin-top: 14px; padding: 12px; }
.err { color: var(--danger); font-size: 14px; margin: 10px 0 0; }

@media (max-width: 640px) {
  .top { padding: 12px 16px 0; padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
  main { padding: 16px; }
  .brand img { height: 26px; } .brand .eyebrow { display: none; } h1 { font-size: 16px; }
  .row > select { min-width: 0; width: 100%; }
  .tabs { gap: 0; }
  .tabs button { padding: 10px 8px 12px; font-size: 11px; letter-spacing: .05em; white-space: nowrap; }
  .signout { padding: 5px 10px; font-size: 11px; white-space: nowrap; }
  /* results table → stacked cards */
  .tbl-wrap { box-shadow: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  table { border: 0; background: none; }
  tr { background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    margin-bottom: 12px; padding: 8px 0; box-shadow: var(--shadow); }
  td { border: 0; padding: 4px 16px; min-width: 0 !important; }
  td:first-child { color: var(--muted); font-size: 12px; }
  td.q { font-weight: 600; }
}
