/* ReelPost — hand-crafted light + dark product UI */

@import url("https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
  color-scheme: light dark;

  --font: "Figtree", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;

  /* Neutral cool grays — creator-tool canvas */
  --bg: #f3f2f7;
  --bg-elev: #ffffff;
  --bg-soft: #ebe9f2;
  --ink: #15131c;
  --ink-soft: #5c5868;
  --line: #ddd9e6;
  --line-strong: #c4bfd2;
  --shadow: 0 1px 2px rgba(21, 19, 28, 0.04), 0 10px 28px rgba(79, 45, 232, 0.06);

  /* Deep indigo primary + magenta wash (WCAG AA on white / ink) */
  --accent: #4f2de8;
  --accent-hover: #3f1fd0;
  --accent-ink: #f8f6ff;
  --accent-soft: #ebe4ff;
  --accent-secondary: #c026a8;

  /* Status — kept distinct from brand indigo */
  --st-queued: #026aa2;
  --st-queued-bg: #e0f2fe;
  --st-published: #047857;
  --st-published-bg: #d1fae5;
  --st-failed: #b42318;
  --st-failed-bg: #fee4e2;
  --st-missed: #c2410c;
  --st-missed-bg: #ffedd5;
  --st-held: #a16207;
  --st-held-bg: #fef3c7;
  --st-processing: #9d174d;
  --st-processing-bg: #fce7f3;
  --st-cancelled: #64748b;
  --st-cancelled-bg: #e2e8f0;

  --danger: #b42318;
  --radius: 12px;
  --radius-sm: 8px;
  --shell: 1120px;
  --nav-h: 58px;
}

html[data-theme="dark"] {
  --bg: #0c0b12;
  --bg-elev: #16141f;
  --bg-soft: #1e1b2a;
  --ink: #eeeaf8;
  --ink-soft: #9b95ad;
  --line: #2a2640;
  --line-strong: #3d3758;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 14px 36px rgba(0, 0, 0, 0.45);

  --accent: #a78bfa;
  --accent-hover: #c4b5fd;
  --accent-ink: #1a1035;
  --accent-soft: #2a2150;
  --accent-secondary: #f0abfc;

  --st-queued: #7dd3fc;
  --st-queued-bg: #0c4a6e;
  --st-published: #6ee7b7;
  --st-published-bg: #064e3b;
  --st-failed: #fca5a5;
  --st-failed-bg: #7f1d1d;
  --st-missed: #fdba74;
  --st-missed-bg: #7c2d12;
  --st-held: #fde68a;
  --st-held-bg: #713f12;
  --st-processing: #f9a8d4;
  --st-processing-bg: #831843;
  --st-cancelled: #94a3b8;
  --st-cancelled-bg: #334155;

  --danger: #f87171;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg: #0c0b12;
    --bg-elev: #16141f;
    --bg-soft: #1e1b2a;
    --ink: #eeeaf8;
    --ink-soft: #9b95ad;
    --line: #2a2640;
    --line-strong: #3d3758;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 14px 36px rgba(0, 0, 0, 0.45);
    --accent: #a78bfa;
    --accent-hover: #c4b5fd;
    --accent-ink: #1a1035;
    --accent-soft: #2a2150;
    --accent-secondary: #f0abfc;
    --st-queued: #7dd3fc;
    --st-queued-bg: #0c4a6e;
    --st-published: #6ee7b7;
    --st-published-bg: #064e3b;
    --st-failed: #fca5a5;
    --st-failed-bg: #7f1d1d;
    --st-missed: #fdba74;
    --st-missed-bg: #7c2d12;
    --st-held: #fde68a;
    --st-held-bg: #713f12;
    --st-processing: #f9a8d4;
    --st-processing-bg: #831843;
    --st-cancelled: #94a3b8;
    --st-cancelled-bg: #334155;
    --danger: #f87171;
  }
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background:
    radial-gradient(920px 440px at 0% -12%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 58%),
    radial-gradient(720px 400px at 100% 0%, color-mix(in srgb, var(--accent-secondary) 10%, transparent), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell {
  width: min(100% - 2rem, var(--shell));
  margin: 0 auto;
  padding: 1.25rem 0 calc(var(--nav-h) + 1.5rem);
}

@media (min-width: 900px) {
  .shell {
    width: min(100% - 3rem, var(--shell));
    padding-top: 1.75rem;
  }
}

/* —— Top bar —— */
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  flex-shrink: 0;
  display: block;
  box-shadow: 0 1px 2px rgba(79, 45, 232, 0.18);
}
.brand .wordmark {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
}
.brand .wordmark .wm-post {
  font-weight: 650;
  color: color-mix(in srgb, var(--ink) 72%, var(--accent));
}
.brand h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.brand .sub {
  color: var(--ink-soft);
  font-size: 0.8rem;
  margin-top: 0.1rem;
}
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}
.brand-lockup:hover { text-decoration: none; color: inherit; }
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--bg-soft);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.badge.on { color: var(--st-published); border-color: color-mix(in srgb, var(--st-published) 40%, var(--line)); background: var(--st-published-bg); }
.badge.warn { color: var(--st-held); border-color: color-mix(in srgb, var(--st-held) 40%, var(--line)); background: var(--st-held-bg); }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink-soft);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1rem;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }

