/* IG Posting Bot: hand-written styles.
   Theme: tokens on :root (light) and [data-theme="dark"]. <html data-theme> comes from the `theme`
   cookie (server) or, with no explicit choice, from the system preference (inline <head> script).
   All text/background pairs below meet WCAG AA (4.5:1); input borders meet 3:1. Spacing is on an 8px grid.
   The accent (buttons, links, the current tab, selections, focus) is red; neutral information (the Processing and
   Batch badges, info messages) is slate, so it never reads as an error (--danger). */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --border: #e2e5e9;
  --border-input: #8a939e;
  --text: #16191d;
  --text-muted: #5a636e;
  --accent: #c62828;
  --accent-hover: #a91f1f;
  --accent-soft: #fdecec;
  --accent-ink: #ffffff;
  --info: #3d4756;
  --info-soft: #e9ecf1;
  --success: #0a7550;
  --success-soft: #e6f4ed;
  --warn: #8a5300;
  --warn-soft: #fcf1dd;
  --danger: #bf2536;
  --danger-soft: #fbe9eb;
  --neutral-soft: #eceef1;
  --sched: #5b3fb3;  /* scheduled posts: their own colour, so "waiting for its time" never reads as busy or broken */
  --sched-soft: #efeafb;
  --gold: #8a6200;  /* the Leaderboard's podium: text/icon colours on their soft backgrounds meet AA */
  --gold-soft: #fdf3d6;
  --gold-line: #e2b53c;
  --silver: #4f5b69;
  --silver-soft: #eef1f5;
  --bronze: #8f4a1c;
  --bronze-soft: #f9ebe1;
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);
  --overlay: rgba(255, 255, 255, 0.9);

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --radius: 8px;
  --radius-lg: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0e1114;
  --surface: #161a1f;
  --surface-2: #1b2026;
  --border: #2a3038;
  --border-input: #6b7580;
  --text: #e8eaed;
  --text-muted: #9ba4ae;
  --accent: #ff6b6b;
  --accent-hover: #ff8585;
  --accent-soft: #3a1b1d;
  --accent-ink: #0b0e14;
  --info: #c5ccd6;
  --info-soft: #252b33;
  --success: #5ccf9d;
  --success-soft: #10281e;
  --warn: #f0b357;
  --warn-soft: #2b2312;
  --danger: #ff7d8a;
  --danger-soft: #33191d;
  --neutral-soft: #232931;
  --sched: #b9a5ff;
  --sched-soft: #261f3d;
  --gold: #f4c95d;
  --gold-soft: #2c2410;
  --gold-line: #9c7a22;
  --silver: #c3ccd6;
  --silver-soft: #22272e;
  --bronze: #e6a271;
  --bronze-soft: #2d1f15;
  --overlay: rgba(22, 26, 31, 0.9);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 var(--sp-2); letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.125rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 var(--sp-3); }
code { font-family: var(--mono); font-size: .875em; background: var(--neutral-soft); padding: 1px 6px; border-radius: 4px; }
small, .small { font-size: .875rem; }
.muted { color: var(--text-muted); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- top bar ---- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: var(--sp-2) var(--sp-4); min-height: 56px;
  display: flex; align-items: center; gap: var(--sp-2) var(--sp-5); flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: var(--sp-2); font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
/* the owner's "P" logo (a near-black square): a hairline keeps its edge on the dark theme */
.brand-mark { display: block; width: 28px; height: 28px; border-radius: 7px; flex: none; }
.brand-mark.lg { width: 60px; height: 60px; border-radius: 14px; }
[data-theme="dark"] .brand-mark { box-shadow: 0 0 0 1px var(--border-input); }
.me-name { color: var(--text-muted); font-size: .875rem; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-spacer { flex: 1; }

.theme-toggle {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; flex: none;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-muted); cursor: pointer;
}
.theme-toggle:hover { color: var(--text); background: var(--surface-2); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---- layout ---- */
.container { max-width: 1200px; margin: 0 auto; padding: var(--sp-5) var(--sp-4) var(--sp-7); }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3) var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-5); }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--text-muted); margin: var(--sp-1) 0 0; }
.actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.crumbs { font-size: .875rem; color: var(--text-muted); margin-bottom: var(--sp-1); }
.crumbs a { color: var(--text-muted); }
.stack > * + * { margin-top: var(--sp-4); }
.section-gap { margin-top: var(--sp-5); }
.cols { display: grid; gap: var(--sp-5); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .cols { grid-template-columns: minmax(0, 1fr) 336px; align-items: start; } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-5); }
.card + .card { margin-top: var(--sp-5); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card.flush { padding: 0; overflow: hidden; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 var(--sp-4); border-radius: var(--radius);
  border: 1px solid var(--border-input); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; font-size: .9375rem; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: var(--surface); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-danger.solid { background: var(--danger); color: var(--surface); }
.btn-danger.solid:hover { filter: brightness(0.95); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--neutral-soft); color: var(--text); }
.btn-sm { height: 32px; padding: 0 var(--sp-3); font-size: .875rem; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; }

/* ---- badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 var(--sp-2);
  border-radius: 999px; font-size: .8125rem; font-weight: 600; white-space: nowrap;
  background: var(--neutral-soft); color: var(--text-muted);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad, .badge.expired, .badge.reconnect { background: var(--danger-soft); color: var(--danger); }
.badge.none { background: var(--neutral-soft); color: var(--text-muted); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.sched { background: var(--sched-soft); color: var(--sched); }

/* ---- flash messages / notes ---- */
.flash { padding: var(--sp-3) var(--sp-4); border-radius: var(--radius); margin-bottom: var(--sp-4); border: 1px solid transparent; }
.flash-ok { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.flash-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.flash-error { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.flash ul { margin: var(--sp-1) 0 0; padding-left: var(--sp-5); }
.note { background: var(--surface-2); border: 1px dashed var(--border-input); border-radius: var(--radius); padding: var(--sp-3) var(--sp-4); color: var(--text-muted); font-size: .9375rem; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: var(--sp-3) var(--sp-4); text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 650; background: var(--surface-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td.num { font-variant-numeric: tabular-nums; }
td.end, th.end { text-align: right; }
.cell-page { display: flex; align-items: center; gap: var(--sp-3); min-width: 200px; }
.cell-page .name { font-weight: 600; color: var(--text); }
.cell-page .handle { color: var(--text-muted); font-size: .875rem; }
/* On phones, rows of a .stack-mobile table become label/value cards. */
@media (max-width: 640px) {
  table.stack-mobile thead { display: none; }
  table.stack-mobile tr { display: block; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); }
  table.stack-mobile tbody tr:last-child { border-bottom: 0; }
  table.stack-mobile td { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); padding: 6px 0; border: 0; text-align: right; }
  table.stack-mobile td[data-label]::before { content: attr(data-label); color: var(--text-muted); font-size: .8125rem; font-weight: 600; text-align: left; }
  table.stack-mobile td:first-child { text-align: left; padding-bottom: var(--sp-2); }
  table.stack-mobile td.end { justify-content: flex-end; padding-top: var(--sp-2); }
  table.stack-mobile tbody tr:hover td { background: none; }
}
.row-link { color: inherit; }
.row-link:hover { text-decoration: none; }
.row-link:hover .name { color: var(--accent); text-decoration: underline; }

/* ---- Pages tab: sections and the order of pages (pages_order.js); the Users list's groups (user_groups.js) are
   headed the same way ---- */
[data-js-only][hidden], .page-board [hidden], .user-table [hidden] { display: none !important; }  /* phones: table rows are display: block */
.add-section, .add-group { max-width: 640px; }
.add-group[hidden] + .card { margin-top: 0; }
.add-section:not([hidden]) + .page-board { margin-top: var(--sp-5); }
:is(.add-section, .add-group) > .help { display: block; margin-top: var(--sp-2); color: var(--text-muted); font-size: .8125rem; }
.drag-handle {
  display: inline-grid; place-items: center; flex: none; width: 24px; height: 36px; margin-left: calc(-1 * var(--sp-2));
  border-radius: 6px; color: var(--text-muted); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.drag-handle:hover { background: var(--neutral-soft); color: var(--text); }
.drag-handle svg { width: 16px; height: 16px; }
.drag-spacer { flex: none; width: 24px; margin-left: calc(-1 * var(--sp-2)); }  /* lines "Unsorted" up with the section names */
@media (pointer: coarse) { .drag-handle, .drag-spacer { width: 36px; } .drag-handle { height: 44px; } }
.row-actions { display: inline-flex; align-items: center; gap: var(--sp-1); }
.menu-btn { width: 32px; padding: 0; }
.menu-btn svg { flex: none; width: 16px; height: 16px; }
.group-actions .menu-btn { padding: 0; }  /* a look's .btn-sm padding mustn't squeeze the dots (Insta Feed) */
.user-table .group-head th {
  padding: var(--sp-5) var(--sp-4) var(--sp-2); background: var(--surface); color: var(--text); white-space: normal;
  font-size: .9375rem; font-weight: 650; letter-spacing: 0; text-transform: none; border-bottom: 1px solid var(--border);
}
.user-table tbody:first-of-type .group-head th { padding-top: var(--sp-3); }
.page-group, .user-group, .user-row, .add-group { scroll-margin-top: 80px; }
.group-bar { display: flex; align-items: center; gap: var(--sp-2); min-height: 32px; }
.group-title { display: flex; align-items: center; gap: var(--sp-2); flex: 1; min-width: 0; }
.group-name { overflow-wrap: anywhere; }
.group-count {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: var(--neutral-soft); color: var(--text-muted); font-size: .75rem; font-weight: 650; font-variant-numeric: tabular-nums;
}
.group-actions { margin-left: auto; }
.group-head.is-renaming .group-title, .group-head.is-renaming .group-actions { display: none; }
.rename-form { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); flex: 1; min-width: 0; margin: 0; }
.rename-form input[type=text] { flex: 0 1 320px; min-width: 0; height: 32px; font-weight: 400; }
.rename-form .error { flex-basis: 100%; color: var(--danger); font-size: .8125rem; font-weight: 600; }
.user-table .group-empty td { padding: var(--sp-3) var(--sp-4); color: var(--text-muted); font-size: .875rem; border-bottom: 1px solid var(--border); }
.user-table tbody tr.group-empty:hover td { background: none; }
.user-table tbody:last-of-type tr:has(+ tr.group-empty[hidden]) td,
.user-table tbody:last-of-type .group-empty td { border-bottom: 0; }
html.is-grabbing, html.is-grabbing * { cursor: grabbing !important; }

/* The Pages tab's blocks: a grid per section of each page's avatar and @handle (a .card, so every look draws it as its
   own), opening the page's settings. A red dot on the avatar: the page needs attention; dimmed and dashed: switched
   off. While dragging (pages_order.js), the picked-up block is lifted, and a picked-up section folds to its heading. */
.page-board { display: flex; flex-direction: column; gap: var(--sp-6); }
.page-group { min-width: 0; }
.page-board .group-head { margin-bottom: var(--sp-3); padding-bottom: var(--sp-2); border-bottom: 1px solid var(--border); }
.page-board .group-title { margin: 0; font-size: 1rem; font-weight: 650; letter-spacing: 0; text-transform: none; }
.page-blocks {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: var(--sp-3); margin: 0; padding: 0;
  list-style: none;
}
.page-block-item { display: flex; min-width: 0; }
.page-blocks > li > .card { margin: 0; }  /* the grid spaces them, not .card + .card */
.page-block {
  position: relative; display: flex; flex: 1; flex-direction: column; align-items: center; gap: var(--sp-2); min-width: 0;
  padding: var(--sp-4) var(--sp-2) var(--sp-3); color: var(--text); text-align: center; text-decoration: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.page-block:hover { border-color: var(--accent); color: var(--text); text-decoration: none; }
.page-block:hover .page-block-handle { color: var(--accent); }
.page-block:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.page-block-face { position: relative; display: inline-flex; flex: none; }
.page-block .avatar { width: 64px; height: 64px; font-size: 1.5rem; }
.page-block-handle {
  display: -webkit-box; max-width: 100%; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  font-size: .875rem; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere;
}
.attention-dot {
  position: absolute; top: 0; right: 0; width: 14px; height: 14px; border-radius: 50%; background: var(--danger);
  box-shadow: 0 0 0 2.5px var(--surface);
}
.page-block.is-off { border-style: dashed; }
.page-block.is-off .avatar { filter: grayscale(1); opacity: .45; }
.page-block.is-off .page-block-handle { color: var(--text-muted); font-weight: 550; }
.page-board .group-empty {
  margin: 0; padding: var(--sp-4); border: 1.5px dashed var(--border-input); border-radius: var(--radius);
  color: var(--text-muted); font-size: .875rem; text-align: center;
}
.page-board-help { margin: var(--sp-5) 0 0; }
@media (pointer: coarse) { .page-board-help .kbd-hint { display: none; } }  /* a phone has no Alt + arrow keys */
.page-board.is-sorting { user-select: none; -webkit-user-select: none; }
.page-block-item.is-dragging { position: relative; z-index: 2; }
.page-block-item.is-dragging > .page-block {
  border-color: var(--accent); background: var(--accent-soft); transform: scale(1.04);
  box-shadow: 0 0 0 2px var(--accent), 0 12px 28px rgba(0, 0, 0, .18);
}
.page-group.is-dragging :is(.page-blocks, .group-empty) { display: none; }
.page-group.is-dragging .group-head { border-radius: var(--radius); background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
@media (max-width: 640px) {
  .page-board { gap: var(--sp-5); }
  .page-blocks { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
  .page-block { padding: var(--sp-3) var(--sp-1) var(--sp-2); }
  .page-block .avatar { width: 56px; height: 56px; font-size: 1.25rem; }
  .page-block-handle { font-size: .8125rem; }
}
@media (max-width: 359.98px) { .page-blocks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* the ⋯ menus: hidden until pages_order.js opens one next to its button (plain [hidden] + position: fixed, so they
   work in every browser, including ones without the Popover API such as older iPhones) */
.pop-menu {
  position: fixed; z-index: 30; min-width: 200px; max-width: 248px; max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px);
  overflow-y: auto; overscroll-behavior: contain; margin: 0; padding: var(--sp-1);
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text); box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
  /* it sits in a table cell: don't inherit the cell's alignment or the heading's type */
  text-align: left; white-space: normal; font-size: .875rem; font-weight: 400; letter-spacing: normal; text-transform: none;
}
.pop-menu form { margin: 0; }
.noscript-actions { display: inline-flex; align-items: center; gap: var(--sp-1); }
.noscript-actions form { margin: 0; }
.menu-item {
  display: flex; align-items: center; gap: var(--sp-2); width: 100%; min-height: 36px; padding: 6px var(--sp-3);
  border: 0; border-radius: 6px; background: none; color: var(--text); font: inherit; font-size: .875rem; font-weight: 550;
  text-align: left; cursor: pointer; overflow-wrap: anywhere;
}
.menu-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.menu-item:focus-visible { outline: none; background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--accent); }
.menu-item[disabled] { color: var(--text-muted); opacity: .55; cursor: default; background: none; }
.menu-item[aria-current="true"] { opacity: 1; color: var(--accent); font-weight: 650; }
.menu-item[aria-current="true"]::after { content: "✓"; margin-left: auto; }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: var(--danger-soft); }
.menu-label {
  margin-top: var(--sp-1); padding: var(--sp-2) var(--sp-3) var(--sp-1); border-top: 1px solid var(--border);
  color: var(--text-muted); font-size: .75rem; font-weight: 650; letter-spacing: .05em; text-transform: uppercase;
}
.pop-menu > form { margin-top: var(--sp-1); padding-top: var(--sp-1); border-top: 1px solid var(--border); }
.pop-menu > .menu-label:first-child { margin-top: 0; border-top: 0; }  /* a menu that starts with its label (Move to group) */
@media (max-width: 640px) {
  table.stack-mobile.user-table tr.group-head, table.stack-mobile.user-table tr.group-empty { padding: 0; border-bottom: 0; }
  .user-table .group-head th { display: block; padding: var(--sp-5) var(--sp-4) var(--sp-2); border-top: 1px solid var(--border); }
  .user-table tbody:first-of-type .group-head th { border-top: 0; padding-top: var(--sp-3); }
  table.stack-mobile.user-table .group-empty td { display: block; padding: var(--sp-3) var(--sp-4); text-align: left; }
}
@media (max-width: 640px) and (pointer: coarse) {
  :is(.page-board, .user-table) .group-actions .menu-btn, .user-row .menu-btn { width: 40px; height: 40px; }
  .user-row .row-actions > .btn:not(.menu-btn) { min-height: 40px; }
}

/* ---- avatars ---- */
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none; object-fit: cover;
  display: inline-grid; place-items: center; font-weight: 700; font-size: .9375rem;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--border);
}
.avatar.lg { width: 64px; height: 64px; font-size: 1.5rem; }

/* ---- forms ---- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-weight: 600; font-size: .875rem; }
.field .help { color: var(--text-muted); font-size: .8125rem; }
.field .error { color: var(--danger); font-size: .8125rem; font-weight: 600; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search],
input[type=datetime-local], select, textarea {
  width: 100%; height: 40px; padding: 0 var(--sp-3); font: inherit; font-size: .9375rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-input); border-radius: var(--radius);
}
textarea { height: auto; min-height: 96px; padding: var(--sp-2) var(--sp-3); resize: vertical; line-height: 1.45; }
select {
  appearance: none; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 17px, calc(100% - 13px) 17px;
  background-size: 5px 5px; background-repeat: no-repeat;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
input[readonly] { background: var(--surface-2); }
input[type=file] { font: inherit; font-size: .875rem; max-width: 100%; color: var(--text-muted); }
input[type=file]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: var(--sp-2); font-weight: 550; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex: none; }
.check input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check .muted { font-weight: 400; }
/* a setting that's shown but not editable (a manager's Active on a page's Edit screen) */
.check-static { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: 0; }
.form-grid { display: grid; gap: var(--sp-4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.form-actions { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; margin-top: var(--sp-5); }
.inline-form { display: flex; gap: var(--sp-2) var(--sp-3); flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { flex: 1 1 240px; }
.checklist { display: grid; gap: var(--sp-2); grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.checklist .check { padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); min-height: 48px; }
.checklist .check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.checklist .sub { display: block; font-size: .8125rem; color: var(--text-muted); font-weight: 400; }
.saved { color: var(--success); font-weight: 600; font-size: .875rem; }

.color-input { display: flex; gap: var(--sp-2); align-items: center; }
.color-input input[type=color] {
  width: 40px; height: 40px; flex: none; padding: 3px; border: 1px solid var(--border-input);
  border-radius: var(--radius); background: var(--surface); cursor: pointer;
}
.color-input input[type=color]:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.color-input input[type=text] { font-family: var(--mono); text-transform: uppercase; }
/* An optional color left blank (e.g. no highlight color): a crossed-out swatch, not the picker's black. */
.color-input.is-empty input[type=color]::-webkit-color-swatch {
  background: linear-gradient(to top right, transparent 45%, var(--danger) 45%, var(--danger) 55%, transparent 55%),
    var(--surface) !important;
}
.color-input.is-empty input[type=color]::-moz-color-swatch {
  background: linear-gradient(to top right, transparent 45%, var(--danger) 45%, var(--danger) 55%, transparent 55%),
    var(--surface) !important;
}

/* ---- auth pages ---- */
.auth-wrap { min-height: calc(100vh - 160px); display: grid; place-items: center; }
.auth-card { width: 100%; max-width: 400px; padding: var(--sp-6); }
.auth-card .brand-mark { margin-bottom: var(--sp-4); }
.auth-card h1 { font-size: 1.375rem; }

/* ---- page cards (submit) ---- */
.page-grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fill, minmax(256px, 1fr)); }
.page-card { display: flex; gap: var(--sp-3); align-items: center; color: inherit; }
.page-card:hover { text-decoration: none; border-color: var(--accent); }
.page-card .name { font-weight: 650; }
.empty { text-align: center; padding: var(--sp-7) var(--sp-5); color: var(--text-muted); }
.empty h2 { color: var(--text); }

/* ---- templates ---- */
.tpl-grid { display: grid; gap: var(--sp-5); grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); }
.tpl-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.tpl-card + .tpl-card { margin-top: 0; }
.tpl-thumb { display: grid; place-items: center; padding: var(--sp-4); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.tpl-thumb img { width: 100%; max-width: 180px; aspect-ratio: 9 / 16; object-fit: contain; display: block; border: 1px solid var(--border); border-radius: 4px; }
.tpl-body { padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); flex: 1; }
.tpl-body h3 { margin: 0; }
.tpl-body .actions { margin-top: auto; padding-top: var(--sp-2); }

.editor { display: grid; gap: var(--sp-5); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1000px) { .editor { grid-template-columns: minmax(0, 1fr) 392px; align-items: start; } }
@media (min-width: 1000px) { .editor-side .card { position: sticky; top: 80px; } }
fieldset.card { margin: 0; min-width: 0; }
fieldset.card + fieldset.card, .card + fieldset.card, fieldset.card + .card { margin-top: var(--sp-5); }
legend { float: left; width: 100%; padding: 0; margin-bottom: var(--sp-4); font-weight: 650; font-size: 1rem; }
legend + * { clear: left; }
.tfields { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fill, minmax(184px, 1fr)); }
.tfields .field.wide { grid-column: 1 / -1; }
.preview-controls { display: grid; gap: var(--sp-3); grid-template-columns: 1fr 1fr; margin-bottom: var(--sp-4); }
.preview-controls .field.wide { grid-column: 1 / -1; }
.preview-controls textarea { min-height: 64px; }
/* Neutral frame: the preview's own colors come from the template, never from the UI theme. */
.preview-frame { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-3); min-height: 240px; display: grid; place-items: center; }
.preview-frame img { display: block; width: 100%; max-width: 336px; height: auto; margin: 0 auto; border: 1px solid var(--border); border-radius: 4px; }
.preview-frame .flash { width: 100%; margin: 0; }
/* Template layers, uploaded images and the draggable watermark (template_editor.js) */
.tfields .field[hidden] { display: none; }
.section-note { margin: calc(-1 * var(--sp-2)) 0 var(--sp-4); clear: left; }
.tfields.toggles { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: var(--sp-2); }
.toggle-help { display: block; color: var(--text-muted); font-size: .75rem; font-weight: 400; line-height: 1.3; }
.toggle-field .check { min-height: 44px; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.toggle-field .check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.asset-row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.asset-thumb {
  display: grid; place-items: center; width: 96px; height: 56px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius);
  /* a checkerboard, so transparent parts of the image read as transparent */
  background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 12px 12px;
}
.asset-thumb img { display: block; max-width: 100%; max-height: 100%; }
.asset-thumb:empty::after { content: "None"; color: var(--text-muted); font-size: .75rem; }
.asset-pick { position: relative; cursor: pointer; }
.asset-pick:focus-within { box-shadow: var(--focus-ring); }
.preview-stage { position: relative; }
.wm-box {
  position: absolute; box-sizing: border-box; border: 2px dashed var(--accent); border-radius: 2px; cursor: move; touch-action: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .6); user-select: none; -webkit-user-select: none;
}
.wm-box[hidden] { display: none; }
.wm-box:hover, .wm-box.dragging { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.wm-handle {
  position: absolute; right: -9px; bottom: -9px; width: 16px; height: 16px; border-radius: 50%; cursor: nwse-resize; touch-action: none;
  background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}
@media (pointer: coarse) { .wm-handle { width: 26px; height: 26px; right: -14px; bottom: -14px; } }
.wm-hint { margin: var(--sp-2) 0 0; text-align: center; }
.htmx-indicator { visibility: hidden; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { visibility: visible; }
.sticky-actions {
  position: sticky; bottom: var(--sp-2); z-index: 5; margin-top: var(--sp-5); padding: var(--sp-3) var(--sp-4);
  background: var(--overlay); backdrop-filter: blur(6px);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap;
}

/* ---- link box ---- */
.link-box { display: flex; gap: var(--sp-2); }
.link-box input { font-family: var(--mono); font-size: .8125rem; }
.link-card { border-color: var(--success); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--sp-2) var(--sp-4); margin: 0; font-size: .9375rem; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.error-page { text-align: center; padding: var(--sp-7) var(--sp-4); }
.error-page .code { font-size: 3rem; font-weight: 800; letter-spacing: -0.03em; color: var(--text-muted); }

/* ---- shared bits (Phase 4) ---- */
.block { display: block; }
.btn-lg { height: 48px; padding: 0 var(--sp-5); font-size: 1rem; }
input.input-lg { height: 48px; font-size: 1rem; }
.danger-text { color: var(--danger); }
.btn.danger-text:hover { background: var(--danger-soft); color: var(--danger); }
.flash-info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.flash > :last-child { margin-bottom: 0; }
.form-actions.tight { margin-top: var(--sp-3); }
.form-actions form { margin: 0; }
.spinner {
  display: inline-block; width: 1em; height: 1em; flex: none; vertical-align: -0.125em;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.5s; } }
.btn.htmx-request { cursor: progress; }

/* toasts (HTMX results and errors) */
.toasts {
  position: fixed; left: 50%; bottom: var(--sp-4); transform: translateX(-50%); z-index: 50;
  display: grid; gap: var(--sp-2); width: min(560px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  pointer-events: auto; padding: var(--sp-3) var(--sp-4); border-radius: var(--radius);
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--success);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .16); font-weight: 550; font-size: .9375rem;
  animation: toast-in .15s ease-out;
}
.toast.info { border-left-color: var(--info); }
.toast.warn { border-left-color: var(--warn); }
.toast.error { border-left-color: var(--danger); color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* ---- submit page ---- */
.submit-card { max-width: 880px; }
.submit-card > .flash + .field { margin-top: var(--sp-4); }
.page-picker { border: 0; padding: 0; margin: 0; min-width: 0; }
.page-picker legend { font-weight: 600; font-size: .875rem; margin-bottom: var(--sp-2); float: none; }
.page-picker .error { display: block; margin-top: var(--sp-2); color: var(--danger); font-size: .8125rem; font-weight: 600; }
.page-options { display: grid; gap: var(--sp-2); grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.page-option {
  display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3); min-height: 64px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.page-option:hover { border-color: var(--border-input); }
.page-option input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--accent); }
.page-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.page-option:has(input:focus-visible) { box-shadow: var(--focus-ring); }
.page-option.is-disabled { opacity: .6; cursor: not-allowed; }
.page-option-text { display: flex; flex-direction: column; min-width: 0; }
.page-option-text .name { font-weight: 650; }
.page-option-text .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* an admin's page picker follows their Pages tab: a small heading per section (Unsorted first, without one) */
.page-group-label {
  display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-4) 0 var(--sp-2);
  color: var(--text-muted); font-size: .75rem; font-weight: 650; letter-spacing: .05em; text-transform: uppercase;
}
.page-group-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.page-picker legend + .page-group-label { margin-top: 0; }
/* the Template control under the page picker (shared by every tab), with a thumbnail of the pick */
.tpl-picker { margin-top: var(--sp-4); }
.tpl-picker > .label { display: block; font-weight: 600; font-size: .875rem; margin-bottom: var(--sp-2); }
.tpl-picker-row { display: flex; align-items: center; gap: var(--sp-3); }
.tpl-pick-thumb {
  flex: none; display: grid; place-items: center; width: 54px; height: 96px; overflow: hidden;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2);
}
.tpl-pick-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.tpl-pick-empty {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-1); padding: 0 var(--sp-1);
  color: var(--text-muted); font-size: .6875rem; font-weight: 600; line-height: 1.2; text-align: center;
}
.tpl-pick-empty .icon { width: 18px; height: 18px; }
.tpl-picker-main { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; max-width: 440px; }
.tpl-picker-main .help { color: var(--text-muted); font-size: .8125rem; }
.tpl-picker-main .error { color: var(--danger); font-size: .8125rem; font-weight: 600; }
.tpl-picker.has-error select { border-color: var(--danger); }
/* review page / batch card: "Template: … (chosen)" and Change template */
.template-panel { display: flex; flex-direction: column; gap: var(--sp-2); }
.template-panel.card { padding: var(--sp-4); }
.tpl-now { margin: 0; overflow-wrap: anywhere; }
.tpl-now-label { color: var(--text-muted); font-size: .875rem; font-weight: 600; }
.tpl-gone { margin: 0; padding: var(--sp-2) var(--sp-3); font-size: .875rem; }
.tpl-change { display: flex; gap: var(--sp-2); align-items: center; margin: 0; }
.tpl-change select {
  flex: 1; min-width: 0; height: 32px; font-size: .875rem;
  background-position: calc(100% - 18px) 13px, calc(100% - 13px) 13px;
}
.tpl-change .btn { flex: none; }
/* review page / batch card: the video's own Trim (a slider, where to cut from, Update video) */
.trim-panel.card { padding: var(--sp-4); }
.trim-form { display: flex; flex-direction: column; gap: var(--sp-2); margin: 0; }
.trim-fields { display: flex; flex-direction: column; gap: var(--sp-2); margin: 0; padding: 0; border: 0; min-width: 0; }
.trim-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); flex-wrap: wrap; }
.trim-now { margin: 0; }
.trim-now-label { color: var(--text-muted); font-size: .875rem; font-weight: 600; }
.trim-now output { font-weight: 700; font-variant-numeric: tabular-nums; }
.trim-range { width: 100%; height: 28px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.trim-range:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.trim-fields:disabled .trim-range { cursor: default; opacity: .6; }
.trim-fields:disabled .btn { opacity: .5; cursor: not-allowed; }  /* disabled by the fieldset: like .btn[disabled] */
.trim-row { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.trim-from-label { color: var(--text-muted); font-size: .875rem; font-weight: 600; }
.trim-row select {
  flex: 1; min-width: 0; height: 32px; font-size: .875rem;
  background-position: calc(100% - 18px) 13px, calc(100% - 13px) 13px;
}
.trim-row .btn { flex: none; margin-left: auto; }
.trim-form .help { color: var(--text-muted); font-size: .8125rem; }
.bcard .trim-row select { flex-basis: calc(100% - 80px); }  /* narrow cards and phones: the button on its own row */
.bcard .trim-row .btn { width: 100%; }
@media (max-width: 480px) {
  .trim-row select { flex-basis: calc(100% - 80px); }
  .trim-row .btn { width: 100%; }
}
.trim-head .trim-open { gap: 6px; margin-left: auto; }
/* "Trim on the video" (trim_editor.js): in place of the player on the review page; over the page (.is-overlay, a dialog)
   from a batch card or on a phone. The script sizes the stage (the canvas and the video's two edges) to fit. */
.trim-editor[hidden], .te-edge[hidden], .te-chip[hidden], .te-status[hidden], .te-status .spinner[hidden] { display: none; }
@media (min-width: 900px) { .video-card.is-trimming > :not(.trim-editor) { display: none; } }
.te-backdrop { display: none; }
.te-panel { display: flex; flex-direction: column; gap: var(--sp-3); min-height: 0; }
/* the title and the trim on one line, where the cut comes from on the next: always two lines, so the stage never moves */
.te-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 2px var(--sp-3); }
.te-title { margin: 0; font-size: 1rem; }
.te-title .muted { font-weight: 500; }
.te-amount { font-size: .9375rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.te-split {
  grid-column: 1 / -1; margin: 0; color: var(--text-muted); font-size: .8125rem; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.te-wrap { display: flex; justify-content: center; align-items: flex-start; min-width: 0; min-height: 0; }
.te-stage {
  position: relative; flex: none; width: 270px; height: 480px;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.te-canvas { display: block; width: 100%; height: 100%; border-radius: var(--radius); background: var(--surface-2); box-shadow: 0 0 0 1px var(--border); }
/* the video's top and bottom edges: a red line across it with a grip in the middle, tall enough to grab with a finger */
.te-edge {
  position: absolute; top: 0; left: 0; width: 100%; height: 40px; margin-top: -20px; display: grid; place-items: center;
  cursor: ns-resize; touch-action: none; outline: none;
}
.te-edge::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 3px; margin-top: -1.5px; background: var(--accent);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .85), 0 1px 4px rgba(0, 0, 0, .35);
}
.te-grip {
  position: relative; display: grid; place-items: center; width: 52px; height: 22px; border-radius: 11px;
  background: var(--accent); border: 2px solid #fff; color: #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, .45);
  transition: transform .12s ease;
}
.te-grip::before { content: ""; width: 20px; height: 6px; border-top: 2px solid #fff; border-bottom: 2px solid #fff; }
.te-edge:hover .te-grip, .te-edge.is-dragging .te-grip { transform: scale(1.12); }
@media (prefers-reduced-motion: reduce) { .te-grip { transition: none; } }
.te-edge:focus-visible .te-grip { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); }
.te-edge.is-locked { cursor: not-allowed; justify-items: start; }  /* the lock at the end: the bar's text is mid-width */
.te-edge.is-locked::before { background: #8a939e; }
.te-edge.is-locked .te-grip { width: 30px; margin-left: 8px; background: #5a636e; transform: none; }
.te-edge.is-locked .te-grip::before { display: none; }
.te-chip {
  position: absolute; right: 8px; padding: 1px 7px; border-radius: 999px; background: rgba(0, 0, 0, .74); color: #fff;
  font-size: .75rem; font-weight: 650; font-variant-numeric: tabular-nums; pointer-events: none;
}
.te-edge-top .te-chip { top: calc(50% + 7px); }
.te-edge-bottom .te-chip { bottom: calc(50% + 7px); }
.te-status {
  position: absolute; left: 8px; top: 8px; z-index: 1; margin: 0; display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; background: rgba(0, 0, 0, .74); color: #fff; font-size: .75rem; font-weight: 600;
  pointer-events: none;
}
.te-status.is-error { left: 12px; right: 12px; top: 40%; padding: var(--sp-3); border-radius: var(--radius); font-size: .875rem; }
.te-help { margin: 0; color: var(--text-muted); font-size: .8125rem; }
.te-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); }
.te-done .spinner { display: none; margin-right: 6px; }
.te-done.is-busy .spinner { display: inline-block; }
.trim-editor.is-overlay {
  position: fixed; inset: 0; z-index: 45; display: flex; align-items: center; justify-content: center;
  padding: max(var(--sp-4), env(safe-area-inset-top)) var(--sp-4) max(var(--sp-4), env(safe-area-inset-bottom));
}
.trim-editor.is-overlay .te-backdrop { display: block; position: absolute; inset: 0; background: rgba(0, 0, 0, .58); }
.trim-editor.is-overlay .te-panel {
  position: relative; width: min(100%, 520px); height: 100%; max-height: 1000px; padding: var(--sp-4);
  border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: 0 16px 48px rgba(0, 0, 0, .35);
}
.trim-editor.is-overlay .te-wrap { flex: 1 1 0; align-items: center; }
@media (max-width: 599.98px) {
  .trim-editor.is-overlay { padding: 0; }
  .trim-editor.is-overlay .te-panel {
    width: 100%; max-height: none; border-radius: 0; box-shadow: none;
    padding: max(var(--sp-3), env(safe-area-inset-top)) var(--sp-4) max(var(--sp-3), env(safe-area-inset-bottom));
  }
}
@media (pointer: coarse) {
  .te-edge { height: 48px; margin-top: -24px; }
  .te-keys { display: none; }  /* no arrow keys on a phone */
}
body.trim-lock { overflow: hidden; }
body.trim-lock .fab { display: none; }
.sub-tpl { white-space: nowrap; }
.dup-warning ul { margin: var(--sp-2) 0 var(--sp-3); padding-left: var(--sp-5); }
.dup-warning a:not(.btn) { color: inherit; text-decoration: underline; }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.list-head h2 { margin: 0; }
.chips { display: flex; gap: var(--sp-2); overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.chip {
  display: inline-flex; align-items: center; height: 32px; padding: 0 var(--sp-3); border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); font-size: .875rem; font-weight: 600;
}
.chip:hover { text-decoration: none; color: var(--text); border-color: var(--border-input); }
.chip.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

.sub-list { list-style: none; margin: 0; padding: 0; }
.sub-list li + li { border-top: 1px solid var(--border); }
.sub-item { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); color: inherit; }
.sub-item:hover { background: var(--surface-2); text-decoration: none; }
.sub-item:hover .name { color: var(--accent); }
.thumb {
  width: 54px; height: 96px; flex: none; border-radius: 6px; overflow: hidden; background: var(--neutral-soft);
  display: grid; place-items: center; color: var(--text-muted); font-weight: 700; border: 1px solid var(--border);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sub-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.sub-title .name { font-weight: 650; }
.sub-text { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.sub-meta { color: var(--text-muted); font-size: .8125rem; overflow-wrap: anywhere; }
.sub-status { display: flex; flex-direction: column; align-items: flex-end; gap: var(--sp-1); flex: none; }
@media (max-width: 640px) {
  .sub-item { flex-wrap: wrap; align-items: flex-start; }
  .sub-main { flex-basis: calc(100% - 54px - var(--sp-3)); }
  .sub-status { flex-direction: row; flex-wrap: wrap; align-items: center; margin-left: calc(54px + var(--sp-3)); }
}
/* The recent list's groups: "Ready to post" first (a green line, then its videos with a green edge), "Scheduled" (the
   same in the scheduled colour), "Everything else" after them */
.recent-group-head {
  display: flex; align-items: center; gap: var(--sp-2); margin: 0; padding: var(--sp-2) var(--sp-4);
  background: var(--surface-2); border-bottom: 1px solid var(--border); color: var(--text-muted);
  font-size: .75rem; font-weight: 650; letter-spacing: .05em; text-transform: uppercase;
}
.recent-group + .recent-group .recent-group-head { border-top: 1px solid var(--border); }
.recent-group.is-ready .recent-group-head {
  border-top: 3px solid var(--success); background: var(--success-soft); color: var(--success); font-size: .8125rem;
}
.recent-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: currentColor; }
.recent-group-count { margin-left: auto; font-weight: 600; letter-spacing: 0; text-transform: none; }
.recent-group.is-ready .sub-item { box-shadow: inset 3px 0 0 var(--success); }
.recent-group.is-scheduled .recent-group-head {
  border-top: 3px solid var(--sched); background: var(--sched-soft); color: var(--sched); font-size: .8125rem;
}
.recent-group.is-scheduled .sub-item, .recent-group.is-scheduled .sub-del { box-shadow: inset 3px 0 0 var(--sched); }
.sub-sched { display: flex; flex-wrap: wrap; gap: 2px var(--sp-2); color: var(--sched); font-size: .8125rem; font-weight: 600; }
.sub-sched-item { white-space: nowrap; }

/* ---- review page ---- */
.state-card h2 { margin-bottom: var(--sp-2); }
.progress-card { max-width: 880px; }
.steps { list-style: none; margin: var(--sp-2) 0 var(--sp-4); padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.step { position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); text-align: center; font-size: .875rem; color: var(--text-muted); }
.step + .step::before { content: ""; position: absolute; top: 13px; right: 50%; width: 100%; height: 2px; background: var(--border); }
.step.done + .step::before { background: var(--success); }
.step-dot {
  position: relative; z-index: 1; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--border-input); background: var(--surface);
}
.step.done .step-dot { background: var(--success); border-color: var(--success); }
.step.done .step-dot::after { content: ""; width: 7px; height: 12px; margin-top: -3px; border: solid var(--surface); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.step.current { color: var(--text); font-weight: 650; }
.step.current .step-dot { border-color: var(--accent-soft); }
.step.current .step-dot::after {
  content: ""; position: absolute; inset: -2px; border-radius: 50%;
  border: 2px solid var(--accent); border-right-color: transparent; animation: spin .9s linear infinite;
}
@media (prefers-reduced-motion: reduce) { .step.current .step-dot::after { animation-duration: 3s; } }
@media (max-width: 640px) {
  .steps { grid-template-columns: 1fr; gap: var(--sp-3); }
  .step { flex-direction: row; text-align: left; }
  .step + .step::before { display: none; }
}
.discard-row { margin-top: var(--sp-4); display: flex; justify-content: flex-end; }

.review { display: grid; gap: var(--sp-5); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) {
  .review { grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); }
  .review-media { position: sticky; top: 80px; }
}
.review-side > .card + .card { margin-top: var(--sp-4); }
.video-card { padding: var(--sp-3); }
.reel {
  display: block; width: min(100%, calc(72vh * 9 / 16)); height: auto; margin: 0 auto;
  aspect-ratio: 9 / 16; background: #000; border-radius: var(--radius);
}
.video-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-3); }
/* Same song for all (batch page) and Song for all (Submit): app.audio.songs */
.batch-song { display: grid; gap: var(--sp-2); margin-top: var(--sp-3); }
.batch-song-label { display: inline-flex; align-items: center; gap: var(--sp-1); margin: 0; }
.batch-song-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.batch-song-row select { flex: 1 1 220px; min-width: 0; max-width: 100%; }
.song-all-field, .reels-tab-all-field { margin-top: var(--sp-2); }
.song-all-field select { max-width: 100%; }
/* Mute (app.publishing.mute): under the player or the slides; the state, then its button (or why it's off) */
.mute-row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-2); }
.mute-row .mute-form { margin-left: auto; }
.mute-state { display: inline-flex; align-items: center; gap: var(--sp-1); margin: 0; font-size: .875rem; }
.mute-state .ico { flex: none; }
.mute-why { flex-basis: 100%; margin: 0; }
.bcard-video .mute-row { justify-content: center; }
.bcard-video .mute-row .mute-form { margin-left: 0; }
.video-card .summary { margin: var(--sp-3) 0 0; }
.job-bar {
  display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4);
  border-radius: var(--radius); background: var(--accent-soft); color: var(--accent); font-weight: 600;
}
.job-bar.is-idle { display: none; }
.notices:not(:has(.flash)) { display: none; }
.notices .flash { margin-bottom: var(--sp-4); }
.notice { display: flex; gap: var(--sp-3); align-items: flex-start; justify-content: space-between; }
.notice p { margin: 0; }
.notice form { margin: 0; flex: none; }
.card-head h2 label { font: inherit; }
.card-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; justify-content: flex-end; margin-top: var(--sp-3); }
.field-foot { display: flex; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.counter { color: var(--text-muted); font-variant-numeric: tabular-nums; font-size: .8125rem; }
.counter.over { color: var(--danger); font-weight: 650; }
.dirty-hint, .field .help.dirty-hint { color: var(--warn); font-size: .8125rem; font-weight: 600; }
.reveal summary { cursor: pointer; font-weight: 600; color: var(--accent); padding: var(--sp-1) 0; }
.reveal[open] summary { margin-bottom: var(--sp-2); }
.note q { font-style: italic; color: var(--text); }
.headline-body .note { margin-bottom: var(--sp-2); }
.post-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
/* Reels tab only (migration 0050): a tick above Post and Schedule, saved at once (a switch: role=switch) */
.reels-tab-form { margin: 0 0 var(--sp-3); }
.reels-tab-tick { display: inline-flex; align-items: center; gap: var(--sp-2); padding: 4px 0; border: 0; background: none;
  color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.reels-tab-tick:disabled { cursor: default; opacity: .85; }
.reels-tab-box { display: inline-grid; place-items: center; width: 20px; height: 20px; border: 2px solid var(--border-input);
  border-radius: 5px; font-size: .8125rem; line-height: 1; }
.reels-tab-tick.is-on .reels-tab-box { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.reels-tab-tick:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 6px; }
.reels-tab-help { display: block; margin-top: 2px; }
.post-buttons .btn { white-space: normal; height: auto; min-height: 48px; line-height: 1.2; padding: var(--sp-2) var(--sp-3); }
.post-card .trial-full { margin: var(--sp-2) 0; }
.post-card > p.small { margin: var(--sp-2) 0 0; }
.confirm-box { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius); padding: var(--sp-4); }
.confirm-box h3 { margin-bottom: var(--sp-1); }
.confirm-box .kv { margin-top: var(--sp-3); }

/* ---- scheduled posts ---- */
.schedule-pick { margin-top: var(--sp-2); }
.schedule-pick > summary { list-style: none; width: 100%; }
.schedule-pick > summary::-webkit-details-marker { display: none; }
.schedule-pick > summary[aria-disabled="true"] { opacity: .55; pointer-events: none; }
.schedule-pick[open] > summary { border-color: var(--sched); color: var(--sched); }
.schedule-form { display: grid; gap: var(--sp-2); margin-top: var(--sp-2); padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.schedule-form .label, .sched-change .label { margin: 0; font-weight: 600; font-size: .875rem; }
.mode-choice.compact { grid-template-columns: 1fr 1fr; margin: 0; }
.mode-choice.compact .mode-option { padding: var(--sp-2) var(--sp-3); align-items: center; }
.confirm-box.is-schedule { border-color: var(--sched); background: var(--sched-soft); }
.post-card.is-scheduled .sched-when { margin: 0 0 var(--sp-1); color: var(--sched); font-size: 1.0625rem; }
.sched-change { margin: var(--sp-3) 0 var(--sp-2); display: grid; gap: var(--sp-1); }
.sched-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.sched-row input { flex: 1 1 200px; min-width: 0; }
.post-card .flash-warn { margin: var(--sp-2) 0; }
/* A video without sound (app.publishing.sound): the warning's "...without sound" box, and the dialogs' tag */
.no-sound .no-sound-check, .sched-change .no-sound-check { margin-top: var(--sp-2); font-weight: 600; }
.no-sound .no-sound-check { color: inherit; }
.no-sound-badge { margin: 2px 0; justify-self: start; align-self: flex-start; }
/* the warning breaks a long word (INSTAGRAM_SOUND_FALLBACK) instead of running out of the box on a phone, its links keep
   the box's own (readable) colour, and the confirm step's long "Yes, post as a Trial Reel without sound" wraps */
.no-sound { overflow-wrap: anywhere; }
.no-sound a { color: inherit; text-decoration: underline; }
.confirm-box .form-actions .btn { white-space: normal; height: auto; min-height: 40px; max-width: 100%; padding-top: var(--sp-2); padding-bottom: var(--sp-2); line-height: 1.25; text-align: center; }
.schedule-all-pick { display: grid; gap: var(--sp-3); justify-items: start; margin-bottom: var(--sp-3); }
.schedule-all-grid { display: grid; gap: var(--sp-3); width: 100%; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); align-items: start; }
.schedule-all-grid .label { display: block; margin-bottom: var(--sp-1); font-weight: 600; font-size: .875rem; }
.schedule-all-grid .mode-choice { margin: 0; }
.schedule-all-pick:not(:has(input[value=spread]:checked)) .gap-field { display: none; }
.schedule-all-sub { margin: var(--sp-2) 0; }
.sched-time { color: var(--sched); }

/* ---- Phase 5: Instagram connection ---- */
.section-gap-bottom { margin: calc(-1 * var(--sp-3)) 0 var(--sp-5); }
.tip { display: inline-flex; }
.tip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius); }
#instagram .form-actions { margin-top: var(--sp-4); }
#instagram .form-actions ~ p { margin: var(--sp-2) 0 0; }
#instagram .form-actions ~ .note { margin-top: var(--sp-3); }
#instagram .card-head + .note { margin: 0 0 var(--sp-3); }
#instagram .flash { margin-bottom: var(--sp-3); }

