/* MTM Content — the YM family look (matches content-marketing-ym, booking-radar, CoS),
   with no YM logo: this is a Georgia State program, not a Yonas Media property.
   Ben, 2026-08-09: "should look like YM content minus the logo."
   Every colour is a custom property. No literals below the token blocks. */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --ink: #1f2328;
  --ink-2: #656d76;
  --ink-3: #6a737d;   /* AA on white AND surface-2 — was #8b949e at 3.08:1 */
  --line: #d1d9e0;
  --accent: #0969da;
  --accent-ink: #ffffff;
  --accent-soft: rgba(9, 105, 218, 0.08);
  --good: #1a7f37;
  --good-soft: rgba(26, 127, 55, 0.1);
  --warn: #cf222e;
  --warn-soft: rgba(207, 34, 46, 0.1);
  --chip: rgba(175, 184, 193, 0.2);
  --yellow: #9a6700;
  --yellow-bg: rgba(154, 103, 0, 0.1);
  /* Georgia State blue. THE brand colour, from MTM Tracker. Constant in both themes —
     a brand that changes shade with the OS setting is not a brand. */
  --mtm-blue: #0039A6;
  --mtm-blue-ink: #ffffff;
  --mtm-blue-dim: #c7d7f2;      /* Tracker's text-blue-200 on the bar */
  --mtm-blue-soft: rgba(255, 255, 255, 0.2);   /* active nav */
  --mtm-blue-hover: rgba(255, 255, 255, 0.1);
  --shadow: 0 12px 40px rgba(0, 0, 0, .25);
  --scrim: rgba(0, 0, 0, .45);
  --bar-shadow: rgba(0, 0, 0, .25);
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

[data-theme="dark"] {
  --bg: #0f1117;
  --surface: #161b22;
  --surface-2: #1b212a;
  --ink: #f0f6fc;
  --ink-2: #8b949e;
  --ink-3: #808893;   /* AA on all three dark surfaces — was #6e7681 at 3.77:1 */
  --line: #2d333b;
  --accent: #388bfd;
  --accent-ink: #ffffff;
  --accent-soft: rgba(56, 139, 253, 0.15);
  --good: #3fb950;
  --good-soft: rgba(63, 185, 80, 0.15);
  --warn: #f85149;
  --warn-soft: rgba(248, 81, 73, 0.15);
  --chip: rgba(110, 118, 129, 0.2);
  --yellow: #d29922;
  --yellow-bg: rgba(210, 153, 34, 0.15);
}

@media (prefers-color-scheme: dark) {
  /* 🔴 Guarded with :not([data-theme="light"]) — without it, someone who explicitly
     chose light still gets dark on a dark-mode machine. Identical tokens to the
     block above; a test asserts the two never drift apart. */
  :root:not([data-theme="light"]) {
    --bg: #0f1117;
    --surface: #161b22;
    --surface-2: #1b212a;
    --ink: #f0f6fc;
    --ink-2: #8b949e;
    --ink-3: #808893;   /* AA on all three dark surfaces — was #6e7681 at 3.77:1 */
    --line: #2d333b;
    --accent: #388bfd;
    --accent-ink: #ffffff;
    --accent-soft: rgba(56, 139, 253, 0.15);
    --good: #3fb950;
    --good-soft: rgba(63, 185, 80, 0.15);
    --warn: #f85149;
    --warn-soft: rgba(248, 81, 73, 0.15);
    --chip: rgba(110, 118, 129, 0.2);
    --yellow: #d29922;
    --yellow-bg: rgba(210, 153, 34, 0.15);
  }
}

* { box-sizing: border-box; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 -apple-system, "Segoe UI", Helvetica, Arial, sans-serif; }
button { font: inherit; }
a { color: var(--accent); }
h1, h2, h3 { font-weight: 700; }

/* ---- top bar: MTM Tracker's colour and mark, on the YM shell ---- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  min-height: 64px; padding: 0 16px;              /* Tracker's h-16 */
  background: var(--mtm-blue);
  box-shadow: 0 1px 3px var(--bar-shadow);
  position: sticky; top: 0; z-index: 20; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; white-space: nowrap; text-decoration: none; }
