/* Plus Jakarta Sans: a contemporary geometric sans drawn by Indonesian foundry Tokotype for
   Jakarta's city brand. Its large x-height keeps small status text readable. */
@font-face {
  font-family: 'Plus Jakarta Sans';
  src: url('/fonts/plus-jakarta-sans-latin-wght-normal.woff2') format('woff2-variations');
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eceef1;
  --line: #e0e3e7;
  --line-strong: #808a94;
  --text: #12151a;
  --muted: #565f69;
  --accent: #d23c0e;
  --accent-hover: #b4320a;
  --accent-text: #b4320a;
  --on-accent: #ffffff;
  --ok: #0c6f47;
  --ok-bg: #dff3ea;
  --warn: #7f5200;
  --warn-bg: #fbf0d9;
  --fail: #b0142c;
  --fail-bg: #fbe4e8;
  --info: #2c3640;
  --info-bg: #e6e9ed;
  --shadow-raised: 0 8px 24px rgb(15 18 22 / 0.14);
  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 20px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #0e1012;
    --surface: #16191c;
    --surface-2: #22262b;
    --line: #2a2f34;
    --line-strong: #6c7680;
    --text: #f1f3f5;
    --muted: #a3acb5;
    --accent: #ff6b3d;
    --accent-hover: #ff8560;
    --accent-text: #ff8d6a;
    --on-accent: #1a0a04;
    --ok: #63d6a3;
    --ok-bg: #12301f;
    --warn: #f0bd59;
    --warn-bg: #33270d;
    --fail: #ff8297;
    --fail-bg: #3a141c;
    --info: #d6dce2;
    --info-bg: #2a2f35;
    --shadow-raised: 0 8px 28px rgb(0 0 0 / 0.55);
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0e1012;
  --surface: #16191c;
  --surface-2: #22262b;
  --line: #2a2f34;
  --line-strong: #6c7680;
  --text: #f1f3f5;
  --muted: #a3acb5;
  --accent: #ff6b3d;
  --accent-hover: #ff8560;
  --accent-text: #ff8d6a;
  --on-accent: #1a0a04;
  --ok: #63d6a3;
  --ok-bg: #12301f;
  --warn: #f0bd59;
  --warn-bg: #33270d;
  --fail: #ff8297;
  --fail-bg: #3a141c;
  --info: #d6dce2;
  --info-bg: #2a2f35;
  --shadow-raised: 0 8px 28px rgb(0 0 0 / 0.55);
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.5;
  /* This typeface sets a narrow word space, which closes up further at tight tracking. */
  word-spacing: 0.06em;
}

h1, h2, h3, p { margin: 0; }

a { color: inherit; }

a[href], button, summary, select, label[for], input[type='checkbox'], input[type='file'] { cursor: pointer; }
button:disabled, input:disabled { cursor: not-allowed; }

:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 10;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: var(--radius-s);
}
.skip-link:focus { top: 8px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 8px 12px;
  max-width: 1200px;
  min-height: 64px;
  margin: 0 auto;
  padding: 0 24px;
}

.wordmark {
  margin-right: 12px;
  font-weight: 800;
  font-size: 1.0625rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  text-decoration: none;
}

.tabs { display: flex; gap: 4px; }

.tabs a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-s);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  transition: background-color 0.12s, color 0.12s;
}
.tabs a:hover { color: var(--text); background: var(--surface-2); }
.tabs a:active { background: var(--line); }
.tabs a[aria-current='page'] { color: var(--text); background: var(--surface-2); }
.tabs a[hidden] { display: none; }

.signed-out .tabs, .signed-out .clock, .signed-out .new-post, .signed-out .topbar-logout { display: none; }
.signed-out #theme-toggle { margin-left: auto; }