/* ---- Phase 6: publishing ---- */
.steps.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 640px) { .steps.four { grid-template-columns: 1fr; } }
.post-card .steps { margin-top: 0; }
.post-card > .btn-lg { width: 100%; margin: var(--sp-1) 0 var(--sp-3); }
.post-card > .note { margin: var(--sp-3) 0 0; }
.post-card.is-posted { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); }
.post-card .flash { margin-bottom: var(--sp-3); }
.caption-preview {
  display: block; white-space: pre-line; overflow-wrap: anywhere; color: var(--text);
  border-left: 3px solid var(--border-input); padding-left: var(--sp-2); margin-bottom: var(--sp-1);
}
textarea[readonly] { background: var(--surface-2); color: var(--text-muted); cursor: default; }
.card-actions:not(:has(*)) { display: none; }
.sub-ext { display: block; padding: 0 var(--sp-4) var(--sp-3) calc(54px + var(--sp-3) + var(--sp-4)); margin-top: calc(-1 * var(--sp-2)); }

/* the actions beside "View on Instagram" (a posted post's panel: Share to Story), and under a posted row of the Batches tab */
.post-card-links { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); }
.sub-ext.sub-ext-row { display: flex; align-items: center; flex-wrap: wrap; gap: 2px var(--sp-3); }
.quota { font-variant-numeric: tabular-nums; white-space: nowrap; }
.quota.low { color: var(--warn); font-weight: 650; }
.quota.none-left { color: var(--danger); font-weight: 650; }

/* ---- submit: where the video comes from (tabs: Paste link | Upload video | Search TikTok | Search Instagram) ---- */
.submit-card [hidden] { display: none !important; }
.submit-limits { margin: var(--sp-5) 0 0; }
.page-picker.attention .page-option:not(.is-disabled) { border-color: var(--danger); }
.icon { width: 18px; height: 18px; flex: none; }
.source { margin-top: var(--sp-5); }
.source-label { display: block; font-weight: 600; font-size: .875rem; margin-bottom: var(--sp-2); }
.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border); margin-bottom: var(--sp-4); }
.tab {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 10px var(--sp-3); margin-bottom: -1px; min-height: 44px;
  border: 0; border-bottom: 2px solid transparent; border-radius: var(--radius) var(--radius) 0 0;
  background: none; color: var(--text-muted); font: inherit; font-weight: 600; font-size: .9375rem; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tab[aria-selected="true"]:hover { background: var(--accent-soft); }
.tab:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.tab .icon { width: 16px; height: 16px; }
.tab-panel:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: var(--radius); }
.tab-panel .form-actions { margin-top: var(--sp-4); }
@media (max-width: 560px) {
  .tabs { gap: 0; }
  .tab { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 2px; padding: 8px 2px; font-size: .8125rem; }
  .tab span { max-width: 100%; text-align: center; line-height: 1.2; white-space: normal; overflow-wrap: break-word; }
}
/* Submit's source tabs (Paste link | Upload | Search TikTok | Search Instagram | Search YouTube) never run past their
   card, in any look. Wider screens: a second row when they don't fit on one. Phones: equal columns, each at least as
   wide as its longest word (a label never breaks inside a word); when even that doesn't fit (the narrowest phones),
   one row that scrolls sideways, with a fade on the cut-off side and the open tab kept in view (submit.js). */
.source .tabs { flex-wrap: wrap; max-width: 100%; }
@media (max-width: 560px) {
  .source .tabs { flex-wrap: nowrap; overflow: auto hidden; overscroll-behavior-x: contain; scrollbar-width: none; }
  .source .tabs::-webkit-scrollbar { display: none; }
  .source .tabs .tab { flex: 1 1 0; min-width: min-content; }
  .source .tabs .tab span { overflow-wrap: normal; word-break: keep-all; }
  .source .tabs.tabs-fade-end {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
  .source .tabs.tabs-fade-start {
    -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent);
  }
  .source .tabs.tabs-fade-start.tabs-fade-end {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 28px), transparent);
  }
}

/* upload */
.upload-status:empty, .tt-use-status:empty, .tt-results:empty { display: none; }
.upload-status .flash { margin-bottom: var(--sp-3); }
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-1);
  min-height: 176px; padding: var(--sp-5) var(--sp-4); text-align: center; cursor: pointer;
  border: 2px dashed var(--border-input); border-radius: var(--radius-lg); background: var(--surface-2); color: var(--text-muted);
  transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone.is-dragging { border-color: var(--accent); background: var(--accent-soft); }
