/* Career Command Centre — design system.
   Principles: calm, minimal, fast, accessible. One accent, generous space,
   system typography, restrained motion. WCAG AA contrast in both themes. */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light dark;

  /* Light theme (default) */
  --bg: #f6f6f4;
  --bg-elev: #ffffff;
  --bg-sunk: #efeeea;
  --ink: #16171a;
  --ink-2: #55585f;
  --ink-3: #85888f;
  --line: #e2e1dc;
  --line-2: #d3d2cc;
  --accent: #2f5bd4;        /* AA on white and on --bg */
  --accent-ink: #ffffff;
  --accent-soft: #e8eefc;
  --good: #1f7a4d;
  --good-soft: #e2f2e9;
  --warn: #9a5b00;
  --warn-soft: #fbeeda;
  --bad: #b3261e;
  --bad-soft: #fbe7e5;

  --excellent: #1f7a4d;
  --strong: #2f5bd4;
  --fair: #9a5b00;
  --weak: #85888f;

  --radius: 16px;
  --radius-sm: 11px;
  --radius-lg: 22px;
  --shadow: 0 1px 2px rgba(20,23,26,.05), 0 6px 20px rgba(20,23,26,.06);
  --shadow-lg: 0 2px 6px rgba(20,23,26,.06), 0 18px 48px rgba(20,23,26,.12);
  --maxw: 1080px;
  --tap: 44px;
  --ease: cubic-bezier(.2,.7,.3,1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0c0f;
    --bg-elev: #16181d;
    --bg-sunk: #101216;
    --ink: #f2f3f5;
    --ink-2: #b3b7c0;
    --ink-3: #7c828d;
    --line: #24272e;
    --line-2: #2f333c;
    --accent: #7aa0ff;
    --accent-ink: #0b0c0f;
    --accent-soft: #1a2540;
    --good: #58c896;
    --good-soft: #12271e;
    --warn: #e0a458;
    --warn-soft: #2a2113;
    --bad: #f0837b;
    --bad-soft: #2c1614;
    --excellent: #58c896;
    --strong: #7aa0ff;
    --fair: #e0a458;
    --weak: #7c828d;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.4);
    --shadow-lg: 0 2px 6px rgba(0,0,0,.5), 0 24px 60px rgba(0,0,0,.6);
  }
}
/* Explicit theme override wins in both directions */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--accent); text-decoration: none; }
button { font: inherit; cursor: pointer; }
svg { flex: none; }
textarea, input, select { font: inherit; color: inherit; }

/* ---------- Accessibility primitives ---------- */
.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;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 200;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 16px; border-radius: 10px; transform: translateY(-150%);
  transition: transform .15s var(--ease);
}
.skip-link:focus { transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---------- Shell ---------- */
.shell { min-height: 100vh; }
.content {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 20px 120px;
}
.content:focus { outline: none; }

/* Top bar (desktop) */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
  padding: 14px 20px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 620; letter-spacing: -.01em; }
.brand__mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--good)));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}
.brand__accent { color: var(--ink-3); font-weight: 500; }
.topnav { display: flex; gap: 4px; }
.topnav .nav__link {
  padding: 8px 14px; border-radius: 999px; color: var(--ink-2); font-weight: 550; font-size: 15px;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.topnav .nav__link:hover { background: var(--bg-sunk); color: var(--ink); }
.topnav .nav__link.is-active { background: var(--accent-soft); color: var(--accent); }

/* Bottom tab bar (mobile) */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  display: none;
  justify-content: space-around;
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-top: 1px solid var(--line);
}
.tabbar .nav__link {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-height: var(--tap); padding: 6px 4px; border-radius: 12px;
  color: var(--ink-3); font-size: 11px; font-weight: 600;
}
.tabbar .nav__link.is-active { color: var(--accent); }
.tabbar__icon svg { width: 24px; height: 24px; }
.tabbar__icon { display: grid; place-items: center; }

@media (max-width: 720px) {
  .topnav { display: none; }
  .tabbar { display: flex; }
  .content { padding: 16px 16px 96px; }
}

