/* CS Tutorials — the records page.
 *
 * One palette, one scale, one shape. Every measurement below is deliberate:
 *   4 · 8 · 12 · 16 · 20 · 24 · 32 · 48   — spacing
 *   11 · 12 · 13 · 15 · 19 · 30           — type, in px
 *   8 · 12 · 16                           — radii
 * Anything that is not in those lists should not be in this file.
 */

:root {
  /* surfaces */
  --bg:            #081120;
  --bg-glow:       #122a47;
  --surface:       #0d1a2c;
  --surface-2:     #101f34;
  --line:          #1e3252;
  --line-soft:     #182a45;

  /* ink */
  --ink:           #eaf1fa;
  --ink-2:         #a9bcd4;
  --ink-3:         #7f95b0;

  /* accent */
  --gold:          #d4af37;
  --gold-ink:      #f4d67a;
  --gold-wash:     rgba(212, 175, 55, .10);
  --go:            #e8892f;
  --go-ink:        #201407;
  --ok:            #6dbf8f;
  --due:           #e5b06b;
  --bad:           #e2796a;

  --radius:        16px;
  --radius-s:      12px;
  --radius-xs:     8px;
  --ring:          0 0 0 2px var(--bg), 0 0 0 4px rgba(212, 175, 55, .55);

  --ease:          cubic-bezier(.2, .7, .3, 1);
  --t:             160ms;
}

* { box-sizing: border-box; }

/* .btn and .iconbtn set a display, which would beat the hidden attribute;
   the sign-out tools must be genuinely gone before anyone signs in. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 620px at 50% -18%, var(--bg-glow) 0%, var(--bg) 58%, #050c17 100%);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: 48px;
}

b, strong { font-weight: 650; }
.num, .stat__v, .row__meta, time { font-variant-numeric: tabular-nums; }

.skip {
  position: absolute; left: 12px; top: -48px; z-index: 40;
  padding: 10px 14px; border-radius: var(--radius-xs);
  background: var(--gold); color: #1c1503; font-weight: 700; text-decoration: none;
  transition: top var(--t) var(--ease);
}
.skip:focus { top: 12px; }

/* ---------------------------------------------------------------- header */
.top {
  position: sticky; top: 0; z-index: 30;
  background: rgba(8, 17, 32, .86);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.top__in {
  max-width: 1080px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.brand__mark {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px;
  display: block;
}
.brand__text { display: grid; min-width: 0; }
.brand__text strong {
  font-size: 15px; font-weight: 650; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand__text em {
  font-style: normal; font-size: 11px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-3); margin-top: 1px;
}
.top__tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.who {
  display: none; align-items: center; gap: 7px;
  margin: 0 6px 0 0; font-size: 12px; color: var(--ink-2);
}
.who i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(109, 191, 143, .14); }
@media (min-width: 620px) { .who { display: flex; } }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--radius-xs);
  background: var(--surface-2); color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 600; letter-spacing: -.005em;
  cursor: pointer; white-space: nowrap;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease), transform 80ms var(--ease);
}
.btn:hover { background: #16283f; border-color: #27405f; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn--ghost { background: transparent; }
.btn--go {
  background: var(--gold); border-color: var(--gold); color: #1c1503;
}
.btn--go:hover { background: #dfbb4a; border-color: #dfbb4a; }
.btn--quiet { background: transparent; border-color: transparent; color: var(--ink-2); padding: 0 10px; }
.btn--quiet:hover { background: rgba(255, 255, 255, .04); color: var(--ink); }
.btn--sm { min-height: 32px; font-size: 12.5px; padding: 0 12px; }

.iconbtn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--radius-xs);
  background: transparent; color: var(--ink-2); cursor: pointer;
  transition: color var(--t) var(--ease), background var(--t) var(--ease);
}
.iconbtn:hover { color: var(--ink); background: var(--surface-2); }
.iconbtn:focus-visible { outline: none; box-shadow: var(--ring); }

