/* ══════════════════════════════════════════════════════════════════════════
   Tool-specific styling: the login screen, TrueString, the servers dashboard,
   the file picker, and the small pieces the expense books use.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── login ───────────────────────────────────────────────────────────────── */

.login {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: var(--s-6);
  background: var(--bg-sunk);
}

.login-card {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--s-8) var(--s-6) var(--s-6);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-6);
  text-align: center;
}
.login-brand .brand-mark { width: 52px; height: 52px; border-radius: var(--r-lg); }
.login-brand .brand-mark svg { width: 28px; height: 28px; }
.login-title { font-size: var(--fs-lg); letter-spacing: -0.025em; }
.login-sub { font-size: var(--fs-sm); color: var(--text-muted); }

.login-form { display: flex; flex-direction: column; gap: var(--s-4); }
.login-foot {
  margin-top: var(--s-5);
  padding-top: var(--s-4);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-xs);
  color: var(--text-subtle);
  text-align: center;
  line-height: var(--lh-snug);
}

/* ══ TrueString ═══════════════════════════════════════════════════════════ */

.tuner {
  display: grid;
  gap: var(--s-4);
  max-width: 620px;
  margin: 0 auto;
}

/* ── the string selector ─────────────────────────────────────────────────
   Six wide targets. Deliberately manual: automatic string detection guesses
   wrong on a detuned string exactly when you need it most. */
.string-picker {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--s-2);
}

.string-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: var(--s-3) var(--s-1);
  min-height: 74px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease);
  cursor: pointer;
}
.string-btn:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.string-btn:active { transform: scale(0.97); }

.string-btn.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}

.string-no {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  color: var(--text-subtle);
  letter-spacing: 0.04em;
}
.string-btn.is-active .string-no { color: var(--accent-text); }

.string-note {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semi);
  letter-spacing: -0.02em;
  line-height: 1;
}
.string-btn.is-active .string-note { color: var(--accent-text); }

.string-hz {
  font-size: 10px;
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}

/* A thicker line under the lower strings, so the picker looks like a nut. */
.string-gauge {
  width: 60%;
  border-radius: var(--r-sm);
  background: var(--text-subtle);
  opacity: 0.5;
  margin-top: 2px;
}

@media (max-width: 480px) {
  .string-picker { gap: 5px; }
  .string-btn { min-height: 66px; padding: var(--s-2) 2px; }
  .string-note { font-size: var(--fs-md); }
  .string-hz { font-size: 9px; }
}

/* ── the meter ───────────────────────────────────────────────────────────── */

.tuner-meter {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-6) var(--s-5) var(--s-5);
  overflow: hidden;
  transition: border-color var(--t-base) var(--ease), background var(--t-base) var(--ease);
}

/* In tune: the whole panel confirms it, not just a number. */
.tuner-meter.is-tuned {
  border-color: var(--ok);
  background: color-mix(in srgb, var(--ok) 7%, var(--surface));
}

.tuner-readout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-1);
  margin-bottom: var(--s-5);
}

.tuner-note {
  font-size: 3.4rem;
  font-weight: var(--fw-semi);
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.tuner-meter.is-tuned .tuner-note { color: var(--ok); }

.tuner-octave { font-size: var(--fs-md); color: var(--text-subtle); vertical-align: super; margin-left: 2px; }

.tuner-hz {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.tuner-instruction {
  font-size: var(--fs-base);
  font-weight: var(--fw-semi);
  min-height: 1.5em;
  text-align: center;
}
.tuner-instruction.is-flat  { color: var(--warn); }
.tuner-instruction.is-sharp { color: var(--warn); }
.tuner-instruction.is-tuned { color: var(--ok); }
.tuner-instruction.is-idle  { color: var(--text-subtle); font-weight: var(--fw-normal); }

/* ── the cents scale ─────────────────────────────────────────────────────── */

.cents-scale {
  position: relative;
  height: 62px;
  margin: var(--s-4) 0 var(--s-2);
}

.cents-ticks {
  position: absolute;
  inset: 0 0 22px 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.cents-tick {
  width: 1px;
  background: var(--border-strong);
  height: 10px;
  border-radius: var(--r-sm);
}
.cents-tick.is-major { height: 20px; width: 2px; background: var(--text-subtle); }
/* The centre tick is the target; make it unmistakable. */
.cents-tick.is-centre { height: 30px; width: 2px; background: var(--ok); }

.cents-labels {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-xs);
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}

/* The needle. Transform only — animating `left` would jitter on every frame. */
.cents-needle {
  position: absolute;
  top: 0;
  bottom: 22px;
  left: 50%;
  width: 3px;
  margin-left: -1.5px;
  border-radius: var(--r-sm);
  background: var(--warn);
  transition: transform 90ms linear, background var(--t-base) var(--ease), opacity var(--t-base) var(--ease);
  will-change: transform;
  box-shadow: 0 0 10px color-mix(in srgb, var(--warn) 50%, transparent);
}
.cents-needle.is-tuned { background: var(--ok); box-shadow: 0 0 14px color-mix(in srgb, var(--ok) 60%, transparent); }
.cents-needle.is-idle { opacity: 0.22; background: var(--text-subtle); box-shadow: none; }

/* The band inside which a string counts as in tune. */
.cents-zone {
  position: absolute;
  top: 0;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--ok) 15%, transparent);
  border-left: 1px solid color-mix(in srgb, var(--ok) 35%, transparent);
  border-right: 1px solid color-mix(in srgb, var(--ok) 35%, transparent);
  pointer-events: none;
}