.clock {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: none;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  color: var(--text);
  transition: background-color 0.12s, border-color 0.12s;
}
.icon-button:hover { background: var(--surface-2); border-color: var(--line-strong); }
.icon-button:active { background: var(--line); }
.icon-button:disabled { color: var(--muted); border-color: var(--line); background: transparent; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  font: inherit;
  font-weight: 650;
  font-size: 0.875rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { transform: none; }

/* The accent is reserved for the one main action on a screen, most of all putting a video on air. */
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { background: var(--surface-2); color: var(--muted); }
.btn-primary[aria-current='page'] { background: var(--surface-2); color: var(--text); }

.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--text); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-secondary:active { background: var(--line); }

.btn-danger { background: transparent; border-color: var(--line-strong); color: var(--fail); }
.btn-danger:hover { background: var(--fail-bg); border-color: var(--fail); }

.btn-small { min-height: 32px; padding: 0 10px; font-size: 0.8125rem; }

.demo-banner {
  padding: 8px 24px;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: center;
}

main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}
main:focus { outline: none; }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 16px;
  min-height: 50px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8125rem;
  text-align: center;
}
.site-footer a:hover { color: var(--text); }
.site-footer[hidden] { display: none; }

.page-head { margin-bottom: 24px; }
.page-title { font-weight: 800; font-size: 1.875rem; line-height: 1.15; letter-spacing: -0.02em; word-spacing: 0.1em; }
.page-sub { margin-top: 4px; color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 20px;
}
.card-title { font-weight: 700; font-size: 0.9375rem; letter-spacing: -0.01em; }

/* Platform marks are plain monograms: quick to scan, and no brand logos are reproduced. */
.mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: none;
  background: var(--surface-2);
  border-radius: var(--radius-s);
  font-weight: 800;
  font-size: 0.6875rem;
  letter-spacing: 0.02em;
}

/* Compose */
.compose {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

.stage-wrap { position: sticky; top: 88px; }
.stage { display: grid; gap: 12px; justify-items: center; }

/* The rounded 9:16 tile is the identity motif: every video appears the way a phone shows it. */
.tile {
  position: relative;
  width: min(100%, calc((100vh - 200px) * 9 / 16));
  min-width: 220px;
  aspect-ratio: 9 / 16;
  background: var(--surface);
  border-radius: var(--radius-l);
  overflow: hidden;
}
.tile video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }

.drop {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-l);
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s;
}
.drop:hover, .drop.dragging { background: var(--surface-2); border-color: var(--text); }
.drop:focus-within { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-title { font-weight: 700; font-size: 1.125rem; letter-spacing: -0.015em; line-height: 1.25; }
.drop-note { color: var(--muted); font-size: 0.8125rem; }
.drop-browse { margin: 6px 0; pointer-events: none; }

.upload-status {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
}
.progress { width: 100%; height: 6px; accent-color: var(--accent); }

.video-facts { width: 100%; font-size: 0.8125rem; color: var(--muted); text-align: center; overflow-wrap: anywhere; }
.video-facts strong { display: block; color: var(--text); font-weight: 600; }
.stage-error { width: 100%; color: var(--fail); font-weight: 600; font-size: 0.875rem; text-align: center; }

.compose-form { display: grid; gap: 16px; min-width: 0; }

.field { display: grid; gap: 6px; }
.field > label, .field-label { font-weight: 650; font-size: 0.875rem; }
.field-hint { font-size: 0.8125rem; color: var(--muted); }
.field-foot { display: flex; justify-content: flex-end; font-size: 0.8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.field-foot.over { color: var(--fail); font-weight: 700; }

input[type='text'], input[type='password'], input[type='datetime-local'], textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-s);
  color: var(--text);
  font: inherit;
  transition: border-color 0.12s;
}
input[type='text']:hover, input[type='password']:hover, input[type='datetime-local']:hover, textarea:hover { border-color: var(--text); }
input[type='datetime-local'] { max-width: 280px; font-variant-numeric: tabular-nums; }
textarea { display: block; resize: vertical; min-height: 112px; }

