:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #111827;
  --muted: #6b7280;
  --faint: #9ca3af;
  --border: #e3e6ea;
  --accent: #2f5bea;
  --accent-soft: #e8eefe;
  --star-bg: #fef3c7;
  --star-fg: #92400e;
  --urgent-bg: #fee2e2;
  --urgent-fg: #991b1b;
  --soon-bg: #fef3c7;
  --soon-fg: #92400e;
  --good-bg: #dcfce7;
  --good-fg: #166534;
  --new-bg: #e0e7ff;
  --new-fg: #3730a3;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1f232c;
    --text: #e8eaee;
    --muted: #9aa1ad;
    --faint: #6b7280;
    --border: #2a2f3a;
    --accent: #7c9cff;
    --accent-soft: #1d2747;
    --star-bg: #3b2f12;
    --star-fg: #fcd34d;
    --urgent-bg: #3f1717;
    --urgent-fg: #fca5a5;
    --soon-bg: #3b2f12;
    --soon-fg: #fcd34d;
    --good-bg: #12301f;
    --good-fg: #86efac;
    --new-bg: #232a4d;
    --new-fg: #c7d2fe;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
/* Elements with their own display (flex rows) must still hide. */
[hidden] { display: none !important; }

/* Headings and the wordmark. Self-hosted (SIL Open Font License), so the
   page makes no requests to Google. Body text uses the device's own font. */
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("fonts/plus-jakarta-sans.woff2") format("woff2");
  font-weight: 700 800;
  font-style: normal;
  font-display: swap;
}
:root { --heading: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-bottom: 48px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ------------------------------------------------------------ header */

.top {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 16px 0 12px; }
.logo {
  display: grid; place-items: center; width: 36px; height: 36px; flex: none;
  border-radius: 10px; background: var(--accent); color: #fff; font-weight: 800;
}
h1 { margin: 0; font-size: 18px; line-height: 1.2; }

/* "Ahmad's Trackr", with Trackr struck through on a diagonal. */
.wordmark { font-family: var(--heading); font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.struck { position: relative; display: inline-block; color: var(--muted); }
.struck::after {
  content: ""; position: absolute; left: -6%; right: -6%; top: 50%;
  height: 3px; border-radius: 3px; background: var(--accent);
  transform: rotate(-16deg);
}
.hello { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.save { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.save.error { color: var(--urgent-fg); }
.gear {
  flex: none; appearance: none; border: 1px solid var(--border); background: var(--surface);
  width: 36px; height: 36px; border-radius: 10px; cursor: pointer; font-size: 18px; color: var(--muted);
}
.gear[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* Summary row under the header: its own quiet strip, scrolling away with the page. */
.stats {
  display: flex; gap: 8px; padding: 16px 16px 2px; margin: 0 -16px;
  overflow-x: auto; scrollbar-width: none;
}
.stats::-webkit-scrollbar { display: none; }
.stats:empty { display: none; }
.stat {
  flex: none; padding: 4px 11px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
}
.stat strong { color: var(--text); font-weight: 700; margin-right: 2px; }
.stat.alert strong { color: var(--urgent-fg); }

.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; }
.tabs button {
  appearance: none; border: 0; background: none; color: var(--muted);
  font: inherit; font-family: var(--heading); font-weight: 700; padding: 10px 12px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.count {
  display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--surface-2); font-size: 12px; text-align: center;
}
.count:empty { display: none; }

/* ---------------------------------------------------------- controls */

.controls { display: grid; gap: 10px; padding: 14px 0 4px; }
.search input {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 16px; /* 16px stops iOS zooming in */
}
.search input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; appearance: none; cursor: pointer;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 600;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.row { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--muted); }
.row label { display: flex; align-items: center; gap: 6px; }
select {
  font: inherit; font-size: 14px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px;
}
.summary { color: var(--muted); font-size: 13px; margin: 8px 0; }

.message {
  margin: 24px 0; padding: 18px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.message h2 { margin: 0 0 6px; font-family: var(--heading); font-size: 17px; }
.message p { margin: 0; color: var(--muted); }

/* ------------------------------------------------------------- cards */

.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 14px 12px; box-shadow: var(--shadow);
}
.card.star-card { border-color: color-mix(in srgb, var(--star-fg) 35%, var(--border)); }
.card.is-done { opacity: 0.72; }
.card-head { display: flex; align-items: flex-start; gap: 10px; }
.firm-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.firm { font-family: var(--heading); font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.badge { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.badge.star { background: var(--star-bg); color: var(--star-fg); }
.badge.new { background: var(--new-bg); color: var(--new-fg); }
.badge.closed { background: var(--surface-2); color: var(--muted); }
.when {
  flex: none; font-size: 12px; padding: 2px 8px; border-radius: 6px;
  color: var(--muted); white-space: nowrap;
}
.when.urgent { background: var(--urgent-bg); color: var(--urgent-fg); font-weight: 700; }
.when.soon { background: var(--soon-bg); color: var(--soon-fg); font-weight: 700; }
.title {
  display: block; margin-top: 2px; color: var(--accent); text-decoration: none;
  font-size: 15px; overflow-wrap: anywhere;
}
.title:hover { text-decoration: underline; }
.meta { margin-top: 6px; font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 8px; }
.kind { font-weight: 700; color: var(--text); background: var(--surface-2); padding: 0 7px; border-radius: 999px; }

.apply { margin-top: 8px; font-size: 13px; }
.apply summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.apply-body { margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); line-height: 1.6; }
.apply-body .label { color: var(--muted); }
.apply-body .flag {
  display: inline-block; margin: 2px 4px 0 0; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--border); color: var(--text);
}
.apply-body .flag.rolling { background: var(--soon-bg); color: var(--soon-fg); }
.apply-body .flag.good { background: var(--good-bg); color: var(--good-fg); }
.apply-body .practice a {
  display: inline-block; margin: 2px 10px 0 0; color: var(--accent); font-weight: 600; text-decoration: none;
}
.apply-body .practice a::after { content: " ↗"; font-size: 11px; }
.practice .tip { display: block; margin-top: 2px; color: var(--text); }
.apply-body .hint { color: var(--faint); font-size: 12px; }

.actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.status select { font-weight: 600; padding: 6px 8px; }
.status select[data-status="applied"],
.status select[data-status="online_test"],
.status select[data-status="interview"] { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.status select[data-status="offer"] { background: var(--good-bg); border-color: transparent; color: var(--good-fg); }
.status select[data-status="rejected"] { background: var(--urgent-bg); border-color: transparent; color: var(--urgent-fg); }
.status select[data-status="not_interested"] { color: var(--muted); }
.note-toggle {
  appearance: none; border: 0; background: none; cursor: pointer; padding: 6px 4px;
  color: var(--muted); font: inherit; font-size: 13px; font-weight: 600;
}
.note textarea {
  display: block; width: 100%; margin-top: 8px; resize: vertical; min-height: 44px;
  padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 16px;
}

.next-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; }
.next { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; }
.next input {
  font: inherit; font-size: 14px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; min-height: 32px;
}
.next-badge {
  padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent);
}
.next-badge.urgent { background: var(--urgent-bg); color: var(--urgent-fg); }
.practice-quick {
  margin-top: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2);
  font-size: 13px; line-height: 1.6;
}
.practice-quick .label { color: var(--muted); font-weight: 600; }
.practice-quick a { display: inline-block; margin-right: 10px; color: var(--accent); font-weight: 600; text-decoration: none; }
.practice-quick a::after { content: " ↗"; font-size: 11px; }
.practice-quick .tip { display: block; }

/* ------------------------------------------------------------- join */

.join {
  margin: 16px 0 0; padding: 16px; border-radius: 14px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.join h2 { margin: 0 0 4px; font-family: var(--heading); font-size: 17px; }
.join p { margin: 0; font-size: 14px; color: var(--text); }
.join-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.join-form input[type="email"] {
  flex: 1 1 200px; min-width: 0; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 16px;
}
.join-form button {
  flex: none; appearance: none; border: 0; cursor: pointer; padding: 10px 16px; border-radius: 10px;
  background: var(--accent); color: #fff; font: inherit; font-weight: 700;
}
.join-form button:disabled { opacity: 0.6; cursor: default; }
.join .trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.join-note { margin-top: 8px !important; font-size: 13px !important; color: var(--muted) !important; }
.join-note.ok { color: var(--good-fg) !important; font-weight: 600; }
.join-note.error { color: var(--urgent-fg) !important; font-weight: 600; }
.join h2 { font-size: 20px; line-height: 1.25; }
.hero-stats { margin-top: 10px !important; font-size: 13px !important; font-weight: 700; color: var(--accent) !important; }
.join-form .join-name { flex: 1 1 120px; }
.join-form input[type="text"] {
  min-width: 0; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 16px;
}
.paste-form { margin-top: 12px; font-size: 13px; color: var(--muted); }
.paste-row { display: flex; gap: 8px; margin-top: 6px; }
.paste-row input {
  flex: 1; min-width: 0; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 16px;
}
.paste-row button, .primary {
  flex: none; appearance: none; border: 0; cursor: pointer; padding: 9px 16px; border-radius: 10px;
  background: var(--accent); color: #fff; font: inherit; font-weight: 700;
}
.demo-hint { margin-top: 12px !important; font-size: 13px !important; color: var(--muted) !important; }

/* --------------------------------------------------------- settings */

.settings {
  margin: 16px 0 0; padding: 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.settings h2 { margin: 0 0 10px; font-family: var(--heading); font-size: 17px; }
.settings h3 { margin: 0 0 4px; font-family: var(--heading); font-size: 15px; }
.field { display: grid; gap: 6px; margin: 0 0 14px; padding: 0; border: 0; font-size: 14px; }
.field legend { padding: 0; margin-bottom: 6px; font-weight: 700; }
.field > label { display: flex; align-items: center; gap: 8px; }
.field input[type="text"] {
  padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: 16px;
}
.field input[type="radio"], .field input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.hint { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.settings-actions { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.install { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 14px; }
.install p { margin: 0 0 8px; color: var(--muted); }

/* ------------------------------------------------------------ stats */

.owner-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 16px 0; }
.tile { padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.tile strong { display: block; font-family: var(--heading); font-size: 24px; }
.tile span { font-size: 12px; color: var(--muted); }
.owner-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 6px; }
.owner-list li { padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); font-size: 14px; }
.owner-list .muted { color: var(--muted); font-size: 12px; display: block; margin-top: 2px; }
#owner-stats h2 { font-family: var(--heading); font-size: 15px; margin: 18px 0 8px; }

/* --------------------------------------------------------- feedback */

.feedback summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.feedback form { display: grid; gap: 8px; margin-top: 10px; }
.feedback textarea, .feedback input[type="email"] {
  width: 100%; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px;
}
.feedback .primary { justify-self: start; }
.feedback .trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.foot { margin: 32px 0 0; font-size: 13px; color: var(--muted); display: grid; gap: 10px; }
.foot p { margin: 0; }
.link-button {
  appearance: none; border: 0; background: none; padding: 0; cursor: pointer;
  color: var(--accent); font: inherit; font-weight: 600;
}

/* ---------------------------------------------------------- pipeline */

.stage { margin: 18px 0 0; }
.stage h2 { font-family: var(--heading); font-size: 15px; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.stage h2 .count { font-weight: 600; }
.empty { color: var(--muted); text-align: center; padding: 32px 8px; }

@media (min-width: 720px) {
  .stats { margin: 0; padding: 18px 0 2px; flex-wrap: wrap; }
  .controls { grid-template-columns: 1fr; }
  .chips { margin: 0; padding: 0; flex-wrap: wrap; }
}