.dropzone:focus-within { border-color: var(--accent); box-shadow: var(--focus-ring); }
.dropzone-icon {
  display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: var(--sp-1);
  border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--accent);
}
.dropzone-icon .icon { width: 22px; height: 22px; }
.dropzone-title { font-weight: 600; color: var(--text); }
.dropzone .link-text { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.dropzone-hint { font-size: .8125rem; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.upload-file {
  display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
}
.upload-file-icon { display: grid; place-items: center; color: var(--accent); }
.upload-file-icon .icon { width: 24px; height: 24px; }
.upload-file-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.upload-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-progress { margin-top: var(--sp-3); }
.progress-track { height: 8px; border-radius: 999px; background: var(--neutral-soft); overflow: hidden; }
.progress-bar { width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .2s linear; }
@media (prefers-reduced-motion: reduce) { .progress-bar { transition: none; } }
.progress-meta {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-top: var(--sp-2);
  color: var(--text-muted); font-variant-numeric: tabular-nums;
}

/* search */
.search-row { display: flex; gap: var(--sp-2); }
.search-input { position: relative; flex: 1; min-width: 0; }
.search-input .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-input input { padding-left: 38px; }
.search-input input:disabled { background: var(--surface-2); cursor: not-allowed; }
#panel-search > .note + .search-row, #panel-instagram > .note + .search-row { margin-top: var(--sp-3); }
.search-options { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); margin-top: var(--sp-3); }
.inline-select { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: .875rem; font-weight: 600; color: var(--text-muted); }
.inline-select[hidden] { display: none; }  /* Search TikTok's Sort, hidden for a #hashtag search */
.inline-select select {
  width: auto; height: 32px; padding-left: var(--sp-2); font-size: .875rem;
  background-position: calc(100% - 18px) 13px, calc(100% - 13px) 13px;
}
.tt-search .help { display: block; margin-top: var(--sp-2); color: var(--text-muted); font-size: .8125rem; }
.tt-search .help:empty { display: none; }
.tt-search .btn .htmx-indicator, .tt-card .btn .htmx-indicator, .tt-more .btn .htmx-indicator { display: none; }
.tt-search.htmx-request .btn .htmx-indicator, .btn.htmx-request .htmx-indicator { display: inline-block; }
.tt-use-status { margin-top: var(--sp-4); scroll-margin-top: 80px; }
.tt-use-status .flash { margin: 0; }
.tt-results { margin-top: var(--sp-4); transition: opacity .15s; }
.tt-results.htmx-request { opacity: .55; pointer-events: none; }
.tt-error { margin: 0; }
.tt-empty { padding: var(--sp-6) var(--sp-4); border: 1px dashed var(--border); border-radius: var(--radius); }
.tt-empty p { margin-bottom: 0; }
.tt-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-4); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.tt-head p { margin: 0; }
.tt-head-side { display: flex; align-items: center; gap: var(--sp-2) var(--sp-4); flex-wrap: wrap; }
.tt-grid { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(172px, 1fr)); }
.tt-card {
  display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.tt-card:hover { border-color: var(--border-input); }
.tt-thumb { position: relative; display: block; aspect-ratio: 9 / 16; overflow: hidden; background: var(--neutral-soft); }
.tt-thumb-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-muted); }
.tt-thumb-fallback .icon { width: 32px; height: 32px; opacity: .5; }
.tt-thumb img { position: absolute; inset: 0; z-index: 1; display: block; width: 100%; height: 100%; object-fit: cover; }
.tt-duration {
  position: absolute; right: 6px; bottom: 6px; z-index: 2; padding: 1px 6px; border-radius: 4px;
  background: rgba(0, 0, 0, .72); color: #fff; font-size: .75rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.tt-body { display: flex; flex-direction: column; gap: 4px; flex: 1; padding: var(--sp-2) var(--sp-3) var(--sp-3); }
.tt-body p { margin: 0; }
.tt-caption {
  min-height: 4.2em; overflow: hidden; overflow-wrap: anywhere; font-size: .875rem; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical;
}
.tt-author { font-size: .8125rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-stats { display: flex; flex-wrap: wrap; gap: 2px var(--sp-2); font-size: .75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tt-stats > span { display: inline-flex; align-items: center; gap: 3px; }
.tt-stats .icon { width: 12px; height: 12px; }
.tt-actions {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-1) var(--sp-2); flex-wrap: wrap;
  margin-top: auto; padding-top: var(--sp-2);
}
.tt-more { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); padding: var(--sp-2) 0; }
.tt-more p { margin: 0; }
.tt-more .flash { width: 100%; margin: 0; }
@media (max-width: 560px) {
  .tt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
  .tt-body { padding: var(--sp-2); }
  .tt-actions .btn { flex: 1 1 100%; }
  .search-row { flex-wrap: wrap; }
  .search-row > .btn { flex: 1 1 100%; }
}
.source-file { overflow-wrap: anywhere; }

/* ---- batches: several videos at once ---- */
/* paste link: 1-10 link boxes */
.link-rows { display: grid; gap: var(--sp-2); }
.link-row { display: grid; gap: 4px; }
.link-input { display: flex; align-items: center; gap: var(--sp-2); }
.link-input input { flex: 1; min-width: 0; }
.link-num {
  display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--neutral-soft); color: var(--text-muted); font-size: .8125rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.link-row.has-error input { border-color: var(--danger); }
.link-row .error { color: var(--danger); font-size: .8125rem; font-weight: 600; }
.link-more { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; min-height: 32px; }
.link-more .btn { padding-left: var(--sp-2); color: var(--accent); }
.link-more .btn:hover { color: var(--accent-hover); }

/* upload: a row per file */
.upload-files { list-style: none; margin: var(--sp-3) 0 0; padding: 0; display: grid; gap: var(--sp-2); }
.upload-files .upload-file { align-items: flex-start; }
.upload-files .upload-file-icon { padding-top: 2px; }
.upload-file.is-error { border-color: var(--danger); background: var(--danger-soft); }
.upload-file.is-done .upload-file-icon { color: var(--success); }
.upload-row-bar { display: block; margin-top: 6px; }
.upload-row-bar .progress-bar { display: block; }
.upload-file.is-done .progress-bar { background: var(--success); }
.upload-row-error { display: block; margin-top: 4px; color: var(--danger); font-weight: 600; font-size: .8125rem; }
/* Submit Feeds: the post's files in order (the first is the cover), a photo's own preview, ↑ ↓ to reorder */
.upload-pos { flex: none; min-width: 3.25em; padding-top: 2px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.upload-file.is-cover .upload-pos { color: var(--accent); font-weight: 650; }
.upload-thumb { display: block; width: 40px; height: 50px; object-fit: cover; border-radius: 6px; }
.upload-thumb[hidden] { display: none; }
.upload-actions { display: flex; align-items: center; gap: var(--sp-1); flex: none; }
.upload-order { display: flex; gap: 2px; }
.upload-order .btn { min-width: 32px; padding-inline: 0; }
@media (max-width: 640px) {  /* the position and preview on the left, the name over the buttons on the right */
  .upload-form.is-feed .upload-file {
    display: grid; grid-template-columns: auto auto minmax(0, 1fr); column-gap: var(--sp-3); row-gap: var(--sp-1);
  }
  .upload-form.is-feed .upload-pos, .upload-form.is-feed .upload-file-icon { grid-row: span 2; }
  .upload-form.is-feed .upload-actions { grid-column: 3; justify-content: flex-end; }
}
.upload-count { margin: var(--sp-2) 0 0; }
.upload-files:not([hidden]) ~ .upload-progress { margin-top: var(--sp-2); }

/* search: tick up to 10 results */
.tt-card { position: relative; }
.tt-pick {
  position: absolute; top: 6px; left: 6px; z-index: 3; display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px 4px 6px; border-radius: 999px; background: rgba(0, 0, 0, .62); color: #fff;
  font-size: .75rem; font-weight: 650; cursor: pointer; user-select: none;
}
.tt-pick input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.tt-pick:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.tt-pick:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.tt-pick:has(input:checked) { background: var(--accent); color: var(--accent-ink); }
.tt-card.is-picked, .tt-card:has(input[data-pick]:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tt-selbar {
  position: sticky; bottom: var(--sp-2); z-index: 6; margin-top: var(--sp-3);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-3); flex-wrap: wrap;
  padding: var(--sp-2) var(--sp-3); border: 1px solid var(--accent); border-radius: var(--radius-lg);
  background: var(--overlay); backdrop-filter: blur(6px); box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
}
.tt-selcount { font-weight: 650; font-variant-numeric: tabular-nums; }
.tt-selactions { display: flex; gap: var(--sp-2); }
.tt-selbar .btn .htmx-indicator { display: none; }
.tt-selbar .btn.htmx-request .htmx-indicator { display: inline-block; }

/* the combined duplicate warning */
.dup-warning .dup-items { list-style: none; padding-left: 0; display: grid; gap: 4px; }
.dup-items li { overflow-wrap: anywhere; }
.dup-label { font-weight: 650; }
.dup-src { display: inline-block; max-width: min(100%, 36ch); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; opacity: .85; }

/* recent list: a batch row */
.batch-row .thumb { position: relative; overflow: visible; isolation: isolate; }
.thumb-stack img { position: absolute; inset: 0; border-radius: 6px; border: 1px solid var(--border); }
.thumb-stack img:nth-child(2) { transform: translate(5px, -4px) scale(.94); z-index: -1; opacity: .8; }
.thumb-stack img:nth-child(3) { transform: translate(10px, -8px) scale(.88); z-index: -2; opacity: .6; }

/* recent lists and the Posts page: Delete batch under a batch row, lined up with the row's text */
.sub-del { margin: calc(-1 * var(--sp-2)) 0 0; padding: 0 var(--sp-4) var(--sp-2) calc(54px + var(--sp-3) + var(--sp-4)); }
.sub-del .btn { margin-left: calc(-1 * var(--sp-2)); }
.recent-group.is-ready .sub-del { box-shadow: inset 3px 0 0 var(--success); }
.batch-chips, .kind-chips { margin: calc(-1 * var(--sp-2)) 0 var(--sp-5); }
/* the Posts page: Reels or feed posts at the top, the page chips under them */
.kind-chips .chip { gap: 6px; }
/* how many of that kind are ready to post: the Ready badge's green */
.kind-count {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--success-soft); color: var(--success); font-size: .75rem; font-weight: 700;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.kind-chips + .batch-chips { margin-top: calc(var(--sp-3) - var(--sp-5)); }
.batches-more { margin: var(--sp-3) 0 0; }

/* /admin: the Admin hub's blocks */
.admin-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.admin-tiles > .card { margin: 0; }  /* the grid spaces them, not .card + .card */
@media (max-width: 640px) { .admin-tiles { grid-template-columns: minmax(0, 1fr); } }
.admin-tile {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 1fr auto; gap: var(--sp-2) var(--sp-4);
  padding: var(--sp-5); color: inherit; transition: border-color .15s ease, box-shadow .15s ease;
}
.admin-tile:hover { text-decoration: none; border-color: var(--accent); box-shadow: 0 4px 16px rgba(0, 0, 0, .08); }
.admin-tile:hover .admin-tile-title { color: var(--accent); }
.admin-tile-icon {
  grid-row: 1 / span 2; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
}
.admin-tile-body { display: flex; flex-direction: column; gap: var(--sp-1); }
.admin-tile-title { font-size: 1.125rem; font-weight: 700; }
.admin-tile-text { color: var(--text-muted); }
.admin-tile-count { grid-column: 2; color: var(--text-muted); font-size: .8125rem; font-weight: 650; }

/* /chat/settings (admins): the checklist of who else can create group chats, in one card a little narrower than the page */
.chat-settings { max-width: 880px; }
.chat-creators { min-width: 0; margin: 0; padding: 0; border: 0; }
.user-chat .toggle-field { margin: 0 0 var(--sp-3); }  /* a person's screen in Users: "Can create group chats" */

/* batch page */
.batch-delete { margin: 0; }
.batch-bar { display: flex; align-items: center; gap: var(--sp-3) var(--sp-4); flex-wrap: wrap; padding: var(--sp-4); margin-bottom: var(--sp-4); }
.batch-counts { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; flex: 1; min-width: 0; }
.batch-total { font-weight: 650; margin-right: var(--sp-1); }
.batch-actions { margin: 0; display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.batch-actions .btn .htmx-indicator { display: none; }
.batch-actions .btn.htmx-request .htmx-indicator { display: inline-block; }
.batch-note { flex-basis: 100%; margin: 0; }
.batch-note:empty { display: none; }
.post-all:empty { display: none; }
.post-all { margin-bottom: var(--sp-4); scroll-margin-top: 80px; }
.post-all .flash { margin-bottom: var(--sp-2); }
.post-all-box { position: relative; background: var(--surface); }
.post-all-box h2 { padding-right: 40px; margin-bottom: var(--sp-3); }
.post-all-close { position: absolute; top: var(--sp-2); right: var(--sp-2); }
.mode-choice { border: 0; margin: 0 0 var(--sp-3); padding: 0; min-width: 0; display: grid; gap: var(--sp-2); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.mode-choice legend { float: none; grid-column: 1 / -1; font-weight: 600; font-size: .875rem; margin-bottom: 0; }
.mode-option {
  display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3); cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.mode-option input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.mode-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.mode-option:has(input:focus-visible) { box-shadow: var(--focus-ring); }
/* a choice that can't be picked right now (Trial Reels once the page's 20 for today are used up) */
.mode-option:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.mode-option .trial-left { color: var(--warn); margin-top: var(--sp-1); }
.post-all-list { list-style: none; margin: 0 0 var(--sp-3); padding: 0; display: grid; gap: var(--sp-2); }
/* several videos (a batch holds up to 10): two columns on wider screens keep "Yes, post all" close to the top */
@media (min-width: 760px) {
  .post-all-list:has(> .post-all-item:nth-child(2)) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.post-all-item { display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-2); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.post-all-item .thumb { width: 45px; height: 80px; }
.post-all-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.post-all-text .caption-preview { max-height: 4.4em; overflow: hidden; font-size: .875rem; }
.post-all-box .kv { margin-bottom: var(--sp-3); }
.post-all-box .flash, .post-all-note { margin-bottom: var(--sp-3); }
.post-all-skipped { margin: var(--sp-1) 0 0; padding-left: var(--sp-5); }
.post-all-skipped a { color: inherit; text-decoration: underline; }

.bcard-grid { display: grid; gap: var(--sp-4); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 760px) { .bcard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1120px) { .bcard-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.bcard { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-4); min-width: 0; scroll-margin-top: 80px; }
.bcard + .bcard { margin-top: 0; }
.bcard.is-posted { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); }
.bcard.is-failed { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.bcard-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.bcard-title { display: flex; align-items: center; gap: var(--sp-2); margin: 0; font-size: 1rem; min-width: 0; }
.bcard-title .muted { font-weight: 500; }
.bcard-num {
  display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-size: .8125rem; font-weight: 700;
}
.bcard-source { margin: calc(-1 * var(--sp-2)) 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bcard-source a { color: var(--text-muted); }
.bcard-progress { padding: var(--sp-3); border-radius: var(--radius); background: var(--surface-2); }
.bcard-state { font-weight: 650; margin: 0 0 var(--sp-3); }
.steps.compact { grid-template-columns: 1fr; gap: var(--sp-2); margin: 0; }
.steps.compact .step { flex-direction: row; text-align: left; gap: var(--sp-2); }
.steps.compact .step + .step::before { display: none; }
.steps.compact .step-dot { width: 20px; height: 20px; }
.steps.compact .step.done .step-dot::after { width: 5px; height: 9px; margin-top: -2px; }
.bcard-state-box { padding: var(--sp-3); border-radius: var(--radius); background: var(--surface-2); }
.bcard-state-box p { margin: 0; }
.bcard-error { color: var(--danger); font-weight: 600; }
.bcard-video .reel { width: min(100%, 240px); }
.bcard-video .video-meta { margin-top: var(--sp-2); justify-content: center; gap: var(--sp-3); }
.bcard-video .video-meta .small { max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bcard .job-bar, .bcard .notices .flash { margin-bottom: 0; }
.bcard .notices .flash + .flash { margin-top: var(--sp-2); }
.bcard .notice { flex-direction: column; }
.bcard-section { margin: 0; padding-top: var(--sp-3); border-top: 1px solid var(--border); }
.bcard .card-head { margin-bottom: var(--sp-2); }
.bcard .card-head h2, .bcard .post-card h2 { font-size: .9375rem; }
.bcard .card-actions { margin-top: var(--sp-2); }
.bcard textarea { font-size: .875rem; }
.bcard textarea[data-headline] { min-height: 64px; }
.bcard-post { padding-top: var(--sp-3); border-top: 1px solid var(--border); }
.bcard-post .card-head { margin-bottom: var(--sp-2); }
.bcard-post > .btn { width: 100%; margin: var(--sp-1) 0 var(--sp-2); }
.bcard .post-buttons .btn { min-height: 40px; }
.bcard .steps.four { grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.bcard .steps.four .step { flex-direction: row; text-align: left; gap: var(--sp-2); font-size: .8125rem; }
.bcard .steps.four .step + .step::before { display: none; }
.bcard .steps.four .step-dot { width: 20px; height: 20px; }
.bcard .confirm-box { padding: var(--sp-3); }
.bcard .confirm-box .kv { grid-template-columns: 1fr; gap: 2px; }
.bcard .confirm-box .kv dd { margin-bottom: var(--sp-2); }
.bcard .confirm-box .form-actions .btn { flex: 1 1 auto; }
.bcard-foot { margin-top: auto; padding-top: var(--sp-2); border-top: 1px solid var(--border); font-size: .875rem; text-align: right; }
@media (max-width: 640px) {
  .batch-bar { padding: var(--sp-3); }
  .batch-actions, .batch-actions .btn { width: 100%; }
  .bcard { padding: var(--sp-3); }
}

/* ---- Trial Reels: the posting dialogs and the Trial Reels page ---- */
.trial-line { margin: 0 0 var(--sp-2); }
/* "Post all to Trial Reels": the Yes button names the picked mode, through :has() (no scripts). Without :has() the
   plain "Yes, post all N" shows instead. */
.post-all-yes .yes-trial, .post-all-yes .yes-normal { display: none; }
@supports selector(:has(*)) {
  .post-all-yes .yes-any { display: none; }
  .post-all-box form:has(input[name="mode"][value="trial"]:checked) .post-all-yes .yes-trial,
  .post-all-box form:has(input[name="mode"][value="normal"]:checked) .post-all-yes .yes-normal { display: inline; }
}

.trial-chips { margin: calc(-1 * var(--sp-2)) 0 var(--sp-5); }
.trial-rows { list-style: none; margin: 0; padding: 0; }
.trial-row { display: flex; gap: var(--sp-3) var(--sp-4); align-items: flex-start; padding: var(--sp-3) var(--sp-4); }
.trial-row + .trial-row { border-top: 1px solid var(--border); }
.trial-row .thumb:hover { text-decoration: none; border-color: var(--border-input); }
.trial-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.trial-main p { margin: 0; }
.trial-title .name { font-weight: 650; }
.trial-title a { color: inherit; }
.trial-headline, .trial-caption { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.trial-headline { font-weight: 600; }
.trial-caption { color: var(--text-muted); font-size: .875rem; }
.trial-main .trial-meta { color: var(--text-muted); font-size: .8125rem; margin-top: var(--sp-1); overflow-wrap: anywhere; }
.trial-main .trial-legacy { color: var(--text-muted); font-size: .8125rem; font-style: italic; }
.trial-side { display: flex; align-items: center; flex: none; max-width: 45%; }
.trial-side > .small { max-width: 240px; text-align: right; }
.trial-more { margin: var(--sp-3) 0 0; }
@media (max-width: 640px) {
  .trial-row { flex-wrap: wrap; padding: var(--sp-3); }
  .trial-row .thumb { width: 45px; height: 80px; }
  .trial-main { flex-basis: calc(100% - 45px - var(--sp-3) * 2); }
  .trial-side { flex: 1 1 100%; max-width: none; justify-content: flex-end; }
  .trial-side > .small { max-width: none; text-align: left; }
}

/* ---- feed posts (Submit Feeds): 4:5 thumbnails, the slides on the review page and batch cards. The strip wraps
   (every slide in view, up to 10), it doesn't scroll sideways. ---- */
.thumb.is-feed { height: 68px; }
.thumb-stack.is-feed { height: 68px; }
.tpl-picker.is-feed .tpl-pick-thumb { height: 68px; }
.tpl-card.is-feed .tpl-thumb img { aspect-ratio: 4 / 5; }
/* a "Open" template's card while no page has a Reel template to preview it with */
.tpl-thumb-note {
  width: 100%; max-width: 180px; aspect-ratio: 4 / 5; display: grid; place-items: center; padding: var(--sp-3);
  text-align: center; border: 1px dashed var(--border); border-radius: 4px; color: var(--text-muted);
  font-size: .8125rem; line-height: 1.35;
}
/* the feed editor's style choice, and the sections (and preview controls) of the style that isn't picked */
.tpl-style { margin: 0; }
/* (on its own surface: the frame around the preview is a look's poster color, which can be dark in a light theme) */
.preview-frame .preview-note {
  margin: var(--sp-2) 0 0; padding: var(--sp-1) var(--sp-2); text-align: center; background: var(--surface);
  color: var(--text-muted); border-radius: var(--radius);
}
#tpl-form [data-show-when][hidden] { display: none !important; }
.sub-kind { font-weight: 600; color: var(--text); }
.feed-viewer {
  position: relative; display: grid; place-items: center; background: #000; border-radius: var(--radius);
  overflow: hidden; width: min(100%, calc(64vh * 4 / 5)); margin: 0 auto;
}
/* the cover's bubble, to drag (placed by app.js): like the template editor's watermark box, but round */
.bubble-drag {
  position: absolute; box-sizing: border-box; border: 2px dashed var(--accent); border-radius: 50%; cursor: move;
  touch-action: none; user-select: none; -webkit-user-select: none; box-shadow: 0 0 0 1px rgba(255, 255, 255, .6);
}
.bubble-drag[hidden] { display: none; }
.bubble-drag:hover, .bubble-drag.dragging { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.bubble-drag:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.bubble-panel { margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid var(--border); }
.bubble-title { margin: 0 0 var(--sp-2); font-weight: 650; }
.bubble-fields { border: 0; margin: 0; padding: 0; min-width: 0; }
.bubble-fields legend { padding: 0; margin-bottom: var(--sp-2); font-weight: 650; }
.bubble-fields legend .muted { font-weight: 400; }
.bubble-photos { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
.bubble-photo { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .75rem; color: var(--text-muted); cursor: pointer; }
.bubble-photo img { display: block; width: 48px; height: 60px; object-fit: cover; border-radius: 6px; border: 2px solid transparent; }
.bubble-radio { position: absolute; opacity: 0; width: 1px; height: 1px; }
.bubble-radio:checked + img { border-color: var(--accent); }
.bubble-radio:focus-visible + img { box-shadow: var(--focus-ring); }
.bubble-form:has(input[name="show"]:not(:checked)) .bubble-photos { opacity: .5; }
.bubble-move { margin-top: var(--sp-3); }
.nudge-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.nudge { min-width: 40px; }
.feed-main { display: block; width: 100%; height: auto; }
video.feed-main { aspect-ratio: auto; max-height: 64vh; }
.slide-strip {
  list-style: none; margin: var(--sp-3) 0 0; padding: 0; display: grid; gap: var(--sp-3) var(--sp-2);
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
}
.slide { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.slide-thumb {
  position: relative; display: block; width: 64px; aspect-ratio: 4 / 5; border-radius: 6px; overflow: hidden;
  border: 2px solid transparent; background: var(--neutral-soft); outline-offset: 2px;
}
.slide-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.slide-thumb.is-shown { border-color: var(--accent); }
.slide.is-cover .slide-thumb::after {
  content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 2px var(--surface); border-radius: 4px;
}
.slide-play {
  position: absolute; left: 4px; bottom: 4px; padding: 1px 5px; border-radius: 4px; font-size: .6875rem;
  font-weight: 700; color: #fff; background: rgba(0, 0, 0, .7); white-space: nowrap;  /* ▶ and its time on one line */
}
.slide-label { font-size: .75rem; color: var(--text-muted); white-space: nowrap; }
.slide.is-cover .slide-label { color: var(--accent); font-weight: 650; }
.slide-make { margin: 0; }
.slide-make .btn { height: auto; min-height: 28px; padding: 2px 6px; font-size: .75rem; white-space: normal; line-height: 1.2; }
.feed-note { margin: var(--sp-3) 0 0; font-size: .875rem; }
.mark-help { display: block; margin-top: var(--sp-1); }
.mark-help code { font-size: .8em; }
.swatch { width: 12px; height: 12px; vertical-align: -1px; margin-right: 6px; }
.bcard-video .feed-viewer { width: min(100%, 240px); }
.bcard-video .slide-strip { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
.bcard-video .slide-thumb { width: 52px; }
.font-upload { margin-top: var(--sp-2); }
.tpl-group .list-head { margin-bottom: var(--sp-3); }
@media (max-width: 640px) {
  .feed-viewer { width: 100%; }
  .slide-strip { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
  .slide-thumb { width: 56px; }
}

/* ---- a feed post's review page: "Remove" under a slide, "Upload cover", and an uploaded cover's position panel (the
   photo, dimmed outside a frame around the part the cover shows; app.js drags the frame) ---- */
.slide-remove { margin: 0; }
.slide-remove .btn { height: auto; min-height: 28px; padding: 2px 6px; font-size: .75rem; line-height: 1.2; }
.cover-outdated {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-3);
  margin-top: var(--sp-3);
}
.cover-outdated p, .cover-outdated form { margin: 0; }
.cover-tools { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--border); }
.cover-upload-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); }
.cover-upload { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin: 0; }
.cover-upload-btn { cursor: pointer; }
.cover-upload-btn:focus-within { box-shadow: var(--focus-ring); }
.cover-upload-btn.is-disabled { opacity: .55; cursor: not-allowed; }
.cover-upload-progress { width: 120px; height: 8px; accent-color: var(--accent); }
.cover-upload-progress[hidden] { display: none; }
.cover-upload-help { margin: 0; flex: 1 1 240px; min-width: 0; }
.cover-pos-panel { margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid var(--border); }
.cover-pos {
  position: relative; width: min(100%, 320px); margin-bottom: var(--sp-3); overflow: hidden; border-radius: 6px;
  background: var(--neutral-soft); cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none;
}
.cover-pos.is-y { width: min(100%, 220px); }
.cover-pos-photo { display: block; width: 100%; height: auto; pointer-events: none; }
.cover-pos-frame {
  position: absolute; box-sizing: border-box; border: 2px dashed #fff; cursor: grab;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .35), 0 0 0 9999px rgba(0, 0, 0, .5);
}
.cover-pos-frame[hidden] { display: none; }
.cover-pos.dragging .cover-pos-frame { cursor: grabbing; border-style: solid; }
.cover-pos-frame:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }

/* ---- a feed post's review page: the slides' order (app.js: a slide after the cover is dragged by its picture, the
   picked-up one lifted, the others making room) and "Add slides" (the picked files listed with their progress, the
   links field, and what came of the last addition) ---- */
.slide-strip.is-sortable .slide.is-movable .slide-thumb {
  cursor: grab; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.slide-strip.is-sorting { user-select: none; -webkit-user-select: none; }
.slide.is-dragging { position: relative; z-index: 2; }
.slide.is-dragging .slide-thumb {
  border-color: var(--accent); transform: scale(1.08); box-shadow: 0 0 0 2px var(--accent), 0 10px 24px rgba(0, 0, 0, .22);
}
.slide.is-dragging .slide-label { color: var(--accent); font-weight: 650; }
.slide-strip.is-saving { opacity: .6; pointer-events: none; }
.slide-order-help { margin: var(--sp-2) 0 0; }
.slide-order-help .touch-hint { display: none; }
@media (pointer: coarse) {  /* a phone has no Alt + arrow keys, and a finger holds a slide before it moves */
  .slide-order-help .kbd-hint { display: none; }
  .slide-order-help .touch-hint { display: inline; }
}
/* ---- a feed post's review page: the resize editor (frame_editor.js): "Resize" under every slide, the post's shape
   with its cover as the profile grid shows it (3:4), and the dialog with the slide in its exact frame ---- */
.slide-resize { height: auto; min-height: 28px; padding: 2px 6px; font-size: .75rem; line-height: 1.2; }
.slide-resize[hidden] { display: none; }
.shape-row {
  display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--sp-3);
  margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--border);
}
.shape-form { flex: 1 1 240px; min-width: 0; margin: 0; }
.shape-fields { border: 0; margin: 0; padding: 0; min-width: 0; }
.shape-fields legend { padding: 0; }
.shape-choices { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.shape-choice {
  display: inline-flex; align-items: center; gap: var(--sp-2); padding: 6px 10px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); cursor: pointer; font-size: .8125rem; font-weight: 600;
}
.shape-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.shape-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.shape-choice:has(input:focus-visible) { box-shadow: var(--focus-ring); }
.shape-fields:disabled .shape-choice { opacity: .55; cursor: not-allowed; }
.shape-icon { display: inline-block; height: 16px; border: 2px solid currentColor; border-radius: 3px; }
.shape-4-5 { width: 13px; } .shape-1-1 { width: 16px; } .shape-191-1 { width: 26px; height: 14px; }
.shape-help { margin: var(--sp-2) 0 0; }
.grid-preview { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.grid-tile { width: 72px; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 4px; background: var(--neutral-soft); }
.grid-tile img { display: block; width: 100%; height: 100%; object-fit: cover; }
.grid-preview figcaption { margin: 0; }
.frame-dialog {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: var(--sp-4); border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); color: var(--text); overflow: auto;
}
.frame-dialog::backdrop { background: rgba(0, 0, 0, .55); }
.frame-dialog:not([open]) { display: none; }
.frame-form { display: flex; flex-direction: column; gap: var(--sp-2); margin: 0; }
.frame-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.frame-head h2 { margin: 0; font-size: 1.0625rem; }
.frame-help { margin: 0; }
.frame-help .touch-hint { display: none; }
@media (pointer: coarse) { .frame-help .touch-hint { display: inline; } }
.frame-stage {
  position: relative; width: min(100%, 420px); margin: var(--sp-1) auto 0; overflow: hidden; border-radius: 6px;
  background: #000; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; outline-offset: 3px;
  min-height: 120px;
}
.frame-stage.is-dragging { cursor: grabbing; }
.frame-stage:focus-visible { outline: 3px solid var(--accent); }
.frame-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.frame-box { position: absolute; overflow: hidden; }
.frame-picture { position: absolute; max-width: none; pointer-events: none; }
.frame-grid-cut { position: absolute; inset: 0; pointer-events: none; }
.frame-grid-cut[hidden] { display: none; }
.frame-grid-band {
  position: absolute; top: 0; bottom: 0; background: rgba(0, 0, 0, .55);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25);
}
.frame-status { margin: 0; min-height: 1.2em; color: var(--text-muted); }
.frame-zoom { display: flex; align-items: center; gap: var(--sp-3); font-size: .875rem; font-weight: 600; }
.frame-zoom input { flex: 1; accent-color: var(--accent); }
.frame-grid { font-size: .875rem; }
.frame-grid[hidden], .frame-video[hidden] { display: none; }
.frame-video { margin: 0; }
.frame-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-1); }
@media (max-width: 560px) {
  .frame-dialog { padding: var(--sp-3); }
  .grid-tile { width: 60px; }
}
/* ---- a feed post's review page: "Slide templates" (a slide drawn in a feed template of its own, with its own
   headline): "Apply to all slides", then each slide after the cover as a row that opens into its editor ---- */
.slide-tpl { display: inline-flex; vertical-align: -1px; margin-right: 3px; color: var(--accent); }
.slide-looks { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--border); }
.slide-looks-count { font-weight: 400; font-size: .875rem; color: var(--text-muted); }
.slide-looks-help { margin: 0 0 var(--sp-3); }
.looks-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2) var(--sp-3); min-width: 0; margin: 0; padding: 0; border: 0; }
.looks-fields:disabled .btn { opacity: .5; cursor: not-allowed; }
.look-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 160px; max-width: 260px; font-size: .8125rem; font-weight: 600; }
.look-field select { width: 100%; }
.looks-all { margin: 0 0 var(--sp-3); padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.look-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.look-row { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.look-row > summary {
  display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); cursor: pointer; list-style: none;
  border-radius: var(--radius); min-width: 0;
}
.look-row > summary::-webkit-details-marker { display: none; }
.look-row > summary:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.look-row > summary:hover { background: var(--surface-2); }
.look-thumb { flex: none; width: 40px; height: 50px; object-fit: cover; border-radius: 4px; background: var(--neutral-soft); }
.look-sum { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.look-num { font-size: .875rem; font-weight: 650; }
.look-what { font-size: .8125rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.look-row > summary .badge { flex: none; }
.look-chev { flex: none; display: inline-flex; color: var(--text-muted); transition: transform .15s ease; }
.look-row[open] > summary .look-chev { transform: rotate(180deg); }
.look-row[open] > summary { border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
.look-body { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-3); min-width: 0; }
.look-body form { margin: 0; }
.look-headline { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.look-label { font-size: .875rem; font-weight: 600; }
.look-headline textarea { min-height: 56px; }
.look-headline .help { color: var(--text-muted); font-size: .8125rem; }
.look-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: 2px; }
.look-change { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--sp-2) var(--sp-3); padding-top: var(--sp-3); border-top: 1px dashed var(--border); }
.look-change .look-form { flex: 1 1 260px; min-width: 0; }
.look-note { margin: 0; font-size: .875rem; overflow-wrap: anywhere; }
.looks-plain-all { margin: var(--sp-2) 0 0; }
@media (max-width: 640px) {
  .look-field { max-width: none; flex-basis: 100%; }
  .look-headline textarea { font-size: 16px; }  /* phones don't zoom into it */
  .look-row > summary { gap: var(--sp-2); padding: var(--sp-2); }
}
.slides-add { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--border); }
.slides-add-fields { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; margin: 0; padding: 0; border: 0; }
.slides-add-files { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2); min-width: 0; }
.slides-add-pick { cursor: pointer; }
.slides-add-pick:focus-within { box-shadow: var(--focus-ring); }
.slides-add-pick.is-disabled, .slides-add-fields:disabled .btn { opacity: .5; cursor: not-allowed; }  /* (like .btn[disabled]) */
.slides-add-fields noscript p { margin: 0; }
.slides-add-or { margin-top: var(--sp-1); font-size: .875rem; font-weight: 600; }
.slides-add-fields textarea { min-height: 64px; }
.slides-add-help { margin: 0; }
.slides-add-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); }
.slides-add-actions [hidden] { display: none; }
.slides-add-status { min-width: 0; overflow-wrap: anywhere; }
.slides-adding { display: flex; align-items: center; gap: var(--sp-2); margin: 0; font-size: .875rem; }
.slides-add-stuck {  /* the update that makes them stopped: why, and Try again */
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-3);
  overflow-wrap: anywhere;
}
.slides-add-stuck p, .slides-add-stuck form { margin: 0; }
.slides-add-full { margin: 0; }
.slides-add-note { margin-top: var(--sp-2); overflow-wrap: anywhere; }  /* (it can name a long link) */
.add-files { display: flex; flex-direction: column; gap: var(--sp-1); width: 100%; margin: 0; padding: 0; list-style: none; }
.add-files[hidden] { display: none; }
.add-file {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px var(--sp-2);
  padding: var(--sp-2) var(--sp-1) var(--sp-2) var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2);
}
.add-file-name { grid-column: 1; grid-row: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .875rem; font-weight: 600; }
.add-file-meta { grid-column: 1; grid-row: 2; font-size: .75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.add-file-remove { grid-column: 2; grid-row: 1 / span 2; min-width: 32px; font-size: 1.125rem; }
.add-file progress { grid-column: 1 / -1; width: 100%; height: 6px; accent-color: var(--accent); }
.add-file progress[hidden], .add-file-error[hidden] { display: none; }
.add-file-error { grid-column: 1 / -1; color: var(--danger); font-size: .8125rem; font-weight: 600; overflow-wrap: anywhere; }
.add-file.is-error { border-color: var(--danger); background: var(--danger-soft); }
.add-file.is-done .add-file-meta { color: var(--success); }
@media (max-width: 640px) {
  .slides-add-fields textarea { font-size: 16px; }  /* phones don't zoom into it */
}

/* ---- "Change screenshot": the review page's line about slide 1's still, and the picker (submission/screenshot.html):
   slide 1's preview with the moment and the slider under it, the strip of stills beside it (under it on a phone) ---- */
.feed-shot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-3);
  margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--border);
}
.feed-shot-now { margin: 0; font-size: .875rem; min-width: 0; }
.frame-picker { margin: 0; }
.frame-picker [hidden] { display: none !important; }  /* (the script hides Preview: a .btn is inline-flex) */
.fp-title { margin: 0 0 var(--sp-3); font-size: 1rem; font-weight: 650; }
.fp-stage { position: relative; width: min(100%, calc(58vh * 4 / 5)); margin: 0 auto; }
.fp-preview {
  display: block; width: 100%; height: auto; border-radius: var(--radius); background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--border);
}
.fp-status {
  position: absolute; left: 8px; right: 8px; bottom: 8px; margin: 0; padding: 6px 10px; display: flex; align-items: center;
  gap: 8px; border-radius: var(--radius); background: rgba(0, 0, 0, .78); color: #fff; font-size: .8125rem; font-weight: 600;
}
.fp-status[hidden] { display: none; }
.fp-status .spinner { flex: none; }
.fp-status.is-error { background: #9b1c1c; }
.fp-time { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); margin-top: var(--sp-4); }
.fp-time > label { font-weight: 600; }
.fp-seconds { display: inline-flex; align-items: center; gap: 6px; }
.fp-seconds input[type=number] { width: 6.5em; font-variant-numeric: tabular-nums; }
.fp-clock { font-variant-numeric: tabular-nums; font-weight: 650; }
.fp-range { display: block; width: 100%; height: 32px; margin: var(--sp-2) 0 0; accent-color: var(--accent); cursor: pointer; }
.fp-range:focus { box-shadow: none; }  /* (not a field's ring after a drag or a tap: the outline below, from the keyboard) */
.fp-range:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fp-help { display: block; margin-top: var(--sp-2); color: var(--text-muted); font-size: .8125rem; }
/* two rows of six (three of four on a phone), never wider than the stills are sharp */
.fp-stills { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--sp-3) var(--sp-2); max-width: 760px; }
.fp-still { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; cursor: pointer; }
.fp-still img {
  display: block; width: 100%; height: auto; border-radius: 6px; border: 2px solid transparent; background: var(--neutral-soft);
}
@media (hover: hover) { .fp-still:hover img { border-color: var(--border-input); } }  /* (a tap leaves no ring) */
.fp-radio { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.fp-radio:checked + img { border-color: var(--accent); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.fp-radio:focus-visible + img { box-shadow: var(--focus-ring); }
.fp-still-time { font-size: .75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fp-radio:checked ~ .fp-still-time { color: var(--text); font-weight: 700; }
.fp-now { margin: var(--sp-4) 0 0; color: var(--text-muted); font-size: .875rem; }
.fp-now strong { color: var(--text); font-variant-numeric: tabular-nums; }
.fp-actions { margin-top: var(--sp-4); }
.fp-auto { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-3); margin-top: var(--sp-3); }
.fp-auto .help { color: var(--text-muted); font-size: .8125rem; }
@media (max-width: 640px) {
  .fp-stage { width: min(100%, calc(50vh * 4 / 5)); }
  .fp-stills { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-2) var(--sp-3); }
  .frame-picker input[type=number] { font-size: 16px; }  /* phones don't zoom into it */
  .fp-actions > * { flex: 1 1 auto; justify-content: center; }
}

/* ---- VA Tracker (/admin/tracker) ---- */
.vt-filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-5); }
.vt-day { display: flex; align-items: center; gap: var(--sp-1); }
.vt-step { font-size: 1.25rem; width: 32px; padding: 0; justify-content: center; }
.vt-step[aria-disabled="true"] { opacity: .35; cursor: default; }
.vt-step[aria-disabled="true"]:hover { background: transparent; }
.vt-date input, .vt-who select { height: 32px; padding-top: 0; padding-bottom: 0; }
.vt-date input { font-family: var(--font); font-size: .875rem; font-variant-numeric: tabular-nums; }
.vt-who { margin-left: auto; min-width: 0; }
.vt-who select { max-width: 280px; }
.vt-title { margin: 0 0 var(--sp-3); }
.vt-title .muted { font-weight: 500; }
.vt-note { margin: calc(-1 * var(--sp-2)) 0 var(--sp-3); }
.vt-section { margin-top: var(--sp-6); }
.vt-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--sp-3); align-items: start; }
.vt-cards > .card { margin: 0; }
.vt-card { display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); }
.vt-card-head p { margin: 2px 0 0; font-size: .75rem; }
.vt-who-line { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.vt-who-line .name { font-weight: 650; font-size: .875rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.vt-who-line .name:hover { color: var(--accent); }
.vt-pages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.vt-page { display: flex; align-items: center; gap: var(--sp-2); }
.vt-page .avatar { width: 22px; height: 22px; font-size: .6875rem; }
.vt-quota-list .avatar { width: 28px; height: 28px; font-size: .8125rem; }
.vt-page-main { flex: 1; min-width: 0; }
.vt-page-line { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sp-2); margin-bottom: 3px; }
.vt-handle { font-weight: 600; font-size: .8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.vt-count { font-variant-numeric: tabular-nums; color: var(--text-muted); white-space: nowrap; font-size: .8125rem; }
.vt-count strong { color: var(--text); font-size: .9375rem; }
.vt-page.met .vt-count strong, .vt-check { color: var(--success); }
.vt-bar { height: 5px; border-radius: 999px; background: var(--neutral-soft); overflow: hidden; }
.vt-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .3s; }
.vt-page.met .vt-bar > span { background: var(--success); }
.vt-bar > .w-0 { width: 0%; }
.vt-bar > .w-5 { width: 5%; }
.vt-bar > .w-10 { width: 10%; }
.vt-bar > .w-15 { width: 15%; }
.vt-bar > .w-20 { width: 20%; }
.vt-bar > .w-25 { width: 25%; }
.vt-bar > .w-30 { width: 30%; }
.vt-bar > .w-35 { width: 35%; }
.vt-bar > .w-40 { width: 40%; }
.vt-bar > .w-45 { width: 45%; }
.vt-bar > .w-50 { width: 50%; }
.vt-bar > .w-55 { width: 55%; }
.vt-bar > .w-60 { width: 60%; }
.vt-bar > .w-65 { width: 65%; }
.vt-bar > .w-70 { width: 70%; }
.vt-bar > .w-75 { width: 75%; }
.vt-bar > .w-80 { width: 80%; }
.vt-bar > .w-85 { width: 85%; }
.vt-bar > .w-90 { width: 90%; }
.vt-bar > .w-95 { width: 95%; }
.vt-bar > .w-100 { width: 100%; }
.vt-table td { white-space: nowrap; }
.vt-table td.vt-headline { white-space: normal; min-width: 200px; }
.vt-table .vt-headline a { color: var(--text); }
.vt-table .vt-headline a:hover { color: var(--accent); }
.vt-back { margin: 0 0 var(--sp-2); font-size: .875rem; }
.vt-quota-list { list-style: none; margin: 0; padding: var(--sp-4) var(--sp-5); display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--sp-2) var(--sp-5); }
.vt-quota-list li { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-1) 0; }
.vt-quota-list label { display: flex; align-items: center; gap: var(--sp-2); font-weight: 600; min-width: 0; }
.vt-quota-list label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vt-quota-list input { width: 84px; height: 36px; text-align: right; flex: none; }
.vt-form-foot { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-3) var(--sp-5) var(--sp-4); border-top: 1px solid var(--border); }
@media (max-width: 640px) {
  .vt-who { margin-left: 0; width: 100%; }
  .vt-who select { max-width: none; width: 100%; }
  .vt-cards { grid-template-columns: minmax(0, 1fr); }
  .vt-table td, .vt-table td.vt-headline { white-space: normal; min-width: 0; }
  .vt-quota-list { grid-template-columns: minmax(0, 1fr); padding: var(--sp-3) var(--sp-4); }
}
.vt-who-line .badge { height: 18px; font-size: .6875rem; padding: 0 6px; }