.cover-card, .timing-card { display: grid; gap: 12px; min-width: 0; margin: 0; }
.cover-card legend, .timing-card legend { float: left; width: 100%; padding: 0; }
.timing-choices { display: grid; gap: 2px; clear: both; }
.timing-card .field[hidden] { display: none; }
.cover-top { display: flex; justify-content: space-between; gap: 16px; clear: both; }
.cover-choices { display: grid; align-content: start; gap: 2px; min-width: 0; }
.cover-preview { flex: none; width: 54px; height: 96px; object-fit: cover; background: var(--surface-2); border-radius: 10px; }
.cover-preview[hidden], .cover-panel[hidden] { display: none; }
.cover-panel { min-width: 0; }
.cover-panel .field-hint { margin-top: 6px; }
.cover-time { font-variant-numeric: tabular-nums; }
.cover-panel input[type='range'] { display: block; width: 100%; min-height: 28px; margin: 0; accent-color: var(--text); }
.file-button:focus-within { outline: 2px solid var(--accent-text); outline-offset: 2px; }
.target-cover-note { color: var(--warn); }

.dest { padding: 14px 0; border-top: 1px solid var(--line); }
.dest:first-of-type { margin-top: 12px; }
.dest:last-child { padding-bottom: 0; }

.dest-head {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  cursor: pointer;
}
.dest-head.disabled { cursor: not-allowed; }
.dest-name { font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.dest-name small { display: block; font-size: 0.8125rem; font-weight: 500; color: var(--muted); }

.switch {
  appearance: none;
  position: relative;
  width: 40px;
  height: 24px;
  margin: 0;
  background: var(--line-strong);
  border-radius: 999px;
  transition: background-color 0.14s;
}
.switch::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--surface);
  border-radius: 50%;
  transition: transform 0.14s;
}
.switch:hover { background: var(--muted); }
.switch:checked { background: var(--text); }
.switch:checked::before { transform: translateX(16px); }
.switch:disabled { background: var(--surface-2); }
.switch:disabled::before { background: var(--line-strong); }

.dest-notes { margin: 8px 0 0 44px; padding: 0; list-style: none; font-size: 0.8125rem; }
.dest-notes li + li { margin-top: 2px; }
.note-error { color: var(--fail); font-weight: 600; }
.note-warn { color: var(--warn); }
.note-ok { color: var(--ok); }

.dest-extra { display: grid; gap: 12px; margin: 12px 0 0 44px; }

details summary { min-height: 24px; font-size: 0.8125rem; font-weight: 600; color: var(--muted); }
details summary:hover { color: var(--text); }
details[open] summary { margin-bottom: 8px; }

.check-row { display: flex; gap: 10px; align-items: center; min-height: 28px; font-size: 0.875rem; cursor: pointer; }
.check-row input { width: 18px; height: 18px; margin: 0; accent-color: var(--text); }

.form-error {
  padding: 10px 14px;
  background: var(--fail-bg);
  border-radius: var(--radius-s);
  color: var(--fail);
  font-weight: 600;
  font-size: 0.875rem;
}

/* Stays in view while the form scrolls, so the one-click action is always reachable. It floats
   above the content, which is why it carries a shadow. */
.action-bar {
  position: sticky;
  bottom: 16px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 12px 12px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-raised);
}
.action-summary { min-width: 0; font-size: 0.875rem; color: var(--muted); }
.action-summary strong { display: block; color: var(--text); font-weight: 650; }
.action-bar .btn { min-height: 44px; padding: 0 18px; font-size: 0.9375rem; }

/* Schedule */
.schedule {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 296px;
  gap: 32px;
  align-items: start;
}
.schedule-side { position: sticky; top: 88px; }

.attention { margin-bottom: 24px; border-color: var(--fail); }
.attention h2 { color: var(--fail); }
.attention-context { margin-top: 12px; font-size: 0.8125rem; color: var(--muted); }

.day-title { margin: 24px 0 12px; font-weight: 700; font-size: 1rem; letter-spacing: -0.015em; }
.day-title:first-child { margin-top: 0; }