/* —— Stat strip —— */
.counts {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 1.35rem;
}
@media (max-width: 640px) {
  .counts { grid-template-columns: repeat(3, 1fr); }
  .counts .count:nth-child(4),
  .counts .count:nth-child(5) { grid-column: span 1; }
}
.count {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 0.55rem 0.75rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.count .n {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
}
.count .l {
  margin-top: 0.2rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.count[data-k="queued"] .n { color: var(--st-queued); }
.count[data-k="published"] .n { color: var(--st-published); }
.count[data-k="failed"] .n { color: var(--st-failed); }
.count[data-k="missed"] .n { color: var(--st-missed); }
.count[data-k="held"] .n { color: var(--st-held); }

/* —— Forms / buttons —— */
input, select, textarea, button, .btn {
  font: inherit;
  color: var(--ink);
}
input, select, textarea {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  min-height: 40px;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 1px;
  border-color: var(--accent);
}
button, .btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  min-height: 36px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}
button:hover, .btn:hover { border-color: var(--line-strong); text-decoration: none; }
button.primary, .btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
}
button.primary:hover, .btn.primary:hover { background: var(--accent-hover); }
button.danger { color: var(--danger); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.ghost, .btn.ghost {
  background: transparent;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}

.day-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.25rem 0 1rem;
  gap: 0.75rem;
}
.day-nav h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  text-align: center;
}

/* —— Cards —— */
.list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.card {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 0.85rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem;
  box-shadow: var(--shadow);
}
@media (min-width: 720px) {
  .card { grid-template-columns: 96px 1fr; gap: 1rem; padding: 1rem; }
}
.thumb {
  width: 76px;
  height: 108px;
  border-radius: 10px;
  background: var(--bg-soft);
  object-fit: cover;
  display: block;
}
@media (min-width: 720px) {
  .thumb { width: 96px; height: 136px; }
}
.thumb.placeholder {
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  font-size: 0.65rem;
  text-align: center;
  padding: 0.4rem;
  line-height: 1.3;
  border: 1px dashed var(--line);
}
.card-body { min-width: 0; }
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
  align-items: center;
}
.status {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.18rem 0.45rem;
  border-radius: 6px;
}
.status.queued { color: var(--st-queued); background: var(--st-queued-bg); }
.status.processing { color: var(--st-processing); background: var(--st-processing-bg); }
.status.published { color: var(--st-published); background: var(--st-published-bg); }
.status.failed { color: var(--st-failed); background: var(--st-failed-bg); }
.status.missed { color: var(--st-missed); background: var(--st-missed-bg); }
.status.held { color: var(--st-held); background: var(--st-held-bg); }
.status.cancelled { color: var(--st-cancelled); background: var(--st-cancelled-bg); }

.account-chip {
  font-size: 0.75rem;
  color: var(--ink-soft);
  font-weight: 500;
}
.account-chip strong { color: var(--ink); font-weight: 600; }

.permalink {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  margin-left: auto;
}
.caption {
  margin: 0.15rem 0 0.45rem;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}
.when {
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-family: var(--mono);
  font-weight: 500;
}
.error {
  color: var(--st-failed);
  font-size: 0.75rem;
  margin-top: 0.4rem;
  line-height: 1.35;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.7rem;
}
.actions form { display: inline; }
.actions button, .actions .btn {
  min-height: 32px;
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
}

