/* Vocal Log: one narrow column, a bottom tab bar on every width (it is a phone app first).
   Neutrals lean violet-grey; the one accent is a deep teal; ratings are a 5-step teal ramp. */
:root {
  --bg: #f4f3f8;
  --surface: #ffffff;
  --ink: #1e1b2b;
  --muted: #6b6680;
  --line: #e1dde9;
  --accent: #0d7766;
  --accent-ink: #ffffff;
  --accent-soft: #dcefeb;
  --warn: #b4472f;
  --r1: #eceaf2; --r2: #cfe5e0; --r3: #8ccbbd; --r4: #2f9e88; --r5: #0b5f52;
  --r-ink-dark: #1e1b2b; --r-ink-light: #ffffff;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, sans-serif;
  --radius: 12px;
  --tabs-h: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16141d; --surface: #201e29; --ink: #ecebf3; --muted: #9d99b0; --line: #322f3e;
    --accent: #3fc0a6; --accent-ink: #0b1714; --accent-soft: #1d3833; --warn: #ec8a72;
    --r1: #2c2a37; --r2: #23463f; --r3: #2a6f61; --r4: #36a68e; --r5: #7fe0cb;
    --r-ink-dark: #ecebf3; --r-ink-light: #0b1714;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font);
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px) + 24px);
}
h1, h2, h3 { font-family: var(--display); line-height: 1.2; text-wrap: balance; margin: 0; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1rem; margin: 28px 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; }
a { color: var(--accent); }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); font-size: .9rem; margin: 0; }
[hidden] { display: none !important; }