/* A vertical timeline: the rail reads as the day running from top to bottom. */
.slot, .now {
  display: grid;
  grid-template-columns: 54px 16px minmax(0, 1fr);
  column-gap: 10px;
}
.slot { padding-bottom: 12px; }

.slot-time {
  padding-top: 13px;
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.02em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.slot-past .slot-time { color: var(--muted); }

.rail { position: relative; }
.slot .rail::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: -12px;
  left: 7px;
  width: 2px;
  background: var(--line);
}

/* The node marks the post's real state: hollow is still to come, filled has gone out. */
.node {
  position: absolute;
  top: 18px;
  left: 2px;
  width: 12px;
  height: 12px;
  background: var(--bg);
  border: 2px solid var(--line-strong);
  border-radius: 50%;
}
.node-live { background: var(--ok); border-color: var(--ok); }
.node-issue { background: var(--fail); border-color: var(--fail); }
.node-off { background: var(--line-strong); }
.node-now { top: 50%; margin-top: -6px; background: var(--accent); border-color: var(--accent); }

.now { align-items: center; margin-bottom: 12px; min-height: 28px; }
.now-time { font-weight: 800; font-size: 0.8125rem; text-align: right; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.now .rail { height: 28px; }
.now .rail::before {
  content: '';
  position: absolute;
  top: -2px;
  bottom: -14px;
  left: 7px;
  width: 2px;
  background: var(--line);
}
.now-line { display: flex; align-items: center; gap: 8px; color: var(--accent-text); font-weight: 700; font-size: 0.8125rem; }
.now-line::after { content: ''; flex: 1; height: 2px; background: var(--accent); }

.slot-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
}

.thumb {
  display: block;
  width: 72px;
  height: 128px;
  object-fit: cover;
  background: var(--surface-2);
  border-radius: 10px;
}

.slot-body { min-width: 0; }
.slot-caption {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.slot-caption.empty { color: var(--muted); font-weight: 500; }
.slot-file { font-size: 0.8125rem; color: var(--muted); overflow-wrap: anywhere; }

.target-list { list-style: none; margin: 10px 0 0; padding: 0; }

.target {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 2px 10px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.target:last-child { padding-bottom: 0; }
.target-account { min-width: 0; font-size: 0.875rem; font-weight: 600; overflow-wrap: anywhere; }
.target-side { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.target-detail { grid-column: 2 / -1; font-size: 0.8125rem; color: var(--muted); overflow-wrap: anywhere; }

/* Pills carry real publishing status, and the wording is never conveyed by color alone. */
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.pill-active { background: var(--info-bg); color: var(--info); }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-fail { background: var(--fail-bg); color: var(--fail); }
.pill-off { background: transparent; color: var(--muted); text-decoration: line-through; }

.slot-remove { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 10px; }
.slot-expiry { order: 2; color: var(--muted); font-size: 0.8125rem; }
.limit-field { margin-top: 14px; }
.confirm .limit-field + .form-error { margin-top: 10px; color: var(--fail); }

/* Calendar */
.cal { padding: 16px; }
.cal-head { display: flex; align-items: center; gap: 6px; }
.cal-title { flex: 1; font-weight: 700; font-size: 0.9375rem; letter-spacing: -0.01em; }
.cal-nav { width: 32px; height: 32px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; margin-top: 10px; }
.cal-dow { padding-bottom: 4px; font-size: 0.6875rem; font-weight: 600; color: var(--muted); text-align: center; }

.day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  min-height: 34px;
  padding: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  color: var(--muted);
  font: inherit;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  transition: background-color 0.12s, border-color 0.12s;
}
.day:disabled { color: var(--muted); }
.day.has-posts { background: var(--surface-2); color: var(--text); font-weight: 700; }
.day.has-posts:hover { border-color: var(--line-strong); }
.day.has-posts:active { background: var(--line); }
.day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.day[aria-pressed='true'] { background: var(--text); color: var(--surface); }
.day small { font-size: 0.625rem; font-weight: 600; }
.day.has-failed small { color: var(--fail); font-weight: 800; }
.day[aria-pressed='true'] small { color: inherit; }
.cal-clear { width: 100%; margin-top: 10px; }

/* Accounts */
.accounts { display: grid; gap: 16px; max-width: 760px; }
.account-note { margin-top: 10px; color: var(--muted); font-size: 0.875rem; }
.account-list { list-style: none; margin: 12px 0 0; padding: 0; }
.account-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.account-name { flex: 1; min-width: 120px; font-weight: 600; overflow-wrap: anywhere; }
.account-name small { display: block; font-size: 0.8125rem; font-weight: 500; color: var(--muted); }
.account-warning { flex-basis: 100%; color: var(--fail); font-weight: 600; font-size: 0.8125rem; }
.account-connect { margin-top: 14px; }
code { font-family: ui-monospace, Consolas, monospace; font-size: 0.85em; overflow-wrap: anywhere; }

.account-connect { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.account-connect .field-hint { flex-basis: 100%; }

/* Guide: one readable column, because people follow it line by line beside another window. */
.guide { display: grid; gap: 16px; max-width: 760px; }
.subtabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 10px; width: fit-content; max-width: 100%; }
.subtabs a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-s);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
  transition: background-color 0.12s, color 0.12s;
}
.subtabs a:hover { color: var(--text); }
.subtabs a:active { background: var(--line); }
.subtabs a[aria-current='page'] { background: var(--surface); color: var(--text); }