/* ------------------------------------------------------------------ tabs */
.tabs {
  position: sticky; top: 55px; z-index: 29;
  background: rgba(8, 17, 32, .9);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.tabs__in {
  max-width: 1080px; margin: 0 auto; padding: 0 16px;
  display: flex; gap: 24px; overflow-x: auto; scrollbar-width: none;
}
.tabs__in::-webkit-scrollbar { display: none; }
.tab {
  position: relative; flex: 0 0 auto;
  padding: 14px 2px 12px;
  border: 0; background: none; cursor: pointer;
  color: var(--ink-3); font: inherit; font-size: 13.5px; font-weight: 600;
  transition: color var(--t) var(--ease);
}
.tab:hover { color: var(--ink-2); }
.tab::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--gold); border-radius: 2px 2px 0 0;
  transform: scaleX(0); transform-origin: left;
  transition: transform var(--t) var(--ease);
}
.tab[aria-selected="true"] { color: var(--gold-ink); }
.tab[aria-selected="true"]::after { transform: scaleX(1); }
.tab:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
.tab__n {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  border-radius: 99px; background: rgba(255, 255, 255, .06);
  font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.tab[aria-selected="true"] .tab__n { background: var(--gold-wash); color: var(--gold-ink); }

/* ----------------------------------------------------------------- cards */
.wrap { max-width: 1080px; margin: 0 auto; padding: 20px 16px 0; }

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .015), transparent 120px), var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.card--flush { padding-bottom: 6px; }
.card__head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 18px 18px 0;
}
.card__head--pad { padding-bottom: 14px; }
.card__head h2 { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.sub { margin: 4px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--ink-3); max-width: 60ch; }
.sub--right { text-align: right; margin: 0; }

.grid { display: grid; gap: 16px; }
@media (min-width: 860px) { .grid { grid-template-columns: 1fr 1fr; } .grid .card { margin-bottom: 16px; } }

/* ----------------------------------------------------------------- stats */
.stats {
  display: grid; grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line-soft); margin-top: 16px;
}
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  padding: 14px 18px 16px;
  border-bottom: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
}
.stat:nth-child(2n) { border-right: 0; }
@media (min-width: 700px) {
  .stat { border-bottom: 0; }
  .stat:nth-child(2n) { border-right: 1px solid var(--line-soft); }
  .stat:last-child { border-right: 0; }
}
.stat__v {
  margin: 0; font-size: 30px; line-height: 1.1; font-weight: 620; letter-spacing: -.03em;
}
.stat__k {
  margin: 5px 0 0; font-size: 11px; letter-spacing: .085em; text-transform: uppercase; color: var(--ink-3);
}
.stat__d { margin: 6px 0 0; font-size: 12px; color: var(--ink-3); }
.stat__d.up { color: var(--ok); }
.stat__d.warn { color: var(--due); }
.stat__d.bad { color: var(--bad); }
.stats--tight .stat { padding: 12px 18px 14px; }
.stats--tight .stat__v { font-size: 22px; }

