/* ==========================================================================
   Profile ShortListing — vanilla frontend stylesheet
   "Engineering paper" theme: warm graph-paper background, near-black ink,
   black buttons. Frosted panels let the faint physics doodles bleed through.
   ========================================================================== */

:root {
  /* Surfaces */
  --paper: #f4f1e9;
  --panel: rgba(250, 248, 242, 0.9);
  --panel-solid: #faf8f2;
  --panel-inset: rgba(255, 255, 255, 0.72);

  /* Ink — darkened for stronger contrast over the paper background */
  --ink: #100e0a;          /* primary text — near black */
  --ink-soft: #2f2b22;     /* secondary text */
  --ink-faint: #4a4536;    /* tertiary / hints */

  /* Lines & accents (monochrome blueprint) */
  --line: rgba(22, 20, 15, 0.26);
  --line-strong: rgba(22, 20, 15, 0.46);
  --accent: #16140f;       /* black — buttons, primary actions */
  --accent-hover: #2c281f;
  --accent-contrast: #f6f3ec;

  /* Spot accent — a muted blueprint blue. Used sparingly for highlights
     (score/progress bars, active nav rail, focus rings, active choices) so the
     page keeps its black-ink/paper character but gains a little life. */
  --accent-color: #2f5f8a;
  --accent-color-hover: #274f74;
  --accent-color-soft: rgba(47, 95, 138, 0.12);
  --accent-color-line: rgba(47, 95, 138, 0.42);

  --ring: rgba(47, 95, 138, 0.55);   /* focus ring picks up the spot accent */

  /* Semantic (kept subtle so the page stays monochrome) */
  --good: #2f6f4f;
  --good-bg: rgba(47, 111, 79, 0.10);
  --warn: #9a6b16;
  --warn-bg: rgba(154, 107, 22, 0.10);
  --warn-line: rgba(154, 107, 22, 0.35);
  --bad: #9a2f2f;
  --bad-bg: rgba(154, 47, 47, 0.10);
  --bad-line: rgba(154, 47, 47, 0.35);

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(22, 20, 15, 0.06), 0 1px 3px rgba(22, 20, 15, 0.05);
  --shadow-md: 0 10px 30px -16px rgba(22, 20, 15, 0.45);

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --hand: "Segoe Print", "Bradley Hand", "Comic Sans MS", var(--sans);
  --mono: "Consolas", "SFMono-Regular", "Menlo", "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-width: 320px;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-color: var(--paper);
  /* Custom asterisk cursor across the whole page. `cursor` is inherited, so it
     flows to most elements; buttons/links/inputs keep their own (pointer/text)
     for affordance. */
  cursor: var(--page-cursor);
}

/* The engineering-paper background lives on a fixed layer *behind* all content,
   lightly blurred and softened so foreground text and tables read clearly while
   the doodles stay sharp-free in the back. The slight scale hides blurred edges. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: var(--paper);
  background-image: url("./engineering-bg.svg");
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  filter: blur(3px);
  transform: scale(1.05);
  opacity: 0.8;
}

h1, h2, h3 { color: var(--ink); margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--ink); text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; }

::selection { background: rgba(22, 20, 15, 0.16); }

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Scrollbar — keep it quiet and on-theme. */
* { scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }

/* ===== App shell ========================================================= */

.shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
  padding: 0 22px;
  background: rgba(244, 241, 233, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand__mark {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-sm);
}
.brand__title { font-size: 21px; font-weight: 800; font-style: italic; line-height: 1.2; }
.brand__subtitle { font-size: 12px; color: var(--ink-faint); }

.topbar__right { display: flex; align-items: center; gap: 12px; }
.topbar__user { font-size: 18px; font-weight: 800; font-style: italic; color: var(--ink); }

/* Circular user logo that reveals a sign-out icon on hover/focus. */
.user-logo {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--panel-inset);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.user-logo:hover,
.user-logo:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}
.user-logo__icon {
  grid-area: 1 / 1;            /* stack both icons in the same cell */
  display: grid;
  place-items: center;
  transition: opacity 0.15s ease;
}
.user-logo__icon svg { width: 20px; height: 20px; display: block; }
.user-logo__icon--hover { opacity: 0; }
.user-logo:hover .user-logo__icon--default,
.user-logo:focus-visible .user-logo__icon--default { opacity: 0; }
.user-logo:hover .user-logo__icon--hover,
.user-logo:focus-visible .user-logo__icon--hover { opacity: 1; }