.cents-value {
  text-align: center;
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-weight: var(--fw-medium);
}

/* ── signal strength ─────────────────────────────────────────────────────── */

.tuner-signal {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-size: var(--fs-xs);
  color: var(--text-subtle);
}
.signal-bar {
  flex: 1;
  height: 4px;
  border-radius: var(--r-sm);
  background: var(--chart-track);
  overflow: hidden;
}
.signal-fill {
  height: 100%;
  border-radius: var(--r-sm);
  background: var(--text-subtle);
  transition: width 100ms linear, background var(--t-base) var(--ease);
}
.signal-fill.is-good { background: var(--ok); }

/* ── tuning list ─────────────────────────────────────────────────────────── */

.tuning-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
  width: 100%;
  text-align: left;
  transition: background var(--t-fast) var(--ease);
}
.tuning-row:last-child { border-bottom: none; }
.tuning-row:hover { background: var(--surface-hover); }
.tuning-row.is-active { background: var(--accent-soft); }

.tuning-notes {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}
.tuning-note-pill {
  min-width: 26px;
  padding: 1px 5px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
.tuning-row.is-active .tuning-note-pill { background: var(--surface); color: var(--accent-text); }

/* The string editor grid inside the tuning modal. */
.string-editor {
  display: grid;
  grid-template-columns: 46px 1fr 84px 92px;
  gap: var(--s-2);
  align-items: center;
}
.string-editor-head {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
}
.string-editor .input, .string-editor .select { height: 34px; min-height: 34px; }
.string-editor .hz {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ══ servers ══════════════════════════════════════════════════════════════ */

.server-card { position: relative; }

.server-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border-subtle);
}

.server-icon {
  width: 38px; height: 38px;
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  flex: none;
  background: var(--tint-soft, var(--surface-3));
  color: var(--tint, var(--text-muted));
}
.server-icon svg { width: 20px; height: 20px; }

.server-name { font-size: var(--fs-base); font-weight: var(--fw-semi); }
.server-meta { font-size: var(--fs-xs); color: var(--text-subtle); }

/* Volume / disk usage rows */
.usage-row { display: flex; flex-direction: column; gap: 5px; }
.usage-head { display: flex; align-items: baseline; gap: var(--s-2); font-size: var(--fs-sm); }
.usage-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usage-figures { font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: var(--fs-xs); }
.usage-pct { font-variant-numeric: tabular-nums; font-weight: var(--fw-semi); }
.usage-pct.is-warn { color: var(--warn); }
.usage-pct.is-danger { color: var(--danger); }

/* Plex stream rows */
.stream-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
}
.stream-row:last-child { border-bottom: none; }
.stream-progress {
  height: 3px;
  border-radius: var(--r-sm);
  background: var(--chart-track);
  overflow: hidden;
  margin-top: 5px;
}
.stream-progress span { display: block; height: 100%; background: var(--warn); }

/* ══ files ════════════════════════════════════════════════════════════════ */

.target-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--s-3);
}

.target-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  text-align: left;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
  cursor: pointer;
}
.target-card:hover:not(:disabled) { border-color: var(--border-strong); background: var(--surface-hover); }
.target-card.is-active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.target-card:disabled { opacity: 0.55; cursor: not-allowed; }
.target-card svg { width: 20px; height: 20px; color: var(--text-muted); }
.target-card.is-active svg { color: var(--accent-text); }
.target-name { font-weight: var(--fw-semi); font-size: var(--fs-sm); }
.target-detail { font-size: var(--fs-xs); color: var(--text-subtle); line-height: var(--lh-snug); }