/* ---- Post Tracker (/post-tracker): the VA Tracker for one person ---- */
.pt-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); }
.pt-stats > .card { margin: 0; }
.pt-stat { display: flex; flex-direction: column; gap: 2px; padding: var(--sp-4); }
.pt-stat-label { font-size: .8125rem; font-weight: 600; color: var(--text-muted); }
.pt-stat-value { font-size: 1.75rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.pt-stat-of { font-size: 1rem; font-weight: 600; color: var(--text-muted); }
.pt-stat-sub { font-size: .75rem; color: var(--text-muted); }
.pt-pages { list-style: none; margin: 0; padding: var(--sp-4) var(--sp-5); display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--sp-3) var(--sp-6); }
.pt-pages .vt-page .avatar { width: 28px; height: 28px; font-size: .8125rem; }
.pt-pages .vt-handle, .pt-pages .vt-count { font-size: .9375rem; }
.pt-pages .vt-count strong { font-size: 1.0625rem; }
.pt-pages .vt-bar { height: 7px; }

/* hiding a page from one's own Post Tracker (app.web.tracker_hidden): a quiet button at the row's end, and the hidden
   pages folded into one line under the list, each with Unhide */
.pt-hide { flex: none; margin: 0; }
.pt-hide-btn {
  display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid transparent; border-radius: 8px;
  background: none; color: var(--text-muted); cursor: pointer; opacity: .55;
}
.vt-page:hover .pt-hide-btn, .pt-hide-btn:focus-visible { opacity: 1; }
.pt-hide-btn:hover { border-color: var(--border); background: var(--surface-2); color: var(--text); opacity: 1; }
@media (hover: none) { .pt-hide-btn { opacity: .8; } }
.pt-hidden { margin-top: var(--sp-3); font-size: .875rem; }
.pt-hidden > summary {
  display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); cursor: pointer; list-style: none;
}
.pt-hidden > summary::-webkit-details-marker { display: none; }
.pt-hidden-show { color: var(--accent); font-weight: 600; }
.pt-hidden[open] .pt-hidden-show { display: none; }
.pt-hidden-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: var(--sp-2) var(--sp-4); margin: var(--sp-2) 0 0; padding: 0; list-style: none; }
.pt-hidden-list li { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.pt-hidden-list .avatar { width: 24px; height: 24px; font-size: .6875rem; opacity: .7; }
.pt-hidden-handle { flex: 1; min-width: 0; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-hidden-list form { margin: 0; }
section > .pt-hidden { padding: 0 var(--sp-1); }
@media (max-width: 640px) {
  .pt-stats { grid-template-columns: minmax(0, 1fr); }
  .pt-stat { flex-direction: row; align-items: baseline; flex-wrap: wrap; gap: 0 var(--sp-2); padding: var(--sp-3) var(--sp-4); }
  .pt-stat-label { flex-basis: 100%; }
  .pt-stat-value { font-size: 1.375rem; }
  .pt-pages { grid-template-columns: minmax(0, 1fr); padding: var(--sp-3) var(--sp-4); }
}

/* ---- Earnings (/admin/earnings, /admin/earnings/ads, /admin/clipping-earnings: routes/earnings.py) ---- */
/* The two kinds' colours (the chart's columns, the totals' keys): a blue and an orange, checked for colour-blind
   separation and 3:1 against the surface in both themes. The text beside them stays in the text colours. */
:root { --earn-ads: #2a78d6; --earn-clip: #eb6834; }
[data-theme="dark"] { --earn-ads: #3987e5; --earn-clip: #d95926; }
.earn-month input { min-width: 156px; }
.earn-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); margin-bottom: var(--sp-3); }
.earn-head .vt-title { margin: 0; }
.earn-key { display: inline-block; flex: none; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; }
.earn-key-ads { background: var(--earn-ads); }
.earn-key-clipping { background: var(--earn-clip); }
.earn-chart-card { padding: var(--sp-4) var(--sp-5) var(--sp-3); }
.earn-legend { list-style: none; margin: 0 0 var(--sp-3); padding: 0; display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4); color: var(--text-muted); font-size: .8125rem; font-weight: 600; }
.earn-legend li { display: inline-flex; align-items: center; }
.earn-chart { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.earn-col-link {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-1); height: 100%; padding-top: var(--sp-2);
  border-radius: var(--radius); color: var(--text-muted);
}
.earn-col-link:hover { text-decoration: none; background: var(--surface-2); color: var(--text); }
.earn-col.is-current .earn-col-link { background: var(--surface-2); color: var(--text); }
.earn-col-total { color: var(--text); font-size: .8125rem; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.earn-plot { display: flex; align-items: flex-end; justify-content: center; width: 100%; height: 120px; border-bottom: 1px solid var(--border-input); }
.earn-plot svg { display: block; width: 28px; height: 120px; }
.earn-seg-ads { fill: var(--earn-ads); }
.earn-seg-clipping { fill: var(--earn-clip); }
.earn-col-month { display: flex; flex-direction: column; align-items: center; padding-bottom: var(--sp-2); font-size: .8125rem; line-height: 1.3; white-space: nowrap; }
.earn-col.is-current .earn-col-month { font-weight: 700; }
.earn-col-year { color: var(--text-muted); font-size: .6875rem; font-weight: 500; }
/* An Ad's renewal (or unpaid invoice) that's close or past: it glows red, here and on its row */
.earn-reminders { margin-bottom: var(--sp-5); }
.earn-alerts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.earn-alert {
  display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--danger); border-radius: var(--radius-lg); background: var(--danger-soft); color: var(--text);
  box-shadow: 0 0 10px 1px color-mix(in srgb, var(--danger) 35%, transparent); animation: earn-glow 2.4s ease-in-out infinite;
}
@keyframes earn-glow { 50% { box-shadow: 0 0 18px 4px color-mix(in srgb, var(--danger) 50%, transparent); } }
.earn-alert-icon { flex: none; margin-top: 1px; color: var(--danger); }
.earn-alert-body { min-width: 0; }
.earn-alert-body p { margin: 0; }
.earn-alert-head { font-weight: 650; overflow-wrap: anywhere; }
.earn-alert-head a { color: var(--text); text-decoration: underline; }
.earn-alert-what { color: var(--danger); }
.earn-alert-day { color: var(--text-muted); font-weight: 500; }
.earn-alert-text { margin-top: 2px; font-size: .875rem; }
.earn-alert-client { color: var(--text-muted); overflow-wrap: anywhere; }
.earn-flag {
  display: inline-flex; align-items: center; min-height: 24px; padding: 0 var(--sp-2); border: 1px solid var(--danger);
  border-radius: 999px; background: var(--danger-soft); color: var(--danger); font-size: .8125rem; font-weight: 650;
  white-space: nowrap; box-shadow: 0 0 8px 1px color-mix(in srgb, var(--danger) 40%, transparent);
  animation: earn-glow-sm 2.4s ease-in-out infinite;
}
@keyframes earn-glow-sm { 50% { box-shadow: 0 0 14px 3px color-mix(in srgb, var(--danger) 55%, transparent); } }
@media (prefers-reduced-motion: reduce) { .earn-alert, .earn-flag { animation: none; } }
.earn-row-alert td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.earn-dates { display: inline-flex; flex-direction: column; align-items: flex-start; gap: var(--sp-1); }
.earn-date { color: var(--text-muted); font-size: .875rem; white-space: nowrap; }
/* the tables */
.earn-table td { vertical-align: top; }
.earn-table td.num { white-space: nowrap; }
.earn-cell { display: block; min-width: 0; }
.earn-name { min-width: 160px; }
.earn-name a { margin-right: var(--sp-2); color: var(--text); font-weight: 650; }  /* (the gap before a badge: none when it wraps) */
.earn-name a:hover { color: var(--accent); }
.earn-name .badge { height: 20px; font-size: .75rem; vertical-align: 1px; }
.earn-sub { display: block; color: var(--text-muted); font-size: .8125rem; font-weight: 400; white-space: normal; }
.earn-sub.nowrap { white-space: nowrap; }
.earn-status { display: block; margin-top: var(--sp-1); }
.earn-pages { display: flex; flex-wrap: wrap; gap: 2px var(--sp-2); font-size: .875rem; }
.earn-more { color: var(--text-muted); }
.earn-note { min-width: 120px; max-width: 260px; overflow-wrap: anywhere; }
.earn-total-row td { border-top: 1px solid var(--border); background: var(--surface-2); font-weight: 650; }
.earn-subtitle { margin: var(--sp-5) 0 var(--sp-3); font-size: 1rem; font-weight: 650; }
.earn-months .earn-name a[aria-current] { color: var(--text); }  /* the month picked above: bold, not the accent (red reads as a reminder here) */
/* All time's Month by month: the years' rows and the All time row on a band a shade deeper than the look's own
   (beats terminal's zebra rows), the months in a regular weight (indented under their year when there are years), and
   the All time row under a heavier rule */
.earn-months { --earn-band: color-mix(in srgb, var(--text) 5%, var(--surface-2)); }
.earn-months tr.earn-total-row td { background: var(--earn-band); }
.earn-months tbody tr:not(.earn-total-row) .earn-name a { font-weight: 500; }
.earn-months tbody tr:not(.earn-total-row) .earn-name a[aria-current] { font-weight: 750; }
.earn-months:has(.earn-year-row) tbody tr:not(.earn-total-row) .earn-name a { margin-left: var(--sp-4); }
.earn-months tfoot td { border-top: 2px solid var(--border-input); }
.earn-earners td[data-label="Kind"] { white-space: nowrap; }  /* the colour key stays by its word */
@media (max-width: 640px) {
  .earn-month input { min-width: 0; }
  .earn-chart-card { padding: var(--sp-3) var(--sp-2) var(--sp-2); }
  .earn-legend { padding: 0 var(--sp-2); }
  .earn-col-total { font-size: .75rem; }
  .earn-name { min-width: 0; }
  .earn-dates { align-items: flex-end; }
  .earn-pages { justify-content: flex-end; }
  .earn-note { max-width: none; min-width: 0; }
  .earn-table td.num { white-space: normal; }
  table.stack-mobile.earn-table td.end { justify-content: space-between; padding-top: 6px; }  /* label left, amount right */
  .earn-row-alert td:first-child { box-shadow: none; }
  table.stack-mobile.earn-table tr.earn-row-alert { box-shadow: inset 3px 0 0 var(--danger); }  /* the whole card */
  .earn-total-row td:first-child { display: none; }
  .earn-months .earn-total-row td:first-child { display: flex; }  /* a year's (or All time's) name stays */
  table.stack-mobile.earn-months tr.earn-total-row { background: var(--earn-band); }  /* the whole card */
  table.stack-mobile.earn-months tr.earn-total-row td { background: none; }
  table.stack-mobile.earn-months tfoot td { border-top: 0; }
  table.stack-mobile.earn-months tfoot tr { border-top: 2px solid var(--border-input); }
  .earn-months:has(.earn-year-row) tbody tr:not(.earn-total-row) .earn-name a { margin-left: 0; }
  table.stack-mobile.earn-earners td[data-label="Kind"] { gap: 0; }  /* the key by its word, both on the right */
  table.stack-mobile.earn-earners td[data-label="Kind"] .earn-key { margin-left: auto; }
}

/* ---- Users: a name with the email under it ---- */
.user-email { display: block; color: var(--text-muted); font-size: .8125rem; overflow-wrap: anywhere; }
.page-head .sub.user-detail-email { margin-top: 2px; }

/* ---- Leaderboard (/leaderboard) and its admin events (/admin/leaderboard) ---- */
.lb-section { margin-bottom: var(--sp-6); }
.lb-board-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); margin-bottom: var(--sp-3); }
.lb-board-head .vt-title { margin: 0; }
.lb-note { margin: var(--sp-2) 0 0; }
/* first place: a gold card with a crown, above everyone else */
.lb-hero {
  display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-5); margin-bottom: var(--sp-3);
  border: 2px solid var(--gold-line); border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--gold-soft), var(--surface) 75%);
  box-shadow: 0 6px 24px color-mix(in srgb, var(--gold-line) 22%, transparent);
}
.lb-crown {
  display: inline-grid; place-items: center; flex: none; width: 64px; height: 64px; border-radius: 50%;
  color: var(--gold); background: var(--surface); border: 2px solid var(--gold-line);
}
.lb-hero-main { flex: 1; min-width: 0; }
.lb-hero-kicker { margin: 0 0 2px; color: var(--gold); font-size: .8125rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.lb-hero-name { margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2); }
.lb-hero-name .lb-name { font-size: 1.625rem; font-weight: 750; line-height: 1.2; overflow-wrap: anywhere; }
.lb-hero-sub { margin: var(--sp-1) 0 0; color: var(--text-muted); font-size: .875rem; }
.lb-hero-points { margin: 0; text-align: right; flex: none; }
.lb-hero-points strong { display: block; font-size: 2.25rem; font-weight: 800; line-height: 1; color: var(--gold); font-variant-numeric: tabular-nums; }
.lb-hero-points span { color: var(--text-muted); font-size: .8125rem; font-weight: 600; }
.lb-hero-sm { padding: var(--sp-3) var(--sp-4); gap: var(--sp-3); box-shadow: none; }
.lb-hero-sm .lb-crown { width: 44px; height: 44px; }
.lb-hero-sm .lb-hero-name .lb-name { font-size: 1.125rem; }
.lb-hero-sm .lb-hero-points strong { font-size: 1.5rem; }
.lb-you {
  display: inline-flex; align-items: center; height: 20px; padding: 0 var(--sp-2); border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-size: .6875rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
/* everyone else */
.lb-card { margin: 0; }
.lb-list { list-style: none; margin: 0; padding: 0; }
.lb-row {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border);
}
.lb-row:last-child { border-bottom: 0; }
.lb-rank {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--neutral-soft); color: var(--text-muted); font-weight: 700; font-variant-numeric: tabular-nums;
}
.lb-silver .lb-rank { background: var(--silver-soft); color: var(--silver); box-shadow: inset 0 0 0 2px var(--silver); }
.lb-bronze .lb-rank { background: var(--bronze-soft); color: var(--bronze); box-shadow: inset 0 0 0 2px var(--bronze); }
.lb-who { min-width: 0; }
.lb-who-line { margin: 0 0 4px; display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2); }
.lb-name { font-weight: 650; overflow-wrap: anywhere; }
.lb-who-line .badge, .lb-hero-name .badge { height: 18px; font-size: .6875rem; padding: 0 6px; }
.lb-bar { height: 4px; max-width: 320px; }
.lb-silver .lb-bar > span { background: var(--silver); }
.lb-bronze .lb-bar > span { background: var(--bronze); }
.lb-posts { color: var(--text-muted); font-size: .8125rem; white-space: nowrap; }
.lb-points { white-space: nowrap; color: var(--text-muted); font-size: .8125rem; text-align: right; min-width: 64px; }
.lb-points strong { color: var(--text); font-size: 1.0625rem; font-variant-numeric: tabular-nums; }
.lb-row.is-me { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); box-shadow: inset 3px 0 0 var(--accent); }
.lb-empty { margin-bottom: var(--sp-3); }
.lb-empty-icon { display: inline-grid; color: var(--gold); margin-bottom: var(--sp-2); }
/* events */
.lb-events { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--sp-4); align-items: start; }
.lb-events > .card { margin: 0; }
.lb-event { padding: var(--sp-4) var(--sp-5); }
.lb-event.is-live { border-color: var(--gold-line); }
.lb-event-flags { margin: 0 0 var(--sp-2); display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2); }
.lb-event-name { font-size: 1.125rem; margin: 0; }
.lb-event-when { margin: 2px 0 var(--sp-2); }
.lb-event-desc { margin: 0 0 var(--sp-3); font-size: .9375rem; }
.lb-event-empty { margin: 0 0 var(--sp-3); }
.lb-prize {
  display: flex; align-items: center; gap: var(--sp-2); width: fit-content; max-width: 100%; margin: 0 0 var(--sp-3);
  padding: var(--sp-2) var(--sp-3); line-height: 1.35; overflow-wrap: anywhere;
  border-radius: var(--radius); background: var(--gold-soft); color: var(--gold); font-weight: 650; font-size: .9375rem;
}
.lb-prize svg { flex: none; }
.lb-mult { background: var(--gold-soft); color: var(--gold); }
.lb-event .lb-list { border: 1px solid var(--border); border-radius: var(--radius); }
.lb-event .lb-row { grid-template-columns: 32px minmax(0, 1fr) auto; padding: var(--sp-2) var(--sp-3); }
.lb-event .lb-rank { width: 26px; height: 26px; font-size: .8125rem; }
.lb-event .lb-posts { display: none; }
.lb-ended { padding: 0; }
.lb-ended summary { cursor: pointer; padding: var(--sp-4) var(--sp-5); }
.lb-ended-title { font-weight: 650; }
.lb-ended-list { list-style: none; margin: 0; padding: 0 var(--sp-5) var(--sp-3); }
.lb-ended-list li { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4); padding: var(--sp-3) 0; border-top: 1px solid var(--border); }
.lb-ended-main { min-width: 0; }
.lb-ended-main p { margin: 0; }
.lb-ended-name { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2); }
.lb-winner { margin: 0; display: flex; align-items: center; gap: var(--sp-2); font-weight: 650; }
.lb-winner-crown { display: inline-grid; color: var(--gold); }
/* the admin's events page and form */
.lb-admin-list { list-style: none; margin: 0; padding: 0; }
.lb-admin-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3) var(--sp-4); padding: var(--sp-3) var(--sp-5); border-bottom: 1px solid var(--border); }
.lb-admin-row:last-child { border-bottom: 0; }
.lb-admin-main { min-width: 0; }
.lb-admin-main p { margin: 0 0 2px; }
.lb-admin-name { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2); font-weight: 650; }
.lb-admin-name a { color: var(--text); }
.lb-admin-name a:hover { color: var(--accent); }
.lb-admin-actions { flex: none; }
.lb-admin-empty { padding: var(--sp-4); }
.lb-admin-empty p { margin: 0; }
.lb-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.lb-fieldset legend { font-weight: 600; font-size: .875rem; padding: 0; margin-bottom: 6px; }
.lb-fieldset .help { margin: 0 0 var(--sp-2); }
.lb-fieldset .error { display: block; color: var(--danger); font-size: .8125rem; font-weight: 600; margin-top: var(--sp-2); }
.lb-choices { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.lb-choice { padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius); min-height: 44px; }
.lb-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.lb-participants:has(input[value="everyone"]:checked) .lb-people { display: none; }
@media (max-width: 640px) {
  .lb-hero { flex-wrap: wrap; padding: var(--sp-4); gap: var(--sp-3); }
  .lb-crown { width: 48px; height: 48px; }
  .lb-hero-name .lb-name { font-size: 1.25rem; }
  .lb-hero-points { flex-basis: 100%; text-align: left; display: flex; align-items: baseline; gap: var(--sp-2); }
  .lb-hero-points strong { display: inline; font-size: 1.75rem; }
  .lb-row { grid-template-columns: 32px minmax(0, 1fr) auto; gap: var(--sp-2) var(--sp-3); padding: var(--sp-3); }
  .lb-rank { width: 28px; height: 28px; font-size: .875rem; grid-row: 1 / span 2; }
  .lb-posts { grid-column: 2; grid-row: 2; }
  .lb-points { grid-column: 3; grid-row: 1 / span 2; }
  .lb-events { grid-template-columns: minmax(0, 1fr); }
  .lb-event { padding: var(--sp-4); }
  .lb-ended summary { padding: var(--sp-4); }
  .lb-ended-list { padding: 0 var(--sp-4) var(--sp-3); }
  .lb-admin-row { flex-direction: column; padding: var(--sp-3) var(--sp-4); }
}