.app-body { display: flex; flex: 1; min-height: 0; }

.sidebar {
  width: 280px;
  flex-shrink: 0;
  border-right: 1px solid var(--line);
  background: rgba(244, 241, 233, 0.55);
  padding: 18px 16px;
  display: none;
}
@media (min-width: 1024px) { .sidebar { display: block; } }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav__link {
  position: relative;
  display: block;
  padding: 9px 12px 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 550;
  color: var(--ink-soft);
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.nav__link:hover { background: rgba(22, 20, 15, 0.05); color: var(--ink); transform: translateX(2px); }
.nav__link.is-active { background: rgba(22, 20, 15, 0.08); color: var(--ink); font-weight: 650; }
.nav__link.is-active::before {
  content: "";
  position: absolute;
  left: 4px; top: 9px; bottom: 9px;
  width: 3px; border-radius: 999px;
  background: var(--accent-color);
  /* Grows in each time a link becomes active (sidebar re-mounts per route). */
  animation: nav-bar 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
  transform-origin: center;
}

.sidebar__section { margin-top: 22px; }
.sidebar__heading {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 8px;
}
.sidebar__version { margin-top: 22px; font-size: 11px; color: var(--ink-faint); }

.main {
  flex: 1;
  min-width: 0;
  padding: 26px clamp(16px, 4vw, 40px) 56px;
}
.view { max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }

/* ===== Typography blocks ================================================= */

.page-head h1 { font-size: 26px; }
.page-head p { margin-top: 6px; color: var(--ink-soft); font-size: 14px; max-width: 64ch; }
.eyebrow {
  font-family: var(--hand);
  font-size: 13px;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}

/* ===== Cards / panels ==================================================== */

.card {
  background: var(--panel);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card > h2 { font-size: 16px; }
.card__lead { margin-top: 6px; color: var(--ink-soft); font-size: 14px; }

.lift { transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease; }
.lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }

.inset {
  background: var(--panel-inset);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.mono { font-family: var(--mono); font-size: 12px; }
.break { word-break: break-word; overflow-wrap: anywhere; }

/* ===== Buttons =========================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
  user-select: none;
}
/* Hover lifts the button a hair; :active is declared after so a press still
   wins over hover and the button dips down. */
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: 0.55; }

/* Primary — solid black button with paper text. */
.btn--primary { background: var(--accent); color: var(--accent-contrast); box-shadow: var(--shadow-sm); }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); box-shadow: var(--shadow-md); }

/* Secondary — outlined, black text. */
.btn--ghost { background: var(--panel-inset); color: var(--ink); border-color: var(--line-strong); }
.btn--ghost:hover:not(:disabled) { background: rgba(22, 20, 15, 0.06); border-color: var(--ink); }

.btn--block { width: 100%; }
.btn--sm { padding: 7px 12px; font-size: 13px; }

/* ===== Forms ============================================================= */

.field { display: block; }
.field__label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field__hint { font-size: 12px; color: var(--ink-faint); margin-top: 6px; }

.input, .textarea, select.input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--panel-inset);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-faint); }
.input:focus, .textarea:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-color-soft);
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.input--narrow { width: 120px; }

/* Range slider — monochrome, engineering theme.
   The thumb is a paper "document" icon: a single page at 1, gaining pages and
   growing a bit bigger/wider as the value rises. ingest.js builds the icon and
   sets --thumb-img / --thumb-w / --thumb-h from the value. The tall input
   reserves vertical room for the largest thumb so it isn't clipped. */
/* Page cursor: a hand-drawn asterisk doodle on-theme with the engineering
   sketches. Drawn twice — a paper-toned halo under an ink asterisk — so it stays
   visible on both the light paper interior and the dark login board. Hotspot is
   the asterisk's center (13,13). */