/* —— Bottom nav —— */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  z-index: 30;
}
.bottom-nav a {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 650;
  padding: 0.55rem 0.15rem 0.4rem;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}
.bottom-nav a.active { color: var(--accent); }
.bottom-nav .nav-ico { font-size: 1rem; line-height: 1; }

.empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 2.25rem 1rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--bg-elev) 70%, transparent);
}

/* —— Login —— */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.login-box {
  width: 100%;
  max-width: 380px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.75rem;
  box-shadow: var(--shadow);
}
.login-box h1 { margin: 0 0 0.25rem; font-size: 1.35rem; letter-spacing: -0.03em; }
.login-box .lede {
  color: var(--ink-soft);
  margin: 0 0 1.35rem;
  font-size: 0.9rem;
  line-height: 1.45;
}
.login-box label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 0.35rem;
}
.login-box input { width: 100%; margin-bottom: 0.9rem; }
.login-box button { width: 100%; min-height: 42px; }
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}
.login-brand .brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 15px;
}
.login-brand .wordmark {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}
.login-brand .wordmark .wm-post {
  font-weight: 650;
  color: color-mix(in srgb, var(--ink) 72%, var(--accent));
}
.login-brand .sub {
  margin-top: 0.2rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.site-credit {
  margin: 1.5rem 0 0;
  text-align: center;
  font-size: 0.72rem;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}
.site-credit a {
  color: color-mix(in srgb, var(--ink-soft) 55%, var(--accent));
  font-weight: 600;
  text-decoration: none;
}
.site-credit a:hover { text-decoration: underline; color: var(--accent); }
.login-wrap .site-credit {
  margin-top: 1.35rem;
}

/* —— Panels / admin —— */
.panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.panel h3 {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-top: 1px solid var(--line);
}
.row:first-of-type { border-top: 0; padding-top: 0; }
.muted { color: var(--ink-soft); font-size: 0.8rem; }

.log {
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.55;
  max-height: 70vh;
  overflow: auto;
  color: var(--ink-soft);
}
.log .err { color: var(--st-failed); }
.log .warn { color: var(--st-held); }
.log .actor { color: var(--accent); }

.flash {
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  color: var(--ink);
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}
.flash.err {
  background: var(--st-failed-bg);
  border-color: color-mix(in srgb, var(--st-failed) 40%, var(--line));
}

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 12, 16, 0.55);
  display: none;
  place-items: center;
  z-index: 40;
  padding: 1rem;
}
.modal-backdrop.open { display: grid; }
.modal {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.15rem;
  width: min(420px, 100%);
  box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 0.85rem; }
.modal .actions { justify-content: flex-end; }

.day-section { margin-bottom: 1.5rem; }
.day-section .day-nav { margin-bottom: 0.65rem; }

.grant-grid {
  display: grid;
  gap: 0.4rem;
  margin: 0.75rem 0 1rem;
}
.grant-grid label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.85rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
}
.grant-grid input { width: auto; min-height: 0; }

.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.user-table th, .user-table td {
  text-align: left;
  padding: 0.65rem 0.4rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.user-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  font-weight: 650;
}