/* Drop zone */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: var(--s-8) var(--s-5);
  text-align: center;
  color: var(--text-muted);
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
  cursor: pointer;
}
.dropzone:hover, .dropzone.is-over {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-text);
}
.dropzone svg { width: 28px; height: 28px; margin: 0 auto var(--s-2); }

/* Remote folder browser */
.browser {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface-2);
}
.browser-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  width: 100%;
  text-align: left;
  font-size: var(--fs-sm);
  border-bottom: 1px solid var(--border-subtle);
}
.browser-row:last-child { border-bottom: none; }
.browser-row:hover { background: var(--surface-hover); }
.browser-row svg { width: 16px; height: 16px; color: var(--text-subtle); flex: none; }
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  flex-wrap: wrap;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-bottom: var(--s-2);
}
.breadcrumb button { color: var(--accent-text); }
.breadcrumb button:hover { text-decoration: underline; }

/* ══ expense pieces ═══════════════════════════════════════════════════════ */

/* The big figure at the top of a book page. */
.hero-figure {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}
.hero-amount {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-semi);
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.hero-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
}

/* Category picker inside the entry form: a two-level list, not a nested select
   — a nested <select> is unusable with a thumb. */
.cat-picker { display: flex; flex-direction: column; gap: var(--s-3); max-height: 340px; overflow-y: auto; }
.cat-group-name {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
}
.cat-options { display: flex; flex-wrap: wrap; gap: var(--s-2); }

/* Undocumented spending is a real category of its own; it gets a visual mark
   so a glance at a list shows what has no paper behind it. */
.undocumented-mark {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  color: var(--warn);
}
.undocumented-mark svg { width: 12px; height: 12px; }

/* Quick amount buttons on the entry sheet. */
.quick-amounts { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.quick-amounts .chip { font-variant-numeric: tabular-nums; }

/* ══ kanban (projects board) ══════════════════════════════════════════════ */

.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(258px, 1fr);
  gap: var(--s-4);
  overflow-x: auto;
  padding-bottom: var(--s-3);
  -webkit-overflow-scrolling: touch;
}

.board-col {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  min-width: 0;
}
.board-col-head {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  padding: 0 var(--s-1);
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-3) var(--s-4);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  text-align: left;
  width: 100%;
  transition: box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.project-card:hover { box-shadow: var(--shadow-md); text-decoration: none; }
.project-card:active { transform: translateY(1px); }
.project-name { font-weight: var(--fw-semi); font-size: var(--fs-sm); line-height: var(--lh-snug); }

/* ══ tasks ════════════════════════════════════════════════════════════════ */

.task-row {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--t-fast) var(--ease);
}
.task-row:last-child { border-bottom: none; }
.task-row:hover { background: var(--surface-hover); }
.task-row.is-done { opacity: 0.55; }
.task-row.is-done .task-title { text-decoration: line-through; }

/* A generous circular hit target — this is the control used most often. */
.task-check {
  width: 21px; height: 21px;
  flex: none;
  margin-top: 1px;
  border-radius: var(--r-sm);
  border: 2px solid var(--border-strong);
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.task-check:hover { border-color: var(--accent); }
.task-check svg { width: 12px; height: 12px; color: transparent; }
.task-check.is-done { background: var(--ok); border-color: var(--ok); }
.task-check.is-done svg { color: #fff; }

.task-body { flex: 1; min-width: 0; }
.task-title { font-size: var(--fs-base); line-height: var(--lh-snug); overflow-wrap: anywhere; }
.task-meta {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
  margin-top: 3px;
  font-size: var(--fs-xs);
  color: var(--text-subtle);
}
.task-due.is-overdue { color: var(--danger); font-weight: var(--fw-semi); }
.task-due.is-today { color: var(--warn); font-weight: var(--fw-semi); }

/* Priority as a coloured left edge — readable without a legend. */
.task-row[data-priority="3"] { box-shadow: inset 3px 0 0 var(--danger); }
.task-row[data-priority="2"] { box-shadow: inset 3px 0 0 var(--warn); }
.task-row[data-priority="0"] { box-shadow: inset 3px 0 0 var(--border-strong); }

/* ══ settings ═════════════════════════════════════════════════════════════ */

.setting-row {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}
.setting-row:last-child { border-bottom: none; }
.setting-info { flex: 1; min-width: 200px; }
.setting-name { font-size: var(--fs-base); font-weight: var(--fw-medium); }
.setting-hint { font-size: var(--fs-sm); color: var(--text-muted); line-height: var(--lh-snug); margin-top: 2px; }
.setting-control { flex: none; min-width: 160px; }

@media (max-width: 560px) {
  .setting-control { width: 100%; min-width: 0; }
}

.backup-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--fs-sm);
}
.backup-row:last-child { border-bottom: none; }
.backup-name { font-family: var(--font-mono); font-size: var(--fs-xs); }