.guide-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.guide-note { color: var(--muted); font-size: 0.875rem; }
.guide-note strong { color: var(--text); }
.part { display: grid; gap: 10px; scroll-margin-top: 80px; }
.part:focus { outline: none; }

.guide-toc { display: grid; gap: 6px; }
.toc-list { display: grid; gap: 2px; margin: 0; padding-left: 24px; }
.toc-list li::marker { color: var(--muted); font-weight: 650; font-variant-numeric: tabular-nums; }
.toc-link {
  min-height: 28px;
  padding: 0;
  background: none;
  border: 0;
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
}
.toc-link:hover { color: var(--text); }

.guide-list { display: grid; gap: 6px; margin: 0; padding-left: 20px; }

/* Checks and warnings inside a step. The bold label says which is which, so color is only a second signal. */
.step-note { margin-top: 6px; padding: 8px 12px; background: var(--surface-2); border-radius: var(--radius-s); font-size: 0.875rem; }
.part > .step-note { margin-top: 0; }
.step-see strong:first-child { color: var(--ok); }
.step-if strong:first-child { color: var(--warn); }
.step-dont strong:first-child { color: var(--fail); }
.steps .guide-note { margin-top: 6px; }
.part-intro { color: var(--muted); }
.part-sub { margin: 6px 0 0; font-weight: 650; font-size: 0.875rem; overflow-wrap: anywhere; }
.part a:not(.btn) { color: var(--accent-text); overflow-wrap: anywhere; }
.part-action { margin: 2px 0; }

/* Numbered markers sit in the margin, so wrapped lines and copy boxes stay aligned with the text. */
.steps { display: grid; gap: 10px; margin: 0; padding-left: 24px; }
.steps li::marker { color: var(--muted); font-weight: 650; font-variant-numeric: tabular-nums; }

.copy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  padding: 6px 6px 6px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-s);
}
.copy-row code { min-width: 0; font-size: 0.8125rem; overflow-wrap: anywhere; }
.copy-list { display: grid; gap: 4px; margin-top: 6px; }
.copy-list .copy-row { margin-top: 0; }

.keys { display: grid; gap: 4px; margin: 6px 0 0; }
.keys dt { margin-top: 6px; font-weight: 600; font-size: 0.875rem; }
.keys dd { margin: 0; color: var(--muted); font-size: 0.875rem; }
.keys dd strong { color: var(--text); }
.keys dd .copy-row { margin-top: 2px; }

.fix { padding-top: 10px; border-top: 1px solid var(--line); }
.fix-why { color: var(--muted); font-size: 0.875rem; }

