:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --fg: #1a1d21;
  --muted: #6b7280;
  --line: #e3e6ea;
  --primary: #1a73e8;
  --danger: #d93025;
  --ok: #188038;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216; --card: #171b21; --fg: #e8eaed; --muted: #9aa0a6;
    --line: #2a2f36; --primary: #8ab4f8; --danger: #f28b82; --ok: #81c995;
    --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--fg);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
h1,h2,h3 { line-height: 1.2; }
a { color: var(--primary); }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 13px; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
pre { background: var(--bg); padding: 10px 12px; border-radius: 8px; overflow-x: auto; border: 1px solid var(--line); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--card); color: var(--fg);
  padding: 10px 16px; border-radius: 10px; font-size: 15px; font-weight: 600;
  cursor: pointer; text-decoration: none; min-height: 44px;
}
.btn:hover { border-color: var(--muted); }
.btn-lg { padding: 14px 20px; font-size: 17px; width: 100%; min-height: 52px; }
.btn-primary { background: var(--primary); color: #fff; border-color: transparent; }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 12px; min-height: 36px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
button.link { background: none; border: none; color: var(--primary); cursor: pointer; font: inherit; padding: 4px; }
button.link.danger { color: var(--danger); }
.inline { display: inline; }

/* Centered card pages (login/denied) */
.center { display: flex; min-height: 100dvh; align-items: center; justify-content: center; padding: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.card.narrow { max-width: 380px; width: 100%; text-align: center; }
.card.narrow .btn { width: 100%; margin-top: 8px; }
.logo { font-size: 44px; }
.banner { padding: 10px 12px; border-radius: 10px; margin: 12px 0; font-size: 14px; }
.banner.err { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.banner.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line);
}
.topbar nav { display: flex; align-items: center; gap: 14px; }
.who { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.tag { font-size: 11px; background: var(--line); color: var(--muted); padding: 1px 6px; border-radius: 999px; vertical-align: middle; }
.tag.active { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }

/* Note entry */
.entry { max-width: 560px; margin: 0 auto; padding: 16px; }
.cutpick { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.cutpick select { flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--fg); font-size: 16px; min-height: 44px; }
.tc-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.tc-display { font-size: 46px; font-weight: 700; text-align: center; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.tc-row { margin: 10px 0; }
.tc-input {
  width: 100%; text-align: center; font-size: 24px; padding: 12px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--bg); color: var(--fg); font-variant-numeric: tabular-nums;
}
.tc-input:focus { outline: none; border-color: var(--primary); }
.nudge { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 6px; }
.nb { padding: 12px 0; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); font-size: 15px; font-weight: 600; cursor: pointer; min-height: 46px; }
.nb:active { background: var(--line); }
.timer { margin-top: 14px; text-align: center; }
.timer.running #timerBtn { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); border-color: transparent; }

.noteform { margin-top: 16px; }
#noteText {
  width: 100%; padding: 14px; font-size: 17px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--fg); resize: vertical; min-height: 60px;
}
#noteText:focus { outline: none; border-color: var(--primary); }
.btn-send { margin-top: 12px; color: #fff; border-color: transparent; }
.flash { margin-top: 12px; padding: 10px 12px; border-radius: 10px; text-align: center; font-weight: 600; }
.flash.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.flash.err { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

.recent { margin-top: 22px; }
.recent ul { list-style: none; padding: 0; margin: 8px 0 0; }
.recent li { padding: 8px 12px; border-left: 4px solid var(--line); margin-bottom: 6px; background: var(--card); border-radius: 6px; }
.recent .rtc { font-weight: 700; font-variant-numeric: tabular-nums; margin-right: 8px; }

.empty { text-align: center; padding: 40px 16px; }

/* Prominent link to the cut's Google Doc */
.doclink {
  display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit;
  padding: 12px 14px; margin-bottom: 14px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.doclink:hover { border-color: var(--primary); }
.doclink-icon { font-size: 20px; line-height: 1; }
.doclink-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.doclink-text strong { color: var(--primary); font-size: 15px; }
.doclink-go { margin-left: auto; color: var(--muted); font-size: 18px; }

/* The format example: shows both kinds of note at a glance */
.format { margin-top: 26px; }
.format h3 { margin: 0 0 10px; font-size: 15px; }
.ex-wrap { overflow-x: auto; }
.ex {
  margin: 0; padding: 14px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; font-size: 13.5px; line-height: 1.7; white-space: pre;
}
.ex-t { font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }
.ex-k { font-weight: 700; color: var(--ok); }
.ex-c { color: var(--muted); }
.format .fmt { list-style: none; padding: 0; margin: 12px 0 0; }
.format .fmt li { padding: 7px 0 7px 16px; position: relative; font-size: 14px; border-bottom: 1px solid var(--line); }
.format .fmt li:last-child { border-bottom: none; }
.format .fmt li::before { content: "·"; position: absolute; left: 2px; color: var(--muted); font-weight: 700; }
.format code, .help code { background: var(--bg); padding: 1px 5px; border-radius: 5px; font-size: 13px; }

/* Live entry, tucked below the paste box */
.live { margin-top: 26px; border-top: 1px solid var(--line); padding-top: 16px; }
.live > summary { cursor: pointer; font-weight: 600; padding: 6px 0; color: var(--primary); }
.live .tc-card { margin-top: 12px; }

.bulkform textarea {
  width: 100%; padding: 14px; font-size: 15px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--fg); resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1.5;
}
.bulkform textarea:focus { outline: none; border-color: var(--primary); }
.bulkbar { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.bulkbar .fine { text-align: center; }

/* Paste preview: exactly what will land in the doc, grouped as the doc groups it */
.preview { margin-top: 14px; }
.pv-head { font-weight: 700; font-size: 13px; margin: 14px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pv-notes { list-style: none; padding: 0; margin: 0; }
.pv-notes li,
.pv-group ul li {
  padding: 7px 12px; border-left: 4px solid var(--line); margin-bottom: 5px;
  background: var(--card); border-radius: 6px; font-size: 14px; word-break: break-word;
}
/* Lines of one note, held together in one card the way they'll be in the doc. */
.pv-ln + .pv-ln { margin-top: 2px; color: var(--muted); }
.pv-groups { display: flex; flex-direction: column; gap: 4px; }
.pv-group { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: start; }
.pv-group .rtc { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; padding-top: 8px; text-align: right; }
.pv-group ul { list-style: none; padding: 0; margin: 0; }

/* Never an error — the line went in. Just a heads-up worth reading. */
.pv-notices { list-style: none; padding: 0; margin: 12px 0 0; }
.pv-notices li {
  padding: 8px 12px; margin-bottom: 6px; border-radius: 8px; font-size: 13px;
  border-left: 4px solid var(--muted);
  background: color-mix(in srgb, var(--muted) 10%, transparent);
  color: var(--muted);
}
.pv-line { font-size: 11px; font-weight: 700; margin-right: 8px; text-transform: uppercase; letter-spacing: .04em; }

/* Admin */
.wrap { max-width: 860px; margin: 0 auto; padding: 16px; }
.tabs { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0 6px; }
.tabs a { padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; background: var(--card); }
.card { margin-bottom: 18px; }
section.card h2 { margin-top: 0; }
.status { padding: 10px 12px; border-radius: 10px; }
.status.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); }
.status.warn { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.help { margin-top: 12px; }
.help summary { cursor: pointer; color: var(--primary); }

.people-list, .cuts-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.person, .cut {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card);
}
.person.blocked { opacity: .55; }
.person-main { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; flex: 1; margin: 0; }
.person-del { margin: 0; }
.person .email, .cut .cut-meta { color: var(--muted); font-size: 13px; }
.person input[type=color] { width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: none; }
.person .p-name { padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); width: 130px; }
.person select, .cut select { padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); }
.person .blk { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.cut { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.cut .cut-name { grid-column: 1; }
.cut .cut-meta { grid-column: 1; }
.cut .cut-doc { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.cut .cut-actions { grid-column: 1 / -1; display: flex; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; }
.cut .cut-seed { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cut .cut-seed select { flex: 1; min-width: 160px; padding: 7px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); font-size: 13px; }
.cut.archived { opacity: .55; }

.addform, .rowform { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.addform input, .addform select { padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); min-height: 44px; }
.settingsform { display: flex; flex-direction: column; gap: 16px; max-width: 480px; }
.settingsform label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.settingsform label.check { flex-direction: row; align-items: center; font-weight: 400; gap: 8px; }
.settingsform input[type=text], .settingsform input:not([type]), .settingsform select { padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); min-height: 44px; }
.center { text-align: initial; }
.blk input, .center input { accent-color: var(--primary); }