.detail-grid {
  display: grid;
  gap: 0.75rem;
}
@media (min-width: 800px) {
  .detail-grid { grid-template-columns: 220px 1fr; }
}
.detail-thumb {
  width: 100%;
  max-width: 220px;
  aspect-ratio: 9/16;
  object-fit: cover;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.detail-video {
  height: auto;
  max-height: 420px;
  aspect-ratio: auto;
  object-fit: contain;
  background: #000;
  margin-top: 0.55rem;
}
.detail-cover {
  margin-bottom: 0;
}
.chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 650;
  padding: 0.18rem 0.45rem;
  border-radius: 6px;
  background: var(--bg-soft);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  text-transform: lowercase;
  letter-spacing: 0.02em;
}
.chip-on {
  color: var(--st-published);
  background: var(--st-published-bg);
  border-color: color-mix(in srgb, var(--st-published) 35%, var(--line));
}
.chip-off {
  color: var(--st-held);
  background: var(--st-held-bg);
  border-color: color-mix(in srgb, var(--st-held) 35%, var(--line));
}
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.caption-block {
  margin-bottom: 1rem;
}
.caption-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.copy-btn {
  min-height: 28px;
  padding: 0.15rem 0.5rem;
  font-size: 0.72rem;
}
.detail-caption {
  -webkit-line-clamp: unset;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.board-details h3 {
  margin-bottom: 0.75rem;
}
.board-details h4 {
  margin: 1rem 0 0.55rem;
  font-size: 0.85rem;
  letter-spacing: -0.01em;
}
.board-kv dd.wrap {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font);
  font-size: 0.85rem;
}
.script-fold {
  margin-top: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  padding: 0.55rem 0.75rem;
}
.script-fold summary {
  cursor: pointer;
  font-weight: 650;
  font-size: 0.85rem;
  color: var(--ink);
}
.script-body {
  margin: 0.65rem 0 0.25rem;
  padding: 0.65rem 0.7rem;
  background: var(--bg-elev);
  border-radius: 8px;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow: auto;
  color: var(--ink);
}
.platform-captions { margin-top: 0.5rem; }
.kv { display: grid; gap: 0.55rem; }
.kv div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0.5rem;
  font-size: 0.85rem;
}
.kv dt { color: var(--ink-soft); margin: 0; }
.kv dd { margin: 0; font-family: var(--mono); font-size: 0.8rem; }

.stack-form {
  display: grid;
  gap: 0.75rem;
}
.stack-form label span {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 0.3rem;
}

.health-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  align-items: center;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.72rem;
  color: var(--ink-soft);
  text-decoration: none;
  box-shadow: var(--shadow);
}
.health-strip:hover { border-color: var(--line-strong); text-decoration: none; color: var(--ink); }
.health-strip strong { color: var(--ink); font-weight: 650; margin-right: 0.2rem; }

.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
}
.health-stat {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem;
}
.health-stat .l {
  font-size: 0.68rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}
.health-stat .v {
  margin-top: 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.board-card .thumb { background: var(--bg-soft); }

/* Board page / sheet layout lives in board.css (cache-busted separately).
   Keep only non-critical fallbacks here so an old app.css cannot break the form. */
.board-page {
  overflow-x: hidden;
  max-width: 100%;
  font-size: 16px;
}
.board-field { display: block; width: 100%; }
.board-label { display: block; width: 100%; }
.board-sheet input,
.board-sheet textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font-size: 16px;
}
.board-sheet-video,
.board-media-frame {
  width: 100%;
  max-width: 100%;
  max-height: 45vh;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: var(--media-ar, 9 / 16);
  overflow: hidden;
  background: #000;
}
.board-sheet-video video,
.board-media-frame video,
.board-media-frame img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 45vh;
  object-fit: contain;
}


code {
  font-family: var(--mono);
  font-size: 0.78em;
  background: var(--bg-soft);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

/* —— Up next + empty slot —— */
.up-next {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: baseline;
  background: linear-gradient(120deg, var(--accent-soft), var(--bg-elev));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.85rem;
  text-decoration: none;
  color: inherit;
  animation: upNextIn 0.45s ease-out;
}
.up-next:hover { border-color: var(--accent); text-decoration: none; }
.up-next-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.up-next-time { font-family: var(--mono); font-weight: 600; }
.up-next-acct {
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--acct, var(--accent));
}
.up-next-title {
  flex: 1 1 8rem;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.up-next-count { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-soft); }
@keyframes upNextIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.empty-slot-warn {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.55rem;
  align-items: center;
  background: var(--st-missed-bg);
  color: var(--st-missed);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  margin-bottom: 0.85rem;
  font-size: 0.82rem;
  animation: upNextIn 0.5s ease-out 0.08s both;
}
.warn-chip {
  background: var(--st-missed-bg) !important;
  color: var(--st-missed) !important;
}

/* —— Calendar views —— */
.cal-toolbar { flex-wrap: wrap; gap: 0.65rem; }
.view-tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.hide-mobile { display: none; }
.hide-desktop { display: inline-flex; }
@media (min-width: 860px) {
  .hide-mobile { display: inline-flex; }
  .hide-desktop { display: none; }
}