/* Log in and sign up */
.auth {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
  gap: 56px;
  align-items: center;
  max-width: 980px;
  min-height: min(640px, calc(100vh - 220px));
  margin: 0 auto;
}
.auth-intro { display: flex; align-items: center; gap: 32px; }

/* The same 9:16 tile as an empty video slot, with the Now marker from the schedule crossing it. */
.auth-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  flex: none;
  gap: 8px;
  width: 144px;
  aspect-ratio: 9 / 16;
  padding: 14px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius-l);
}
.auth-now {
  position: absolute;
  top: 34%;
  left: -8px;
  right: -8px;
  height: 2px;
  background: var(--accent);
}
.auth-now::before {
  content: '';
  position: absolute;
  top: -5px;
  left: -6px;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
}

.auth-lead { font-weight: 800; font-size: 1.875rem; line-height: 1.15; letter-spacing: -0.02em; word-spacing: 0.1em; }
.auth-sub { margin-top: 10px; color: var(--muted); }
.auth-card { display: grid; gap: 16px; padding: 28px; }
.auth-title { font-weight: 800; font-size: 1.5rem; line-height: 1.2; letter-spacing: -0.02em; }
.auth-note { color: var(--muted); font-size: 0.875rem; }
.auth-submit { min-height: 44px; font-size: 0.9375rem; }
.auth-legal { color: var(--muted); font-size: 0.8125rem; }
.auth-legal a, .auth-links a { color: var(--accent-text); font-weight: 600; }
.auth-links { display: grid; gap: 6px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.875rem; }

/* Profile and admin */
.profile { display: grid; gap: 16px; max-width: 560px; }
.stack { display: grid; gap: 14px; }
.storage-line { margin-top: 8px; font-weight: 600; }
.storage-note { margin-top: 8px; }
.profile .progress { margin-top: 8px; }
.profile-session { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }

.admin { display: grid; gap: 16px; max-width: 860px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.card-sub { margin-top: 2px; color: var(--muted); font-size: 0.875rem; }
.admin-list { list-style: none; margin: 12px 0 0; padding: 0; }
.admin-used { margin-top: 12px; }
.admin-used .admin-list { margin-top: 0; }

.invite-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.invite-code { flex: 1; min-width: 160px; font-size: 0.9375rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.invite-used { color: var(--muted); font-size: 0.8125rem; }
.invite-used .invite-code { font-size: 0.8125rem; font-weight: 500; }

.person-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 16px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.person-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-weight: 650; overflow-wrap: anywhere; }
.person-meta { grid-column: 1; color: var(--muted); font-size: 0.8125rem; }
.person-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

/* States */
.state { display: flex; align-items: center; gap: 20px; padding: 28px; }
.state-tile { width: 54px; height: 96px; flex: none; border: 2px dashed var(--line-strong); border-radius: 10px; }
.state h2 { font-weight: 700; font-size: 1.0625rem; letter-spacing: -0.015em; }
.state p { margin-top: 2px; color: var(--muted); }
.state .btn { margin-top: 12px; }
.state-error h2 { color: var(--fail); }

/* The dialog sits above the page, so it carries a shadow. */
.confirm {
  max-width: min(440px, calc(100vw - 32px));
  padding: 24px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-raised);
}
.confirm[open] { animation: rise 0.16s ease-out; }
.confirm::backdrop { background: rgb(8 10 12 / 0.55); }
.confirm h2 { font-weight: 700; font-size: 1.125rem; letter-spacing: -0.015em; }
.confirm p { margin-top: 6px; color: var(--muted); }
.confirm-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 20px; }

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 5;
  display: grid;
  justify-items: end;
  gap: 8px;
  pointer-events: none;
}
.toast {
  max-width: 420px;
  padding: 11px 14px;
  background: var(--text);
  color: var(--surface);
  border-radius: var(--radius-s);
  box-shadow: var(--shadow-raised);
  font-weight: 600;
  font-size: 0.875rem;
  animation: rise 0.16s ease-out;
}