:root { --page-cursor: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='26' height='26' viewBox='0 0 24 24' fill='none' stroke-linecap='round'><path d='M12 3 V21 M19.8 7.5 L4.2 16.5 M19.8 16.5 L4.2 7.5' stroke='%23f4f1e9' stroke-width='4.6'/><path d='M12 3 V21 M19.8 7.5 L4.2 16.5 M19.8 16.5 L4.2 7.5' stroke='%2316140f' stroke-width='2.4'/></svg>") 13 13, auto; }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%;
  height: 40px;                 /* room for the biggest thumb */
  background: transparent;
  outline: none;
  cursor: inherit;
}
/* Track */
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: var(--line-strong); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; background: var(--line-strong); }
/* Thumb — a paper "document" icon. Its image (--thumb-img: a file that gains
   pages) and dimensions (--thumb-w / --thumb-h) are built from the slider value
   in ingest.js. Re-centered on the 6px track via --thumb-h. No circle/border;
   the SVG carries its own outline, and hover/active use a shape-aware shadow. */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: var(--thumb-w, 16px); height: var(--thumb-h, 20px);
  margin-top: calc((6px - var(--thumb-h, 20px)) / 2);
  background: var(--thumb-img) center / contain no-repeat;
  border: none;
  cursor: inherit;
  transition: filter 0.15s ease;
  filter: drop-shadow(0 1px 1px rgba(22, 20, 15, 0.18));
}
input[type="range"]::-moz-range-thumb {
  width: var(--thumb-w, 16px); height: var(--thumb-h, 20px);
  background: var(--thumb-img) center / contain no-repeat;
  border: none;
  cursor: inherit;
  transition: filter 0.15s ease;
  filter: drop-shadow(0 1px 1px rgba(22, 20, 15, 0.18));
}
input[type="range"]:hover::-webkit-slider-thumb { filter: drop-shadow(0 2px 3px rgba(22, 20, 15, 0.32)); }
input[type="range"]:active::-webkit-slider-thumb { filter: drop-shadow(0 1px 2px rgba(22, 20, 15, 0.45)); }
input[type="range"]:hover::-moz-range-thumb { filter: drop-shadow(0 2px 3px rgba(22, 20, 15, 0.32)); }
input[type="range"]:active::-moz-range-thumb { filter: drop-shadow(0 1px 2px rgba(22, 20, 15, 0.45)); }
input[type="range"]:focus-visible::-webkit-slider-thumb { filter: drop-shadow(0 0 2px var(--ring)); }
input[type="range"]:focus-visible::-moz-range-thumb { filter: drop-shadow(0 0 2px var(--ring)); }

/* Radio "mode" cards */
.choice-grid { display: grid; gap: 12px; grid-template-columns: 1fr; margin-top: 16px; }
@media (min-width: 720px) { .choice-grid { grid-template-columns: repeat(3, 1fr); } }
.choice {
  display: flex; align-items: center; gap: 10px;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--panel-inset);
  cursor: pointer;
  font-size: 14px; font-weight: 550;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.choice:hover { border-color: var(--ink); }
.choice.is-active { border-color: var(--accent-color); background: var(--accent-color-soft); box-shadow: inset 0 0 0 1px var(--accent-color); }
.choice input { accent-color: var(--accent); width: 16px; height: 16px; }

/* Dropzone */
.dropzone {
  margin-top: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 168px;
  padding: 28px;
  text-align: center;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel-inset);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--accent); background: rgba(22, 20, 15, 0.05); }
.dropzone.is-drag { transform: scale(1.01); box-shadow: var(--shadow-md); }
.dropzone__title { font-weight: 600; }
.dropzone__hint { margin-top: 4px; font-size: 12px; color: var(--ink-faint); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ===== Stat / metric tiles ============================================== */

.tile-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) { .tile-grid--3 { grid-template-columns: repeat(3, 1fr); } .tile-grid--4 { grid-template-columns: repeat(4, 1fr); } .tile-grid--5 { grid-template-columns: repeat(5, 1fr); } }
.tile {
  background: var(--panel-inset);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 14px;
  color: var(--ink);
}
.tile__label { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.tile__value { font-size: 24px; font-weight: 700; margin-top: 2px; color: var(--ink); }
.tile__value--sm { font-size: 15px; font-weight: 600; color: var(--ink); }

/* ===== Progress & score bars =========================================== */

.bar { height: 8px; border-radius: 999px; background: rgba(22, 20, 15, 0.10); overflow: hidden; }
.bar__fill { height: 100%; border-radius: 999px; background: var(--accent-color); transition: width 0.4s ease; }
.bar__fill--anim { animation: grow 0.6s cubic-bezier(0.4, 0, 0.2, 1) both; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.score { display: flex; flex-direction: column; gap: 6px; }
.score__top { display: flex; justify-content: space-between; font-size: 12px; }
.score__label { color: var(--ink-faint); font-weight: 550; }
.score__pct { font-weight: 700; }

/* ===== Badges =========================================================== */

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--panel-inset);
  font-size: 12.5px; font-weight: 650;
  color: var(--ink);
}
.badge__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); }
/* Grade badges get a gentle tint by match quality (text stays ink for contrast). */
.badge--A { background: var(--good-bg); border-color: rgba(47, 111, 79, 0.4); }
.badge--A .badge__dot { background: var(--good); }
.badge--B { background: var(--accent-color-soft); border-color: var(--accent-color-line); }
.badge--B .badge__dot { background: var(--accent-color); }
.badge--C { background: var(--warn-bg); border-color: var(--warn-line); }
.badge--C .badge__dot { background: var(--warn); }
.badge--D { background: var(--bad-bg); border-color: var(--bad-line); }
.badge--D .badge__dot { background: var(--bad); }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-inset);
  font-size: 12px;
}
.chip__type { color: var(--ink-faint); }