.top { position: sticky; top: 0; z-index: 5; background: var(--bg); padding-top: env(safe-area-inset-top, 0px); border-bottom: 1px solid var(--line); }
.top-in, .main, .banner {
  max-width: 680px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.top-in { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-block: 12px; }
.top h1 { font-size: 1.2rem; display: flex; align-items: center; gap: 6px; }
.logo { width: 22px; height: 22px; color: var(--accent); }
.who { margin: 0; color: var(--muted); font-size: .85rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.main { padding-block: 16px; outline: none; }
.view { display: grid; gap: 14px; }
.view > h3 { margin-bottom: -4px; }
.view-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

.banner { padding-block: 12px; }
.banner > div { background: var(--accent-soft); border-radius: var(--radius); padding: 12px 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.banner.warn > div { background: color-mix(in oklab, var(--warn) 18%, var(--surface)); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-decoration: none; color: var(--ink); font-weight: 600; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--warn); }
.btn:disabled { opacity: .45; cursor: default; }
.chip { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: .9rem; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.icon-btn svg { width: 20px; height: 20px; }

.datebar { display: flex; align-items: center; gap: 8px; }
.datepick { position: relative; flex: 1; min-width: 0; height: 44px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 650; }
.datepick input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.date-text { pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 8px; }
.count { margin: 0; color: var(--muted); }

/* song rows */
.songs { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.song { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.song.done { border-color: color-mix(in oklab, var(--accent) 35%, var(--line)); }
.song-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; cursor: pointer; width: 100%; background: none; border: 0; text-align: left; border-radius: var(--radius); }
.song-title { flex: 1; min-width: 0; display: grid; }
.song-title b { font-weight: 650; overflow-wrap: anywhere; }
.song-title span { color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.song-sub { color: var(--muted); font-size: .85rem; }
.pill { flex: none; font-size: .8rem; font-weight: 650; color: var(--accent); border: 1.5px dashed color-mix(in oklab, var(--accent) 55%, transparent); border-radius: 999px; padding: 4px 10px; }

.badge { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 750; font-variant-numeric: tabular-nums; }
.r1 { background: var(--r1); color: var(--r-ink-dark); }
.r2 { background: var(--r2); color: var(--r-ink-dark); }
.r3 { background: var(--r3); color: var(--r-ink-dark); }
.r4 { background: var(--r4); color: var(--r-ink-light); }
.r5 { background: var(--r5); color: var(--r-ink-light); }
@media (prefers-color-scheme: dark) { .r3 { color: var(--r-ink-dark); } .r4, .r5 { color: var(--r-ink-light); } }

/* the support meter: four steps, filled up to how little support you needed */
.meter { display: inline-flex; gap: 2px; vertical-align: middle; }
.meter i { width: 7px; height: 10px; border-radius: 2px; background: var(--line); }
.meter i.on { background: var(--accent); }

.trend { font-size: .78rem; font-weight: 650; border-radius: 999px; padding: 2px 8px; background: var(--r1); color: var(--muted); }
.trend.up { background: var(--accent-soft); color: var(--accent); }
.trend.down { background: color-mix(in oklab, var(--warn) 14%, var(--surface)); color: var(--warn); }

/* the editor under a row */
.editor { border-top: 1px solid var(--line); padding: 14px; display: grid; gap: 14px; }
.group { display: grid; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.group > legend, .field > span { font-size: .8rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 0; margin-bottom: 6px; }
.rates { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.rate { min-height: 58px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; display: grid; align-content: center; justify-items: center; gap: 2px; padding: 4px 2px; }
.rate b { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.rate span { font-size: .68rem; line-height: 1.1; color: var(--muted); text-align: center; }
.rate[aria-pressed="true"] { border-color: transparent; }
.rate.r1 { background: var(--r1); } .rate.r2 { background: var(--r2); } .rate.r3 { background: var(--r3); }
.rate.r4 { background: var(--r4); } .rate.r5 { background: var(--r5); }
.rate[aria-pressed="true"] span { color: inherit; }
.rate-hint { margin: 0; font-size: .85rem; color: var(--muted); min-height: 1.2em; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { min-height: 44px; border: 0; background: var(--surface); cursor: pointer; padding: 4px 6px; font-size: .9rem; line-height: 1.15; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 650; }
.field { display: grid; gap: 0; }
.field input, .field textarea { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg); }
.field textarea { resize: vertical; min-height: 64px; }
.links { display: flex; gap: 8px; flex-wrap: wrap; }
.links a { font-size: .88rem; font-weight: 600; text-decoration: none; border-radius: 999px; padding: 6px 12px; background: var(--bg); border: 1px solid var(--line); color: var(--ink); }
.links a.find { color: var(--muted); border-style: dashed; }
.last { margin: 0; font-size: .85rem; color: var(--muted); }

/* songs view */
.form { gap: 12px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .form .two { grid-template-columns: 1fr; } }
.song-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.spark { width: 84px; height: 28px; flex: none; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: var(--accent); }
.spark line { stroke: var(--line); stroke-width: 1; }
.detail { border-top: 1px solid var(--line); padding: 14px; display: grid; gap: 12px; }
.hist { width: 100%; border-collapse: collapse; font-size: .88rem; }
.hist th { text-align: left; color: var(--muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; padding: 4px 6px; }
.hist td { padding: 6px; border-top: 1px solid var(--line); vertical-align: top; }
.hist td.n { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hist .note { color: var(--muted); }
.archived summary { cursor: pointer; color: var(--muted); padding: 8px 0; }
.confirm { background: color-mix(in oklab, var(--warn) 10%, var(--surface)); border-radius: 10px; padding: 12px; display: grid; gap: 10px; }

/* progress */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 2px; min-width: 0; }
.stat b { font-family: var(--display); font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.stat span { font-size: .78rem; color: var(--muted); line-height: 1.25; }
.stat em { font-style: normal; font-size: .8rem; font-weight: 650; }
.stat em.up { color: var(--accent); } .stat em.down { color: var(--warn); }
.grid-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.grid { border-collapse: separate; border-spacing: 3px; font-size: .8rem; min-width: 100%; }
.grid th { font-weight: 600; color: var(--muted); padding: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.grid th.song-col { text-align: left; position: sticky; left: 0; background: var(--surface); max-width: 9.5rem; overflow: hidden; text-overflow: ellipsis; color: var(--ink); z-index: 1; }
.grid td { width: 3.4rem; min-width: 3.4rem; height: 2.6rem; text-align: center; border-radius: 6px; line-height: 1.05; }
.grid td b { display: block; font-size: .95rem; }
.grid td small { font-size: .62rem; opacity: .85; }
.grid td.empty { background: transparent; border: 1px dashed var(--line); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .78rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend span.codes { display: block; flex-basis: 100%; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.plain-list li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: center; }
.plain-list .badge { grid-row: span 2; }
.plain-list p { margin: 0; font-size: .85rem; color: var(--muted); grid-column: 2; overflow-wrap: anywhere; }
.plain-list .line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; }

.empty-state { text-align: center; padding: 32px 16px; display: grid; gap: 10px; justify-items: center; color: var(--muted); }
.empty-state b { color: var(--ink); font-family: var(--display); font-size: 1.15rem; }

.link-out { display: grid; gap: 10px; }
.link-out textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--bg); font: .78rem/1.35 ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; resize: none; }

/* artist suggestions under the song form */
.sugg { display: flex; flex-wrap: wrap; gap: 6px; }
.sugg .chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* the QR sheet: the code always on white, as large as the screen allows */
.sheet { position: fixed; inset: 0; z-index: 20; background: color-mix(in oklab, var(--ink) 55%, transparent); display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.sheet-in { background: var(--surface); border-radius: 16px; padding: 18px; width: min(100%, 460px); display: grid; gap: 12px; justify-items: center; text-align: center; }
.qr-box { width: 100%; max-width: min(420px, 70vh); aspect-ratio: 1; background: #fff; border-radius: 8px; }
.qr-box svg { width: 100%; height: 100%; display: block; }

/* the tab bar */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; justify-content: center; background: var(--surface); border-top: 1px solid var(--line);
  padding: 0 env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
.tabs a { flex: 1; max-width: 170px; height: var(--tabs-h); display: grid; place-items: center; align-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: .75rem; font-weight: 600; }
.tabs a svg { width: 24px; height: 24px; }
.tabs a[aria-current="page"] { color: var(--accent); }

@media (prefers-reduced-motion: no-preference) {
  .editor, .detail { animation: open .16s ease-out; }
  @keyframes open { from { opacity: .4; transform: translateY(-4px); } }
}

/* the coach's switcher and student list */
.whose { min-width: 0; max-width: 55%; min-height: 36px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .9rem; align-self: center; }
.top-in:has(.whose:not([hidden])) { align-items: center; }
#students { display: grid; gap: 10px; }
.students { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.students li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.students a { display: grid; gap: 2px; color: inherit; text-decoration: none; min-width: 0; flex: 1; }
.students a span { color: var(--muted); font-size: .85rem; }
.students .confirm { flex-basis: 100%; }
