/* Live Twice — Edit Tracker.
   Phone first. Leo opens this standing up, between edits; James, Hamish and
   Indiah paste into it one-handed while scrolling Reels. Every decision below
   follows from that: big tap targets, one column, no hover-only affordances,
   and the tick is the largest control on the row.

   Monochrome with a single functional accent (LT red, #e90053) used ONLY for
   the primary action and the "left to do" count. No second accent anywhere. */

:root {
  --bg: #ffffff;
  --surface: #fafafa;
  --surface-2: #f4f4f5;
  --border: #e5e5e8;
  --border-soft: #f0f0f2;
  --text: #17171a;
  --text-2: #5c5c66;
  --text-3: #86868f;

  --accent: #e90053;
  --accent-hover: #c70047;
  --accent-tint: rgba(233, 0, 83, 0.07);

  --ok: #15803d;
  --ok-bg: #f0fdf4;
  --ok-bd: #d3f0dd;

  --r-card: 12px;
  --r-ctl: 9px;
  --tap: 44px;            /* iOS minimum comfortable tap target */
  --wrap: 720px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;               /* 16px min or iOS Safari zooms on focus */
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 48px;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }
: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); white-space: nowrap; }

/* ---------- shell ------------------------------------------------------ */

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,0.94);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-in {
  max-width: var(--wrap); margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px; min-height: 56px;
}
/* nowrap + a shrinking spacer: at 390px the brand, the name and the button do
   not all fit, and letting the brand wrap drove it straight into the sign-out
   button. The suffix and the name are the two things worth losing first. */
.brand { font-weight: 700; letter-spacing: -0.02em; font-size: 17px; white-space: nowrap; }
.brand span { color: var(--text-3); font-weight: 500; }
.spacer { flex: 1; min-width: 0; }
.who { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 460px) {
  .brand span { display: none; }
}
@media (max-width: 380px) {
  .who { display: none; }
}

.btn {
  min-height: var(--tap); padding: 0 18px; border-radius: var(--r-ctl);
  border: 1px solid var(--border); background: var(--bg); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; font-weight: 500; }
.btn-link { border: 0; background: none; color: var(--text-2); text-decoration: underline; padding: 0; min-height: 0; }

/* ---------- creator tabs ----------------------------------------------- */

.tabs {
  display: flex; gap: 8px; overflow-x: auto; padding: 14px 0 4px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; min-height: var(--tap); padding: 0 16px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--bg);
  font-weight: 600; display: inline-flex; align-items: center; gap: 8px;
  white-space: nowrap;
}
.tab[aria-selected="true"] { background: var(--text); border-color: var(--text); color: #fff; }
.tab .n {
  font-size: 12px; font-weight: 700; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: var(--accent-tint); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
}
.tab[aria-selected="true"] .n { background: rgba(255,255,255,0.18); color: #fff; }
.tab .n.zero { background: var(--surface-2); color: var(--text-3); }

/* ---------- add box ----------------------------------------------------- */

.add {
  margin: 14px 0 20px; padding: 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-card);
}
.add .row { display: flex; flex-direction: column; gap: 10px; }
.add input[type="url"], .add input[type="text"], .add select, .add input[type="password"], .add input[type="email"] {
  width: 100%; min-height: var(--tap); padding: 0 14px;
  border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--bg);
}
.add select { padding-right: 34px; }
.add .two { display: flex; gap: 10px; }
.add .two > * { flex: 1; min-width: 0; }
.hint { font-size: 13px; color: var(--text-3); }

/* ---------- list -------------------------------------------------------- */

.sec-head {
  display: flex; align-items: baseline; gap: 10px;
  margin: 22px 0 10px; padding-top: 4px;
}
.sec-head h2 { font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }

.card {
  border: 1px solid var(--border); border-radius: var(--r-card);
  background: var(--bg); padding: 14px; margin-bottom: 10px;
  display: flex; gap: 12px; align-items: flex-start;
}
.card.done { background: var(--surface); border-color: var(--border-soft); }
.card.done .card-link { color: var(--text-3); text-decoration: line-through; }

.card-body { flex: 1; min-width: 0; }
/* Clamped to two lines. A full TikTok URL is ~55 characters and at 390px it
   ran to three wrapped lines of monospace-ish noise, which pushed the note and
   the "added by" line — the two things that tell you what this row IS — below
   the fold of the card. The href is still the whole URL. */
.card-link {
  font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  line-clamp: 2; overflow: hidden; word-break: break-all;
  line-height: 1.35; margin-bottom: 4px;
}
.card-note { color: var(--text-2); font-size: 14px; margin-bottom: 4px; word-break: break-word; }
.card-meta { font-size: 13px; color: var(--text-3); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pill {
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 5px; background: var(--surface-2); color: var(--text-2);
}

/* The tick is the biggest thing on the row — it is the only control Leo needs
   while holding a phone in one hand. */
.tick {
  flex: 0 0 auto; width: var(--tap); height: var(--tap); border-radius: 50%;
  border: 2px solid var(--border); background: var(--bg);
  display: inline-flex; align-items: center; justify-content: center;
}
.tick svg { width: 22px; height: 22px; stroke: var(--text-3); stroke-width: 3; fill: none; }
.tick:hover { border-color: var(--text-3); }
.tick[aria-pressed="true"] { background: var(--ok-bg); border-color: var(--ok-bd); }
.tick[aria-pressed="true"] svg { stroke: var(--ok); }
.tick:disabled { opacity: 0.4; cursor: not-allowed; }
.tick.busy { opacity: 0.5; }

.empty {
  text-align: center; padding: 40px 20px; color: var(--text-3);
  border: 1px dashed var(--border); border-radius: var(--r-card);
}

.flash {
  margin: 12px 0; padding: 12px 14px; border-radius: var(--r-ctl);
  border: 1px solid var(--border); background: var(--surface); font-size: 14px;
}
.flash.err { border-color: #f5c6d3; background: #fff1f5; color: #a30040; }
.flash.ok { border-color: var(--ok-bd); background: var(--ok-bg); color: var(--ok); }

/* ---------- auth pages -------------------------------------------------- */

.auth { max-width: 380px; margin: 12vh auto 0; padding: 0 20px; }
.auth h1 { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 6px; }
.auth p.sub { color: var(--text-2); margin-bottom: 22px; font-size: 15px; }
.auth label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
.auth input {
  width: 100%; min-height: var(--tap); padding: 0 14px;
  border: 1px solid var(--border); border-radius: var(--r-ctl); background: var(--bg);
}
.auth .btn { width: 100%; margin-top: 20px; }

/* ---------- admin table ------------------------------------------------- */

/* Wide content scrolls inside its own container so the PAGE never scrolls
   sideways. tabindex="0" is required or the scroll region is unreachable by
   keyboard (axe: scrollable-region-focusable). */
.tablewrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-card); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