/* A live event takes the full width: the event (name, prize, description) beside its ranking */
.lb-events.is-live { grid-template-columns: minmax(0, 1fr); }
.lb-event-board > :last-child { margin-bottom: 0; }
@media (min-width: 900px) {
  .lb-event.is-live { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--sp-6); align-items: start; padding: var(--sp-5); }
  .lb-event.is-live .lb-event-desc:last-child { margin-bottom: 0; }
}

/* ---- the Submit pages' compact page picker (4+ pages): "Recent" chips, and the picked page on one line that opens a
   searchable list (a <details>, submit.js) ---- */
.avatar.xs { width: 22px; height: 22px; font-size: .6875rem; }
.page-recent { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.page-recent-label { font-size: .75rem; font-weight: 650; color: var(--text-muted); letter-spacing: .05em; text-transform: uppercase; margin-right: 2px; }
.page-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px 3px 3px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface); font-size: .875rem; font-weight: 550; cursor: pointer; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.page-chip:hover { border-color: var(--border-input); }
.page-chip.is-on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.page-dd { position: relative; }
.page-dd-trigger {
  display: flex; align-items: center; gap: var(--sp-3); min-height: 56px; padding: var(--sp-2) var(--sp-3); cursor: pointer;
  border: 1px solid var(--border-input); border-radius: var(--radius); background: var(--surface); list-style: none;
}
.page-dd-trigger::-webkit-details-marker { display: none; }
.page-dd-trigger:hover { border-color: var(--text-muted); }
.page-dd-trigger:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.page-dd[open] > .page-dd-trigger { border-color: var(--accent); }
.page-dd-placeholder { color: var(--text-muted); font-weight: 550; }
.page-dd-caret { margin-left: auto; flex: none; color: var(--text-muted); transition: transform .15s ease; }
.page-dd[open] .page-dd-caret { transform: rotate(180deg); }
.page-dd-panel {
  margin-top: var(--sp-2); padding: var(--sp-2); border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); max-height: 420px; overflow-y: auto; box-shadow: 0 8px 24px rgba(0, 0, 0, .08);
}
.page-dd-search { width: 100%; margin-bottom: var(--sp-2); }
.page-dd-group .page-group-label { margin: var(--sp-3) var(--sp-1) var(--sp-1); }
.page-dd-group:first-of-type .page-group-label { margin-top: var(--sp-1); }
.page-dd-list { display: flex; flex-direction: column; gap: 2px; }
.page-dd-list .page-option { min-height: 0; padding: var(--sp-2); border-color: transparent; background: none; }
.page-dd-list .page-option:hover { background: var(--surface-2); border-color: transparent; }
.page-dd-list .page-option:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); box-shadow: none; }
.page-dd-list .page-option .avatar { width: 30px; height: 30px; font-size: .8125rem; }
.page-dd-none { margin: var(--sp-2); }
.page-picker.attention .page-dd-trigger { border-color: var(--danger); }

/* ---- the header's Account menu: an icon (like the theme toggle) that opens who's signed in and Log out ---- */
.account { display: flex; }
.account-menu { min-width: 220px; }
.account-menu form { border-top: 0; padding-top: 0; }  /* the head already draws the line */
.account-head { display: flex; flex-direction: column; gap: 1px; padding: var(--sp-2) var(--sp-3) var(--sp-3); margin-bottom: var(--sp-1); border-bottom: 1px solid var(--border); }
.account-name { font-weight: 650; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-email { font-size: .8125rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu .menu-item.account-logout { display: flex; align-items: center; gap: var(--sp-2); width: 100%; border: 0; background: none; font: inherit; font-size: .875rem; color: var(--text); text-align: left; cursor: pointer; }
.account-menu .menu-item.account-logout:hover { background: var(--surface-2); }

/* ---- a page's settings: its status as small pills under its name, and Submit Reels / Feeds beside it ---- */
.status-pills { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1); }
.status-pills .badge { height: 22px; font-size: .75rem; }
.page-status { margin-top: var(--sp-2); }
/* a long pill (an uppercase look's "Reconnect to allow views and analytics") wraps inside a narrow phone */
.status-pills.page-status .badge { max-width: 100%; height: auto; min-height: 22px; padding-block: 2px; white-space: normal; overflow-wrap: anywhere; }
.page-head > .cell-page, .page-head > .cell-page > div { min-width: 0; }
.page-submit .btn .ico { flex: none; }

/* ---- Calendar (/calendar): scheduled posts (the scheduled purple) and live ones (green) by ET day. The week is 7
   columns (a list of days on phones); the month a grid of days (just the counts on phones, a tap opens that week).
   A scheduled post can be dragged to another day (calendar.js): it follows the pointer as a "ghost" and the day under
   it lights up. ---- */
.cal-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-3); }
.cal-nav { display: flex; align-items: center; gap: var(--sp-1); min-width: 0; }
.cal-title { margin: 0 0 0 var(--sp-2); font-size: 1.0625rem; white-space: nowrap; }
.cal-filter { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; min-width: 0; }
.cal-filter select { height: 32px; width: auto; max-width: 240px; font-size: .875rem; background-position: calc(100% - 18px) 13px, calc(100% - 13px) 13px; }
.cal-legend { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1) var(--sp-4); margin-bottom: var(--sp-3); font-size: .875rem; }
.cal-key { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.cal-key::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: currentColor; }
.cal-key.is-scheduled { color: var(--sched); }
.cal-key.is-posted { color: var(--success); }
.cal-empty { margin: 0 0 var(--sp-3); padding: var(--sp-3) var(--sp-4); border: 1px dashed var(--border-input); border-radius: var(--radius); background: var(--surface-2); color: var(--text-muted); font-size: .9375rem; }

/* the days */
.cal-day { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; padding: var(--sp-2); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); transition: background-color .12s; }
.cal-day.is-past { background: var(--surface-2); }
.cal-day.is-today { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.cal-day-head { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.cal-dow { color: var(--text-muted); font-size: .75rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.cal-date { font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-today { padding: 0 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .6875rem; font-weight: 700; }
.cal-counts { display: inline-flex; gap: 4px; margin-left: auto; }
.cal-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: .75rem; font-weight: 700; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.cal-count.is-scheduled { background: var(--sched-soft); color: var(--sched); }
.cal-count.is-posted { background: var(--success-soft); color: var(--success); }
.cal-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cal-none { margin: 0; color: var(--text-muted); font-size: .8125rem; }
.cal-day:has(.cal-entry) .cal-none { display: none; }

/* a post */
.cal-item {
  display: flex; flex-direction: column; gap: 2px; padding: 6px var(--sp-2); border-radius: 6px; min-width: 0;
  border-left: 3px solid var(--border-input); background: var(--neutral-soft); color: var(--text); font-size: .8125rem; line-height: 1.35;
}
.cal-item:hover { text-decoration: none; box-shadow: 0 0 0 1px var(--border-input); }
.cal-item.is-scheduled { background: var(--sched-soft); border-left-color: var(--sched); }
.cal-item.is-posted { background: var(--success-soft); border-left-color: var(--success); }
.cal-item.is-posting { background: var(--info-soft); border-left-color: var(--info); }
.cal-item.is-scheduled .cal-time { color: var(--sched); }
.cal-item.is-posted .cal-time { color: var(--success); }
.cal-item-top { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); min-width: 0; }
.cal-time { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cal-type { color: var(--text-muted); font-size: .75rem; font-weight: 600; white-space: nowrap; }
.cal-page { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cal-handle { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.avatar.xs { width: 18px; height: 18px; font-size: .625rem; }
.cal-headline { color: var(--text-muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.cal-item.is-compact { padding: 2px 6px; font-size: .75rem; }
.cal-item.is-compact .cal-item-top { justify-content: flex-start; gap: 6px; }
.cal-item.is-compact .cal-handle { font-weight: 500; }

/* dragging (calendar.js) */
.cal-item[data-cal-drag] { cursor: grab; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.cal-item.is-dragging { opacity: .35; }
.cal-item.is-saving { opacity: .6; cursor: progress; }
.cal-item.is-pressed { box-shadow: 0 0 0 2px var(--sched); }
.cal-ghost { position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; margin: 0; box-shadow: 0 10px 28px rgba(0, 0, 0, .25); opacity: .95; }
.cal-ghost .cal-item { box-shadow: 0 0 0 2px var(--sched); }
.cal-day.is-drop { background: var(--sched-soft); outline: 2px dashed var(--sched); outline-offset: -2px; }
.cal-day.is-drop.is-past { background: var(--surface-2); outline-color: var(--border-input); }
html.cal-dragging, html.cal-dragging * { cursor: grabbing !important; -webkit-user-select: none; user-select: none; }

/* the week: seven columns; a list of days on narrower screens */
.cal-week { display: grid; gap: var(--sp-2); grid-template-columns: repeat(7, minmax(0, 1fr)); align-items: stretch; }
.cal-week .cal-day { min-height: 180px; }
@media (max-width: 900px) {
  .cal-week { grid-template-columns: minmax(0, 1fr); }
  .cal-week .cal-day { min-height: 0; }
  .cal-week .cal-day-head { align-items: center; }
  .cal-week .cal-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

/* the month: a grid of days, the month's own on white */
.cal-month { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.cal-dows, .cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dows span { padding: 6px var(--sp-2); color: var(--text-muted); font-size: .75rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.cal-cell { min-height: 116px; gap: 4px; padding: 4px; border: 0; border-top: 1px solid var(--border); border-radius: 0; background: var(--surface); }
.cal-row > .cal-cell + .cal-cell { border-left: 1px solid var(--border); }
.cal-cell.is-past { background: var(--surface); }
.cal-cell.is-outside { background: var(--surface-2); }
.cal-cell.is-outside .cal-date { color: var(--text-muted); font-weight: 500; }
.cal-cell.is-today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-cell-head { display: flex; align-items: center; gap: 4px; padding: 2px 4px; border-radius: 4px; color: var(--text); font-size: .875rem; }
.cal-cell-head:hover { text-decoration: none; background: var(--surface-2); }
.cal-cell.is-today .cal-date { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }
.cal-cell .cal-count { min-width: 18px; height: 18px; line-height: 18px; font-size: .6875rem; padding: 0 5px; }
.cal-more { padding: 0 6px; color: var(--text-muted); font-size: .75rem; font-weight: 600; }
.cal-more:hover { color: var(--accent); }
@media (max-width: 640px) {
  .cal-filter { margin-left: 0; width: 100%; }
  .cal-filter .vt-date { flex: none; }
  .cal-filter select { flex: 1; max-width: none; }
  .cal-dows span { padding: 4px 2px; text-align: center; font-size: .6875rem; letter-spacing: 0; }
  .cal-cell { min-height: 64px; padding: 2px; }
  .cal-cell .cal-list, .cal-cell .cal-more { display: none; }
  .cal-cell-head { flex-direction: column; align-items: center; gap: 2px; height: 100%; padding: 2px 0; }
  .cal-cell .cal-counts { flex-direction: column; align-items: center; margin-left: 0; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) { .cal-day { transition: none; } }
.account-menu .menu-item.account-link { color: var(--text); font-size: .875rem; }
.account-menu .menu-item.account-link:hover { background: var(--surface-2); text-decoration: none; }
.account-menu .menu-item.account-link::after { content: none; }
.account-form { max-width: 480px; }

/* /account/appearance: the light/dark switch, then a card per look (one click switches); each card's preview follows
   the page's light/dark. Shared by every look (a look restyles it in its own stylesheet). */
.appearance-mode { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); max-width: 640px; }
.appearance-mode h2 { margin: 0; }
.appearance-mode p { margin: var(--sp-1) 0 0; }
.appearance-head { margin-top: var(--sp-6); }
.look-grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.look-card { margin: 0; }
.look-pick {
  display: flex; flex-direction: column; width: 100%; height: 100%; padding: 0; text-align: left; cursor: pointer;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; font: inherit; transition: border-color .15s, box-shadow .15s;
}
.look-pick:hover { border-color: var(--border-input); }
.look-card.is-current .look-pick { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.look-preview { display: block; aspect-ratio: 16 / 10; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.look-shot { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.look-shot-dark { display: none; }
[data-theme="dark"] .look-shot-light { display: none; }
[data-theme="dark"] .look-shot-dark { display: block; }
.look-text { display: flex; flex-direction: column; gap: var(--sp-1); padding: var(--sp-3) var(--sp-4) var(--sp-4); }
.look-name { display: flex; align-items: center; gap: var(--sp-2); font-weight: 650; }
.look-tagline { color: var(--text-muted); font-size: .875rem; }

/* the Calendar week's "Show live posts" toggle, at the end of the legend */
.cal-live-toggle { margin-left: auto; }
.cal-live-toggle.is-on { border-color: var(--success); color: var(--success); background: var(--success-soft); }

/* the Calendar's Day view: the one day, its posts side by side; a week column's header opens its day */
.cal-week.is-day { grid-template-columns: minmax(0, 1fr); }
.cal-week.is-day .cal-day { min-height: 0; }
.cal-week.is-day .cal-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.cal-day-link { display: inline-flex; align-items: baseline; gap: 4px; color: inherit; border-radius: 6px; }
.cal-day-link:hover { color: var(--accent); text-decoration: none; }

/* the Calendar's "Create new post" menu (Submit Reels / Submit Feeds) */
.cal-new { display: flex; flex: none; }
.cal-new .btn { gap: var(--sp-2); }
.cal-new .btn[aria-expanded="true"] svg:last-child { transform: rotate(180deg); }
.cal-new-menu, #cal-new-menu { min-width: 200px; }
#cal-new-menu .menu-item { color: var(--text); font-size: .875rem; }
#cal-new-menu .menu-item:hover { background: var(--surface-2); text-decoration: none; }

/* ---- the app shell (base.html, app.web.shell) ----
   Desktop (900px and up): a fixed sidebar with every link, the page beside it under a slim top bar ("Create new post").
   Phones: a top bar with the section's name, a fixed bottom bar (Home, Analytics, All Posts, Leaderboard, More), a +
   button just above it, and two bottom sheets (More, Create new post) that app.js opens. */
:root { --sidebar-w: 236px; --appbar-h: 56px; --tabbar-h: 60px; }
.ico { flex: none; }
.skip-link {
  position: fixed; left: var(--sp-2); top: -100px; z-index: 100; padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius); background: var(--accent); color: var(--accent-ink); font-weight: 650;
}
.skip-link:focus { top: var(--sp-2); text-decoration: none; }

.sidebar { display: none; }
.sidebar .brand { flex: none; height: var(--appbar-h); padding: 0 var(--sp-5); border-bottom: 1px solid var(--border); }
.side-nav { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: var(--sp-3) var(--sp-3) var(--sp-4); }
.side-section + .side-section { margin-top: var(--sp-4); }
.side-label, .sheet-label {
  margin: 0 0 var(--sp-1); padding: 0 var(--sp-3); color: var(--text-muted);
  font-size: .6875rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase;
}
.side-link {
  display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 6px var(--sp-3); border-radius: var(--radius);
  color: var(--text-muted); font-size: .9063rem; font-weight: 550; cursor: pointer;
}
.side-link:hover { background: var(--neutral-soft); color: var(--text); text-decoration: none; }
.side-link.active { background: var(--accent-soft); color: var(--accent); }
.side-link .avatar { width: 20px; height: 20px; font-size: .625rem; }
.nav-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The Chat badge (_macros.html chat_badge; static/chat_badge.js keeps it current): the unread chat messages, a pill at the
   end of Chat's link (the phone's Chat tab: at its icon's corner), and on what hides that link (a look's Plan & track
   menu button). An "@" leads the count when one of them mentions you: a mark of its own, not just a colour. Gone at 0. */
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center; flex: none; gap: 1px;
  min-width: 20px; height: 20px; margin-left: auto; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-size: .6875rem; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: 0; text-transform: none; white-space: nowrap;
}
.nav-badge[hidden] { display: none !important; }
.nav-badge-at { display: none; }
.nav-badge.is-mention .nav-badge-at { display: inline; font-weight: 800; }
.nav-badge.is-mention { padding: 0 6px 0 5px; }
.nav-more > summary { list-style: none; }
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more > summary .ico { transition: transform .15s ease; }
.nav-more[open] > summary .ico { transform: rotate(180deg); }
.nav-more .if-open, .nav-more[open] .if-closed { display: none; }
.nav-more[open] .if-open { display: inline; }
/* Admin Tools (_shell.html nav_fold): a <details> whose summary is a row like the links, with a chevron at its end that
   turns when it's open; its links sit a little in, along a guide line from the group's icon. A rule above sets it apart
   from the page shortcuts, since it has no heading of its own. */
.nav-fold { padding-top: var(--sp-2); border-top: 1px solid var(--border); }
.nav-fold > summary { list-style: none; }
.nav-fold > summary::-webkit-details-marker { display: none; }
.nav-fold-toggle > .ico:last-child { margin-left: auto; transition: transform .15s ease; }
.nav-fold[open] > .nav-fold-toggle > .ico:last-child { transform: rotate(180deg); }
.nav-fold[open] > .nav-fold-toggle { color: var(--text); }
.nav-fold:not([open]) > .nav-fold-toggle.is-on { background: var(--accent-soft); color: var(--accent); }  /* closed on one of its pages */
.nav-fold-links { margin: 2px 0 0 21px; padding-left: 4px; border-left: 1px solid var(--border); }
.nav-fold-links .side-link { padding-left: var(--sp-2); }
@media (prefers-reduced-motion: reduce) { .nav-fold-toggle > .ico:last-child { transition: none; } }
.side-foot { flex: none; display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-3); border-top: 1px solid var(--border); }
.side-foot .account { flex: 1; min-width: 0; }
.side-me {
  display: flex; align-items: center; gap: var(--sp-2); width: 100%; min-width: 0; padding: 6px var(--sp-2);
  border: 0; border-radius: var(--radius); background: none; color: var(--text-muted); font: inherit; text-align: left; cursor: pointer;
}
.side-me:hover, .side-me[aria-expanded="true"] { background: var(--neutral-soft); color: var(--text); }
.side-me[aria-expanded="true"] .ico { transform: rotate(180deg); }
.side-me-text { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; flex: 1; min-width: 0; }
.side-me .me-name { max-width: 100%; color: var(--text); font-weight: 650; }
.side-me .badge { height: 20px; font-size: .6875rem; }
/* Classic's own sidebar (the looks style theirs): a role too long for the column ("Clipping Manager") wraps onto a
   second line instead of running under the chevron */
[data-look="classic"] .side-me .badge {
  max-width: 100%; height: auto; min-height: 20px; padding: 2px var(--sp-2); border-radius: 10px; white-space: normal; line-height: 1.2;
}
.me-avatar {
  display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: .9375rem;
}

.appbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--sp-3);
  min-height: var(--appbar-h); padding: 0 var(--sp-4); background: var(--surface); border-bottom: 1px solid var(--border);
}
.appbar-brand { min-width: 0; }
.appbar-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.create-new { display: flex; margin-left: auto; }
.create-new .btn { gap: var(--sp-2); }
#create-menu .menu-item { color: var(--text); }
#create-menu .menu-item .ico { color: var(--text-muted); }
/* a page with its own "Create new post" (the Calendar's, for the page picked in its filter): one is enough */
.has-shell:has(.cal-new) .create-new { visibility: hidden; }

.tabbar, .fab { display: none; }

@media (min-width: 900px) {
  .has-shell .sidebar {
    display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0; z-index: 25;
    width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border);
  }
  .has-shell .shell-main { margin-left: var(--sidebar-w); }
  .appbar-brand { display: none; }
  .sheet { display: none !important; }  /* the sheets are the phone's; the sidebar has all of it */
}

@media (max-width: 899.98px) {
  .appbar { min-height: 52px; padding-top: env(safe-area-inset-top); justify-content: center; }  /* the logo and title, centered */
  .create-new { display: none; }
  .has-shell .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; gap: 2px;
    padding: 4px max(4px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
    background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -2px 12px rgba(0, 0, 0, .05);
  }
  .tab {
    flex: 1 1 0; min-width: 0; min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; border-radius: var(--radius); color: var(--text-muted); font-size: .6875rem; font-weight: 600; line-height: 1.1;
  }
  .tab:hover { color: var(--text); text-decoration: none; }
  .tab .ico { width: 52px; height: 28px; padding: 3px 0; border-radius: 999px; transition: background .15s; }
  .tab.active { color: var(--accent); }
  .tab.active .ico { background: var(--accent-soft); }
  .tab-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* The Chat badge (on More, the last tab, since 2026-11-10): on its icon's top right corner, ringed in the bar's
     colour so it stands off */
  .tabbar .tab { position: relative; }
  .tabbar .tab .nav-badge {
    position: absolute; top: 2px; left: calc(50% + 4px); right: auto; min-width: 18px; height: 18px; margin: 0;
    padding: 0 5px; font-size: .625rem; box-shadow: 0 0 0 2px var(--surface);
  }
  /* More is the last tab: the badge's right edge is pinned at the icon's, so a long count ("@99+") grows to the left,
     over the icon, never off the screen (above every look's own placement, which was made for Chat's tab) */
  .has-shell .tabbar .tab[data-nav="tab-more"] .nav-badge { left: auto; right: max(2px, calc(50% - 26px)); }
  .has-shell .fab {
    display: grid; place-items: center; position: fixed; z-index: 39;
    right: max(16px, env(safe-area-inset-right)); bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom));
    width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
  }
  .has-shell .fab:hover { background: var(--accent-hover); text-decoration: none; }
  /* room under the page for the bottom bar and the + button */
  .has-shell .container { padding-bottom: calc(var(--tabbar-h) + 96px + env(safe-area-inset-bottom)); }
  .has-shell .toasts { bottom: calc(var(--tabbar-h) + var(--sp-3) + env(safe-area-inset-bottom)); }
  .has-shell .sticky-actions, .has-shell .tt-selbar { bottom: calc(var(--tabbar-h) + var(--sp-2) + env(safe-area-inset-bottom)); }
  /* a page's own bar of buttons along the bottom: the + button would cover them */
  .has-shell:has(.sticky-actions) .fab, .has-shell:has(.tt-selbar:not([hidden])) .fab { display: none; }
}

/* the phone's bottom sheets (app.js): slide up over a dim backdrop */
.sheet { position: fixed; inset: 0; z-index: 60; }
.sheet[hidden] { display: none; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); opacity: 0; transition: opacity .2s ease; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column;
  max-height: 88vh; max-height: 88dvh; padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); color: var(--text); border-radius: 16px 16px 0 0; box-shadow: 0 -8px 30px rgba(0, 0, 0, .22);
  transform: translateY(100%); transition: transform .22s ease; outline: none;
}
.sheet.is-open .sheet-backdrop { opacity: 1; }
.sheet.is-open .sheet-panel { transform: none; }
@media (min-width: 600px) {
  .sheet-panel { left: 50%; right: auto; width: 560px; transform: translate(-50%, 100%); }
  .sheet.is-open .sheet-panel { transform: translate(-50%, 0); }
}
@media (prefers-reduced-motion: reduce) { .sheet-backdrop, .sheet-panel { transition: none; } }
.sheet-grip { position: relative; flex: none; display: block; width: 100%; height: 22px; padding: 0; border: 0; background: none; cursor: pointer; }
.sheet-grip::before {
  content: ""; position: absolute; left: 50%; top: 9px; width: 40px; height: 4px; border-radius: 2px;
  background: var(--border-input); opacity: .6; transform: translateX(-50%);
}
.sheet-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); padding: 0 var(--sp-4) var(--sp-2); }
.sheet-head h2 { margin: 0; font-size: 1.125rem; }
.sheet-x { width: 40px; height: 40px; padding: 0; justify-content: center; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: var(--sp-1) var(--sp-4) var(--sp-5); }
body.sheet-lock { overflow: hidden; }

.sheet-user { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3); margin-bottom: var(--sp-3); border-radius: var(--radius-lg); background: var(--surface-2); }
.sheet-user-text { display: flex; flex-direction: column; min-width: 0; }
.sheet-user-name { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2); font-weight: 650; overflow-wrap: anywhere; }
.sheet-user-email { color: var(--text-muted); font-size: .8125rem; overflow-wrap: anywhere; }
.sheet-group + .sheet-group { margin-top: var(--sp-3); }
.sheet-group form { margin: 0; }
.sheet-label { padding: 0 var(--sp-2); }
.sheet-link {
  position: relative; display: flex; align-items: center; gap: var(--sp-3); width: 100%; min-height: 48px; padding: var(--sp-2);
  border: 0; border-radius: var(--radius); background: none; color: var(--text); font: inherit; font-weight: 550; text-align: left; cursor: pointer;
}
.sheet-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sheet-link .ico { color: var(--text-muted); }
.sheet-link.active { background: var(--accent-soft); color: var(--accent); }
.sheet-link.active .ico { color: inherit; }
.sheet-link .avatar { width: 26px; height: 26px; font-size: .75rem; }
.sheet-group .nav-fold-links { margin-left: 17px; padding-left: var(--sp-1); }  /* the guide line under the group's icon */
.nav-fold:not([open]) > .sheet-link.is-on .ico { color: inherit; }
.sheet-theme { justify-content: space-between; cursor: default; }
.sheet-theme:hover { background: none; }
.sheet-logout, .sheet-logout:hover, .sheet-logout .ico { color: var(--danger); }