.day-timeline {
  position: relative;
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  min-height: 540px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}
.day-axis { position: relative; border-right: 1px solid var(--line); background: var(--bg-soft); }
.day-hour {
  position: absolute;
  left: 0; right: 0;
  transform: translateY(-50%);
  font-family: var(--mono);
  font-size: 0.65rem;
  color: var(--ink-soft);
  text-align: center;
}
.day-track { position: relative; min-height: 540px; }
.tl-post {
  position: absolute;
  left: 0.4rem; right: 0.4rem;
  transform: translateY(-50%);
  z-index: 2;
  border-left: 3px solid var(--acct, var(--accent));
  background: var(--bg);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 0.35rem;
  align-items: stretch;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tl-post.draggable { cursor: grab; }
.tl-post.draggable:active { cursor: grabbing; }
.tl-post.clash { outline: 1px dashed var(--st-missed); }
.tl-post:hover { transform: translateY(-50%) scale(1.01); z-index: 3; }
.tl-inner {
  display: flex;
  gap: 0.5rem;
  padding: 0.35rem 0.45rem;
  text-decoration: none;
  color: inherit;
  flex: 1;
  min-width: 0;
}
.tl-cover {
  width: 36px; height: 48px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg-soft);
  flex-shrink: 0;
}
.tl-cover.placeholder { background: var(--accent-soft); }
.tl-meta { display: flex; gap: 0.35rem; align-items: center; flex-wrap: wrap; }
.tl-time { font-family: var(--mono); font-size: 0.72rem; font-weight: 600; }
.tl-acct { font-size: 0.72rem; color: var(--acct, var(--accent)); font-weight: 650; }
.tl-title {
  font-size: 0.82rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tl-time-btn { align-self: center; margin-right: 0.35rem; }

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.4rem;
  margin-bottom: 1rem;
  overflow-x: auto;
}
.week-col {
  min-width: 0;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  min-height: 280px;
}
.week-col.today { border-color: var(--accent); }
.week-col-head {
  text-align: center;
  padding: 0.45rem 0.25rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}
.week-dow { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; color: var(--ink-soft); }
.week-dom { font-size: 1.05rem; font-weight: 700; }
.week-col-body { padding: 0.35rem; display: flex; flex-direction: column; gap: 0.35rem; min-height: 220px; }
.week-post {
  border-left: 3px solid var(--acct, var(--accent));
  background: var(--bg);
  border-radius: 6px;
  padding: 0.35rem 0.4rem;
  font-size: 0.72rem;
}
.week-post a { color: inherit; text-decoration: none; }
.week-post.clash { outline: 1px dashed var(--st-missed); }
.week-post.draggable { cursor: grab; }
.week-post-time { font-family: var(--mono); font-weight: 600; }
.week-post-title { font-weight: 600; margin-top: 0.1rem; }
.week-post-acct { color: var(--acct, var(--accent)); }

.agenda-list { display: flex; flex-direction: column; gap: 0.5rem; }
.agenda-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-left: 3px solid var(--acct, var(--accent));
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.55rem;
}
.agenda-row.clash { outline: 1px dashed var(--st-missed); }
.agenda-main {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.agenda-cover {
  width: 40px; height: 54px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg-soft);
  flex-shrink: 0;
}
.agenda-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.agenda-acct { font-size: 0.72rem; color: var(--acct, var(--accent)); font-weight: 650; }
.agenda-title { font-weight: 600; font-size: 0.9rem; }

.lane-view { display: flex; flex-direction: column; gap: 1rem; }
.lane { border-left: 3px solid var(--acct, var(--accent)); padding-left: 0.65rem; }
.lane-head { margin: 0 0 0.45rem; font-size: 1rem; }
.lane-posts { display: flex; flex-direction: column; gap: 0.4rem; }
.lane-post {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.55rem;
}
.lane-post a {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  align-items: center;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
.lane-time { font-family: var(--mono); font-size: 0.75rem; }
.lane-title { font-weight: 600; }
.lane-post.clash { outline: 1px dashed var(--st-missed); }

.account-chip { border-left: 2px solid var(--acct, transparent); padding-left: 0.35rem; }

.insights-block { margin-top: 1rem; }
.insights-block h4 { margin: 0 0 0.5rem; font-size: 0.9rem; }
.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 0.45rem;
}
.insight-stat {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.5rem;
  text-align: center;
}
.insight-stat .l {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  font-weight: 650;
}
.insight-stat .v { font-weight: 700; font-size: 1rem; margin-top: 0.15rem; }
.insights-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.insight-overview h3 { margin-top: 0; }