/* ------------------------------------------------------------ week strip */
.week {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  /* start, not end: a column with an empty code would otherwise sit lower than
     its neighbours and the labels would stagger. */
  align-items: start; padding: 16px 18px 18px;
}
@media (min-width: 720px) {
  .week { max-width: 620px; }
  .day__b { max-width: 58px; }
}
.day { display: grid; justify-items: center; gap: 5px; }
.day b { font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.day span { font-size: 10px; letter-spacing: .09em; color: var(--ink-3); }
.day u { display: block; min-height: 13px; font-size: 9.5px; letter-spacing: .08em; color: #5d7391; text-decoration: none; }
.day__b {
  width: 100%; max-width: 44px; height: 72px; border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, var(--go), var(--gold-ink));
  transform-origin: bottom; transform: scaleY(var(--h));
  min-height: 3px;
}
.day:nth-child(2) .day__b,
.day:nth-child(3) .day__b,
.day:nth-child(5) .day__b,
.day:nth-child(6) .day__b,
.day:nth-child(7) .day__b {
  background: linear-gradient(180deg, #2a4468, #1c3251);
}
.day--nil b { color: var(--ink-3); }
.day--nil .day__b { background: #16263c; }

/* ---------------------------------------------------------------- rows */
.rows { list-style: none; margin: 0; padding: 0; }
.row { border-top: 1px solid var(--line-soft); }
.row:first-child { border-top: 1px solid var(--line-soft); }
.row__hit {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 13px 18px;
  background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer;
  transition: background var(--t) var(--ease);
}
.row__hit:hover { background: rgba(255, 255, 255, .022); }
.row__hit:focus-visible { outline: none; box-shadow: inset 0 0 0 2px rgba(212, 175, 55, .45); }
.row__hit--static { cursor: default; }
.row__main { min-width: 0; flex: 1 1 auto; display: grid; gap: 2px; }
.row__main b { font-size: 13.5px; font-weight: 600; letter-spacing: -.005em; }
.row__main span { font-size: 12.5px; color: var(--ink-3); }
@media (min-width: 560px) { .row__main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } }
.row__meta { flex: 0 0 auto; font-size: 12.5px; color: var(--ink-2); }
.row__extra { font-size: 12px; color: var(--ink-3); }

/* Narrow: the counts drop to their own line under the name, so a long name
   never gets squeezed to one word per line. */
@media (max-width: 719px) {
  .row__hit { flex-wrap: wrap; }
  .row__main { flex: 1 1 62%; }
  .row__extra { flex: 0 0 100%; order: 3; margin-top: 2px; }
}
@media (min-width: 720px) {
  .row__extra { margin-left: auto; margin-right: 24px; }
  .row__extra + .row__meta { min-width: 84px; text-align: right; }
}
.row__chev {
  flex: 0 0 auto; width: 16px; height: 16px; position: relative; opacity: .5;
  transition: transform var(--t) var(--ease), opacity var(--t) var(--ease);
}
.row__chev::before {
  content: ""; position: absolute; inset: 3px 4px 3px 5px;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor;
  transform: rotate(-45deg); border-radius: 1px;
}
.row[data-open] .row__chev { transform: rotate(90deg); opacity: .9; }
.row__more {
  padding: 0 18px 16px;
  animation: drop 180ms var(--ease);
}
@keyframes drop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.row__note { margin: 0 0 12px; font-size: 12.5px; line-height: 1.55; color: var(--ink-2); max-width: 62ch; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; }

.dl { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
@media (min-width: 700px) { .dl { grid-template-columns: repeat(4, 1fr); } }
.dl div { min-width: 0; }
.dl dt { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.dl dd { margin: 2px 0 0; font-size: 13px; color: var(--ink); }

.rows__empty { margin: 0; padding: 22px 18px; font-size: 13px; color: var(--ink-3); text-align: center; }

/* --------------------------------------------------------------- lists */
.rows--flush .row:first-child { border-top: 0; }
/* ---------------------------------------------------------------- tags */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 650; letter-spacing: .02em;
  background: rgba(255, 255, 255, .055); color: var(--ink-2);
  white-space: nowrap;
}
.tag b { color: var(--ink); letter-spacing: .1em; }
.tag--live { background: var(--gold-wash); color: var(--gold-ink); border: 1px solid rgba(212, 175, 55, .24); }
.tag--ok { background: rgba(109, 191, 143, .12); color: #8fd6a9; }
.tag--due { background: rgba(229, 176, 107, .13); color: #efc48c; }
.tag--lapse { background: rgba(226, 121, 106, .13); color: #f0a196; }

/* --------------------------------------------------------------- search */
.tools { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.search {
  display: flex; align-items: center; gap: 7px;
  height: 36px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 99px;
  background: rgba(0, 0, 0, .18); color: var(--ink-3);
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
  max-width: 210px;
}
.search:focus-within { border-color: #33507a; box-shadow: 0 0 0 3px rgba(51, 80, 122, .22); }
.search input {
  width: 100%; border: 0; background: none; color: var(--ink);
  font: inherit; font-size: 13px; outline: none;
}
.search input::placeholder { color: var(--ink-3); }
@media (max-width: 559px) {
  .card__head--tools { flex-wrap: wrap; }
  .tools { width: 100%; }
  .search { max-width: none; flex: 1 1 auto; }
}

/* ----------------------------------------------------------------- form */
.form { padding: 16px 18px 18px; display: grid; gap: 12px; }
.form__row { display: grid; gap: 12px; }
@media (min-width: 520px) { .form__row { grid-template-columns: 1fr 1fr; } }
.field { display: grid; gap: 6px; }
.field > span { font-size: 10.5px; letter-spacing: .085em; text-transform: uppercase; color: var(--ink-3); }
.field input {
  width: 100%; min-height: 42px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius-xs);
  background: rgba(0, 0, 0, .22); color: var(--ink);
  font: inherit; font-size: 14px;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.field input:hover { border-color: #27405f; }
.field input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 175, 55, .16); }
.field input::placeholder { color: #667c99; }
.form__foot { display: flex; gap: 8px; align-items: center; padding-top: 2px; }

/* ----------------------------------------------------------- disclosure */
.why { padding: 0 18px 16px; }
.why summary {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 0; font-size: 12px; color: var(--ink-3);
  cursor: pointer; list-style: none;
  transition: color var(--t) var(--ease);
}
.why summary:hover { color: var(--ink-2); }
.why summary::-webkit-details-marker { display: none; }
.why summary::before {
  content: "?"; display: grid; place-items: center;
  width: 15px; height: 15px; border-radius: 50%;
  border: 1px solid var(--line); font-size: 9.5px; color: var(--ink-3);
}
.why summary:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
.why p { margin: 8px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--ink-2); max-width: 66ch; }

/* ---------------------------------------------------------------- toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 50;
  transform: translate(-50%, 12px);
  max-width: min(92vw, 420px);
  padding: 11px 16px 11px 14px;
  border: 1px solid #2a4064; border-left: 3px solid var(--gold);
  border-radius: 10px;
  background: #0f1f36; color: var(--ink);
  font-size: 13px; line-height: 1.45;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
  opacity: 0; pointer-events: none;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

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

/* ---------------------------------------------------------------- print */
@media print {
  body { background: #fff; color: #000; }
  .top, .tabs, .toast, .tools, .why, .row__chev { display: none !important; }
  .card { break-inside: avoid; border-color: #ccc; }
}

/* ------------------------------------------------------- live-page additions */

/* With the install button present the header has five things in it; on a phone
   the subtitle goes first, then the label, so the title never truncates. */
@media (max-width: 559px) {
  .top__in { gap: 10px; padding: 10px 12px; }
  .brand__text em { display: none; }
  .install__t { display: none; }
  .btn[data-install] { padding: 0; width: 38px; }
  #signout { padding: 0 12px; }
}

.msg { min-height: 18px; margin: 2px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--gold-ink); }
.msg--bad { color: #f0a196; }

.gatecard { max-width: 460px; margin: clamp(24px, 9vh, 84px) auto 0; }
.gatecard .form { padding-top: 14px; }

.field select {
  width: 100%; min-height: 42px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius-xs);
  background: rgba(0, 0, 0, .22); color: var(--ink);
  font: inherit; font-size: 14px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%237f95b0' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.field select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 175, 55, .16); }

.form--tight { padding: 12px 18px 18px; border-top: 1px solid var(--line-soft); gap: 10px; }

.issue {
  margin-top: 4px; padding: 12px;
  border: 1px dashed rgba(212, 175, 55, .35); border-radius: var(--radius-s);
  background: var(--gold-wash);
}
.issue__n { margin: 0 0 10px; font-size: 13px; color: var(--ink); letter-spacing: .01em; }
.issue__n b { color: var(--gold-ink); font-variant-numeric: tabular-nums; }

/* rows that are not buttons still need the same padding rhythm */
.row__hit--static { cursor: default; }
.row__hit--static:hover { background: transparent; }

/* a quiet button inside a static row should not stretch the row */
.row .btn--quiet { flex: 0 0 auto; }

/* code you can copy, a split line under the figures, a quiet footer */
.tag--button { border: 1px solid rgba(212, 175, 55, .24); cursor: pointer; font-family: inherit; }
.tag--button:hover { background: rgba(212, 175, 55, .18); }
.tag--button:focus-visible { outline: none; box-shadow: var(--ring); }

.footnote { margin: 12px 18px 2px; font-size: 12.5px; color: var(--ink-3); }

.pagefoot {
  margin: 6px 2px 28px; padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px; line-height: 1.6; color: var(--ink-3);
}

.check { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; line-height: 1.5; color: var(--ink-3); }
.check input { margin: 2px 0 0; width: 16px; height: 16px; accent-color: var(--gold); flex: 0 0 auto; }

/* an empty count pill would look like a missing figure */
.tab__n:empty { display: none; }