/* ---------- Dashboard ---------- */
.dash__header { margin-bottom: 22px; }
.dash__eyebrow { color: var(--ink-3); font-weight: 600; font-size: 14px; }
.dash__title { font-size: clamp(1.55rem, 5vw, 2.1rem); letter-spacing: -.02em; font-weight: 680; margin-top: 2px; }
.dash__feedmeta, .dash__feedmeta a { color: var(--ink-3); font-size: 13.5px; margin-top: 8px; }
.feed__seed { color: var(--warn); }

.hero {
  display: block; margin-bottom: 26px; padding: 22px;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s var(--ease);
  position: relative; overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background: radial-gradient(120% 100% at 100% 0%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%);
}
.hero:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.hero[data-band="excellent"] { border-color: color-mix(in srgb, var(--excellent) 40%, var(--line)); }
.hero__label { color: var(--accent); font-weight: 650; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.hero__label svg { width: 16px; height: 16px; }
.hero__body { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-top: 10px; }
.hero__title { font-size: clamp(1.2rem, 3.5vw, 1.55rem); letter-spacing: -.01em; font-weight: 640; }
.hero__org { color: var(--ink-2); margin-top: 4px; font-size: 15px; }
.hero__why { color: var(--ink); margin-top: 10px; font-size: 15px; }

.tiles {
  display: grid; gap: 12px; margin-bottom: 30px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.tile {
  display: flex; flex-direction: column; gap: 2px;
  padding: 16px; background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink);
  transition: transform .15s var(--ease), border-color .15s var(--ease);
  min-height: 92px; justify-content: center;
}
a.tile:hover { transform: translateY(-2px); border-color: var(--line-2); }
.tile__value { font-size: 1.7rem; font-weight: 680; letter-spacing: -.02em; line-height: 1.1; }
.tile__label { color: var(--ink-2); font-size: 13.5px; font-weight: 560; }
.tile__sub { color: var(--ink-3); font-size: 12px; }
.tile--accent .tile__value { color: var(--accent); }
.tile--warn .tile__value { color: var(--warn); }

.dash__section { margin-top: 30px; }
.section__title {
  display: flex; align-items: center; gap: 8px;
  font-size: 1.05rem; font-weight: 640; letter-spacing: -.01em; margin-bottom: 14px; color: var(--ink);
}
.section__title svg { width: 18px; height: 18px; color: var(--accent); }

/* ---------- Cards ---------- */
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.card {
  display: flex; flex-direction: column; gap: 12px;
  padding: 18px; background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), border-color .15s var(--ease);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card:focus { outline: none; }
.card[data-band="excellent"] { border-left: 3px solid var(--excellent); }
.card[data-band="strong"] { border-left: 3px solid var(--strong); }
.card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.card__titlewrap { min-width: 0; }
.card__title { font-size: 1.12rem; font-weight: 620; letter-spacing: -.01em; line-height: 1.25; }
.card__titlelink { color: var(--ink); }
.card__titlelink:hover { color: var(--accent); }
.card__org { display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 14px; margin-top: 4px; }
.card__org svg { width: 15px; height: 15px; color: var(--ink-3); }

.card__facts { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.card__facts li { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 14px; }
.card__facts svg { width: 16px; height: 16px; color: var(--ink-3); }
.card__facts .is-urgent { color: var(--warn); font-weight: 600; }
.card__facts .is-urgent svg { color: var(--warn); }
.card__facts .is-closed { color: var(--ink-3); text-decoration: line-through; }

.tag { padding: 1px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--bg-sunk); }
.tag--remote { background: var(--good-soft); color: var(--good); }
.tag--hybrid { background: var(--accent-soft); color: var(--accent); }
.tag--office { background: var(--warn-soft); color: var(--warn); }

.card__why { background: var(--bg-sunk); border-radius: var(--radius-sm); padding: 12px 14px; }
.card__whylabel { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 650; color: var(--accent); margin-bottom: 6px; }
.card__whylabel svg { width: 15px; height: 15px; }
.card__why ul { display: flex; flex-direction: column; gap: 4px; }
.card__why li { font-size: 14px; color: var(--ink); padding-left: 14px; position: relative; }
.card__why li::before { content: "·"; position: absolute; left: 2px; color: var(--accent); font-weight: 700; }

.card__caution { display: flex; align-items: flex-start; gap: 7px; font-size: 13.5px; color: var(--warn); }
.card__caution svg { width: 16px; height: 16px; margin-top: 1px; }

.card__status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 620; }
.card__status svg { width: 15px; height: 15px; }
.card__status--applied, .card__status--interviewing { color: var(--good); }
.card__status--saved, .card__status--maybe { color: var(--accent); }
.card__status--rejected { color: var(--ink-3); }