/* Motion confirms a state change and nothing else. */
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 900px) {
  .compose { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .stage-wrap { position: static; }
  .tile { width: min(100%, 260px); }
  .schedule { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .schedule-side { position: static; max-width: 420px; }
  .clock { display: none; }
  #theme-toggle { margin-left: auto; }
  .auth { grid-template-columns: minmax(0, 1fr); gap: 24px; min-height: 0; max-width: 460px; }
  .auth-intro { order: 2; }
  .auth-tile { display: none; }
  .auth-lead { font-size: 1.125rem; }
  .auth-sub { margin-top: 4px; font-size: 0.875rem; }
}

@media (max-width: 860px) {
  .part { scroll-margin-top: 132px; }
  .topbar-inner { flex-wrap: wrap; padding: 10px 16px; }
  .wordmark { flex: 1; margin-right: 0; }
  #theme-toggle { margin-left: 0; }
  .tabs { order: 5; flex-basis: 100%; flex-wrap: wrap; }
  .tabs a { flex: 1; padding: 0 6px; }
}

@media (max-width: 640px) {
  .part { scroll-margin-top: 12px; }
  .toc-link { min-height: 44px; }
  .cover-panel input[type='range'] { min-height: 44px; }
  .subtabs { width: 100%; }
  .subtabs a { flex: 1; min-height: 44px; }
  .subtabs a:first-child { flex-basis: 100%; }
  .topbar { position: static; }
  .wordmark { display: inline-flex; align-items: center; min-height: 44px; }
  .icon-button { width: 44px; height: 44px; }
  .btn { min-height: 44px; }
  .tabs a { min-height: 44px; }
  main { padding: 24px 16px 48px; }
  .auth-card { padding: 20px; }
  .auth-links a, .auth-legal a { display: inline-block; padding: 12px 0; }
  .site-footer a { display: inline-block; padding: 12px 4px; }
  .site-footer { align-items: center; padding-top: 6px; padding-bottom: 6px; }
  .person-row { grid-template-columns: minmax(0, 1fr); }
  .person-actions { grid-column: 1; grid-row: auto; justify-content: flex-start; margin-top: 8px; }
  .demo-banner, .site-footer { padding-left: 16px; padding-right: 16px; }
  .page-title { font-size: 1.625rem; }
  input[type='datetime-local'] { max-width: none; }
  input[type='text'], input[type='password'], input[type='datetime-local'] { min-height: 44px; }
  .btn-small { min-height: 44px; padding: 0 14px; }
  .dest-head { min-height: 44px; }
  .dest-notes, .dest-extra { margin-left: 0; }
  details summary { padding: 11px 0; min-height: 44px; }
  .check-row { min-height: 44px; }
  .action-bar { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px; bottom: 8px; }
  .action-bar .btn { width: 100%; }
  .slot { grid-template-columns: minmax(0, 1fr); padding-bottom: 16px; }
  .slot-time { padding: 0 0 6px; text-align: left; }
  .slot .rail, .now .rail { display: none; }
  .now { grid-template-columns: auto minmax(0, 1fr); margin-bottom: 16px; }
  .slot-card { grid-template-columns: 54px minmax(0, 1fr); gap: 12px; }
  .thumb { width: 54px; height: 96px; }
  .target { grid-template-columns: 32px minmax(0, 1fr); }
  .target-side { grid-column: 1 / -1; justify-content: flex-start; margin-top: 4px; }
  .target-detail { grid-column: 1 / -1; }
  .cal-nav { width: 44px; height: 44px; }
  .day { min-height: 44px; }
  .state { flex-direction: column; align-items: flex-start; padding: 20px; }
  .toasts { justify-items: stretch; }
}

@media (max-width: 360px) {
  .new-post { flex: 1; }
  /* No room beside New post on the smallest phones, so Log out stays on the Profile page there. */
  .topbar-logout { display: none; }
  .tabs { gap: 2px; }
  .tabs a { padding: 0 4px; font-size: 0.8125rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
