:root {
  --bg: #f6f6f4; --surface: #ffffff; --surface-2: #efefec; --line: #dedcd6; --text: #1c1c1a; --muted: #6b6a65;
  --brand: #111111; --brand-ink: #ffffff; --accent: #f2c230;
  --draft: #8a8a85; --internal: #7c5cd6; --client: #d98a00; --changes: #d1453b; --approved: #2f9e5b; --published: #2b6fd6;
  --radius: 10px; font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #141413; --surface: #1d1d1b; --surface-2: #262624; --line: #33322f; --text: #ecebe6; --muted: #9c9a93; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #141413; --surface: #1d1d1b; --surface-2: #262624; --line: #33322f; --text: #ecebe6; --muted: #9c9a93; color-scheme: dark; }

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h2 { font-size: 18px; } h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 20px 0 8px; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 12px; }
button:hover { border-color: var(--muted); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
button.good { background: var(--approved); color: #fff; border-color: var(--approved); }
button.bad { color: var(--changes); }
button.link { border: 0; background: none; padding: 0; text-decoration: underline; }
input, textarea, select { width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
input[type=checkbox] { width: auto; }
input[type=color] { padding: 2px; height: 38px; width: 64px; }
textarea { min-height: 90px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.warn { color: var(--changes); font-size: 13px; padding: 6px 12px; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.error { color: var(--changes); min-height: 1.4em; font-size: 14px; }
.hidden { display: none !important; }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; color: #fff; background: var(--draft); white-space: nowrap; }
.st-internal_review { --st: var(--internal); } .st-client_review { --st: var(--client); } .st-changes_requested { --st: var(--changes); }
.st-approved { --st: var(--approved); } .st-published { --st: var(--published); } .st-draft { --st: var(--draft); }
.badge[class*=st-] { background: var(--st); }

/* header */
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--brand); color: var(--brand-ink); flex-wrap: wrap; }
.topbar .logo { height: 36px; width: 36px; border-radius: 8px; object-fit: contain; background: var(--accent); }
.topbar select { width: auto; background: transparent; color: inherit; border-color: color-mix(in srgb, var(--brand-ink) 40%, transparent); }
.topbar select option { color: #111; }
.topbar button { background: transparent; color: inherit; border-color: color-mix(in srgb, var(--brand-ink) 40%, transparent); }
.nav { display: flex; gap: 4px; padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--surface); overflow-x: auto; }
.nav button { border: 0; background: none; border-radius: 6px; white-space: nowrap; }
.nav button[aria-current=true] { background: var(--surface-2); font-weight: 600; }
main { padding: 16px; max-width: 1400px; margin: 0 auto; }

/* board */
.board { display: grid; grid-template-columns: repeat(6, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 200px; }
.col h3 { margin: 0 0 10px; display: flex; gap: 6px; align-items: center; }
.col h3::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--st); }
.pcard { display: block; width: 100%; text-align: left; padding: 0; overflow: hidden; margin-bottom: 8px; }
.pcard .thumb { aspect-ratio: 16/10; background: var(--surface-2); overflow: hidden; }
.pcard .thumb > * { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcard .body { padding: 8px 10px; }
.pcard .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }

/* drawer */
.drawer { position: fixed; inset: 0 0 0 auto; width: min(980px, 100%); background: var(--bg); border-left: 1px solid var(--line); overflow-y: auto; z-index: 10; box-shadow: -10px 0 40px rgb(0 0 0 / .15); }
.drawer-head { position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--line); padding: 12px 16px; display: flex; gap: 8px; align-items: center; z-index: 1; }
.drawer-body { display: grid; grid-template-columns: 1fr 380px; gap: 20px; padding: 16px; }
@media (max-width: 820px) { .drawer-body { grid-template-columns: 1fr; } }
.platforms { display: flex; flex-wrap: wrap; gap: 6px; }
.platforms label { margin: 0; display: flex; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 99px; padding: 4px 10px; color: var(--text); background: var(--surface); cursor: pointer; }
.counts { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.counts .over { color: var(--changes); font-weight: 600; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.media-grid figure { margin: 0; position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.media-grid figure > :first-child { width: 100%; height: 100%; object-fit: cover; }
.media-grid figure button { position: absolute; top: 4px; right: 4px; padding: 0 7px; border-radius: 99px; background: rgb(0 0 0 / .6); color: #fff; border: 0; }

/* preview */
.tabs { display: flex; gap: 4px; margin-bottom: 8px; flex-wrap: wrap; }
.tabs button { padding: 4px 10px; font-size: 13px; border-radius: 99px; }
.tabs button[aria-selected=true] { background: var(--text); color: var(--bg); border-color: var(--text); }
.pv { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; max-width: 420px; }
.pv-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: 14px; }
.pv-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; overflow: hidden; font-weight: 700; flex: none; }
.pv-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pv-net { margin-left: auto; font-size: 12px; color: var(--muted); }
.pv-media { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; background: #000; }
.pv-media > * { flex: 0 0 100%; scroll-snap-align: start; width: 100%; aspect-ratio: var(--ratio, auto); max-height: 640px; object-fit: cover; display: block; }
.pv-caption { padding: 10px 12px; white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.pv-tiktok .pv-media > *, .pv-youtube .pv-media > * { object-fit: contain; }

/* thread */
.thread { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 10px; }
.thread time { font-size: 12px; color: var(--muted); }
.ev-status { font-size: 13px; color: var(--muted); }
.ev-comment { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.ev-comment.client { border-left: 3px solid var(--client); }
.ev-comment.internal { background: var(--surface-2); border-style: dashed; }
.ev-comment p { margin: 4px 0 0; white-space: pre-wrap; }

/* calendar */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* login */
.login { max-width: 360px; margin: 12vh auto; padding: 24px; }
/* The empty error line collapses, so the button needs its own gap from the last field. */
.login button.primary { margin-top: 16px; }

/* diffs, history, attachments */
del { background: color-mix(in srgb, var(--changes) 18%, transparent); color: var(--changes); text-decoration: line-through; }
ins { background: color-mix(in srgb, var(--approved) 18%, transparent); color: var(--approved); text-decoration: none; }
.diff { white-space: pre-wrap; word-break: break-word; }
.history { margin: 8px 0 12px; }
.history summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.history .thread { margin-top: 8px; }
.attach { max-width: 220px; max-height: 160px; border-radius: 8px; margin-top: 6px; display: block; }
.mention { color: var(--published); }
.seek { border: 0; cursor: pointer; }
.overdue { color: var(--changes); font-weight: 600; }

/* topbar extras */
.agency-name { font-weight: 700; }
.bell { position: relative; }
.bell .count { position: absolute; top: -6px; right: -6px; background: var(--changes); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 5px; }

/* lists & tables */
.stack { display: grid; gap: 16px; }
.panel { padding: 16px; }
.list-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.list-row:first-of-type { border-top: 0; }
.list-row .grow { flex: 1; min-width: 180px; }
.cat-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; }
.check { display: flex; gap: 8px; align-items: center; margin: 8px 0; color: var(--text); font-size: 14px; }
.check input { width: auto; }
.picker { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; background: var(--surface); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 12px; }
.secret { font-family: ui-monospace, monospace; background: var(--surface-2); padding: 8px 10px; border-radius: 8px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.filters button[aria-pressed=true] { background: var(--text); color: var(--bg); border-color: var(--text); }

/* drag & drop + week view */
[data-day].drop, [data-slot].drop { outline: 2px dashed var(--accent); outline-offset: -2px; }

/* ---- agency (Storyline Creative) typography; client pages keep a neutral face under the client's colors */
.agency-ui { font-family: 'Epilogue', ui-sans-serif, system-ui, sans-serif; }
.agency-ui h1, .agency-ui h2, .agency-ui .agency-name { font-family: 'Playfair Display', Georgia, serif; letter-spacing: -.01em; }
.agency-ui .topbar .logo { height: 32px; width: auto; max-width: 180px; background: none; border-radius: 0; }
.agency-ui .agency-name:not(:empty) + select { margin-left: 4px; }
.agency-ui #agency-logo:not(.hidden) + .agency-name { display: none; }
.brand-logo { height: 64px; width: auto; max-width: 220px; object-fit: contain; border-radius: 12px; }
.pv-avatar img { object-fit: contain; background: #fff; }

/* subtle agency credit on client-facing pages */
.site-foot { text-align: center; padding: 28px 16px 40px; }
.powered { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; text-decoration: none; opacity: .75; }
.powered:hover { opacity: 1; }
.powered img { height: 16px; width: auto; border-radius: 3px; }
.powered span { font-family: 'Playfair Display', Georgia, serif; font-style: italic; font-size: 13px; }

/* statuses added for the approval workflow */
.st-rejected { --st: #8c1d18; } .st-withdrawn { --st: #9a9892; } .st-client_review { --st: var(--client); }
.tag.ok { background: color-mix(in srgb, var(--approved) 18%, transparent); color: var(--approved); }
.tag.new { background: var(--accent); color: var(--accent-ink, #111); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sr-only:focus { position: static; width: auto; height: auto; clip: auto; margin: 8px; }

/* preview extras */
.pv-link { display: block; padding: 0 12px 10px; font-size: 13px; word-break: break-all; }
.pv-count { font-size: 12px; padding: 6px 12px 0; }

/* feedback threads */
.thread.replies { margin: 8px 0 0 12px; padding-left: 10px; border-left: 2px solid var(--line); }
.ev-actions { margin-top: 6px; font-size: 13px; display: flex; gap: 6px; flex-wrap: wrap; }
.ev-comment.resolved { opacity: .7; }
.reply { margin-top: 6px; display: grid; gap: 6px; }
.decisions { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.decisions .revoked { text-decoration: line-through; text-decoration-color: var(--changes); }
.decisions .revoked span.overdue { text-decoration: none; display: inline-block; }

/* editor */
.policy { padding: 10px 14px; margin-bottom: 12px; }
.policy p, .policy ul { margin: 4px 0; }
.decide { width: 100%; border: 1px dashed var(--line); border-radius: 8px; padding: 8px 10px; margin: 6px 0; }
.fig-tools { position: absolute; inset: auto 4px 4px 4px; display: flex; gap: 4px; justify-content: flex-end; }
.media-grid figure .fig-tools button { position: static; padding: 0 7px; border-radius: 99px; background: rgb(0 0 0 / .6); color: #fff; border: 0; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 12px 0; padding: 8px 12px; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.platforms { border: 0; padding: 0; }
legend { font-size: 13px; color: var(--muted); padding: 0 4px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.board { grid-template-columns: repeat(7, minmax(200px, 1fr)); }

/* ---- Storyline Creative brand guidelines v1.0 (dashboard only; client pages carry the client's look) */
.agency-ui:not([data-dark]) {
  --bg: #fdfaf7; --surface: #ffffff; --surface-2: #f7f3ee; --line: #e4ddd6; --text: #1a1c24; --muted: #6b7280; --radius: 4px;
  font-weight: 400;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .agency-ui { --bg: #1a1c24; --surface: #23262f; --surface-2: #2d3240; --line: #404760; --text: #fdfaf7; --muted: #a3a8b6; }
}
.agency-ui .card { border-width: 1.5px; border-radius: 4px; transition: transform .2s ease, box-shadow .2s ease; }
.agency-ui .pcard:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgb(45 50 64 / .08); }
.agency-ui button { border-radius: 2px; border-width: 1.5px; transition: background .2s ease, border-color .2s ease; }
.agency-ui button.primary { background: #c4622d; border-color: #c4622d; color: #fff; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; font-size: 13px; }
.agency-ui button.primary:hover { background: #d4764a; border-color: #d4764a; }
.agency-ui input, .agency-ui textarea, .agency-ui select { border-radius: 2px; border-width: 1.5px; }
.agency-ui h3 { font-family: 'Epilogue', sans-serif; font-size: 11px; font-weight: 600; letter-spacing: .2em; color: #c4622d; }
.agency-ui h3::before { content: '— '; }
.agency-ui .col h3::before { content: ""; }
.agency-ui .col h3 { color: var(--muted); }
.agency-ui .topbar { background: #2d3240; color: #fdfaf7; }
.agency-ui .topbar button, .agency-ui .topbar select { color: #fdfaf7; border-color: rgb(253 250 247 / .3); }
.agency-ui .topbar .logo { height: 40px; }
.agency-ui .nav button[aria-current=true] { background: none; color: #c4622d; box-shadow: inset 0 -2px #c4622d; border-radius: 0; }
.agency-ui :focus-visible { outline-color: #c4622d; }
.agency-ui .login { border-width: 1.5px; }

/* credit: terra "S" mark at its 32px minimum, then a quiet line of text */
.powered { gap: 8px; }
.powered img { height: 32px; width: 32px; border-radius: 50%; }
.powered span { font-family: inherit; font-style: normal; font-size: 12px; }
.powered b { font-family: 'Playfair Display', Georgia, serif; font-weight: 600; font-size: 13px; }
.tag.warn-tag { background: color-mix(in srgb, var(--changes) 15%, transparent); color: var(--changes); font-weight: 600; }
.warn button { margin-left: 6px; }

/* ======================================================================
   Layout system: one button size, one spacing scale, predictable wrapping.
   ====================================================================== */
:root { --gap: 12px; --gap-sm: 8px; --pad: 20px; --tap: 40px; }
@media (pointer: coarse), (max-width: 700px) { :root { --tap: 44px; --pad: 16px; } }

button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap);
  padding: 0 14px; line-height: 1.2; white-space: nowrap; font-weight: 500; vertical-align: middle; flex-shrink: 0; }
input, select { min-height: var(--tap); }
textarea { line-height: 1.45; }
/* elements that are buttons for semantics but not visually */
button.link { display: inline; min-height: 0; padding: 0; white-space: normal; font-weight: 500; }
.pcard { display: block; min-height: 0; padding: 0; white-space: normal; text-align: left; font-weight: 400; }
.tag.seek { display: inline-flex; min-height: 0; padding: 1px 8px; }
.tabs button, .filters button, .seg button { min-height: 36px; padding: 0 12px; }
.media-grid figure .fig-tools button { min-height: 28px; min-width: 28px; padding: 0 6px; }
.media-grid figure > button { min-height: 0; }
.nav button { min-height: var(--tap); padding: 0 12px; }
.bell { min-width: var(--tap); padding: 0 10px; }

/* spacing */
.row { gap: var(--gap-sm) var(--gap); }
.actions { gap: var(--gap-sm); }
.panel { padding: var(--pad); }
.stack { gap: var(--gap); }
.list-row { gap: var(--gap-sm) var(--gap); padding: var(--gap) 0; }
.list-row .grow { min-width: 0; overflow-wrap: anywhere; }
.check { min-height: 32px; }
label { margin: 14px 0 6px; }
h2 + p.muted { margin-top: 6px; }
.panel > h2:first-child, .card > h2:first-child { margin-bottom: 4px; }
.thread { gap: var(--gap-sm); }
.ev-comment p { overflow-wrap: anywhere; }
.policy .row { margin-top: 8px; }
.drawer-head { gap: var(--gap-sm); }
.drawer-head b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- phones ---------- */
@media (max-width: 700px) {
  input, select, textarea { font-size: 16px; }            /* stops iOS zooming into fields */
  .hide-sm { display: none !important; }
  main { padding: 12px; }
  .grid2 { grid-template-columns: 1fr; }
  .check { min-height: var(--tap); }

  /* list rows: text on its own line, controls below, left-aligned */
  .list-row { align-items: flex-start; }
  .list-row > .grow { flex: 1 1 100%; }
  .list-row > input[readonly] { flex: 1 1 100%; max-width: none !important; }

  /* agency dashboard: one-row top bar, tabs pinned to the bottom like a native app */
  .topbar { flex-wrap: nowrap; gap: var(--gap-sm); padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
  .topbar select { flex: 1 1 auto; min-width: 0; width: auto; }
  .topbar .spacer { display: none; }
  .agency-ui .topbar .logo { height: 28px; max-width: 92px; }
  .agency-ui .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; gap: 2px; padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line); border-bottom: 0; scroll-snap-type: x proximity;
    -webkit-mask-image: linear-gradient(to right, #000 88%, transparent); mask-image: linear-gradient(to right, #000 88%, transparent); }
  .agency-ui .nav button { scroll-snap-align: start; font-size: 14px; }
  .agency-ui .nav button[aria-current=true] { box-shadow: inset 0 2px #c4622d; }
  .agency-ui main { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }

  /* board: one column, only statuses that have posts */
  .board { grid-template-columns: 1fr; overflow: visible; }
  .col { min-height: 0; }
  .col.empty { display: none; }
  .filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }

  /* editor */
  .drawer { width: 100%; border-left: 0; }
  .drawer-head { padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
  .drawer-body { padding: 12px; gap: 20px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .policy .row > button, .decide .row > button { flex: 1 1 auto; }
  .media-grid { grid-template-columns: repeat(3, 1fr); }

  /* calendar */

  .login { margin: 8vh 12px; padding: 20px; }
  .site-foot { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
}

/* compact rows: text block left, one action right, never wrapping under */
.list-row.compact { flex-wrap: nowrap; align-items: center; }
.list-row.compact > .grow { flex: 1 1 auto; }
.meta-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 4px; font-size: 13px; }
.quote { display: block; margin-top: 2px; color: var(--muted); font-size: 14px; }
a.btn { display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 0 14px; border: 1.5px solid var(--line);
  border-radius: 2px; background: var(--surface); color: var(--text); text-decoration: none; font-weight: 500; white-space: nowrap; flex-shrink: 0; }
a.btn:hover { border-color: var(--muted); }
.plus { font-size: 20px; line-height: 1; font-weight: 400; }
.nav { scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
@media (max-width: 700px) {
  .list-row.compact > .grow { flex-basis: auto; }
  #new-post { min-width: var(--tap); padding: 0; }
}
.panel > :last-child, .card > :last-child { margin-bottom: 0; }
.panel > p.muted:only-of-type { margin-bottom: 0; }
@media (max-width: 700px) {
  .pcard { display: grid; grid-template-columns: 84px minmax(0, 1fr); align-items: center; }
  .pcard .thumb { aspect-ratio: 1; height: 100%; }
  .pcard .body { padding: 8px 12px; }
  .pcard:not(:has(.thumb)) { grid-template-columns: minmax(0, 1fr); }
}
input[type=checkbox], input[type=radio] { min-height: 0; width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--accent); }
.agency-ui input[type=checkbox], .agency-ui input[type=radio] { accent-color: #c4622d; }
.platforms label { min-height: 36px; padding: 0 12px; gap: 8px; }
@media (max-width: 700px) { .platforms label { min-height: 40px; } }
.attach-btn { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); max-width: 100%; padding: 0 14px; margin: 0;
  border: 1px dashed var(--line); border-radius: 8px; color: var(--text); font-size: 14px; cursor: pointer; background: var(--surface); }
.attach-btn span[data-filename] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.attach-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.error:empty { display: none; }
.error { margin: 8px 0; }
.list-row.stacked { flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
.row-actions { display: flex; flex-wrap: wrap; gap: var(--gap-sm); align-items: center; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
@media (max-width: 700px) { .row-actions .spacer { display: none; } .row-actions > * { flex: 1 1 auto; } }
.panel > p.muted + .list-row, .panel > .row + p.muted { margin-top: 8px; }
.panel > p.muted + .list-row { margin-top: 12px; }
a.btn, button { box-sizing: border-box; height: auto; line-height: 1.2; }
.agency-ui a.btn { border-width: 1.5px; border-radius: 2px; }

/* ---- per-content-type previews */
.pv-dots { display: flex; justify-content: center; gap: 5px; padding: 8px 0 0; }
.pv-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.pv-dots span.on { background: var(--text); }
.pv-alt { padding: 0 12px 8px; font-size: 13px; }
/* A height cap alone would leave the box full width and crop the reel, so the width shrinks with it to stay 9:16. */
.pv-type-clip .pv-media { --clip-h: min(640px, 70vh); justify-content: center; }
.pv-type-clip .pv-media > * { aspect-ratio: 9/16; object-fit: cover; max-height: var(--clip-h); flex-basis: min(100%, var(--clip-h) * 9 / 16); }
.pv-video { max-width: 640px; }
.yt-player { background: #000; aspect-ratio: 16/9; display: grid; place-items: center; }
.yt-player > * { width: 100%; height: 100%; object-fit: contain; }
.yt-body { padding: 12px 14px; display: grid; gap: 10px; }
.yt-title { font-size: 17px; margin: 0; }
.yt-channel { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.yt-thumb { display: grid; gap: 4px; font-size: 12px; }
.yt-thumb img { width: 168px; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; }
.yt-desc, .ep-notes { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.yt-desc p, .ep-notes p { margin: 0 0 8px; }
.chapters { margin: 6px 0 0; padding-left: 0; list-style: none; display: grid; gap: 4px; font-size: 14px; }
.chapters button.link { font-variant-numeric: tabular-nums; color: var(--published); text-decoration: none; margin-right: 4px; }
.pv-audio { padding: 14px; display: grid; gap: 12px; }
.pv-audio audio { width: 100%; }
.ep-head { display: flex; gap: 12px; align-items: center; }
.ep-head h3 { margin: 2px 0 0; font-size: 17px; }
.ep-cover { width: 88px; height: 88px; border-radius: 10px; object-fit: cover; flex: none; }
.ep-cover-empty { display: grid; place-items: center; background: var(--surface-2); font-size: 32px; }
.pv-article { max-width: 680px; }
.art-hero { width: 100%; aspect-ratio: 2/1; object-fit: cover; display: block; }
.art-body { padding: 16px 18px; font-size: 16px; line-height: 1.65; }
.art-body h3 { font-family: Georgia, serif; font-size: 24px; margin: 4px 0 12px; line-height: 1.25; }
.art-body p { margin: 0 0 12px; }
.pv-empty { color: #aaa; padding: 40px; }
.audio-thumb { display: grid; place-items: center; height: 100%; font-size: 32px; background: var(--surface-2); }
.type-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
dialog { border: 0; border-radius: 12px; padding: 0; max-width: min(680px, calc(100vw - 24px)); width: 100%; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgb(0 0 0 / .25); }
dialog::backdrop { background: rgb(26 28 36 / .45); }
.type-pick { padding: 20px; display: grid; gap: 14px; }
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.type-card { display: grid; justify-items: start; gap: 4px; text-align: left; white-space: normal; padding: 14px; min-height: 0; border-radius: 8px; height: auto; }
.type-card:hover { border-color: var(--accent); }
.type-card .type-icon { font-size: 24px; }
.type-card .muted { font-size: 13px; font-weight: 400; }
.type-pick > .link { justify-self: center; }
@media (max-width: 700px) { .type-grid { grid-template-columns: 1fr 1fr; } .type-card { padding: 12px; } }

/* ---- activity timeline (the audit trail) */
.timeline { gap: 10px; }
.timeline .ev-status { display: flex; gap: 10px; align-items: baseline; font-size: 14px; color: var(--muted); padding-left: 2px; }
.timeline .ev-status b { color: var(--text); font-weight: 600; }
.timeline .ev-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; transform: translateY(1px); }
.ev-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 14px; }
.ev-decision { border-left-width: 4px !important; }
.ev-decision.dec-approved { border-left-color: var(--approved) !important; }
.ev-decision.dec-changes_requested { border-left-color: var(--client) !important; }
.ev-decision.dec-rejected { border-left-color: var(--changes) !important; }
.ev-comment.client:not(.ev-decision) { border-left: 3px solid color-mix(in srgb, var(--client) 55%, transparent); }

/* timed notes under video/audio */
.note-track { display: grid; gap: 8px; padding: 8px 12px 4px; }
.note-track .track { position: relative; height: 14px; border-radius: 99px; background: var(--surface-2); }
.note-track .marker { position: absolute; top: 50%; width: 12px; height: 12px; min-height: 0; padding: 0; border-radius: 50%; transform: translate(-50%, -50%);
  background: var(--client); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--client); }
.note-track .marker.dec { background: var(--changes); box-shadow: 0 0 0 1px var(--changes); }
.note-track .marker:hover, .note-track .marker:focus-visible { transform: translate(-50%, -50%) scale(1.3); }
.note-actions { display: flex; gap: 8px; }
.note-track .add-note, .note-track .add-voice { min-height: 40px; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.note-track .add-note .t { font-variant-numeric: tabular-nums; font-weight: 600; margin-left: 4px; }
.pv-audio .note-track { padding: 0; }
#note-chip { justify-self: start; }

/* carousel */
.carousel { position: relative; }
.carousel .pv-media { scroll-behavior: smooth; scrollbar-width: none; }
.carousel .pv-media::-webkit-scrollbar { display: none; }
.car-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; min-height: 0; padding: 0; border-radius: 50%;
  background: rgb(255 255 255 / .92); color: #1a1c24; border: 0; box-shadow: 0 2px 8px rgb(0 0 0 / .25); font-size: 22px; line-height: 1; z-index: 2; }
.car-btn.prev { left: 10px; } .car-btn.next { right: 10px; }
.car-btn:disabled { opacity: 0; pointer-events: none; }
.car-count { position: absolute; top: 10px; right: 10px; z-index: 2; background: rgb(0 0 0 / .6); color: #fff; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }
.pv-dots { padding: 10px 0 2px; gap: 6px; }
.pv-dots button { width: 8px; height: 8px; min-height: 0; padding: 0; border-radius: 50%; background: var(--line); border: 0; }
.pv-dots button.on { background: var(--text); }
@media (pointer: coarse) { .pv-dots button { width: 10px; height: 10px; } }

/* upload progress */
#up-state:not(:empty), #bulk-state:not(:empty) { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; }
.up-label { grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.up-bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.up-bar > span { display: block; height: 100%; background: var(--accent); transition: width .2s ease; }
.up-pct { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }

/* comment header: name and tags on the left, time pinned right */
.ev-head .ev-time { margin-left: auto; font-size: 13px; white-space: nowrap; }
.timeline .ev-status { align-items: baseline; }
.timeline .ev-status .ev-text { flex: 1; min-width: 0; }
.timeline .ev-status .ev-time { font-size: 13px; white-space: nowrap; margin-left: auto; }
@media (max-width: 820px) {
  .drawer-body > .pv-col { order: -1; }
  .pv-col .pv { max-width: 100%; }
  .pv-col .pv-media > *, .pv-col .yt-player { max-height: 50vh; }
  .pv-col .pv-type-clip .pv-media { --clip-h: 50vh; }
}
.tag.team-tag { background: color-mix(in srgb, var(--brand) 12%, transparent); color: var(--text); font-weight: 600; }

/* accessibility (Lighthouse): contrast and touch-target fixes */
:root { --approved: #237a46; }
.powered { opacity: 1; }
.pv-dots { gap: 0; }
.pv-dots button { width: 24px; height: 24px; background: none; position: relative; }
.pv-dots button::before { content: ""; position: absolute; inset: 50% auto auto 50%; width: 8px; height: 8px; border-radius: 50%; background: var(--line); transform: translate(-50%, -50%); }
.pv-dots button.on::before { background: var(--text); }
.pv-dots button.on { background: none; }
@media (pointer: coarse) { .pv-dots button { width: 28px; height: 28px; } .pv-dots button::before { width: 10px; height: 10px; } }

/* accessibility: status colors dark enough for white text (WCAG AA) */
:root { --draft: #6e6e69; --client: #9e6100; --changes: #b8352c; }
.st-withdrawn { --st: #74726c; }
/* Storyline palette tuned for small text: terra text uses a deeper shade, muted text a touch darker */
.agency-ui { --terra-text: #a34c1d; }
.agency-ui:not([data-dark]) { --muted: #5d6270; }
.agency-ui .nav button[aria-current=true] { color: var(--terra-text); box-shadow: inset 0 -2px var(--terra-text); }
.agency-ui h3 { color: var(--terra-text); }
.agency-ui button.primary { background: #b35624; border-color: #b35624; }
.agency-ui button.primary:hover { background: #a34c1d; border-color: #a34c1d; }
@media (max-width: 700px) { .agency-ui .nav button[aria-current=true] { box-shadow: inset 0 2px var(--terra-text); } }
.login button.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.views { margin-top: 6px; font-size: 14px; }
.views summary { cursor: pointer; color: var(--text); }
.views ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }
.seen { color: var(--approved); font-weight: 500; }
.seen.not { color: var(--muted); font-weight: 400; }
.col .show-all { width: 100%; min-height: 36px; font-size: 14px; background: transparent; }
.pv-more { color: var(--muted); text-decoration: none; font-weight: 500; }
.pv-tag { color: #3b6fd1; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pv-tag { color: #7ea6f2; } }
a.pv-tag { text-decoration: none; }
.mention-list { position: absolute; z-index: 20; margin: 0; padding: 4px; list-style: none; min-width: 240px; max-width: calc(100% - 8px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.14); }
.mention-list li { padding: 8px 10px; border-radius: 6px; cursor: pointer; min-height: 36px; display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mention-list li[aria-selected="true"], .mention-list li:hover { background: var(--surface-2); }
.ok-mark { color: var(--approved); font-weight: 700; }
.handle-check { font-size: 14px; margin: 6px 0 0; }
.handle-check .hc { white-space: nowrap; margin-right: 8px; }
.handle-list .list-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px 8px; align-items: center; }
.handle-list .list-row .handle-id { grid-column: 1 / -1; overflow-wrap: anywhere; }
.handle-list .list-row .handle-name { width: 100%; min-width: 0; padding: 6px 8px; }
.handle-list .list-row button { width: auto; }
@media (min-width: 700px) { .handle-list .list-row { grid-template-columns: minmax(160px, 220px) minmax(0, 1fr) auto auto; } .handle-list .list-row .handle-id { grid-column: auto; } }
.crop-note { color: var(--client); font-size: 14px; margin: 6px 0 0; }
.crop-note:empty { display: none; }
.add-media { margin-top: 8px; } .add-media span { white-space: normal; }
/* voice notes */
.voice { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.voice audio { flex: 1 1 220px; min-width: 0; max-width: 100%; height: 40px; }
.voice-btn { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); padding: 0 16px; border-radius: 99px; font-weight: 600; }
.voice-stop { min-height: var(--tap); padding: 0 18px; border-radius: 99px; background: var(--changes); border-color: var(--changes); color: #fff; font-weight: 600; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--changes); animation: rec-pulse 1s ease-in-out infinite; }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; }
@keyframes rec-pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }
.voice-note { display: grid; gap: 6px; margin-top: 6px; }
.voice-note audio { width: 100%; max-width: 420px; height: 40px; }
.transcript { margin: 0; font-size: 15px; line-height: 1.5; }
.transcript .muted { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; margin-right: 6px; }
/* On the client page the voice note is the main way to give feedback. */
.composer .voice-btn, #ch-voice .voice-btn { width: 100%; justify-content: center; background: var(--brand, var(--accent)); color: var(--brand-ink, #fff); border-color: transparent; }
#comment-form .row > button:last-child { margin-left: auto; }

/* thumbnails in lists (review overview and dashboard) */
.ov-thumb { flex: none; width: 54px; height: 72px; border-radius: 8px; background: var(--surface-2); overflow: hidden; display: block; }
.ov-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ======================================================================
   Dashboard: one column of cards, list rows with thumbnails, five tabs.
   ====================================================================== */
.show-sm { display: none; }
.page { max-width: 820px; margin: 0 auto; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--gap); flex-wrap: wrap; }
.page-head h2 { margin: 0; }
.back-row { max-width: 820px; margin: 0 auto 8px; }
.card.callout { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.card.callout h2 { margin-bottom: 4px; }
.card.callout .primary { margin-top: 10px; }

/* rows: picture, text, chevron; the whole row is the tap target */
.item-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; min-width: 0; }
.panel > h2 + .item-row, .list-card > .item-row:first-child, .page-head + p + .item-row, .page-head + .item-row { border-top: 0; }
.item-row.slim { padding: 10px 0; }
.item-row:hover .item-text > b { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.item-row:focus-visible { outline-offset: 2px; }
.item-text { flex: 1; min-width: 0; display: grid; gap: 4px; justify-items: start; }
.item-text > b { line-height: 1.3; overflow-wrap: anywhere; }
.item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; color: var(--muted); }
.item-meta .badge, .item-meta .tag { white-space: nowrap; }
.item-go { color: var(--muted); font-size: 22px; line-height: 1; flex: none; }
.item-row .quote { margin: 0; }
.notes-count { color: var(--changes); font-weight: 600; }
.item-row > input.pick { width: 22px; height: 22px; }

/* filter chips: one scrollable row on phones */
.toolbar { display: flex; gap: var(--gap-sm); margin-bottom: 10px; }
.toolbar input[type=search] { flex: 1; min-width: 0; }
.chips-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chips-row button { min-height: 36px; padding: 0 12px; border-radius: 99px; font-size: 14px; }
.chips-row button .n { color: var(--muted); font-weight: 400; margin-left: 2px; }
.chips-row button[aria-pressed=true] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chips-row button[aria-pressed=true] .n { color: inherit; opacity: .7; }
#bulk { margin-bottom: 12px; }

/* bottom action bar for a selection */
.pick-bar { position: sticky; bottom: 12px; z-index: 4; display: flex; align-items: center; gap: var(--gap-sm); margin-top: 12px; padding: 10px 12px;
  background: var(--surface); border: 1.5px solid var(--line); box-shadow: 0 8px 24px rgb(0 0 0 / .12); border-radius: 6px; }
.pick-bar > span { flex: 1; font-weight: 600; }

/* review link cards */
.link-card { display: grid; gap: 6px; padding: 14px 0; border-top: 1px solid var(--line); }
.list-card > .link-card:first-child, summary + .link-card { border-top: 0; }
.lc-head b { font-size: 16px; }
.lc-actions { display: flex; gap: var(--gap-sm); flex-wrap: wrap; align-items: center; margin-top: 4px; }
.lp { display: grid; gap: 4px; width: 100%; }
.lp-bar { display: flex; height: 6px; border-radius: 99px; overflow: hidden; background: var(--surface-2); gap: 2px; }
.lp-bar .ok { background: var(--approved); } .lp-bar .chg { background: var(--changes); } .lp-bar .wait { background: var(--line); }
.lp-text { font-size: 13px; color: var(--muted); }
details.menu { position: relative; }
details.menu > summary { list-style: none; display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 14px; border: 1.5px solid var(--line); border-radius: 2px; cursor: pointer; font-weight: 500; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); z-index: 6; display: grid; min-width: 200px; background: var(--surface); border: 1.5px solid var(--line);
  box-shadow: 0 10px 28px rgb(0 0 0 / .14); border-radius: 4px; padding: 4px; }
.menu-list button { justify-content: flex-start; border: 0; background: none; }
.menu-list button:hover { background: var(--surface-2); }

/* send for review */
.send-form h3 { margin-top: 22px; }
.send-form h3 .muted { letter-spacing: normal; text-transform: none; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 8px 0; }
.pick-tile { display: flex; align-items: center; gap: 10px; margin: 0; padding: 8px; border: 1.5px solid var(--line); border-radius: 4px; cursor: pointer; min-width: 0; }
.pick-tile:has(input:checked) { border-color: #c4622d; background: color-mix(in srgb, #c4622d 7%, var(--surface)); }
.pick-tile .ov-thumb { width: 40px; height: 54px; border-radius: 4px; }
.pt-text { display: grid; gap: 4px; min-width: 0; justify-items: start; font-size: 13px; }
.pt-text b { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
.more-opts { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.more-opts > summary { cursor: pointer; font-weight: 600; }
.send-btn { width: 100%; min-height: 52px; margin-top: 16px; font-size: 15px !important; }
.select-all { margin: 0; font-size: 14px; }

/* history */
.h-filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--gap-sm); margin: 12px 0 4px; }
.h-day { margin: 16px 0 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.h-row { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.h-day + .h-row { border-top: 0; }
.h-time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; padding-top: 1px; }
.h-body { display: grid; gap: 2px; min-width: 0; }
.h-post { font-weight: 600; }
.h-detail { color: var(--muted); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

@media (max-width: 700px) {
  .show-sm { display: inline; }
  .agency-ui .nav { display: grid; grid-template-columns: repeat(5, 1fr); -webkit-mask-image: none; mask-image: none; padding-left: 0; padding-right: 0; }
  .agency-ui .nav button { padding: 0 2px; font-size: 13px; }
  .chips-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -12px; padding-inline: 12px; }
  .chips-row::-webkit-scrollbar { display: none; }
  .h-filters { grid-template-columns: 1fr 1fr; }
  .h-filters input, .h-filters #h-post { grid-column: 1 / -1; }
  .h-row { grid-template-columns: 54px minmax(0, 1fr); }
  .pick-bar { bottom: calc(68px + env(safe-area-inset-bottom)); }
  .pick-grid { grid-template-columns: 1fr; }
  .page-head .primary { flex: none; }
}
.list-card > .item-row:first-child, .list-card > .link-card:first-child { padding-top: 0; }
.list-card > .item-row:last-child, .list-card > .link-card:last-child { padding-bottom: 0; }
.icon-btn { min-width: var(--tap); padding: 0; }
.handle-list .list-row { padding: 8px 0; }
@media (min-width: 701px) { .agency-ui .nav { padding-inline: max(16px, calc((100% - 820px) / 2 - 12px)); } }
.list-card > h2 + .item-row, .list-card > h2 + .link-card { padding-top: 4px; border-top: 0; }

/* the content itself, by format (review page and editor) */
.fmt { max-width: none; border: 0; background: none; border-radius: 0; }
.stage { display: flex; justify-content: center; background: #000; border-radius: 12px; overflow: hidden; }
.stage > video, .stage > img { display: block; max-width: 100%; max-height: var(--stage-h, 60vh); width: auto; height: auto; }
.stage .carousel { width: 100%; }
.stage:has(> video), .stage:has(> img) { width: fit-content; max-width: 100%; margin-inline: auto; }
.stage .pv-media > * { max-height: var(--stage-h, 60vh); object-fit: contain; }
.fmt .note-track { padding: 8px 0 0; }
.fmt-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.fmt-line b { color: var(--text); font-weight: 600; }
.fmt-caption { margin: 10px 0 0; white-space: pre-wrap; font-size: 15px; line-height: 1.45; }
.edit-box { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 12px; }
.edit-box > summary { cursor: pointer; font-weight: 600; min-height: var(--tap); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.edit-box > summary .muted { font-weight: 400; font-size: 13px; }
.policy > p:first-child { margin: 0; }
.drawer .fmt { max-width: 420px; margin: 0 auto; }
.fig-replace { position: absolute; left: 4px; bottom: 4px; margin: 0; padding: 2px 8px; font-size: 12px; font-weight: 600; background: rgb(0 0 0 / .65); color: #fff; border-radius: 4px; cursor: pointer; }
.edit-box > summary { list-style: none; }
.edit-box > summary::-webkit-details-marker { display: none; }
.edit-box > summary::before { content: '▸'; color: var(--muted); transition: transform .15s ease; }
.edit-box[open] > summary::before { transform: rotate(90deg); }
.drawer .stage > video, .drawer .stage > img { max-height: 46vh; }
#comment-form textarea { min-height: 64px; }
#comment-form .check { min-height: 0; font-size: 14px; }

/* ======================================================================
   Storyline Creative, in the same shape as the client pages:
   rounded cards and controls, sentence-case buttons, quiet section labels.
   Brand stays in the colors (navy bar, terra actions) and type (Playfair + Epilogue).
   ====================================================================== */
.agency-ui:not([data-dark]) { --radius: 12px; }
.agency-ui .card { border-width: 1px; border-radius: 12px; }
.agency-ui button, .agency-ui a.btn, .agency-ui details.menu > summary { border-radius: 10px; border-width: 1px; }
.agency-ui input, .agency-ui textarea, .agency-ui select { border-radius: 10px; border-width: 1px; }
.agency-ui button.primary { text-transform: none; letter-spacing: 0; font-size: 15px; font-weight: 600; }
.agency-ui h3 { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 20px 0 8px; }
.agency-ui h3::before { content: none; }
.agency-ui .chips-row button { border-radius: 99px; }
.agency-ui .pick-tile, .agency-ui .menu-list { border-radius: 12px; }
.agency-ui .pick-bar { border-radius: 14px; border-width: 1px; }
.agency-ui .ov-thumb { border-radius: 8px; }
.agency-ui .page-head h2, .agency-ui .panel > h2 { font-size: 22px; }

/* phone tab bar: icon over label, like a native app */
.nav-ico { display: none; }
@media (max-width: 700px) {
  .agency-ui .nav { gap: 0; padding-top: 6px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
  .agency-ui .nav button { flex-direction: column; gap: 3px; min-height: 52px; font-size: 11px; font-weight: 600; color: var(--muted); border-radius: 10px; }
  .agency-ui .nav button[aria-current=true] { color: #c4622d; box-shadow: none; background: none; }
  .nav-ico { display: block; width: 24px; height: 24px; }
  .agency-ui main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .pick-bar { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
@media (max-width: 700px) { .agency-ui .page-head h2, .agency-ui .panel > h2 { font-size: 20px; } }
/* editor header: back, then title over status */
.drawer-head { position: sticky; top: 0; z-index: 3; background: var(--surface); }
.agency-ui .back-btn { border: 0; background: none; font-size: 30px; line-height: 1; min-width: var(--tap); padding: 0; color: var(--text); }
.dh-title { flex: 1; min-width: 0; display: grid; gap: 3px; }
.dh-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.dh-meta { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
#save-state:empty { display: none; }
@media (max-width: 700px) {
  .policy .row > button:not(.primary), .decide .row > button:not(.primary) { flex: 0 1 auto; }
  .policy .row > .primary { flex: 1 1 100%; }
}
#comment-form .row { flex-wrap: wrap; }
#comment-form .row > .check { flex: 1 1 100%; }
#comment-form .row > .spacer { flex: 1; }
.upload-btn { min-height: 52px; font-size: 16px; cursor: pointer; background: #c4622d; border-color: #c4622d; color: #fff; font-weight: 600; justify-content: center; }
.type-pick > #quick-state { margin: -6px 0 0; text-align: center; font-size: 13px; }
.type-or { margin: 6px 0 -4px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
@media (max-width: 700px) {
  /* bottom sheet, like the client side */
  #type-dialog { margin: auto 0 0; width: 100%; max-width: 100%; max-height: 92svh; border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .type-grid { grid-template-columns: 1fr; gap: 0; }
  .type-card { border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 12px 2px; }
  .type-card:first-child { border-top: 0; }
}
.agency-ui .upload-btn { display: flex; align-items: center; justify-content: center; margin: 0; border-radius: 12px; }
.type-card { width: 100%; justify-content: start; align-content: center; }
@media (max-width: 700px) { .agency-ui .type-card { border-radius: 0; border-width: 1px 0 0; background: none; } }
.thumb-strip { display: flex; gap: 4px; align-items: center; margin: 4px 0 2px; }
.thumb-strip .ov-thumb { width: 36px; height: 48px; border-radius: 6px; }
.thumb-strip .more-n { font-size: 13px; color: var(--muted); margin-left: 4px; }
/* top bar: soft filled controls instead of outlines */
.agency-ui .topbar { gap: 10px; box-shadow: 0 1px 0 rgb(0 0 0 / .2); }
.agency-ui .topbar select, .agency-ui .topbar button { border: 0; background-color: rgb(253 250 247 / .1); border-radius: 10px; }
.agency-ui .topbar select { font-weight: 600; padding-right: 32px; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23fdfaf7' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.agency-ui .topbar button:hover, .agency-ui .topbar select:hover { background-color: rgb(253 250 247 / .18); }
.agency-ui #new-post { background: #c4622d; color: #fff; font-weight: 600; }
.agency-ui #new-post:hover { background: #d4764a; }
.agency-ui .bell .count { box-shadow: 0 0 0 2px #2d3240; }
@media (max-width: 700px) {
  .agency-ui .topbar select { min-height: 40px; font-size: 16px; }
  .agency-ui .topbar button { min-height: 40px; min-width: 40px; border-radius: 99px; }
}
.agency-ui .topbar { position: sticky; top: 0; z-index: 5; }
/* form controls in the dashboard: file pickers, color swatches, plain sections */
.agency-ui input[type=file] { border: 0; padding: 0; background: none; min-height: 0; font-size: 14px; color: var(--muted); max-width: 100%; }
.agency-ui input[type=file]::file-selector-button { font: inherit; font-weight: 600; color: var(--text); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 14px; margin-right: 12px; cursor: pointer; }
.agency-ui input[type=color] { width: 56px; height: 44px; padding: 4px; border-radius: 12px; cursor: pointer; }
.agency-ui input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.agency-ui input[type=color]::-webkit-color-swatch { border: 0; border-radius: 8px; }
.agency-ui fieldset { border: 0; padding: 0; margin: 18px 0 0; min-width: 0; }
.agency-ui legend { padding: 0; margin-bottom: 4px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.logo-field { display: flex; align-items: center; gap: 12px; }
.logo-field img { width: 48px; height: 48px; object-fit: contain; border-radius: 10px; background: var(--surface-2); flex: none; }
/* people */
details.person { border-top: 1px solid var(--line); }
.page-head + #secret + .invite-form + details.person, .invite-form.hidden + details.person { border-top: 0; }
details.person > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 12px 0; cursor: pointer; }
details.person > summary::-webkit-details-marker { display: none; }
details.person[open] > summary .item-go { transform: rotate(90deg); }
details.person > form { padding: 0 0 16px; }
.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff; background: #2d3240; }
.role-help { margin: 6px 0 0; font-size: 13px; }
.invite-form { border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px 16px; margin: 12px 0; }
details.fold > summary { list-style: none; cursor: pointer; display: grid; gap: 4px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h2 { margin: 0; }
details.fold > summary h2::after { content: ' ›'; color: var(--muted); font-family: inherit; }
details.fold[open] > summary h2::after { content: ' ⌄'; }
.logo-field.dark img { background: #2d3240; width: auto; max-width: 140px; padding: 6px 10px; }
.back-row button.link { font-size: 15px; text-decoration: none; color: var(--muted); font-weight: 600; }
.conn { display: flex; gap: 8px; align-items: baseline; margin: 6px 0 12px; }
.conn .dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); transform: translateY(-1px); }
.conn.on .dot { background: var(--approved); }
a.item-row { color: inherit; text-decoration: none; }
.mail-row .item-text > b { font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mail-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--line); align-self: flex-start; margin-top: 6px; }
.mail-dot.ok { background: var(--approved); } .mail-dot.bad { background: var(--changes); } .mail-dot.wait { background: #c9a227; }
.mail-state.bad { color: var(--changes); font-weight: 600; }
.conn > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.profile { display: flex; gap: 14px; align-items: center; }
.avatar.big { width: 56px; height: 56px; font-size: 20px; background: #c4622d; }
.profile .item-text > b { font-size: 18px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 0; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; }
.switch-row > span { display: grid; gap: 2px; }
.switch-row b { color: var(--text); font-size: 15px; }
.switch-row .muted { font-size: 13px; font-weight: 400; }
input.switch { appearance: none; -webkit-appearance: none; flex: none; width: 50px !important; height: 30px !important; border-radius: 99px; background: var(--line); position: relative; cursor: pointer; transition: background .2s; border: 0; }
input.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .2s; }
input.switch:checked { background: #c4622d; }
input.switch:checked::after { transform: translateX(20px); }
.small { font-size: 13px; }
.selecting .item-go { display: none; }
/* the send button stays in reach while picking content */
.send-btn { position: sticky; bottom: 12px; z-index: 4; box-shadow: 0 8px 24px rgb(196 98 45 / .3); }
@media (max-width: 700px) { .send-btn { bottom: calc(80px + env(safe-area-inset-bottom)); } }
.h3-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.h3-row .link { font-size: 14px; font-weight: 600; color: #c4622d; text-decoration: none; }
.save-bar { position: sticky; bottom: 0; z-index: 2; margin: 16px -12px 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-top: 1px solid var(--line); }
.save-bar .primary { width: 100%; min-height: 48px; }
textarea.grow { resize: none; overflow: hidden; min-height: 76px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .agency-ui .avatar:not(.big) { background: #4a5270; } }
/* terra text needs the deeper shade at small sizes to stay readable (4.5:1) */
@media (max-width: 700px) { .agency-ui .nav button[aria-current=true] { color: #a34b1c; } }
.h3-row .link { color: #a34b1c; }
.pick-tile input[type=checkbox], .item-row > input.pick, .select-all input[type=checkbox] { width: 24px; height: 24px; }
.agency-ui h3.h-day { margin: 16px 0 4px; font-size: 13px; letter-spacing: 0; text-transform: none; color: var(--muted); font-weight: 600; }
@media (min-width: 821px) { .drawer .pv-col { position: sticky; top: 88px; align-self: start; } }