.card__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.act, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 12px; border-radius: 11px;
  border: 1px solid var(--line-2); background: var(--bg-elev); color: var(--ink-2);
  font-size: 14px; font-weight: 560;
  transition: background .12s var(--ease), color .12s var(--ease), border-color .12s var(--ease);
}
.act { flex: 1 1 auto; }
.act svg, .btn svg { width: 17px; height: 17px; }
.act:hover, .btn:hover { background: var(--bg-sunk); color: var(--ink); border-color: var(--line-2); }
.act.is-on { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.act--danger.is-on, .btn--danger.is-on { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.act--open, .btn--primary { color: var(--ink); }

/* ---------- Score ring ---------- */
.ring { position: relative; width: 48px; height: 48px; flex: none; display: grid; place-items: center; }
.ring__track { stroke: var(--line-2); stroke-width: 4; fill: none; }
.ring__val { stroke-width: 4; fill: none; stroke-linecap: round; transition: stroke-dashoffset .6s var(--ease); }
.ring__num { position: absolute; font-size: 14px; font-weight: 700; letter-spacing: -.02em; }
.ring--excellent .ring__val { stroke: var(--excellent); }
.ring--strong .ring__val { stroke: var(--strong); }
.ring--fair .ring__val { stroke: var(--fair); }
.ring--weak .ring__val { stroke: var(--weak); }

/* ---------- Pills / chips ---------- */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.pill--new { background: var(--accent); color: var(--accent-ink); margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: 999px; background: var(--bg-sunk); color: var(--ink-2); font-size: 13px; font-weight: 560; }
.chip--clear { color: var(--accent); background: var(--accent-soft); }
.chip--pos { background: var(--good-soft); color: var(--good); }
.chip--neg { background: var(--bad-soft); color: var(--bad); }

/* ---------- Lists / controls ---------- */
.list__header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.list__header h1 { font-size: clamp(1.4rem, 4vw, 1.8rem); letter-spacing: -.02em; font-weight: 680; }
.list__count { color: var(--ink-3); font-size: 14px; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.control { display: flex; align-items: center; gap: 8px; background: var(--bg-elev); border: 1px solid var(--line-2); border-radius: 12px; padding: 0 12px; min-height: 44px; }
.control svg { width: 18px; height: 18px; color: var(--ink-3); }
.control--search { flex: 1 1 260px; }
.control input[type="search"] { border: 0; background: transparent; outline: none; width: 100%; min-width: 0; padding: 10px 0; }
.control select { border: 0; background: transparent; outline: none; padding: 10px 24px 10px 0; -webkit-appearance: none; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: right 8px center, right 3px center; background-size: 5px 5px; background-repeat: no-repeat; }
.control--check { cursor: pointer; }
.control--check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- Detail ---------- */
.backlink { display: inline-flex; align-items: center; gap: 2px; color: var(--ink-2); font-weight: 560; margin-bottom: 14px; }
.backlink svg { width: 18px; height: 18px; transform: rotate(180deg); }
.detail__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.detail__title { font-size: clamp(1.4rem, 5vw, 2rem); letter-spacing: -.02em; font-weight: 680; line-height: 1.15; }
.detail__org { display: flex; align-items: center; gap: 7px; color: var(--ink-2); margin-top: 6px; }
.detail__org svg { width: 17px; height: 17px; color: var(--ink-3); }

.detail__facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; padding: 16px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); }
.detail__facts li { display: flex; align-items: center; gap: 10px; }
.detail__facts svg { width: 20px; height: 20px; color: var(--ink-3); }
.detail__facts .k { display: block; font-size: 12px; color: var(--ink-3); }
.detail__facts .v { display: block; font-weight: 600; }
.detail__facts .is-urgent .v { color: var(--warn); }

.view--detail section { margin-bottom: 26px; }
.view--detail section h2 { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; font-weight: 640; margin-bottom: 12px; }
.view--detail section h2 svg { width: 18px; height: 18px; color: var(--accent); }
.why__list { display: flex; flex-direction: column; gap: 10px; }
.why__list li { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; }
.why__list svg { width: 18px; height: 18px; color: var(--good); margin-top: 2px; }
.why__cautions { margin-top: 16px; padding: 14px; background: var(--warn-soft); border-radius: var(--radius-sm); }
.why__cautions h3 { font-size: 14px; color: var(--warn); margin-bottom: 8px; }
.why__cautions ul { display: flex; flex-direction: column; gap: 8px; }
.why__cautions li { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; color: var(--ink); }
.why__cautions svg { width: 16px; height: 16px; color: var(--warn); margin-top: 2px; }

.bars { display: flex; flex-direction: column; gap: 10px; }
.bar { display: grid; grid-template-columns: 130px 1fr 34px; align-items: center; gap: 12px; }
.bar__label { font-size: 13.5px; color: var(--ink-2); }
.bar__track { height: 8px; background: var(--bg-sunk); border-radius: 999px; overflow: hidden; }
.bar__fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .5s var(--ease); }
.bar__pct { font-size: 13px; font-weight: 600; text-align: right; color: var(--ink-2); }