/* ===== Candidate card =================================================== */

.candidate__head { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 720px) { .candidate__head { grid-template-columns: 1fr auto auto; } }
.candidate__rank {
  display: grid; place-items: center;
  width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--panel-inset);
  font-size: 12px; font-weight: 700;
}
.candidate__id { display: flex; gap: 12px; align-items: flex-start; }
.candidate__name { font-size: 18px; }
.candidate__title { margin-top: 2px; color: var(--ink-soft); font-size: 13px; }
.candidate__score {
  min-width: 96px; text-align: center;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel-inset); padding: 8px 12px;
}
.candidate__scores { display: grid; gap: 16px; grid-template-columns: 1fr; margin-top: 18px; }
@media (min-width: 720px) { .candidate__scores { grid-template-columns: repeat(3, 1fr); } }

details.details { margin-top: 18px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-inset); padding: 0; }
details.details > summary { cursor: pointer; padding: 12px 14px; font-size: 13px; font-weight: 600; list-style: none; }
details.details > summary::-webkit-details-marker { display: none; }
details.details > summary::after { content: "▾"; float: right; color: var(--ink-faint); transition: transform 0.2s ease; }
details.details[open] > summary::after { transform: rotate(180deg); }
.details__body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }

.reasoning {
  margin-top: 14px;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent-color);
  border-radius: var(--radius-sm);
  background: var(--panel-inset);
  padding: 12px 14px;
  font-size: 13px;
}
.reasoning__title { font-weight: 700; margin-bottom: 4px; }

/* ===== Alerts =========================================================== */

.alert { border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13.5px; border: 1px solid var(--line); }
.alert--error { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-line); }
.alert--warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.alert--warn strong { color: var(--warn); }
.alert__list { margin: 8px 0 0; padding-left: 18px; font-size: 12px; }

/* ===== Login ============================================================ */

/* The login page wears its own "chalkboard" theme: a dark drafting board with
   chalk-white physics sketches, distinct from the light paper interior. */
.login {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 20px;
  color: #f4f1e9;
  background-color: #15140f;
  background-image: url("./login-bg.svg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}
.login__inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; }

/* A crisp, near-solid paper card so it reads as light on the dark board. */
.login__card {
  width: 100%;
  max-width: 400px;
  color: var(--ink);
  background: #faf8f2;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 34px 30px;
  box-shadow:
    0 34px 80px -34px rgba(0, 0, 0, 0.85),
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 0 22px -4px rgba(170, 230, 210, 0.16),
    0 0 48px -12px rgba(47, 95, 138, 0.12);
}
.login__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login__title { font-size: 21px; font-weight: 800; font-style: italic; }
.login__hint { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.login__form { display: flex; flex-direction: column; gap: 16px; }
.login__demo { margin-top: 18px; font-size: 12px; color: var(--ink-faint); text-align: center; line-height: 1.6; }
.login__demo code { font-family: var(--mono); color: var(--ink-soft); }

/* Footer line sits on the dark board, below the card — chalk-toned. */
.login__foot {
  font-family: var(--hand);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: rgba(244, 241, 233, 0.55);
  text-align: center;
}

/* ===== Spinner / loading =============================================== */

.spinner {
  width: 16px; height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.center-state { min-height: 60vh; display: grid; place-items: center; color: var(--ink-soft); gap: 10px; }

/* ===== Toasts =========================================================== */

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--panel-solid);
  box-shadow: var(--shadow-md);
  font-size: 13px;
  animation: toast-in 0.2s ease both;
}
.toast--error { border-color: var(--bad-line); color: var(--bad); }
.toast--success { border-color: var(--good); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Two-column layout for the ingest page ========================== */

.split { display: grid; gap: 22px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 1200px) { .split { grid-template-columns: minmax(0, 1fr) 340px; } }

/* OneDrive counters */
.counter-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; text-align: center; }
.counter { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-inset); padding: 8px 4px; }
.counter--good { border-color: rgba(47, 111, 79, 0.4); }
.counter--bad { border-color: var(--bad-line); }
.counter__label { font-size: 11px; color: var(--ink-faint); }
.counter__value { font-size: 17px; font-weight: 700; margin-top: 2px; }
.counter { transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease; }
.counter:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); background: rgba(22, 20, 15, 0.05); }