/* "Create new post" (the + sheet and /menu): a Reel or a feed post, then the recent pages */
.create-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.create-choice {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-3); min-height: 132px;
  padding: var(--sp-4); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); color: var(--text);
}
a.create-choice:hover { border-color: var(--accent); text-decoration: none; }
.create-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.create-text { display: flex; flex-direction: column; gap: 2px; }
.create-title { font-size: 1.0625rem; font-weight: 700; }
.create-sub { color: var(--text-muted); font-size: .8125rem; line-height: 1.35; }
.create-choices + .sheet-label { margin-top: var(--sp-5); }
.page-chips { flex-wrap: wrap; overflow: visible; }
.page-chip { gap: 6px; padding-left: 4px; color: var(--text); }
.page-chip .avatar { width: 24px; height: 24px; font-size: .6875rem; }
.menu-page { display: grid; gap: var(--sp-4); max-width: 640px; }
.menu-page > .card { margin: 0; }
.menu-card h2 { margin-bottom: var(--sp-3); }

/* ---- Home (routes/home.py, app.web.home_blocks): the person's own blocks on one grid ----
   12 columns on a desktop, each block taking its size's share of a row (hb-s 3, hb-m 4, hb-l 6, hb-f 12). Below
   1100px, 6 columns: Small and Medium two to a row, Large and Full width one. Phones: one to a row, but the numbers
   (hb-compact) two. Each block is a card (so every look's cards style it); the looks restyle the rest. */
.home-board { display: flex; flex-direction: column; gap: var(--sp-4); }
.home-bar { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2) var(--sp-3); flex-wrap: wrap; min-height: 32px; }
.home-bar h1 { margin: 0 auto 0 0; }
.home-bar-note { flex: 1 1 320px; margin: 0; color: var(--text-muted); font-size: .875rem; }
.home-customize, .home-done { gap: var(--sp-1); }
.hb-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--sp-4); }
.hb-grid > .hb { position: relative; display: flex; flex-direction: column; min-width: 0; margin: 0; padding: var(--sp-4); }
.hb-s { grid-column: span 3; }
.hb-m { grid-column: span 4; }
.hb-l { grid-column: span 6; }
.hb-f { grid-column: span 12; }
.hb-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-1) var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.hb-title { display: flex; align-items: center; flex-wrap: wrap; gap: 0 var(--sp-2); margin: 0; font-size: 1rem; }
.hb-title .muted { font-size: .875rem; font-weight: 500; }
.hb-link { display: inline-flex; align-items: center; gap: 4px; font-size: .8125rem; font-weight: 600; white-space: nowrap; }
.hb-link .ico { width: 15px; height: 15px; }
.hb-empty, .hb-failed { margin: auto 0; color: var(--text-muted); font-size: .875rem; }
.home-need-empty { display: flex; align-items: center; gap: var(--sp-2); margin: auto 0; padding: var(--sp-2) 0; color: var(--text-muted); font-size: .875rem; }
.home-need-empty .ico { flex: none; color: var(--success); }
.home-more-note { margin: var(--sp-2) 0 0; }

/* the greeting */
.hb-hello h1 { margin: 0; font-size: 1.5rem; }
.hb-hello .sub { margin: var(--sp-1) 0 0; color: var(--text-muted); }
.hb-hello-quota { margin: var(--sp-3) 0 0; font-size: .875rem; }

/* the numbers: the whole block is the link */
.hb-grid > .hb-compact { align-self: start; padding: 0; }  /* a number keeps its own height beside a long list */
a.hb-stat { flex: 1; justify-content: space-between; padding: var(--sp-4); border-radius: inherit; color: var(--text); }
a.hb-stat:hover { background: var(--surface-2); text-decoration: none; }
.stat-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-2); }
.stat-ico { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); }
.stat-ico .ico { width: 18px; height: 18px; }

/* Needs you: Failed to post, Ready to post, Next scheduled */
.home-need { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.home-need-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.home-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.home-dot.ok { color: var(--success); }
.home-dot.bad { color: var(--danger); }
.home-dot.sched { color: var(--sched); }
.home-rows { list-style: none; margin: 0 calc(-1 * var(--sp-2)); padding: 0; }
.home-row { display: flex; align-items: center; gap: var(--sp-3); min-height: 52px; padding: var(--sp-2); border-radius: var(--radius); color: var(--text); }
.home-row:hover { background: var(--surface-2); text-decoration: none; }
.home-row:hover .home-row-title { color: var(--accent); }
.home-row > .ico { flex: none; color: var(--text-muted); }
.home-row .avatar { width: 32px; height: 32px; font-size: .8125rem; }
.home-row-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.home-row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-row-meta { color: var(--text-muted); font-size: .8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-need-more { display: block; margin-top: auto; padding-top: var(--sp-2); font-size: .875rem; font-weight: 600; }

/* Today's quotas */
.hb .pt-pages { padding: 0; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-3) var(--sp-5); }
.hb a.vt-handle { color: var(--text); }
.hb a.vt-handle:hover { color: var(--accent); }

/* Leaderboard: the event running now, then the all-time top three on a podium */
.home-event { display: flex; align-items: center; gap: var(--sp-3); margin: 0 0 var(--sp-3); padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-2); border-radius: var(--radius); background: var(--gold-soft); color: var(--text); }
.home-event:hover { text-decoration: none; box-shadow: inset 0 0 0 2px var(--gold-line); }
.home-event-ico { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 8px; background: var(--surface); color: var(--gold); }
.home-event-text { display: flex; flex-direction: column; min-width: 0; }
.home-event-name { display: flex; align-items: center; flex-wrap: wrap; gap: 2px var(--sp-2); font-weight: 650; }
.home-event .lb-mult { background: var(--surface); }
.home-event-meta { color: var(--text-muted); font-size: .8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-podium { list-style: none; margin: auto 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: var(--sp-2); }
.mp-step { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; text-align: center; }
.mp-1 { grid-column: 2; grid-row: 1; }
.mp-2 { grid-column: 1; grid-row: 1; }
.mp-3 { grid-column: 3; grid-row: 1; }
.mp-avatar { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 2px; border-radius: 50%; background: var(--silver-soft); color: var(--silver); font-weight: 700; }
.mp-1 .mp-avatar { width: 44px; height: 44px; background: var(--gold-soft); color: var(--gold); box-shadow: 0 0 0 2px var(--gold-line); }
.mp-3 .mp-avatar { background: var(--bronze-soft); color: var(--bronze); }
.mp-name { max-width: 100%; font-weight: 600; font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-you { display: inline-block; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .625rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; vertical-align: 2px; }
.mp-points { color: var(--text-muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.mp-points strong { color: var(--text); }
.mp-block { display: grid; place-items: start center; width: 100%; margin-top: 4px; padding-top: 6px; border-radius: var(--radius) var(--radius) 0 0; font-size: 1.25rem; font-weight: 800; line-height: 1; }
.mp-1 .mp-block { height: 76px; background: var(--gold-soft); color: var(--gold); }
.mp-2 .mp-block { height: 56px; background: var(--silver-soft); color: var(--silver); }
.mp-3 .mp-block { height: 40px; background: var(--bronze-soft); color: var(--bronze); }

/* Quick access */
.home-quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-3); }
.home-quick > .card { margin: 0; }
.home-tile { position: relative; display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); color: var(--text); }
a.home-tile:hover { border-color: var(--accent); text-decoration: none; }
a.home-tile:hover .home-tile-title { color: var(--accent); }
.home-tile-ico { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.home-tile-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.home-tile-title { font-weight: 650; }
.home-tile-sub { color: var(--text-muted); font-size: .8125rem; line-height: 1.35; }

/* the blocks from around the site (app.web.home_blocks.site: Chat, Analytics, Ads, Clipping, the Calendar, Batches,
   Submit Reels, Submit Feeds, Comments) */
/* numbers in a row (Chat, Analytics, Batches): each a small tile that opens its page */
.hb-nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: var(--sp-2); margin: 0 0 var(--sp-3); }
.hb-num { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: var(--sp-2) var(--sp-3); border-radius: var(--radius); background: var(--surface-2); color: var(--text); }
.hb-num:hover { background: var(--accent-soft); text-decoration: none; }
.hb-num .pt-stat-value { font-size: 1.5rem; }
.hb-num .pt-stat-label, .hb-num .pt-stat-sub { overflow-wrap: anywhere; }
.hb-an-nums { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.hb-delta { display: inline-flex; align-items: center; gap: 1px; font-weight: 700; white-space: nowrap; }
.hb-delta .ico { flex: none; }
.hb-delta.is-up { color: var(--success); }
.hb-delta.is-down { color: var(--danger); }
.hb-delta.is-same { color: var(--text-muted); }

/* a round-cornered icon or initial at the start of a row (Chat, Ads, Clipping, Comments) */
.hb-ico, .hb-chat-ico { display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: .875rem; font-weight: 700; }
.hb-ico .ico, .hb-chat-ico .ico { width: 18px; height: 18px; }

/* Chat: when the newest message was, an @ when they were mentioned, and the unread count */
.hb-chat-side { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.hb-chat-when { color: var(--text-muted); font-size: .75rem; white-space: nowrap; }
.hb-chat-at { color: var(--accent); font-weight: 700; }
.hb-chat-unread { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .75rem; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Ads and Clipping: the campaign's progress under its lines */
.hb-camp-bar { display: block; margin: 4px 0 2px; }
.hb-camp-rows .home-row-meta strong { color: var(--text); }

/* Calendar: the next 7 days, a tile each (they wrap to a second row in a narrow block) */
.hb-days { display: grid; grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)); gap: var(--sp-2); margin: 0; padding: 0; list-style: none; }
.hb-day { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; height: 100%; padding: var(--sp-2) 4px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); text-align: center; }
.hb-day:hover { border-color: var(--accent); text-decoration: none; }
.hb-day.is-today { border-color: var(--accent); background: var(--accent-soft); }
.hb-day-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .75rem; font-weight: 650; }
.hb-day-date { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); font-size: .6875rem; }
.hb-day-count { margin-top: 4px; font-size: 1.375rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.hb-day:not(.has-posts) .hb-day-count { color: var(--text-muted); font-weight: 600; }
.hb-day-label { color: var(--text-muted); font-size: .6875rem; }
.hb-day-live { margin-top: 2px; color: var(--success); font-size: .6875rem; font-weight: 700; white-space: nowrap; }
.hb-days-note { margin: var(--sp-3) 0 0; }

/* Batches: a row's state under its lines, so it reads at any width */
.hb-batch-state { align-self: flex-start; margin-top: 2px; }

/* Submit Reels and Submit Feeds: the counts, the recent pages, the way in */
.hb-submit-line { margin: 0 0 var(--sp-3); color: var(--text-muted); }
.hb-submit-line strong { margin-right: 2px; color: var(--text); font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.hb-submit-pages { margin-bottom: var(--sp-3); }
.hb-submit-pages .page-chip { color: var(--text); }
.hb-submit-pages .page-chip:hover { text-decoration: none; }
.hb-submit-go { align-self: flex-start; margin-top: auto; }

/* Customize: each block's tools along its top (the drag handle is home.js's: hidden without scripts) */
.home-board.is-editing .hb-grid > .hb { outline: 2px dashed color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 2px; }
.hb-tools {
  display: flex; align-items: center; gap: var(--sp-1); flex-wrap: wrap; margin: calc(-1 * var(--sp-2)) calc(-1 * var(--sp-2)) var(--sp-3);
  padding: 4px; border-radius: var(--radius); background: var(--surface-2); color: var(--text);
}
.hb-compact .hb-tools { margin: var(--sp-2) var(--sp-2) 0; }
.hb-s .hb-tools-name { display: none; }  /* a Small block's own heading is right under its tools */
.hb-tools form { display: inline-flex; gap: 2px; margin: 0; }
.hb-tools-name { flex: 1 1 auto; min-width: 0; padding: 0 var(--sp-1); font-size: .8125rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-tool, .hb-size, .hb-grip {
  display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px; border: 1px solid transparent;
  border-radius: 6px; background: none; color: var(--text-muted); font: inherit; font-size: .75rem; font-weight: 700; cursor: pointer;
}
.hb-tool:hover:not(:disabled), .hb-size:hover, .hb-grip:hover { background: var(--surface); color: var(--text); }
.hb-tool:disabled { opacity: .35; cursor: default; }
.hb-size[aria-pressed="true"] { border-color: var(--accent); background: var(--surface); color: var(--accent); }
.hb-remove:hover:not(:disabled) { color: var(--danger); }
.hb-grip { cursor: grab; touch-action: none; }
.hb-grip[hidden] { display: none; }
.hb.is-dragging { opacity: .5; }
.hb-ghost { border: 2px dashed var(--accent); border-radius: var(--radius-lg); background: var(--accent-soft); }
.hb-grid > .hb.hb-drag-copy { position: fixed; z-index: 90; margin: 0; pointer-events: none; box-shadow: 0 16px 40px rgba(0, 0, 0, .18); opacity: .95; }

/* adding blocks: the bubbles, then More blocks (the rest of the catalog), then Start over */
.hb-add { display: flex; flex-direction: column; gap: var(--sp-4); padding: var(--sp-5); border: 1px dashed var(--border-input); border-radius: var(--radius-lg); background: var(--surface); }
.hb-add-head h2 { margin: 0; font-size: 1.25rem; }
.hb-add-sub { margin: var(--sp-1) 0 0; color: var(--text-muted); }
.hb-bubbles { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0; padding: 0; list-style: none; }
.hb-bubbles form { margin: 0; }
.hb-bubble {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 var(--sp-4) 0 var(--sp-3); border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
}
.hb-bubble .ico { color: var(--accent); }
.hb-bubble:hover { border-color: var(--accent); background: var(--accent-soft); }
.hb-more > summary { display: inline-flex; align-items: center; gap: var(--sp-1); font-weight: 650; cursor: pointer; list-style: none; }
.hb-more > summary::-webkit-details-marker { display: none; }
.hb-more[open] > summary .ico { transform: rotate(180deg); }
.hb-cat-group { margin-top: var(--sp-4); }
.hb-cat-title { margin: 0 0 var(--sp-2); color: var(--text-muted); font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.hb-catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--sp-2); margin: 0; padding: 0; list-style: none; }
.hb-cat { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius); }
.hb-cat form { margin: 0; }
.hb-cat-ico { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 9px; background: var(--surface-2); color: var(--text-muted); }
.hb-cat-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.hb-cat-name { font-weight: 650; }
.hb-cat-blurb { color: var(--text-muted); font-size: .8125rem; line-height: 1.35; }
.hb-cat-add { flex: none; gap: 4px; }
.hb-cat-on { display: inline-flex; align-items: center; gap: 4px; flex: none; color: var(--success); font-size: .8125rem; font-weight: 650; }
.hb-cat.is-on { background: var(--surface-2); }
.hb-reset { margin: 0; }

/* the Admin tools blocks (app.web.home_blocks.admin) */
.hb-admin-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 5.5rem), 1fr)); gap: var(--sp-3); margin: 0 0 var(--sp-3); }
.hb-admin-pair { grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); }
.hb-admin-fig { display: flex; flex-direction: column; gap: 2px; min-width: 0; margin: 0; }
.hb-admin-figs .pt-stat-value { font-size: 1.5rem; overflow-wrap: anywhere; }
.hb-admin-pair .pt-stat-value, .hb-admin-big .pt-stat-value { font-size: 1.75rem; }
.hb-admin-big { margin: 0 0 var(--sp-2); }
.hb-admin-fig.is-bad .pt-stat-value { color: var(--danger); }
.hb-admin-sub { margin: var(--sp-1) 0 var(--sp-1); color: var(--text-muted); font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.hb-admin-note { margin: calc(-1 * var(--sp-1)) 0 var(--sp-2); }
.hb-admin-count { flex: none; color: var(--text-muted); font-size: .875rem; font-variant-numeric: tabular-nums; }
.hb-admin-count strong { color: var(--text); }
.hb-admin-delta { display: flex; align-items: flex-start; gap: 4px; margin: 0; color: var(--text-muted); font-size: .8125rem; }
.hb-admin-delta .ico { flex: none; margin-top: 2px; }
.hb-admin-delta.is-up { color: var(--success); }
.hb-admin-delta.is-down { color: var(--danger); }
.pt-stat-sub.hb-admin-delta { font-size: .75rem; }
[data-block="va_tracker"] .home-row .vt-bar { margin-top: 4px; }

/* Earnings: this month and last, Ads and clipping */
.hb-admin-split { width: 100%; margin-top: var(--sp-3); font-size: .875rem; font-variant-numeric: tabular-nums; }
.hb-admin-split th, .hb-admin-split td { padding: 6px 0 6px var(--sp-2); border-bottom: 0; border-top: 1px solid var(--border); background: none; text-align: right; overflow-wrap: anywhere; }
.hb-admin-split thead th, .hb-admin-split thead td { padding-bottom: 4px; border-top: 0; color: var(--text-muted); font-size: .75rem; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; }
.hb-admin-split tbody th { padding-left: 0; color: var(--text); font-size: .875rem; font-weight: 600; letter-spacing: 0; text-align: left; text-transform: none; white-space: normal; }

/* Trial Reels: each reel is a row with its page's picture; the Instagram link is its own line, so it never gets cut off */
.hb-trial-rows { margin: 0; }
.hb-trial-row { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-2) 0; }
.hb-trial-row + .hb-trial-row { border-top: 1px solid var(--border); }
.hb-trial-row .avatar { flex: none; width: 32px; height: 32px; font-size: .8125rem; }
.hb-trial-open { align-self: flex-start; font-size: .8125rem; font-weight: 600; }