/* ══ Popcorn Time ═════════════════════════════════════════════════════════ */

.film-row {
  display: flex;
  gap: var(--s-4);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border-subtle);
}
.film-row:last-child { border-bottom: none; }

.film-poster {
  width: 58px;
  flex: none;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: var(--surface-3);
  border: 1px solid var(--border-subtle);
}
.film-poster.is-empty {
  display: grid;
  place-items: center;
  color: var(--text-subtle);
}

.film-main { flex: 1; min-width: 0; }

.film-title {
  font-size: var(--fs-base);
  font-weight: var(--fw-semi);
  color: var(--text);
  line-height: var(--lh-snug);
}
a.film-title:hover { color: var(--accent-text); }

/* The times are the point of this screen, so they get the weight. */
.showtimes {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-3);
}

.showtime {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 5px var(--s-3);
  min-width: 62px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
a.showtime:hover {
  border-color: var(--accent);
  background: var(--c-1);
  text-decoration: none;
}
.showtime.is-unavailable { opacity: 0.45; }

.showtime-time {
  font-size: var(--fs-base);
  font-weight: var(--fw-semi);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.showtime-version { font-size: 9px; color: var(--text-subtle); letter-spacing: 0.02em; }
.showtime-format {
  font-size: 9px;
  font-weight: var(--fw-bold);
  letter-spacing: 0.06em;
  color: var(--accent-text);
}

@media (max-width: 560px) {
  .film-row { padding: var(--s-3) var(--s-4); gap: var(--s-3); }
  .film-poster { width: 46px; }
  .showtime { min-width: 56px; padding: 4px var(--s-2); }
}

.showtime-seats {
  font-size: 9px;
  font-weight: var(--fw-semi);
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}
.showtime-seats.is-low { color: var(--warn); }

/* ══ Calendar ═════════════════════════════════════════════════════════════ */

.cal-head {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.cal-head > div {
  padding: var(--s-2);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  text-align: center;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-rows: minmax(96px, auto);
}

.cal-cell {
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  padding: 4px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.is-outside { background: var(--surface-2); }
.cal-cell.is-outside .cal-daynum { color: var(--text-subtle); }
.cal-cell.is-today { background: var(--c-1); }

.cal-daynum {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  padding: 1px 3px;
}
.cal-cell.is-today .cal-daynum { color: var(--c-8); }

.cal-events { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.cal-event {
  display: flex;
  align-items: baseline;
  gap: 4px;
  width: 100%;
  padding: 1px 4px;
  font-size: 10px;
  line-height: 1.35;
  text-align: left;
  color: var(--text);
  background: var(--surface-3);
  border-left: 3px solid var(--dot, var(--c-6));
  min-width: 0;
}
.cal-event:hover { background: var(--surface-hover); }
.cal-event-time {
  font-variant-numeric: tabular-nums;
  color: var(--text-subtle);
  flex: none;
}

@media (max-width: 700px) {
  .cal-grid { grid-auto-rows: minmax(64px, auto); }
  .cal-event-time { display: none; }
  .cal-event { font-size: 9px; }
}

/* ══ Listening / Watchlist ════════════════════════════════════════════════ */

.media-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
}
.media-row:last-child { border-bottom: none; }

.media-rank {
  width: 22px;
  flex: none;
  text-align: right;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}

.media-art {
  width: 40px; height: 40px;
  flex: none;
  object-fit: cover;
  background: var(--surface-3);
}

.media-plays {
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}


/* ── calendar: week and day ──────────────────────────────────────────────── */

/* The whole grid scrolls as one, so the hour gutter cannot drift out of step
   with the columns — that is the classic failure of a two-pane time grid. */
.tg-card {
  padding: 0;
  max-height: min(70vh, 760px);
  overflow: auto;
}

.tg {
  display: grid;
  grid-template-columns: 56px repeat(var(--cols), minmax(0, 1fr));
  min-width: 0;
}

/* Header row sticks while the hours scroll under it. */
.tg-corner,
.tg-dayhead {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.tg-corner { border-right: 1px solid var(--border); }

.tg-dayhead {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--s-2) 4px;
  border-right: 1px solid var(--border);
}
.tg-dayhead:last-of-type { border-right: none; }
.tg-dayname {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.tg-daynum {
  font-size: var(--fs-md);
  font-weight: var(--fw-semi);
  color: var(--text);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
}
.tg-daynum:hover { background: var(--surface-3); }
.tg-dayhead.is-today .tg-daynum { background: var(--c-6); color: var(--on-accent); }

/* All-day band */
.tg-allday-label,
.tg-allday {
  position: sticky;
  top: 52px;
  z-index: 2;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  min-height: 26px;
}
.tg-allday-label {
  border-right: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  padding: 4px 6px;
  text-align: right;
}
.tg-allday {
  border-right: 1px solid var(--border);
  padding: 3px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tg-allday:last-of-type { border-right: none; }

.tg-chip {
  display: block;
  width: 100%;
  text-align: left;
  font-size: var(--fs-xs);
  padding: 2px 5px;
  color: var(--text);
  background: color-mix(in srgb, var(--dot) 16%, transparent);
  border-left: 2px solid var(--dot);
  min-width: 0;
}
.tg-chip:hover { background: color-mix(in srgb, var(--dot) 26%, transparent); }

/* Hours */
.tg-gutter { border-right: 1px solid var(--border); }
.tg-hour {
  height: 46px;
  position: relative;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-align: right;
  padding-right: 6px;
}
/* Label sits on the line, not inside the box below it. */
.tg-hour span { position: relative; top: -6px; }

.tg-col {
  position: relative;
  border-right: 1px solid var(--border);
}
.tg-col:last-of-type { border-right: none; }
.tg-col.is-today { background: var(--c-1); }

.tg-slot { height: 46px; border-top: 1px solid var(--border-soft, var(--border)); }
.tg-slot:first-child { border-top: none; }

.tg-event {
  position: absolute;
  overflow: hidden;
  text-align: left;
  padding: 2px 4px;
  font-size: var(--fs-xs);
  line-height: 1.25;
  color: var(--text);
  background: color-mix(in srgb, var(--dot) 20%, var(--surface));
  border-left: 3px solid var(--dot);
  /* Separators on three sides. Back-to-back meetings — 10:00, 10:30, 11:00 —
     are not overlapping, so nothing else would divide them and five of them
     read as one long block. The border eats a pixel of height, which is
     exactly the gap wanted. */
  border-bottom: 1px solid var(--surface);
  box-shadow: 1px 0 0 var(--surface), -1px 0 0 var(--surface);
  min-width: 0;
}
.tg-event:hover {
  background: color-mix(in srgb, var(--dot) 32%, var(--surface));
  z-index: 4;
}
.tg-event-time { font-weight: var(--fw-semi); margin-right: 4px; }
/* Titles are long and columns are narrow; cut with an ellipsis rather than
   mid-word. */
.tg-event-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Wide enough to read a title on one line: keep time and name together. */
.tg-col:only-of-type .tg-event,
.tg-event { display: block; }

/* Where we are now */
.tg-now {
  position: absolute;
  left: 0;
  right: 0;
  height: 0;
  border-top: 2px solid var(--danger);
  z-index: 3;
  pointer-events: none;
}
.tg-now::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -4px;
  width: 7px;
  height: 7px;
  border-radius: var(--r-full);
  background: var(--danger);
}

/* A week is unreadable at phone width; a day is not. */
@media (max-width: 640px) {
  .tg { grid-template-columns: 42px repeat(var(--cols), minmax(64px, 1fr)); }
  .tg-card { overflow: auto; }
}

/* ── calendar: managing them ─────────────────────────────────────────────── */

.cal-source {
  border: 1px solid var(--border);
  padding: var(--s-3);
  background: var(--surface);
}

.swatches { display: flex; gap: 4px; }
.swatch {
  width: 18px;
  height: 18px;
  background: var(--swatch);
  border: 2px solid transparent;
  outline: 1px solid var(--border);
  outline-offset: -1px;
}
.swatch:hover { transform: scale(1.12); }
.swatch.is-active {
  border-color: var(--surface);
  outline: 2px solid var(--text);
  outline-offset: 0;
}

/* An input that reads as text until you touch it — for renaming in place. */
.input-flush {
  border-color: transparent;
  background: transparent;
  font-weight: var(--fw-semi);
  padding-left: 4px;
}
.input-flush:hover { border-color: var(--border); }
.input-flush:focus { border-color: var(--c-6); background: var(--surface); }

/* ── a receipt on an expense ─────────────────────────────────────────────── */

.receipt-slot { min-height: 30px; }

.receipt-card {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

/* Fixed box, cover fit: receipts are every shape and a row of them should not
   be. */
.receipt-thumb {
  width: 46px;
  height: 46px;
  flex: none;
  object-fit: cover;
  background: var(--surface-3);
  border: 1px solid var(--border);
}
.receipt-thumb.is-empty {
  display: grid;
  place-items: center;
  color: var(--text-muted);
}

/* ── the gym ─────────────────────────────────────────────────────────────── */

/* A session in progress. The pulse is the only animation in the app, and it
   earns its place: it is the difference between "logging" and "logged". */
.live-dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: var(--r-full);
  background: var(--ok);
  animation: live-pulse 2s var(--ease) infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}
@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
}

/*
 * Sets, as rows.
 *
 * A table rather than a list because sets line up: the set number, what you
 * did, how hard it was. Reading down a column is the whole point — "did I get
 * more reps than last time" should not need arithmetic.
 */
.set-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.set-table td {
  padding: var(--s-2) var(--s-3);
  border-top: 1px solid var(--border);
  vertical-align: middle;
}
.set-table tr:first-child td { border-top: none; }

.set-no {
  width: 30px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-xs);
}
/* A warm-up is logged but should not compete for attention with the work. */
.set-table tr.is-warmup td { color: var(--text-muted); }
.set-table tr.is-warmup .set-no { font-style: italic; }

.set-rpe {
  width: 68px;
  text-align: right;
  color: var(--text-subtle);
  font-size: var(--fs-xs);
  white-space: nowrap;
}
.set-actions {
  width: 62px;
  text-align: right;
  white-space: nowrap;
}

/* A quiet square button for row actions — visible enough to find, faint
   enough not to shout on every row. */
.icon-btn {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  color: var(--text-subtle);
  background: transparent;
}
.icon-btn:hover { color: var(--text); background: var(--surface-3); }

/* ── books you make ──────────────────────────────────────────────────────── */

/* The dashed tile at the end of the book grid. Dashed rather than solid so it
   reads as a slot to fill, not as a book that exists. */
.book-new {
  border-style: dashed;
  background: transparent;
}
.book-new:hover {
  border-style: solid;
  background: var(--surface);
}
.book-new-body {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 96px;
}
.book-new-plus {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
}
.book-new:hover .book-new-plus { color: var(--c-7); border-color: var(--c-6); }

.icon-picker,
.hue-picker {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.icon-choice {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
}
.icon-choice:hover { color: var(--text); border-color: var(--border-strong); }
.icon-choice.is-active {
  color: var(--on-accent);
  background: var(--c-6);
  border-color: var(--c-6);
}

/* Each swatch previews its own hue, which is only possible because [data-hue]
   re-points --c-6 on the element itself. */
.hue-choice {
  width: 30px;
  height: 30px;
  background: var(--c-6);
  border: 2px solid transparent;
  outline: 1px solid var(--border);
  outline-offset: -1px;
}
.hue-choice:hover { transform: scale(1.08); }
.hue-choice.is-active {
  border-color: var(--surface);
  outline: 2px solid var(--text);
  outline-offset: 0;
}

.template-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  text-align: left;
  padding: var(--s-3);
  border: 1px solid var(--border);
  background: var(--surface);
}
.template-row:hover { border-color: var(--border-strong); }
.template-row.is-active {
  border-color: var(--c-6);
  background: var(--c-1);
}

/* ── important dates on a contact ────────────────────────────────────────── */

.date-row {
  padding: var(--s-3);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

/* Flex, not the auto-fit grid: the delete button is not a field and should not
   be given a whole column of its own, which is what pushed it onto its own
   line under the inputs. */
.date-row-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--s-2);
}
.date-row-fields .icon-btn { margin-bottom: 3px; }
/* A checkbox that sits on one line beside its label, for the two small flags
   under each date — the stacked .check is too heavy here. */
.check-inline {
  align-items: center;
  gap: var(--s-2);
}
.check-inline .check-text { margin: 0; }