/* ==========================================================================
   Motion & micro-interactions
   Route transitions, staggered content entrances, and hover/press feedback.
   Everything here is neutralized by the prefers-reduced-motion block at the
   very bottom, so users who ask for reduced motion get a calm, static UI.
   ========================================================================== */

html { scroll-behavior: smooth; }

/* ----- keyframes ----- */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
/* "Emerge": each box starts smaller and a touch lower — as if sitting behind
   the page — then scales up into its final position. Fast by design. */
@keyframes emerge { from { opacity: 0; transform: scale(0.86) translateY(14px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes nav-bar { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* ----- route / page-load transition ----- */
.view { animation: fade-in 0.22s ease both; }

/* On every page load/refresh the top-level boxes (and everything inside them,
   since the box carries its contents) emerge from behind into place, lightly
   staggered. Child combinator only, so in-page re-renders — e.g. the ingest
   mode toggle re-mounting a nested .stack — don't replay the cascade, and the
   topbar/sidebar (outside .view) never re-animate. `backwards` fill (not
   `forwards`) hides each box until its turn WITHOUT locking `transform`, so
   .lift hover still works after. */
.view > .stack > *,
.view > .split > * {
  animation: emerge 0.3s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.view > .stack > *:nth-child(1), .view > .split > *:nth-child(1) { animation-delay: 0s; }
.view > .stack > *:nth-child(2), .view > .split > *:nth-child(2) { animation-delay: 0.04s; }
.view > .stack > *:nth-child(3), .view > .split > *:nth-child(3) { animation-delay: 0.08s; }
.view > .stack > *:nth-child(4), .view > .split > *:nth-child(4) { animation-delay: 0.12s; }
.view > .stack > *:nth-child(5), .view > .split > *:nth-child(5) { animation-delay: 0.15s; }
.view > .stack > *:nth-child(n+6), .view > .split > *:nth-child(n+6) { animation-delay: 0.18s; }

/* Search result cards emerge as they mount (per-card delay set inline in
   search.js by result rank). */
.reveal { animation: emerge 0.3s cubic-bezier(0.22, 1, 0.36, 1) backwards; }

/* Sidebar emerges on load/navigation. Animates the persistent nav + status
   column (direct children), NOT their re-rendered inner sections, so updating
   the session/API-usage stats never replays the animation (no flicker). */
.sidebar > * { animation: emerge 0.3s cubic-bezier(0.22, 1, 0.36, 1) backwards; }
.sidebar > *:nth-child(1) { animation-delay: 0.03s; }
.sidebar > *:nth-child(2) { animation-delay: 0.1s; }

/* ----- cards: every card responds to hover (brightens + lifts shadow) ----- */
.card { transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s ease, background 0.25s ease; }
.card:hover { box-shadow: var(--shadow-md); border-color: var(--line-strong); background: var(--panel-solid); }

/* ----- stat tiles ----- */
.tile { transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease; }
.tile:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); background: rgba(22, 20, 15, 0.05); }

/* ----- inset boxes (sidebar status/usage cards, pool panels, etc.) ----- */
.inset { transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; }
.inset:hover { background: rgba(22, 20, 15, 0.05); border-color: var(--line-strong); box-shadow: var(--shadow-sm); }

/* ----- skill chips & grade badges ----- */
.chip, .badge { transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease; }
.chip:hover { border-color: var(--line-strong); transform: translateY(-1px); background: rgba(22, 20, 15, 0.05); }
/* Badges only lift on hover so the grade tint underneath is preserved. */
.badge:hover { transform: translateY(-1px); }

/* ----- inputs: gentle border on hover before focus takes over ----- */
.input:hover:not(:focus),
.textarea:hover:not(:focus),
select.input:hover:not(:focus) { border-color: var(--ink-faint); }

/* ----- collapsible details summary ----- */
details.details > summary { transition: background 0.15s ease; }
details.details > summary:hover { background: rgba(22, 20, 15, 0.04); }

/* ----- login card entrance: rises from below into the center ----- */
@keyframes login-card-in {
  0% { opacity: 0; transform: translateY(72px) scale(0.94); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
/* Gentle breathing glow around the card borders. */
@keyframes card-glow {
  0%, 100% {
    box-shadow:
      0 34px 80px -34px rgba(0, 0, 0, 0.85),
      0 0 0 1px rgba(255, 255, 255, 0.06),
      0 0 22px -4px rgba(170, 230, 210, 0.16),
      0 0 48px -12px rgba(47, 95, 138, 0.12);
  }
  50% {
    box-shadow:
      0 34px 80px -34px rgba(0, 0, 0, 0.85),
      0 0 0 1px rgba(255, 255, 255, 0.11),
      0 0 34px -2px rgba(170, 230, 210, 0.30),
      0 0 72px -8px rgba(47, 95, 138, 0.22);
  }
}
.login__card { animation: login-card-in 0.6s cubic-bezier(0.16, 1, 0.3, 1) both, card-glow 4.5s ease-in-out 0.6s infinite; }
/* Keep the glow running during/after a shake (shake replaces the animation list). */
.login__card.shake { animation: shake 0.4s ease both, card-glow 4.5s ease-in-out infinite; }

/* ----- respect the OS "reduce motion" setting: kill all motion ----- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Login page — animated chalkboard, input glow, button shine, validation
   ========================================================================== */

/* Decorative layer behind the card: drifting math + a heartbeat trace. */
.login__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Chalk math doodles drifting up and fading in/out (per-item position, size,
   delay and duration are set inline in login.js). */
.login__math {
  position: absolute;
  font-family: var(--hand);
  color: rgba(244, 241, 233, 0.8);
  text-shadow: 0 0 10px rgba(244, 241, 233, 0.25);
  white-space: nowrap;
  opacity: 0;
  animation-name: math-float;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}
@keyframes math-float {
  0% { opacity: 0; transform: translateY(18px); }
  18% { opacity: 0.5; }
  82% { opacity: 0.5; }
  100% { opacity: 0; transform: translateY(-24px); }
}

/* Heartbeat / ECG trace: a faint full line with a glowing segment scanning
   across it like a monitor. */
.login__ecg {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1200px;
  max-width: none;
  transform: translate(-50%, -50%);
  opacity: 0.55;
}
.login__ecg svg { width: 100%; height: auto; display: block; }
.login__ecg-base { fill: none; stroke: rgba(244, 241, 233, 0.12); stroke-width: 2; }
.login__ecg-pulse {
  fill: none;
  stroke: rgba(170, 230, 210, 0.9);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 0.16 0.84;     /* lit 16% segment, gap 84% */
  stroke-dashoffset: 1;
  filter: drop-shadow(0 0 5px rgba(150, 220, 200, 0.7));
  animation: ecg-scan 5s linear infinite;
}
@keyframes ecg-scan { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

.login__foot { animation: fade-in 0.7s ease 0.35s both; }

/* Refined uppercase, tracked field labels. */
.login__card .field__label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* Text boxes: a soft accent glow at rest, stronger on focus. */
.login__card .input {
  box-shadow: 0 0 10px -5px rgba(47, 95, 138, 0.3);
  transition: border-color 0.18s ease, box-shadow 0.28s ease, background 0.2s ease;
}
.login__card .input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px var(--accent-color-soft), 0 0 18px -2px rgba(47, 95, 138, 0.6);
}
.login__card .input.is-invalid { box-shadow: none; }

/* Sign-in button: keep the black look, add a hover shine sweep + soft glow. */
.login__card .btn--primary { position: relative; overflow: hidden; }
.login__card .btn--primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.22) 50%, transparent 65%);
  transform: translateX(-130%);
  transition: transform 0.6s ease;
  pointer-events: none;
}
.login__card .btn--primary:hover:not(:disabled)::after { transform: translateX(130%); }
.login__card .btn--primary:hover:not(:disabled) {
  box-shadow: 0 10px 26px -10px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(47, 95, 138, 0.25);
}

/* Field-level validation: red box + message, and a shake on bad submit. */
.field__error { margin-top: 6px; font-size: 12px; color: var(--bad); min-height: 1em; line-height: 1.3; }
.input.is-invalid { border-color: var(--bad-line); background: var(--bad-bg); }
.input.is-invalid:focus {
  border-color: var(--bad);
  box-shadow: 0 0 0 3px var(--bad-bg), 0 0 14px -2px rgba(154, 47, 47, 0.4);
}
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}
/* Note: .login__card.shake is defined in the motion section so the breathing
   glow keeps running during/after the shake. */