.brand-logo { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }  /* round mark, never squared */
.brand-name { color: var(--mtm-blue-ink); font-weight: 700; font-size: 18px; letter-spacing: -.02em; }
.ver { font-size: 10px; font-family: var(--mono); color: var(--mtm-blue-dim); align-self: flex-end; margin-bottom: 3px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  padding: 8px 16px; border-radius: 6px; border: none; cursor: pointer;
  font-size: 13px; font-weight: 500; background: none; color: var(--mtm-blue-dim);
  transition: background-color .15s, color .15s;
}
.tab:hover { background: var(--mtm-blue-hover); color: var(--mtm-blue-ink); }
.tab.is-active { background: var(--mtm-blue-soft); color: var(--mtm-blue-ink); font-weight: 600; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.iconbtn {
  background: none; border: 1px solid var(--mtm-blue-soft); border-radius: 6px;
  padding: 5px 9px; cursor: pointer; color: var(--mtm-blue-dim); font-size: 13px;
}
.iconbtn:hover { background: var(--mtm-blue-hover); color: var(--mtm-blue-ink); }

main { padding: 18px 16px 60px; max-width: 1100px; margin: 0 auto; }
.view { display: none; }
.view.is-active { display: block; }

h2 { font-size: 15px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar h2 { flex: 1; }
.lede { color: var(--ink-2); font-size: 12.5px; max-width: 70ch; margin-bottom: 16px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: flex-end; }
.inline-form input, .inline-form select { width: auto; flex: 1 1 170px; }

/* ---- buttons ---- */
button {
  font-size: 12.5px; font-weight: 600; padding: 7px 13px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.ghost { border: none; color: var(--ink-2); background: none; }
button.money { background: var(--yellow-bg); border-color: var(--yellow); color: var(--yellow); }
button:disabled { opacity: .5; cursor: default; }

/* ---- inputs ---- */
label { display: block; font-size: 11px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px;
  font: 13px inherit; background: var(--surface); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ---- cards ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.card {
  border: 1px solid var(--line); border-radius: 10px; padding: 14px 14px 12px;
  background: var(--surface); display: flex; flex-direction: column; gap: 9px;
  text-align: left; width: 100%; font: inherit; color: var(--ink);
}
button.card { cursor: pointer; }
button.card:hover { border-color: var(--accent); }
.card h3 { font-size: 14.5px; }
.card-meta { font-size: 11.5px; color: var(--ink-2); }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); padding: 9px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }

.pill { display: inline-block; font-size: 10px; font-weight: 700; border-radius: 5px; padding: 1px 6px; text-transform: uppercase; letter-spacing: .04em; }
.pill-draft, .pill-done, .pill-unknown { background: var(--chip); color: var(--ink-2); }
.pill-ready { background: var(--accent-soft); color: var(--accent); }
.pill-live, .pill-approved, .pill-granted { background: var(--good-soft); color: var(--good); }
.pill-awaiting_ben { background: var(--yellow-bg); color: var(--yellow); }
.pill-declined, .pill-refused { background: var(--warn-soft); color: var(--warn); }

.amount { font-family: var(--mono); font-weight: 700; }

/* ---- money. Deliberately not the accent: it must never look like ordinary UI. ---- */
.money-strip {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--yellow-bg); border: 1px solid var(--yellow); color: var(--yellow);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 16px; font-size: 12.5px;
}
.money-strip strong { font-weight: 700; }

/* ---- ledger ---- */
.ledger-term { margin-bottom: 20px; }
.ledger-term > h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); margin-bottom: 8px; }
.totals { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.total { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.total.is-waiting { border-color: var(--yellow); background: var(--yellow-bg); }
.total .figure { font-family: var(--mono); font-size: 19px; font-weight: 700; display: block; }
.total.is-waiting .figure { color: var(--yellow); }
.total .label { font-size: 11px; color: var(--ink-2); }
.caveat { color: var(--ink-3); font-size: 11.5px; margin-top: 10px; max-width: 70ch; }

.blockers { margin: 0; padding-left: 18px; color: var(--warn); font-size: 12.5px; }
.blockers li { margin-bottom: 5px; }
.clear-note { color: var(--good); font-weight: 600; font-size: 12.5px; }

.notice { color: var(--ink-3); padding: 24px 0; text-align: center; font-size: 13px; }
.notice.bad { color: var(--warn); background: var(--warn-soft); border-radius: 10px; padding: 14px; text-align: left; }

/* ---- modal: the YM twin's shape, not a drawer of my own invention ---- */
.modal-overlay {
  position: fixed; inset: 0; background: var(--scrim); z-index: 40;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 14px; overflow-y: auto;
}
.modal { width: 100%; max-width: 560px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.modal .m-head { padding: 15px 18px 4px; }
.modal h3 { font-size: 15px; }
.modal .m-sub { font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.m-body { padding: 12px 18px; display: flex; flex-direction: column; gap: 10px; }
.m-body h4 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.m-row { display: flex; gap: 10px; flex-wrap: wrap; }
.field { flex: 1; min-width: 140px; }
.m-foot {
  display: flex; gap: 8px; justify-content: flex-end; padding: 13px 18px;
  border-top: 1px solid var(--line); background: var(--surface-2);
  align-items: center; border-radius: 0 0 12px 12px; flex-wrap: wrap;
}
.m-foot .note { margin-right: auto; font-size: 11.5px; color: var(--ink-3); }

#toast {
  position: fixed; bottom: 44px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 8px;
  font-size: 13px; z-index: 60; opacity: 0; transition: opacity .2s;
  pointer-events: none; max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; }
#toast.bad { background: var(--warn); color: var(--accent-ink); }

/* ---- phone: thumbs, not mice. Checked at 390px, not by shrinking a window. ---- */
@media (max-width: 640px) {
  .topbar { padding: 8px 12px; gap: 8px; }
  .tabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { padding: 11px 14px; font-size: 14px; }          /* ~44px tall */
  button { padding: 11px 15px; font-size: 13.5px; }
  .iconbtn { padding: 9px 12px; }
  input, select, textarea { font-size: 16px; }            /* under 16px, iOS zooms the page */
  main { padding: 14px 12px 64px; }
  .cards { grid-template-columns: 1fr; }
  .modal-overlay { padding: 12px 10px 40px; }
  .m-foot { justify-content: stretch; }
  .m-foot button { flex: 1; }
  .totals { grid-template-columns: 1fr 1fr; }
  .total .figure { font-size: 17px; }
}

/* ---- gate ---- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.gate-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 24px; width: min(460px, 100%); display: grid; gap: 12px;
}
.gate-logo { width: 48px; height: 48px; border-radius: 50%; }
.gate-card h1 { font-size: 17px; }
.gate-sub { color: var(--ink-2); font-size: 12.5px; }
.gate-note { font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 11px 12px; color: var(--ink-2); }
.gate-note code { font-family: var(--mono); }

footer.app-foot {
  position: fixed; bottom: 0; left: 0; right: 0; padding: 8px 16px;
  border-top: 1px solid var(--line); font-size: 11px; color: var(--ink-3);
  display: flex; justify-content: space-between; gap: 12px; background: var(--surface);
}