/* Users */
.hb-users-roles { display: flex; flex-direction: column; margin: 0 0 var(--sp-3); padding: 0; list-style: none; }
.hb-users-roles li { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); padding: 6px 0; border-top: 1px solid var(--border); }
.hb-users-roles li:first-child { border-top: 0; }
.hb-users-role { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-users-n { font-variant-numeric: tabular-nums; }
.hb-users-notes { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin: auto 0 0; }
.hb-users-notes a.badge:hover { text-decoration: none; filter: brightness(.95); }

/* Leaderboard events: the multiplier stays whole beside a name that can be cut */
[data-block="leaderboard_events"] .home-row .lb-mult { flex: none; }
[data-block="leaderboard_events"] .home-row > .home-dot { margin-right: calc(-1 * var(--sp-1)); }

@media (max-width: 1099.98px) {
  .hb-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .hb-s, .hb-m { grid-column: span 3; }
  .hb-l, .hb-f { grid-column: span 6; }
}
@media (max-width: 640px) {
  .hb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
  .hb-grid > * { grid-column: span 2; }
  .hb-grid > .hb-compact { grid-column: span 1; }
  .home-stat .pt-stat-value { font-size: 1.375rem; }
  .home-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
  .home-tile { flex-direction: column; align-items: flex-start; gap: var(--sp-2); padding: var(--sp-3); }
  .home-tile-sub { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .hb-add { padding: var(--sp-4); }
  .hb-catalog { grid-template-columns: minmax(0, 1fr); }
  .hb-tools-name { display: none; }
}

/* signed out (login, set password): the logo centered too, the theme toggle at the right */
.topbar-inner { position: relative; justify-content: center; }
.topbar-inner .topbar-spacer { display: none; }
.topbar-inner .theme-toggle { position: absolute; right: var(--sp-4); }

/* Phones: a page title that just repeats the top bar's (Batches, Calendar, ...) is hidden; desktop keeps it, since its
   bar doesn't change from page to page */
@media (max-width: 899.98px) {
  .has-shell h1.bar-title { display: none; }
  .has-shell .page-head > div:has(> h1.bar-title:only-child) { display: none; }
  .has-shell .page-head:has(> div > h1.bar-title:only-child):not(:has(> :nth-child(2))) { display: none; }  /* nothing else in it: no gap either */
}

/* ---- Ads (/ads; it was Promotions): each running campaign, its content as tiles with "Use this" ---- */
.promo-card { scroll-margin-top: 80px; }
.promo-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3) var(--sp-5); flex-wrap: wrap; }
.promo-head-main { flex: 1 1 320px; min-width: 0; }
.promo-brand { margin: 0 0 2px; color: var(--accent); font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; overflow-wrap: anywhere; }
.promo-name { margin: 0; font-size: 1.25rem; overflow-wrap: anywhere; }
.promo-flags { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2); margin: var(--sp-2) 0 0; }
.promo-when { color: var(--text-muted); font-size: .8125rem; font-weight: 550; }
.promo-progress { flex: 0 1 240px; min-width: 200px; }
.promo-count { margin: 0 0 6px; text-align: right; color: var(--text-muted); font-size: .875rem; font-variant-numeric: tabular-nums; }
.promo-count strong { color: var(--text); font-size: 1.125rem; }
.promo-progress .vt-bar { height: 7px; }
.promo-brief {
  margin: var(--sp-4) 0 0; padding: var(--sp-3) var(--sp-4); border-radius: var(--radius); background: var(--surface-2);
  border-left: 3px solid var(--accent); white-space: pre-line; overflow-wrap: anywhere; font-size: .9375rem;
}
.promo-facts { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--sp-4) var(--sp-6); margin-top: var(--sp-4); }
.promo-label { margin: 0 0 var(--sp-2); font-size: .75rem; font-weight: 700; color: var(--text-muted); letter-spacing: .05em; text-transform: uppercase; }
.promo-label .muted { font-weight: 600; letter-spacing: 0; text-transform: none; }
.promo-caption-text { margin: 0; white-space: pre-line; overflow-wrap: anywhere; font-size: .9375rem; }
.promo-more { margin-top: var(--sp-1); font-size: .8125rem; }
.promo-caption-how { margin: var(--sp-1) 0 0; }
.promo-more summary { cursor: pointer; color: var(--accent); font-weight: 600; width: fit-content; }
.promo-caption-full {
  margin: var(--sp-2) 0 0; padding: var(--sp-2) var(--sp-3); border-radius: var(--radius); background: var(--surface-2);
  white-space: pre-line; overflow-wrap: anywhere; font-size: .875rem; color: var(--text);
}
.promo-page-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.promo-page-chips .page-chip { cursor: default; }
.promo-content-label { margin-top: var(--sp-5); }
.promo-no-items { margin: 0; }
.promo-grid { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); }
/* The Ads and Clipping pages: a campaign's content as a strip two rows deep (one on a phone; the owner's choices of
   2026-11-11), in order down each column, scrolling sideways (app.js initStrip): snapping to its columns, its arrows at
   its ends (hidden there), its cut-off side fading out. The page never scrolls sideways: the
   strip does. "Use this" opens inside its tile, so the strip never cuts it off. A look sets its column's width with
   --strip-col. */
.promo-strip { position: relative; min-width: 0; }
.promo-grid.promo-strip-track {
  --strip-col: 240px;  /* (a page's handle and its state fit on one line) */
  grid-template-columns: none; grid-template-rows: repeat(2, auto); grid-auto-flow: column; grid-auto-columns: var(--strip-col);
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scroll-snap-type: x mandatory;
  scroll-padding-inline: 4px; padding: 4px 4px 10px; scrollbar-width: thin;
}
.promo-grid.promo-strip-track > .promo-tile { scroll-snap-align: start; }
.promo-strip-track:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.promo-strip-track.strip-fade-end {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
}
.promo-strip-track.strip-fade-start {
  -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(to left, #000 calc(100% - 40px), transparent);
}
.promo-strip-track.strip-fade-start.strip-fade-end {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent);
}
.strip-arrow {
  position: absolute; top: 50%; z-index: 3; display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
  transform: translateY(-50%); border: 1px solid var(--border); border-radius: 50%; background: var(--surface);
  color: var(--text); box-shadow: 0 2px 10px rgba(0, 0, 0, .18); cursor: pointer;
}
.strip-arrow[hidden] { display: none; }
.strip-arrow.is-prev { left: 2px; }
.strip-arrow.is-next { right: 2px; }
.strip-arrow:hover { border-color: var(--accent); color: var(--accent); }
.strip-arrow:focus-visible { outline: none; box-shadow: var(--focus-ring); }
@media (max-width: 760px) {
  .promo-grid.promo-strip-track { grid-template-rows: auto; grid-auto-columns: 82%; }
  .strip-arrow { top: 112px; width: 34px; height: 34px; }  /* (over the picture, never a tile's text) */
}
.promo-tile {
  display: flex; flex-direction: column; min-width: 0; overflow: hidden; scroll-margin-top: 80px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.promo-tile:target { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.promo-thumb { position: relative; display: block; aspect-ratio: 4 / 5; overflow: hidden; background: var(--neutral-soft); color: var(--text-muted); }
.promo-thumb:hover { text-decoration: none; }
.promo-thumb img { position: absolute; inset: 0; z-index: 1; display: block; width: 100%; height: 100%; object-fit: cover; }
.promo-thumb-ph {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-2); font-size: .8125rem; font-weight: 650;
}
.promo-thumb.is-link .promo-thumb-ph { background: linear-gradient(160deg, var(--info-soft), var(--neutral-soft)); color: var(--info); }
.promo-kind {
  position: absolute; left: 6px; top: 6px; z-index: 2; display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px 2px 6px; border-radius: 999px; background: rgba(0, 0, 0, .68); color: #fff; font-size: .75rem; font-weight: 600;
}
.promo-tile-body { display: flex; flex-direction: column; gap: var(--sp-2); flex: 1; padding: var(--sp-3); }
.promo-tile-body > p { margin: 0; }
.promo-headline {
  font-weight: 650; font-size: .875rem; line-height: 1.35; overflow-wrap: anywhere; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical;
}
.promo-headline.is-ai { font-weight: 500; font-size: .8125rem; font-style: italic; }
.promo-states { list-style: none; margin: 0; padding: var(--sp-2) 0 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.promo-state { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); min-width: 0; }
.promo-state-page { display: inline-flex; align-items: center; gap: 6px; min-width: 0; font-size: .8125rem; font-weight: 600; }
.promo-state-handle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.promo-state .badge, .pr-page-state .badge { flex: none; height: 22px; gap: 3px; font-size: .75rem; }
.promo-state .avatar, .promo-use-page .avatar, .pr-page-state .avatar, .pr-page-check .avatar { width: 22px; height: 22px; font-size: .6875rem; }
a.badge:hover { text-decoration: none; box-shadow: inset 0 0 0 1px currentColor; }
.promo-use-one, .promo-use, .promo-done { margin-top: auto; }
.promo-use-on { font-weight: 500; opacity: .9; overflow: hidden; text-overflow: ellipsis; }
.promo-use-one .btn, .promo-use > summary { min-width: 0; }
.promo-done { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; margin-bottom: 0; color: var(--success); font-weight: 600; }
.promo-done.muted { color: var(--text-muted); }
.promo-use > summary { list-style: none; }
.promo-use > summary::-webkit-details-marker { display: none; }
.promo-use > summary .ico { transition: transform .15s ease; }
.promo-use[open] > summary .ico { transform: rotate(180deg); }
.promo-use-menu {
  margin-top: var(--sp-2); padding: var(--sp-2); border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2);
}
.promo-use-title { margin: 0 0 var(--sp-1); padding: 0 var(--sp-1); font-size: .75rem; font-weight: 700; color: var(--text-muted); letter-spacing: .05em; text-transform: uppercase; }
.promo-use-pages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.promo-use-pages form { margin: 0; }
.promo-use-page {
  display: flex; align-items: center; gap: var(--sp-2); width: 100%; min-height: 40px; padding: var(--sp-1) var(--sp-2);
  border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; font-size: .875rem;
  font-weight: 600; text-align: left; cursor: pointer;
}
.promo-use-page:hover { background: var(--accent-soft); color: var(--accent); }
.promo-use-page:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.promo-use-handle { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.promo-use-page > .ico { color: var(--text-muted); flex: none; }
.promo-empty-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; margin-bottom: var(--sp-3); border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.promo-empty .btn { margin-top: var(--sp-2); }
.promo-tpl-note, .promo-trial-off { margin: var(--sp-2) 0 0; }
/* a campaign's post: its required text under the caption box, locked (always added below the caption) */
.required-text { margin-top: var(--sp-2); padding: var(--sp-2) var(--sp-3); border: 1px dashed var(--border-input); border-radius: var(--radius); background: var(--neutral-soft); color: var(--text); }
.required-text-head { display: flex; align-items: flex-start; gap: 6px; margin: 0 0 var(--sp-1); color: var(--text-muted); font-weight: 600; }
.required-text-head .ico { flex: none; margin-top: 3px; }
.required-text-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 14em; overflow-y: auto; }
.required-text-note { margin: var(--sp-1) 0 0; }
@media (max-width: 760px) {
  .promo-facts { grid-template-columns: minmax(0, 1fr); }
  .promo-progress { flex: 1 1 100%; min-width: 0; }
  .promo-count { text-align: left; }
}
@media (max-width: 560px) {
  .promo-card { padding: var(--sp-4); }
  .promo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
  .promo-tile-body { padding: var(--sp-2); }
  .promo-use-on { display: none; }  /* the button says which page in its label; too long for a phone's half-width tile */
  /* a half-width tile: the page's handle keeps its room and its state goes under it when they don't fit side by side */
  .promo-state { flex-wrap: wrap; row-gap: 2px; }
  .promo-state-page { flex: 1 0 auto; max-width: 100%; }
}

/* ---- Ad Admin (/admin/ads; it was Promotions Admin): the list, a campaign's form and its content ---- */
.pr-brand { color: var(--text-muted); font-weight: 600; font-size: .875rem; }
.pr-counts { color: var(--text-muted); }
.pr-warn { color: var(--warn); font-weight: 600; }
.pr-progress { display: flex; align-items: center; gap: var(--sp-3); max-width: 360px; margin-top: var(--sp-2); }
.pr-progress .vt-bar { flex: 1; }
.pr-progress-text { font-size: .8125rem; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pr-progress-text strong { color: var(--text); }
.pr-fieldset legend { margin-bottom: var(--sp-2); }
.pr-choices { display: grid; gap: var(--sp-2); grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.pr-choice { align-items: flex-start; padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.pr-choice input { margin-top: 2px; }
.pr-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pr-choice .sub, .pr-trial .sub { display: block; margin-top: 2px; font-size: .8125rem; font-weight: 400; color: var(--text-muted); }
.pr-trial { align-items: flex-start; width: fit-content; }
.pr-trial input { margin-top: 2px; }
.pr-dates-help, .pr-mode-help { margin: var(--sp-2) 0 0; }
.pr-pages { margin-top: var(--sp-5); }
.pr-pages .help { margin: 0 0 var(--sp-2); }
.pr-pages-tools { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2); margin-bottom: var(--sp-2); }
.pr-pages-tools[hidden] { display: none; }
.pr-section-name { margin: var(--sp-3) 0 var(--sp-2); font-size: .75rem; font-weight: 700; color: var(--text-muted); letter-spacing: .05em; text-transform: uppercase; }
.pr-checklist .check { gap: var(--sp-2); }
.pr-page-check > span { min-width: 0; overflow-wrap: anywhere; }
.pr-content { scroll-margin-top: 80px; }
.pr-add { display: grid; gap: var(--sp-3); grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.pr-add > .card { margin: 0; padding: var(--sp-4); }
.pr-add-title { display: flex; align-items: center; gap: var(--sp-2); margin: 0 0 var(--sp-1); }
.pr-add-card > p { margin-bottom: var(--sp-3); }
.pr-pick { position: relative; cursor: pointer; }
.pr-pick:has(input:focus-visible) { box-shadow: var(--focus-ring); }
.pr-separate { margin-top: var(--sp-3); font-size: .875rem; }
.field > label.pr-links-label { font-weight: 400; }
.pr-add-card [hidden] { display: none !important; }  /* the upload's list, Cancel and progress until they're needed */
.pr-link-errors { margin: var(--sp-1) 0 0; padding-left: var(--sp-4); }
.pr-files { list-style: none; margin: var(--sp-3) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.pr-file {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px var(--sp-2);
  padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.pr-file.is-cover { border-color: var(--accent); }
.pr-file.is-error { border-color: var(--danger); }
.pr-file.is-done { border-color: color-mix(in srgb, var(--success) 50%, var(--border)); }
.pr-file-main { display: flex; flex-direction: column; min-width: 0; }
.pr-file-name { font-size: .875rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-file-meta { font-size: .75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pr-file-actions { display: flex; gap: 2px; }
.pr-file-btn { width: 32px; padding: 0; }
.pr-file-bar { grid-column: 1 / -1; height: 4px; border-radius: 999px; background: var(--neutral-soft); overflow: hidden; }
.pr-file-bar > span { display: block; width: 0; height: 100%; background: var(--accent); transition: width .2s; }
.pr-file.is-done .pr-file-bar > span { background: var(--success); }
.pr-file-error { grid-column: 1 / -1; color: var(--danger); font-size: .8125rem; font-weight: 600; }
.pr-upload-count { margin: var(--sp-2) 0 0; }
.pr-upload-count.is-over { color: var(--danger); font-weight: 600; }
.pr-upload-foot { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }
.pr-upload-status:not(:empty) { margin-top: var(--sp-3); }
.pr-upload-status .flash { margin: 0; }
.pr-items { list-style: none; margin: var(--sp-4) 0 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.pr-items > .card { margin: 0; }
.pr-item { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: var(--sp-4); padding: var(--sp-4); scroll-margin-top: 80px; }
.pr-item:target { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.pr-item-thumb { border-radius: var(--radius); align-self: start; }
.pr-item-main { min-width: 0; }
.pr-item-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); flex-wrap: wrap; }
.pr-item-title { display: flex; align-items: center; gap: var(--sp-2); margin: 0; font-weight: 650; }
.pr-item-num {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--neutral-soft);
  color: var(--text-muted); font-size: .75rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.pr-item-actions { gap: 2px; }
.pr-item-name { margin: var(--sp-1) 0 var(--sp-3); color: var(--text-muted); overflow-wrap: anywhere; }
.pr-item-form { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--sp-3); align-items: start; }
.pr-item-form textarea { min-height: 72px; }
.pr-item-form > p, .pr-item-form > .error { margin: 0; align-self: center; }
.pr-item-save { grid-column: 1 / -1; }
.pr-item-pages { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--border); }
.pr-label { margin: 0 0 var(--sp-2); font-size: .8125rem; font-weight: 650; }
.pr-label .muted { font-weight: 500; }
.pr-page-states { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.pr-page-state {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 4px; border: 1px solid var(--border);
  border-radius: 999px; font-size: .8125rem; font-weight: 600;
}
.pr-page-handle { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-items-empty { margin-top: var(--sp-4); }
@media (max-width: 1000px) { .pr-add { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .pr-item { grid-template-columns: 84px minmax(0, 1fr); gap: var(--sp-3); padding: var(--sp-3); }
  .pr-item-form { grid-template-columns: minmax(0, 1fr); }
  .pr-item-head { align-items: flex-start; }
  .pr-progress { max-width: none; }
}

/* ---- An Ad's money (Ad Admin and the admin's Home, admins only: app.promotions.terms) ---- */
/* An Ad that needs a follow-up (its renewal close or past, its invoice overdue) glows red: its row on the list, the
   alert at the top of its page, its payments and the Ads on Home. The glow breathes, unless motion is reduced. */
.adt-alert.is-due, .adt-summary.is-due, .adt-cycle.is-due, .adt-home-rows {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger), 0 0 18px 2px color-mix(in srgb, var(--danger) 38%, transparent);
  animation: adt-glow 2.4s ease-in-out infinite alternate;
}
@keyframes adt-glow {
  from { box-shadow: 0 0 0 1px var(--danger), 0 0 8px 0 color-mix(in srgb, var(--danger) 22%, transparent); }
  to { box-shadow: 0 0 0 1px var(--danger), 0 0 22px 4px color-mix(in srgb, var(--danger) 45%, transparent); }
}
.pr-list > .lb-admin-row.adt-due {
  background: color-mix(in srgb, var(--danger-soft) 70%, var(--surface));
  box-shadow: inset 4px 0 0 var(--danger), inset 0 0 26px color-mix(in srgb, var(--danger) 24%, transparent);
}
@media (prefers-reduced-motion: reduce) {
  .adt-alert.is-due, .adt-summary.is-due, .adt-cycle.is-due, .adt-home-rows { animation: none; }
}
.adt-reminder { display: flex; align-items: flex-start; gap: 6px; margin: var(--sp-2) 0 0; color: var(--danger); font-size: .875rem; font-weight: 650; }
.adt-reminder .ico { flex: none; margin-top: 2px; }
.lb-admin-main .adt-reminder { margin-top: var(--sp-2); }
.adt-alert {
  display: flex; align-items: flex-start; flex-wrap: wrap; gap: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-5);
  padding: var(--sp-4) var(--sp-5); background: color-mix(in srgb, var(--danger-soft) 60%, var(--surface));
}
.adt-alert-ico { display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--danger); color: var(--surface); }
.adt-alert-main { flex: 1 1 260px; min-width: 0; }
.adt-alert-main p { margin: 0; overflow-wrap: anywhere; }
.adt-alert-title { margin-bottom: 2px; font-weight: 700; color: var(--danger); }
.adt-alert-actions { flex: 0 1 auto; min-width: 0; align-self: center; }
.adt-due-list { margin: var(--sp-1) 0 0; padding-left: var(--sp-4); font-size: .875rem; overflow-wrap: anywhere; }
.adt-due-list li + li { margin-top: 2px; }
.adt-due-list a { font-weight: 650; }
/* the list: each Ad's status, client, this cycle's money and renewal under its progress */
.adt-row-terms { display: flex; align-items: center; flex-wrap: wrap; gap: 2px var(--sp-2); margin-top: var(--sp-2) !important; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.adt-row-terms > span:not(.badge) + span:not(.badge)::before { content: "·"; margin-right: var(--sp-2); }
.adt-row-client { color: var(--text); font-weight: 600; }
/* the payment terms, in the Ad's form */
.adt-terms { margin-top: var(--sp-5); padding-top: var(--sp-5); border-top: 1px solid var(--border); }
.adt-terms > legend { display: flex; align-items: center; gap: 6px; float: left; width: 100%; margin-bottom: var(--sp-1); font-size: 1rem; font-weight: 650; }
.adt-terms > legend + .help { clear: both; margin: 0 0 var(--sp-3); }
:where(.adt-terms, .adt-pay) input[type=date] {
  width: 100%; height: 40px; padding: 0 var(--sp-3); font: inherit; font-size: .9375rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-input); border-radius: var(--radius);
}
.field.has-error input[type=date] { border-color: var(--danger); }
.adt-money { position: relative; display: block; }
.adt-money-sign { position: absolute; left: var(--sp-3); top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: .9375rem; pointer-events: none; }
.adt-money > input[type=text] { padding-left: calc(var(--sp-3) + 12px); font-variant-numeric: tabular-nums; }
.adt-kinds legend { margin-bottom: 6px; }
.adt-seg { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.adt-seg-opt {
  display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 40px; padding: 0 var(--sp-3);
  border: 1px solid var(--border-input); border-radius: var(--radius); background: var(--surface); font-size: .875rem; font-weight: 600; cursor: pointer;
}
.adt-seg-opt input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.adt-seg-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.adt-seg-opt:has(input:focus-visible) { box-shadow: var(--focus-ring); }
.adt-status-line { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2); margin: var(--sp-4) 0 0; }
.adt-status-label { font-weight: 600; font-size: .875rem; }
/* the payments, on the Ad's page */
.adt-pay { scroll-margin-top: 80px; }
.adt-summary { padding: var(--sp-4) var(--sp-5); }
.adt-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-3) var(--sp-4); margin: 0; }
.adt-facts > div { min-width: 0; }
.adt-facts dt { font-size: .75rem; font-weight: 650; color: var(--text-muted); letter-spacing: .05em; text-transform: uppercase; }
.adt-facts dd { margin: 2px 0 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.adt-summary .adt-reminder { margin-top: var(--sp-3); }
.adt-cycle-note { margin: var(--sp-2) 0 0; }
.adt-pay-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--sp-3); align-items: start; margin-top: var(--sp-3); }
.adt-pay-grid > .card { margin: 0; padding: var(--sp-4); scroll-margin-top: 80px; }
.adt-pay-grid > .card > p { margin-bottom: var(--sp-3); }
.adt-gap { margin-top: var(--sp-4); }
.adt-cycle-error { display: block; margin-top: var(--sp-2); color: var(--danger); font-size: .8125rem; font-weight: 600; }
.adt-history, .adt-history-empty { margin-top: var(--sp-3); }
.adt-history-empty { padding: var(--sp-5); }
.adt-history-empty p { margin: 0; }
.adt-history td { font-variant-numeric: tabular-nums; }
.adt-note { max-width: 280px; overflow-wrap: anywhere; }
/* Home's Ads to follow up block (admins) */
.adt-home { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.adt-home-rows.home-rows { margin: 0; }
.adt-home-rows .home-row { border-radius: 0; }
.adt-home-rows li + li { border-top: 1px solid var(--border); }
.adt-home-title { display: flex; align-items: center; gap: var(--sp-2); margin: 0 0 var(--sp-2); font-size: 1rem; }
.adt-home-rows { overflow: hidden; }
.adt-home-rows .home-row-main { display: flex; flex-direction: column; align-items: stretch; flex: 1; gap: 0; min-width: 0; }  /* in every look */
.adt-home-rows .home-row-meta { flex: 0 1 auto; white-space: normal; }
.adt-home-ico { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--danger-soft); color: var(--danger); }
.adt-home-badge { flex: none; }
.adt-home-more { margin-top: var(--sp-2); padding: 0; border: 0; }
.adt-tile .adt-home { margin: 0; }
@media (max-width: 900px) { .adt-pay-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .adt-alert { padding: var(--sp-4); }
  .adt-alert-actions { flex-basis: 100%; }  /* the buttons on their own row, wrapping */
  .adt-summary { padding: var(--sp-4); }
  .adt-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adt-note { max-width: none; }
  .adt-row-terms { column-gap: var(--sp-3); }
  .adt-row-terms > span:not(.badge) + span:not(.badge)::before { content: none; }  /* a wrapped line never starts with · */
  .adt-home-badge { display: none; }  /* the reminder under the name says it */
}

/* --- SocialTools: a customer's Plan & billing (billing.html), the upgrade page, and the admins' Customers page --- */
.bill-current, .bill-none { margin-bottom: var(--sp-5); }
.bill-current-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-4); }
.bill-current-head h2 { margin: 0; }
.bill-kicker { margin: 0 0 2px; font-size: .8125rem; font-weight: 600; color: var(--text-muted); }
.bill-price { font-size: 1rem; font-weight: 600; color: var(--text-muted); }
.bill-usage { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4) var(--sp-6); margin-bottom: var(--sp-3); }
.bill-meter { display: flex; flex-direction: column; gap: var(--sp-2); }
.bill-meter-top { display: flex; justify-content: space-between; gap: var(--sp-2); font-size: .9375rem; }
.bill-meter-top strong { font-variant-numeric: tabular-nums; }
.bill-meter .vt-bar { height: 8px; }
.bill-dev { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-3); }
.bill-none h2 { margin: 0 0 var(--sp-1); }
.bill-none p { margin: 0; }
.bill-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--sp-4); margin-bottom: var(--sp-3); }
.bill-plan { display: flex; flex-direction: column; gap: var(--sp-2); }
.bill-plan h3 { margin: 0; }
.bill-plan p { margin: 0; }
.bill-plan.is-chosen { border-color: var(--accent); box-shadow: var(--focus-ring); }
.bill-plan.is-mine { border-color: var(--success); }
.bill-plan-price strong { font-size: 1.75rem; font-weight: 750; letter-spacing: -0.02em; }
.bill-plan-buy { display: flex; flex-direction: column; gap: var(--sp-2); }  /* monthly, yearly (the panel's Plans) */
.bill-plan-list { list-style: none; margin: var(--sp-2) 0; padding: 0; display: flex; flex-direction: column; gap: 6px; flex: 1; font-size: .9375rem; }
.bill-plan-list li { padding-left: 20px; position: relative; }
.bill-plan-list li::before { content: ""; position: absolute; left: 2px; top: .45em; width: 9px; height: 5px; border-left: 2px solid var(--success); border-bottom: 2px solid var(--success); transform: rotate(-45deg); }
.bill-credits { margin-bottom: var(--sp-5); scroll-margin-top: var(--sp-6); }
.bill-credits-note { margin: 0; }
.bill-topups { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); margin: var(--sp-2) 0 var(--sp-3); }
.bill-topups form { margin: 0; }
/* SocialTools: paying in crypto (billing.html's #crypto, billing_crypto.html; app.billing.crypto) */
.bill-crypto { margin-bottom: var(--sp-5); scroll-margin-top: var(--sp-6); }
.crypto-list { list-style: none; margin: 0 0 var(--sp-3); padding: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.crypto-list li { display: flex; align-items: flex-start; gap: var(--sp-2); font-size: .9375rem; }
.crypto-list .badge { flex: none; }
.crypto-renew { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-2); }
.crypto-pick, .crypto-send { display: flex; flex-direction: column; gap: var(--sp-4); margin-bottom: var(--sp-5); }
.crypto-pick fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.crypto-pick legend { margin-bottom: 6px; }
.crypto-send .bill-kicker { margin: 0; }
.crypto-amount { margin: 0; font-size: 1.125rem; font-weight: 600; }
.crypto-amount strong { font-size: 1.5rem; font-weight: 750; letter-spacing: -0.01em; }
.crypto-rules { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 4px; font-size: .9375rem; }
.crypto-sent { display: flex; flex-direction: column; gap: var(--sp-3); border-top: 1px solid var(--border); padding-top: var(--sp-4); }
.crypto-sent h3 { margin: 0; font-size: 1rem; }
.crypto-sent .btn-primary { align-self: flex-start; }
.crypto-sent p { margin: 0; }
/* card payments switched off on the panel: shown greyed out, as coming soon (.btn[disabled] greys it) */
.bill-soon { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); }
.bill-soon-tag { font-size: .6875rem; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; padding: 2px 8px;
  border-radius: 999px; background: var(--surface-2); color: var(--text-muted); }