.desc { color: var(--ink); font-size: 15px; }
.desc p { margin-bottom: 12px; }
.notes { width: 100%; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--bg-elev); resize: vertical; }
.notes__saved { color: var(--good); font-size: 13px; height: 18px; margin-top: 4px; }
.detail__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.detail__actions .btn { flex: 1 1 auto; min-height: 46px; }
.btn--primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); color: var(--accent-ink); }

/* ---------- Pipeline / applications ---------- */
.pipe { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.pipe__col { background: var(--bg-sunk); border-radius: var(--radius); padding: 12px; }
.pipe__title { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 640; margin-bottom: 10px; color: var(--ink-2); }
.pipe__count { background: var(--bg-elev); border-radius: 999px; padding: 1px 9px; font-size: 12px; }
.pipe__items { display: flex; flex-direction: column; gap: 8px; }
.pipe__card { display: flex; flex-direction: column; gap: 2px; padding: 12px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.pipe__card:hover { border-color: var(--line-2); }
.pipe__jobtitle { font-weight: 600; font-size: 14.5px; color: var(--ink); }
.pipe__org { font-size: 13px; color: var(--ink-2); }
.pipe__meta { font-size: 12px; color: var(--ink-3); }
.pipe__empty { color: var(--ink-3); text-align: center; padding: 8px; }

/* ---------- Settings ---------- */
.panel { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.panel h2 { font-size: 1.05rem; font-weight: 640; margin-bottom: 8px; }
.panel__meta { color: var(--ink-2); font-size: 14px; margin-bottom: 12px; }
.panel__hint { color: var(--ink-3); font-size: 13px; margin-top: 10px; }
.panel__ok { color: var(--good); font-weight: 600; margin-bottom: 12px; }
.notice { background: var(--bg-sunk); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 14px; font-size: 14px; }
.notice ol { list-style: decimal; padding-left: 20px; margin: 10px 0; display: flex; flex-direction: column; gap: 8px; }
.notice code { background: var(--bg-elev); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.toggle { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.toggle input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.field { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; flex-wrap: wrap; }
.field select { min-height: 40px; border: 1px solid var(--line-2); border-radius: 10px; padding: 0 12px; background: var(--bg-elev); }
.dna { list-style: decimal; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; color: var(--ink); }
.dna li { font-weight: 600; }
.dna span { color: var(--ink-3); font-weight: 400; font-size: 13px; margin-left: 6px; }
.panel .btn { margin-top: 8px; }

/* ---------- Misc ---------- */
.empty { text-align: center; color: var(--ink-3); padding: 48px 20px; font-size: 15px; }
.muted { color: var(--ink-3); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

@media (max-width: 720px) {
  .bar { grid-template-columns: 108px 1fr 30px; }
  .detail__actions .btn { flex: 1 1 40%; }
}