.upgrade-card { max-width: 560px; margin: var(--sp-6) auto; }
.upgrade-actions { justify-content: center; }
.cust-search { flex: 0 1 360px; }
.cust-table td { vertical-align: top; }
.cust-email { font-weight: 600; word-break: break-all; }
.cust-plan { display: flex; gap: var(--sp-2); align-items: center; margin-bottom: var(--sp-2); }
.cust-plan select { min-width: 0; }
.card-pad { padding: var(--sp-4) var(--sp-4) 0; margin: 0; }
form.inline { display: inline; margin: 0; }
@media (max-width: 640px) {
  .bill-usage { grid-template-columns: 1fr; }
}
/* All Posts' summary for a customer (platform/_all_posts_tracker.html): the Post Tracker's tiles and quota card, then the list */
.ap-tracker { margin-bottom: var(--sp-6); }
.ap-tracker .vt-section { margin-top: var(--sp-5); }

/* ---- Rules (/admin/rules, admins): a switch per role for each page and action (admin/_rules_form.html) ----
   All roles: a card per area, a table with a column per role (on phones each row is a card: the name, then the six
   roles' switches three to a row, each with its role's name). One role: what it can do and what it can't, side by
   side (stacked on phones). A switch is the role's own checkbox over a drawn track; a dot marks one changed from the
   default; a locked one is a lock with On or Off. */
.rules-roles { margin: 0 0 var(--sp-4); flex-wrap: wrap; overflow: visible; }
.rules-chip-count { margin-left: var(--sp-2); font-size: .75rem; font-weight: 600; font-variant-numeric: tabular-nums; opacity: .75; }
.rules-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2) var(--sp-4); flex-wrap: wrap; margin: 0 0 var(--sp-3); }
.rules-bar .rules-status { margin-right: auto; }
.rules-reset { margin: 0; }
.rules-legend { display: inline-flex; align-items: center; gap: var(--sp-2); margin: 0; flex-wrap: wrap; }
.rules-legend .ico { vertical-align: -2px; }
.rules-status { margin: 0; min-height: 1.5em; font-size: .875rem; font-weight: 600; color: var(--success); display: inline-flex; align-items: center; gap: var(--sp-1); }
.rules-status:empty { display: none; }
.rules-form .card + .card { margin-top: var(--sp-4); }
.rules-area { padding: var(--sp-4) 0 0; overflow: hidden; }
.rules-area > h2 { margin: 0 var(--sp-5) var(--sp-3); font-size: 1.0625rem; }
.rules-table { table-layout: fixed; }
.rules-table th.rules-name-col { width: 34%; }
.rules-table th.rules-col { text-align: center; white-space: normal; line-height: 1.25; padding-left: var(--sp-1); padding-right: var(--sp-1); }
.rules-table th.rules-col a { color: inherit; }
.rules-table th.rules-name {
  text-transform: none; letter-spacing: 0; font-size: inherit; font-weight: 400; color: var(--text); background: none;
  white-space: normal; vertical-align: top;
}
.rules-table td.rules-cell { text-align: center; padding-left: var(--sp-1); padding-right: var(--sp-1); }
.rules-table tbody tr:hover td, .rules-table tbody tr:hover th { background: var(--surface-2); }
.rules-label { display: block; font-weight: 650; color: var(--text); }
.rules-help { display: block; color: var(--text-muted); font-size: .8125rem; line-height: 1.35; margin-top: 2px; }
.rules-note { display: flex; align-items: center; gap: var(--sp-1); color: var(--text-muted); font-size: .75rem; line-height: 1.35; margin-top: var(--sp-1); }
.rules-note.is-needs { color: var(--warn); font-weight: 600; }
.rules-note .ico { flex: none; }

.rule-switch { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; cursor: pointer; vertical-align: middle; }
.rule-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; z-index: 1; }
.rule-track { position: relative; display: block; width: 38px; height: 22px; border-radius: 999px; background: var(--neutral-soft); border: 1px solid var(--border-input); transition: background .15s ease, border-color .15s ease; }
.rule-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s ease;
}
.rule-switch input:checked + .rule-track { background: var(--success); border-color: var(--success); }
.rule-switch input:checked + .rule-track::after { transform: translateX(16px); }
.rule-switch input:focus-visible + .rule-track { box-shadow: var(--focus-ring); }
.rule-switch:hover input:not(:disabled) + .rule-track { border-color: var(--text-muted); }
.rule-switch.is-blocked { cursor: not-allowed; opacity: .45; }
.rule-switch.is-changed::after {
  content: ""; position: absolute; top: 6px; right: 0; width: 8px; height: 8px; border-radius: 50%;
  background: var(--warn); box-shadow: 0 0 0 2px var(--surface); pointer-events: none;
}
.rules-key.is-changed { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.rule-lock { display: inline-flex; align-items: center; gap: 3px; min-height: 44px; color: var(--text-muted); font-size: .75rem; font-weight: 650; }
.rule-lock.is-on { color: var(--success); }
@media (prefers-reduced-motion: reduce) { .rule-track, .rule-track::after { transition: none; } }

.rules-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); align-items: start; }
.rules-split .card + .card { margin-top: 0; }
.rules-side .card-head h2 { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: 1.0625rem; }
.rules-side.is-can .card-head .ico { color: var(--success); }
.rules-side.is-cannot .card-head .ico { color: var(--text-muted); }
.rules-side-area { margin: var(--sp-4) 0 var(--sp-1); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.rules-side-area:first-of-type { margin-top: 0; }
.rules-items { list-style: none; margin: 0; padding: 0; }
.rules-item { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-2) 0; }
.rules-item + .rules-item { border-top: 1px solid var(--border); }
.rules-about { min-width: 0; }
.rules-save { margin-top: var(--sp-4); }

@media (max-width: 900px) { .rules-split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 720px) {
  .rules-area { padding-top: var(--sp-3); }
  .rules-area > h2 { margin: 0 var(--sp-4) var(--sp-2); }
  .rules-table, .rules-table tbody { display: block; }
  .rules-table thead { display: none; }
  .rules-table tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); }
  .rules-table th.rules-name { grid-column: 1 / -1; padding: 0 0 var(--sp-2); border: 0; }
  .rules-table td.rules-cell { display: flex; flex-direction: column; align-items: center; gap: 0; padding: var(--sp-1) 0 0; border: 0; }
  .rules-table td.rules-cell::before { content: attr(data-role); color: var(--text-muted); font-size: .6875rem; font-weight: 650; text-align: center; line-height: 1.2; }
  .rules-table tbody tr:hover td, .rules-table tbody tr:hover th { background: none; }
  .rule-switch, .rule-lock { min-height: 40px; height: 40px; }
}

/* --- SocialTools: the platform's clipping campaigns (platform/clipping.html, _campaign_card.html, earnings.html) --- */
.cc-section-title { display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-6) 0 var(--sp-3); font-size: 1.0625rem; }
.cc-section-title:first-of-type { margin-top: var(--sp-2); }
.cc-section-title .muted { font-weight: 500; }
.cc-card.is-mine { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cc-card + .cc-card { margin-top: var(--sp-4); }
.cc-limits { display: flex; flex-direction: column; gap: 2px; }
.cc-limits .promo-count + .vt-bar { margin-bottom: var(--sp-2); }
.cc-mine { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: var(--sp-2); margin: var(--sp-4) 0 0; padding: var(--sp-3) var(--sp-4); border-radius: var(--radius); background: var(--accent-soft); }
.cc-mine div { min-width: 0; }
.cc-mine dt { font-size: .75rem; font-weight: 650; color: var(--text-muted); }
.cc-mine dd { margin: 0; font-size: 1.125rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.cc-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: .9375rem; overflow-wrap: anywhere; }
.cc-post-menu { display: flex; flex-direction: column; gap: var(--sp-2); margin: var(--sp-2) 0 0; }
.cc-post-menu select { width: 100%; min-width: 0; }
.cc-post-menu .btn { justify-content: center; }
.cc-totals { margin-bottom: var(--sp-4); }
.cc-section { margin-top: var(--sp-4); scroll-margin-top: 80px; }
.cc-table tr.is-active td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.cc-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .875em; word-break: break-all; }
.cc-payout-form { display: grid; grid-template-columns: minmax(150px, 200px) minmax(0, 1fr) auto; gap: var(--sp-3); align-items: start; margin-top: var(--sp-3); }
.cc-payout-save { padding-top: 26px; }
.cc-saved { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: var(--sp-3) 0 0; color: var(--success); }
@media (max-width: 720px) {
  .cc-payout-form { grid-template-columns: minmax(0, 1fr); }
  .cc-payout-save { padding-top: 0; }
  .cc-payout-save .btn { width: 100%; }
}

/* ---- Activity log (a user's screen, /admin/users/<id>, admins only: admin/_activity.html, app.activity) ---- */
.activity { margin-top: var(--sp-5); }
.activity-head { align-items: flex-end; }
.activity-dates { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--sp-2); margin-left: auto; }
.activity-dates .field { flex: none; }
.activity-dates input[type="date"] {
  width: 10.5rem; height: 36px; padding: 0 var(--sp-2); font: inherit; font-size: .875rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-input); border-radius: var(--radius);
}
.activity-dates .btn { height: 36px; }
.activity-chips { flex-wrap: wrap; margin-bottom: var(--sp-2); }
.activity-since { margin: 0 0 var(--sp-4); }
.activity-upcoming { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4); }
.activity-upcoming h3 { margin: 0 0 var(--sp-2); font-size: .875rem; }
.activity-upcoming ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); max-height: 13rem; overflow-y: auto; overscroll-behavior: contain; }
.activity-upcoming li { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2); overflow-wrap: anywhere; }
/* a medium-sized box that scrolls on its own (the owner's pick): the page stays the same length, "Load more" is at its
   bottom and adds the next entries inside it */
.activity-list {
  list-style: none; margin: 0; padding: var(--sp-3) var(--sp-4) var(--sp-4);
  max-height: min(36rem, 70vh); overflow-y: auto; overscroll-behavior: contain;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.activity-day h3 { margin: var(--sp-5) 0 var(--sp-1); color: var(--text-muted); font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; }
.activity-day:first-child h3 { margin-top: 0; }
.activity-item { display: grid; grid-template-columns: 5.25rem minmax(0, 1fr); gap: var(--sp-3); padding: var(--sp-2) 0; border-top: 1px solid var(--border); }
.activity-day + .activity-item { border-top: 0; }
.activity-time { padding-top: 2px; color: var(--text-muted); font-size: .8125rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.activity-main { min-width: 0; }
.activity-text { margin: 0; overflow-wrap: anywhere; }
.activity-cat {
  display: inline-block; margin-right: var(--sp-1); padding: 0 6px; border-radius: 4px; vertical-align: 1px;
  background: var(--neutral-soft); color: var(--text-muted); font-size: .6875rem; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
}
.activity-posts .activity-cat { background: var(--success-soft); color: var(--success); }
.activity-submitted .activity-cat { background: var(--info-soft); color: var(--info); }
.activity-pages .activity-cat { background: var(--accent-soft); color: var(--accent); }
.activity-passwords .activity-cat { background: var(--warn-soft); color: var(--warn); }
.activity-account .activity-cat { background: var(--sched-soft); color: var(--sched); }
.activity-link { margin-left: 2px; font-size: .8125rem; font-weight: 600; }
.activity-note { margin: 2px 0 0; color: var(--text-muted); font-size: .875rem; overflow-wrap: anywhere; }
.activity-start .activity-main { border-left: 3px solid var(--border-input); padding-left: var(--sp-3); }
.activity-more { padding-top: var(--sp-4); border-top: 1px solid var(--border); text-align: center; }
.activity-newest { margin: var(--sp-3) 0 0; text-align: center; }
@media (max-width: 640px) {
  .activity-item { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .activity-list { padding: var(--sp-2) var(--sp-3) var(--sp-3); }
  .activity-dates { width: 100%; margin-left: 0; }
  .activity-dates .field { flex: 1 1 8rem; }
  .activity-dates input[type="date"] { width: 100%; min-width: 0; }
}

/* a campaign's song on the Ads and Clipping pages (app.audio) */
.promo-sound { display: flex; align-items: flex-start; gap: var(--sp-2); margin: var(--sp-2) 0 0; }
.promo-sound .ico { flex: none; margin-top: 2px; }
.snd-field select { width: 100%; max-width: 32rem; }

/* a batch dialog's post with a sound from the library (app.audio) */
.snd-batch { height: auto; min-height: 22px; white-space: normal; max-width: 100%; }

/* Ad Admin / Clipping Admin: the pages and their posts (admin/_campaign_posts.html). The pages not picked sit in a
   slider; the picked ones are rows under it (each with its count of posts in the campaign) that open to their posts on
   Instagram, as small tiles, to tick into the campaign; "Ticked only" shows each open page's posts in it instead. */
.cp-area-label { margin: var(--sp-3) 0 var(--sp-2); }
.cp-slider { display: flex; gap: var(--sp-2); overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding: 2px 2px var(--sp-2); }
.cp-slider .cp-page { flex: none; scroll-snap-align: start; }
.cp-slider .cp-open, .cp-slider .cp-body { display: none; }
.cp-slider .cp-empty { align-self: center; margin: 0; padding: var(--sp-2) 0; }
.cp-chip { display: flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); min-height: 48px; cursor: pointer; }
.cp-chip-face { display: contents; }
.cp-chip .sub, .cp-open-name .sub { display: block; font-size: .8125rem; color: var(--text-muted); font-weight: 400; }
.cp-chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.cp-slider .cp-chip { max-width: 260px; white-space: nowrap; }
.cp-slider .cp-chip-face > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cp-picked-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-1) var(--sp-3); margin: var(--sp-3) 0 var(--sp-2); }
.cp-picked-head .cp-area-label { margin: 0; }
.cp-only { margin: 0; }
.cp-picked { display: grid; gap: var(--sp-2); }
.cp-picked > .cp-empty { margin: 0; }
.cp-picked .cp-page { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.cp-page-head { display: flex; align-items: stretch; min-width: 0; }
.cp-picked .cp-chip { flex: none; min-height: 0; padding: 0 0 0 var(--sp-3); border: 0; background: none; }
.cp-picked .cp-chip:has(input:checked) { background: none; }
.cp-picked .cp-chip-face { display: none; }
.cp-open { flex: 1; display: flex; align-items: center; gap: var(--sp-2); min-width: 0; min-height: 54px; padding: var(--sp-2) var(--sp-3); border: 0; border-radius: var(--radius-lg); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.cp-open:hover { background: var(--surface-2); }
.cp-open:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.cp-open-face { flex: 1; display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.cp-open-name { min-width: 0; overflow: hidden; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.cp-open-name .sub { overflow: hidden; text-overflow: ellipsis; }
.cp-count { flex: none; padding: 1px 9px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .75rem; font-weight: 700; line-height: 1.6; white-space: nowrap; }
.cp-count.is-zero { background: none; color: var(--text-muted); font-weight: 500; }
.cp-chev { flex: none; display: grid; color: var(--text-muted); transition: transform .15s ease; }
.cp-page.is-open .cp-chev { transform: rotate(180deg); }
.cp-body { padding: 0 var(--sp-3) var(--sp-3); }
.cp-posts { min-width: 0; }
.cp-posts-ticked, .is-ticked-only .cp-body > .cp-posts { display: none; }
.is-ticked-only .cp-body > .cp-posts-ticked { display: block; }
.cp-grid { display: grid; gap: var(--sp-2); grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.cp-post { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cp-post.is-ticked { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cp-post-link { display: block; color: inherit; }
.cp-post-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cp-cover { position: relative; display: block; aspect-ratio: 4 / 5; background: var(--surface-2); overflow: hidden; }
.cp-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cp-cover-ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-muted); }
.cp-kind, .cp-views { position: absolute; left: 5px; max-width: calc(100% - 10px); padding: 1px 7px; border-radius: 999px; background: rgba(0, 0, 0, .62); color: #fff; font-size: .6875rem; font-weight: 700; line-height: 1.6; white-space: nowrap; }
.cp-kind { top: 5px; max-width: calc(100% - 36px); overflow: hidden; text-overflow: ellipsis; }  /* (clear of the tick) */
.cp-views { bottom: 5px; display: inline-flex; align-items: center; gap: 3px; }
.cp-in { position: absolute; top: 5px; right: 5px; display: none; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 2px rgba(0, 0, 0, .25); }
.cp-post.is-ticked .cp-in { display: grid; }
.cp-cap { position: absolute; inset: auto 0 0; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; padding: 24px 7px 7px; background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, .85) 28px); color: #fff; font-size: .75rem; line-height: 1.35; overflow-wrap: anywhere; opacity: 0; pointer-events: none; transition: opacity .15s ease; }
@media (hover: hover) {
  .cp-post-link:hover .cp-cap, .cp-post-link:focus-visible .cp-cap { opacity: 1; }
}
.cp-post-body { display: flex; flex: 1; flex-direction: column; gap: 6px; min-width: 0; padding: 6px; }
.cp-post-meta, .cp-post-caption { margin: 0; }
.cp-post-meta { overflow: hidden; font-size: .75rem; white-space: nowrap; text-overflow: ellipsis; }
.cp-post-caption { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.cp-tick { width: 100%; margin-top: auto; justify-content: center; }
.cp-tick .cp-tick-on, .cp-post.is-ticked .cp-tick .cp-tick-off { display: none; }
.cp-post.is-ticked .cp-tick .cp-tick-on { display: inline; }
.cp-more { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 120px; border: 1px dashed var(--border-input); border-radius: var(--radius); background: transparent; color: var(--text-muted); font: inherit; font-weight: 600; cursor: pointer; }
.cp-more:hover { background: var(--surface-2); color: var(--text); }
.cp-more:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.cp-ticked { margin-top: var(--sp-4); }
.cp-ticked-title { margin: 0 0 var(--sp-1); font-size: 1rem; }
.cp-ticked-list { display: grid; gap: var(--sp-2); margin: var(--sp-2) 0 0; padding: var(--sp-2); list-style: none; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface-2); }
/* more than 3: they scroll inside the box (promotions_admin.js sets its height to 3 of them) */
.cp-ticked-list.is-capped { overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.cp-ticked-list:focus-visible { outline: none; box-shadow: var(--focus-ring); }
/* its arrow, on the box's bottom edge (a .strip-arrow): the next posts; at the end it points up, back to the top */
.cp-ticked-box { position: relative; }
.cp-ticked-box.is-capped { margin-bottom: 24px; }
.strip-arrow.cp-ticked-arrow { top: auto; bottom: -18px; left: 50%; width: 36px; height: 36px; transform: translateX(-50%); }
.cp-ticked-arrow > span { display: grid; place-items: center; }
.cp-ticked-arrow .cp-arrow-up, .cp-ticked-arrow.is-end .cp-arrow-down { display: none; }
.cp-ticked-arrow.is-end .cp-arrow-up { display: grid; }
.cp-ticked-item { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; padding: var(--sp-2); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.cp-cover.is-small { flex: none; width: 48px; border-radius: 6px; }
.cp-cover.is-small .cp-kind, .cp-cover.is-small .cp-in, .cp-cover.is-small .cp-views { display: none; }
.cp-ticked-body { flex: 1; min-width: 0; }
.cp-ticked-body p { margin: 0; }
.cp-error { display: flex; align-items: flex-start; gap: 6px; margin: 0; color: var(--danger); }
.cp-error .ico { flex: none; margin-top: 2px; }
.cp-loading, .cp-none { margin: 0; }
@media (max-width: 760px) {
  .cp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cp-body { padding: 0 var(--sp-2) var(--sp-2); }
  .cp-open { padding: var(--sp-2); }
  .cp-ticked-item { flex-wrap: wrap; }
}

/* Long Form Video Slicing (app.longform): Submit Reels' tab, a clipping campaign's section, a long video's page */
.long-intro { margin: 0 0 var(--sp-4); color: var(--text-muted); max-width: 46rem; }
.long-form .field { margin-bottom: 0; }
.long-or { display: flex; align-items: center; gap: var(--sp-3); margin: var(--sp-5) 0 var(--sp-4); color: var(--text-muted); font-size: .8125rem; }
.long-or::before, .long-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.long-form .upload-progress { margin-top: var(--sp-3); }
.long-form .upload-progress .progress-track { display: block; margin-top: var(--sp-2); }
.long-form.is-uploading .dropzone { opacity: .6; pointer-events: none; }
.long-form .btn .htmx-indicator { display: none; }
.long-form.htmx-request .btn .htmx-indicator { display: inline-block; }
.long-limits { margin: var(--sp-4) 0 0; }
.long-recent { margin-top: var(--sp-5); }
.long-recent-list, .long-batches, .long-moment-list { list-style: none; margin: var(--sp-2) 0 0; padding: 0; }
.long-recent-list li, .long-batches li { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-2) 0; border-top: 1px solid var(--border); }
.long-recent-list li:first-child, .long-batches li:first-child { border-top: 0; }
.long-recent-row, .long-batch-row { display: flex; flex-direction: column; min-width: 0; color: inherit; text-decoration: none; }
.long-recent-row:hover .long-recent-title, .long-batch-row:hover .long-batch-name { text-decoration: underline; }
.long-recent-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.long-recent-list .badge { flex: none; }
.long-title { overflow-wrap: anywhere; }
.long-source { margin: var(--sp-1) 0 0; overflow-wrap: anywhere; }
.long-status > * + * { margin-top: var(--sp-4); }
.long-bar { display: block; width: 100%; height: 8px; margin: 0 0 var(--sp-3); accent-color: var(--accent); }
.long-summary .card-head, .long-moments .card-head, .long-progress .card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.long-more { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-4); }
.long-more form { margin: 0; }
.long-more p { margin: 0; }
.long-moment { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) auto; gap: var(--sp-3); align-items: start; padding: var(--sp-3) 0; border-top: 1px solid var(--border); }
.long-moment:first-child { border-top: 0; }
.long-moment-time { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.long-moment-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.long-moment.is-made .long-moment-time, .long-moment.is-made strong { color: var(--text-muted); }
@media (max-width: 640px) {
  .long-moment { grid-template-columns: minmax(0, 1fr) auto; }
  .long-moment-text { grid-column: 1 / -1; grid-row: 2; }
}

/* an audio campaign on the Ads and Clipping pages, and in its editor (app.audio) */
.promo-audio-only { display: flex; align-items: flex-start; gap: var(--sp-2); margin: var(--sp-3) 0 0; padding: var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.promo-audio-only .ico { flex: none; margin-top: 2px; }
.promo-audio-admin { margin: var(--sp-4) 0; }
.snd-mode { border: 0; padding: 0; margin-inline: 0; min-width: 0; }
.snd-mode legend { padding: 0; margin-bottom: var(--sp-1); }
.snd-mode .check { margin-top: var(--sp-2); align-items: flex-start; }
.snd-mode .check .sub { display: block; font-weight: 400; }

/* "Share as Story" on a Reel or feed post (app.stories): a button and a line under it */
.share-story .btn { display: inline-flex; align-items: center; gap: var(--sp-2); }
.share-story p { margin: var(--sp-2) 0 0; }
.share-story-form { display: inline-flex; margin: 0; }
.share-story-btn { display: inline-flex; align-items: center; gap: 6px; }
