/* Theia dashboard styles. Text sizes: 14px for what people read (table cells,
   messages, inputs), 13px for labels (headers, hints, sub-lines), 11–12px only for badges and codes.
   Sections: tokens · layout (app, sidebar, page) · cards and text · controls · pills and notices ·
   tables (creators, posts, jobs) · dialogs · errors · sign in · responsive.
   Every width-dependent rule is in the responsive section at the end, so it reads top to bottom. */

/* ---- tokens and base ---- */
:root {
  --bg: #F6F3EE; --side: #EDE7DE; --card: #FFFFFF; --soft: #FBF9F6; --track: #EFE9E0;
  --line: #E2DBD0; --line-2: #D8D0C3; --ink: #1C1B19; --ink-2: #3A3631; --ink-3: #4A453E; --muted: #6B655C;
  --accent: #8A4B2E; --accent-dk: #6A3620; --accent-bg: #F1E2D8; --green: #3F6B55;
  --good-bg: #E3EDE6; --good: #2F5542; --warn-bg: #F6EDD2; --warn: #6E5410;
  --bad-bg: #F6E1DE; --bad: #8A2A2A; --info-bg: #E3EAF1; --info: #2E4760; --chip: #F1ECE4;
  --serif: Fraunces, Georgia, serif; --sans: 'IBM Plex Sans', system-ui, sans-serif; --mono: 'IBM Plex Mono', monospace;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 14px; }
a { color: var(--accent); } a:hover { color: var(--accent-dk); }
code, .code { font-family: var(--mono); font-size: 12px; }

/* Scrollbars: slim, in the theme's warm greys (Windows and "always show scrollbars" macOS
   show them all the time; macOS overlay bars barely change). Not hidden: on the creators
   table, the bar is one of the cues that there are more columns to scroll to. */
html { scrollbar-width: thin; scrollbar-color: var(--line-2) var(--bg); }
.table-scroll { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.table-scroll:hover { scrollbar-color: #B9AFA1 transparent; }
@supports not (scrollbar-color: auto) {  /* Safari */
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: transparent; }
  .table-scroll::-webkit-scrollbar-track { margin: 0 14px; }  /* clear of the card's rounded corners */
  ::-webkit-scrollbar-thumb { background: var(--line-2) padding-box; border: 3px solid transparent; border-radius: 10px; }
  ::-webkit-scrollbar-thumb:hover { background-color: #B9AFA1; }
}
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- layout: app and sidebar ---- */
.app { display: flex; min-height: 100vh; }
aside { width: 240px; flex-shrink: 0; background: var(--side); border-right: 1px solid var(--line); padding: 32px 18px;
        display: flex; flex-direction: column; gap: 28px; position: sticky; top: 0; height: 100vh;
        transition: margin-left .28s ease, visibility 0s linear 0s; }
.aside-top { position: relative; }
.brand { padding: 0 12px; min-width: 0; } .brand b { display: block; font-family: var(--serif); font-weight: 400; font-size: 22px; line-height: 1.15; }
.brand span { font-size: 13px; color: var(--muted); }
.env-badge { display: inline-block; margin-top: 10px; padding: 3px 10px; border-radius: 10px; background: var(--warn-bg);  /* staging */
             color: var(--warn); font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }
.aside-actions { position: absolute; top: 0; right: 0; display: flex; gap: 4px; }  /* lock + hide sidebar */
.brand b { padding-right: 72px; }  /* room for them */
.lock { margin: 0; display: flex; }
.aside-actions .icon-btn { width: 32px; height: 32px; background: transparent; }
.aside-actions .icon-btn .icon { width: 16px; height: 16px; }
.sidebar-open { position: fixed; top: 20px; left: 16px; z-index: 5; opacity: 0; visibility: hidden; pointer-events: none;
                transition: opacity .2s ease; }  /* shown when the sidebar is hidden (see responsive) */
nav { display: flex; flex-direction: column; gap: 2px; }
nav a { display: flex; gap: 12px; align-items: center; min-height: 40px; padding: 0 12px; border-radius: 8px; color: var(--ink-2); text-decoration: none; }
nav a span { font-family: var(--mono); font-size: 11px; color: var(--muted); }
nav a.on { background: var(--ink); color: var(--bg); } nav a.on span { color: #BDB5A8; }
nav a:hover:not(.on) { background: #E4DDD2; color: var(--ink); }
.nav-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent);
             color: #fff; font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.online { display: flex; align-items: center; gap: 8px; margin: -16px 0 0; padding: 0 12px; font-size: 13px; color: var(--muted); }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.run { margin-top: auto; padding: 14px 12px; border: 1px solid var(--line-2); border-radius: 10px; font-size: 13px; line-height: 1.5; color: var(--ink-3); }
.run b { font-weight: 600; }
.run > * { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }  /* one line each */
.run.paused { border-color: #E9C3BD; background: #FDF6F5; }
.run.paused code { color: var(--bad); }

/* ---- layout: the page ---- */
main { flex-grow: 1; min-width: 0; padding: 36px 40px 60px; display: flex; flex-direction: column; gap: 22px;
       transition: padding-left .28s ease; }
main > *, .card { min-width: 0; }  /* let cards shrink, so wide tables scroll instead of widening the page */
header.page { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.header-actions { display: flex; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 22px; }
.eyebrow { font-family: var(--mono); font-size: 12px; color: var(--muted); }
h1 { margin: 6px 0; font-family: var(--serif); font-weight: 400; font-size: 36px; line-height: 1.1; }
.question { font-size: 15px; color: var(--muted); }
h2 { margin: 0; font-size: 16px; font-weight: 600; }

/* ---- cards and text ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px 24px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.card.flush .card-head { padding: 16px 18px 0; }
.card-head h2 { display: inline-flex; align-items: center; gap: 8px; }
.card-head:has(h2 .count) { align-items: center; }
.head-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.card-note { margin: -4px 18px 12px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.card-foot { margin: 12px 0 0; }
.count { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 10px; background: var(--chip);
         color: var(--ink-3); font-size: 12px; font-weight: 500; line-height: 1; }
.hint { font-size: 13px; color: var(--muted); }
.sub { display: block; margin-top: 2px; font-size: 13px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.empty { padding: 28px 18px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.err { color: var(--bad); font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.tile { background: var(--soft); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.tile .l { font-size: 13px; color: var(--muted); } .tile .v { font-size: 18px; font-weight: 500; font-variant-numeric: tabular-nums; }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat-tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.card.schedule { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; padding: 16px 24px; }
.card.schedule h2 { display: flex; align-items: center; gap: 10px; }
.card.schedule p { margin: 6px 0 0; font-size: 14px; color: var(--ink-3); }

/* ---- controls: forms, buttons, icons ---- */
form.inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input[type=text], input[type=number], input[type=search], select, textarea {
  height: 38px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 8px; font: inherit; font-size: 14px; background: var(--soft); color: var(--ink); }
textarea { height: auto; min-height: 80px; padding: 10px 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type=checkbox]:focus { outline: none; }  /* a click shouldn't leave a ring; the keyboard still gets one */
input[type=checkbox]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.btn { height: 40px; padding: 0 16px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); border-radius: 8px; font: inherit; font-size: 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn:hover { border-color: var(--ink); }
.btn.busy { gap: 8px; cursor: progress; opacity: .85; }
.btn .icon { width: 15px; height: 15px; margin-right: 6px; }
.link-btn { padding: 0; border: 0; background: none; font: inherit; color: var(--ink); text-decoration: underline; cursor: pointer; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0;
            border: 1px solid var(--line-2); border-radius: 50%; background: var(--card); color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { border-color: var(--ink); color: var(--ink); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn.busy { cursor: progress; color: var(--muted); }
.icon-btn .spinner { width: 14px; height: 14px; }
.spinner { width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
           display: inline-block; flex-shrink: 0; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pending-stage { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-3); }
.pending-stage.waiting { color: var(--muted); } .pending-stage.waiting .spinner { display: none; }  /* queued, not running */

/* ---- pills, chips and notices ---- */
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 12px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--chip); color: var(--ink-3); }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.bad { background: var(--bad-bg); color: var(--bad); } .pill.info { background: var(--info-bg); color: var(--info); }
.flash { padding: 12px 16px; border-radius: 10px; font-size: 14px; } .flash.ok { background: var(--good-bg); color: var(--good); } .flash.error { background: var(--bad-bg); color: var(--bad); }
#toasts { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 10; max-width: 420px; }
#toasts .flash { box-shadow: 0 4px 16px rgba(28, 27, 25, .12); }
.toast-code { display: block; margin-top: 4px; font-family: var(--mono); font-size: 11px; opacity: .85; }
.toast-meaning { display: block; margin-top: 2px; font-size: 13px; }

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 400; font-size: 13px; color: var(--muted); background: var(--soft); padding: 10px 12px; border-top: 1px solid var(--track); white-space: nowrap; }
td { padding: 10px 12px; border-top: 1px solid var(--track); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 18px; } th:last-child, td:last-child { padding-right: 18px; }
td.num, th.num { text-align: right; }
tr.pending td { color: var(--muted); background: var(--soft); }
tr[hidden] { display: none !important; }  /* phones lay rows out as grids, which would override [hidden] */
.table-scroll { overflow-x: auto; max-width: 100%; }  /* never cut off: scroll inside the card instead */
.who { display: flex; flex-direction: column; gap: 1px; } .who b { font-weight: 500; } .who span { font-size: 13px; color: var(--muted); }
.who a { color: var(--ink); text-decoration: none; } .who a:hover { text-decoration: underline; }

/* Data tables (creators, jobs): every column is as wide as its content, with the same padding,
   so the gap between any two columns is the same (2 × --cell-x). One column (Creator, Result)
   takes the spare width and cuts off with … when there's too little (full value on hover). */
.creators-table, .jobs-table { --cell-x: 14px; }
.creators-table th, .creators-table td, .jobs-table th, .jobs-table td { width: 1%; padding-left: var(--cell-x); padding-right: var(--cell-x); }
.creators-table tr > :first-child, .jobs-table tr > :first-child { padding-left: 18px; }
.creators-table tr > :last-child, .jobs-table tr > :last-child { padding-right: 18px; }

/* creators: many columns, so the table scrolls sideways inside the card when it doesn't fit.
   The tick box and name stay pinned on the left and the refresh button on the right (sticky);
   a soft shadow shows where columns are scrolled underneath (js/creators-table.js sets the classes). When it
   all fits, the spare width goes to the number columns (unsized), not the pinned ones (fixed). */
.creators-table { width: 100%; border-collapse: separate; border-spacing: 0; }  /* separate: borders move with pinned cells */
.creators-table th, .creators-table td { width: auto; }  /* number columns take the spare width; pinned ones are fixed */
.table-frame { --select-w: 38px; --name-w: 200px; --action-w: 68px; }  /* the pinned columns' widths */
.creators-table .cell-select { width: var(--select-w); min-width: var(--select-w); }
.creators-table .cell-creator, .creators-table th.col-creator { width: var(--name-w); min-width: var(--name-w); max-width: var(--name-w); }
.creators-table .cell-action { width: var(--action-w); min-width: var(--action-w); }
.creators-table .cell-select, .creators-table .cell-creator, .creators-table th.col-creator, .creators-table .cell-action {
  position: sticky; z-index: 1; background: var(--card); }
.creators-table .cell-select { left: 0; }
.creators-table .cell-creator, .creators-table th.col-creator { left: var(--select-w); }
.creators-table .cell-action { right: 0; }
.creators-table th.cell-select, .creators-table th.col-creator, .creators-table th.cell-action { background: var(--soft); z-index: 2; }
.creators-table tr.pending td { background: var(--soft); }
/* One shadow down each pinned edge, over the whole table (not per row), shown while columns
   are scrolled underneath. It lives on the frame around the scroller, so it doesn't scroll. */
.table-frame { position: relative; }
.table-frame::before, .table-frame::after { content: ""; position: absolute; top: 0; bottom: var(--scrollbar, 0px); width: 14px; z-index: 3;
  pointer-events: none; opacity: 0; transition: opacity .15s; }
.table-frame::before { left: calc(var(--select-w) + var(--name-w)); background: linear-gradient(to right, rgba(28, 27, 25, .10), transparent); }
.table-frame::after { right: var(--action-w); background: linear-gradient(to left, rgba(28, 27, 25, .10), transparent); }
.table-frame.more-left::before, .table-frame.more-right::after { opacity: 1; }
.table-frame.more-left .cell-creator, .table-frame.more-left th.col-creator { box-shadow: inset -1px 0 var(--track); }  /* hairline edges */
.table-frame.more-right .cell-action { box-shadow: inset 1px 0 var(--track); }
.creators-table th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-top: 8px; padding-bottom: 8px; }
.creators-table td, .posts-table td { font-variant-numeric: tabular-nums; }
.creators-table td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.creators-table td.num, .posts-table td.num { white-space: nowrap; }
.creators-table .cell-action { text-align: right; white-space: nowrap; }
.creators-table td.cell-action { overflow: visible; padding-right: 18px; }  /* last visible cell (the phone summary follows it) */

/* creators: ticking rows for bulk actions */
.creators-table .cell-select { padding-right: 4px; overflow: visible; cursor: pointer; }  /* room for the focus ring */
.creators-table .cell-select input { width: 16px; height: 16px; margin: 0; display: block; accent-color: var(--ink); cursor: pointer; }
.creators-table tr.is-selected td { background: #FBF6F1; }
.bulk-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.bulk-bar[hidden], .card.selecting .head-actions > .btn { display: none; }
.bulk-count { margin-right: 4px; font-size: 14px; color: var(--ink-3); }
.btn.danger { color: var(--bad); border-color: #E9C3BD; } .btn.danger:hover { border-color: var(--bad); }
.btn.plain { border-color: transparent; background: transparent; color: var(--muted); } .btn.plain:hover { color: var(--ink); }
.creators-table .cell-summary { display: none; }  /* phones only */
.creators-table .who > * { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.creators-table .who .err-pill { display: inline-flex; }
.creators-table .sub { overflow: hidden; text-overflow: ellipsis; }
.creators-table .no-match td { padding: 28px 18px !important; text-align: center !important; color: var(--muted); white-space: normal !important; }
.mobile-sort { display: none; }  /* phones only */

/* sortable headers (Creators, Jobs); the link fills the whole cell, so anywhere in it sorts */
th.sortable { padding: 0; }
th.sortable a { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 3px;
                                padding: 8px var(--cell-x); user-select: none; -webkit-user-select: none; }
th.num.sortable a { justify-content: flex-end; text-align: right; }
th.sortable a:hover, th.sorted a { color: var(--ink); }
th.sortable a:hover { background: var(--track); }
th.sortable a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sort-label { position: relative; }  /* columns fit their header, so no cut-off needed */
th.sortable { overflow: visible; }  /* the arrow hangs into the padding */
.sort-mark { position: absolute; left: 100%; margin-left: 3px; font-size: 11px; opacity: 0; transition: opacity .15s; }  /* shown on hover, or when sorted */
th.num .sort-mark { left: auto; right: 100%; margin: 0 3px 0 0; }
th.sortable a:hover .sort-mark, th.sortable a:focus-visible .sort-mark { opacity: .45; }
th.sorted .sort-mark { opacity: 1; }

/* creators: search box (next to Add creators and Export) */
.table-search { position: relative; display: flex; align-items: center; margin: 0; }
.table-search .icon { position: absolute; left: 10px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.table-search input { height: 32px; width: 220px; padding-left: 32px; font-size: 14px; }

/* a creator's posts */
.posts-table .cell-thumb { width: 56px; }
.posts-table .cell-post { white-space: nowrap; }
.posts-table .col-caption { width: 100%; min-width: 180px; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; display: block; background: var(--track); }
.caption { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* jobs */
.jobs-table { width: 100%; min-width: 760px; }
.jobs-table th, .jobs-table td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jobs-table .cell-result, .jobs-table .col-result { width: 100%; max-width: 0; min-width: 200px; }  /* the flexible column */
.jobs-table .who { max-width: 260px; }
.jobs-table th { padding-top: 8px; padding-bottom: 8px; }
.jobs-table th.sortable { padding: 0; overflow: visible; }  /* the link carries the padding; the arrow hangs out */
.jobs-table .cell-id { color: var(--muted); font-variant-numeric: tabular-nums; }
.jobs-table .who > * { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jobs-table .cell-action { text-align: right; overflow: visible; }
.jobs-table .err-code { padding: 2px 6px; border-radius: 5px; background: var(--bad-bg); color: var(--bad); font-size: 11px; }
.jobs-table tr.job-done td, .jobs-table tr.job-cancelled td { color: var(--ink-3); }
.jobs-table .pending-stage { max-width: 100%; overflow: hidden; }

/* campaigns: the list and one campaign's videos. Tables scroll sideways inside the card, on phones too. */
.camp-scroll { overflow-x: auto; max-width: 100%; }
.camp-table { --cell-x: 14px; min-width: 760px; }
.camp-table th, .camp-table td { padding-left: var(--cell-x); padding-right: var(--cell-x); white-space: nowrap; font-variant-numeric: tabular-nums; }
.camp-table tr > :first-child { padding-left: 18px; } .camp-table tr > :last-child { padding-right: 18px; }
.camp-table th { padding-top: 8px; padding-bottom: 8px; }
.videos-table { min-width: 980px; }
.camp-table .who a { color: var(--ink); text-decoration: none; } .camp-table .who a:hover { text-decoration: underline; }
.camp-table .dim, .dim { color: var(--muted); }
.sub-inline { font-size: 13px; color: var(--muted); }
.plat { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 18px; padding: 0 5px; border-radius: 5px; background: var(--chip);
        color: var(--ink-3); font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: .03em; vertical-align: 1px; }
.plats { display: inline-flex; gap: 4px; }
.bar { display: flex; align-items: center; gap: 8px; }
.track { width: 70px; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; flex-shrink: 0; }
.track i { display: block; height: 100%; border-radius: 3px; background: var(--green); }
.track.tracking i { background: var(--accent); }
.vid { display: flex; align-items: center; gap: 10px; }
.vid .thumb { width: 36px; height: 44px; flex-shrink: 0; }
.thumb.ph { background: repeating-linear-gradient(135deg, var(--track), var(--track) 6px, #E8E1D6 6px, #E8E1D6 12px); }
.vid .who a { color: var(--accent); }
.cap { display: block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; font-size: 13px; color: var(--muted); }
.actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.actions form { margin: 0; }
.link-form { display: flex; gap: 6px; }
.link-form input { height: 32px; width: 190px; font-size: 13px; }
.pill.warn { background: var(--warn-bg); color: var(--warn); } .pill.accent { background: var(--accent-bg); color: var(--accent); }
.camp-table tr.video-waiting td { background: var(--soft); }
input[type=date] { height: 38px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 8px; font: inherit; font-size: 14px; background: var(--soft); color: var(--ink); }
input[type=date]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
dialog.modal .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
dialog.modal input[type=text], dialog.modal input[type=date] { width: 100%; }
dialog.modal fieldset.platform-pick { margin: 14px 0 0; padding: 0; border: 0; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
dialog.modal fieldset.platform-pick legend { float: left; margin-right: 6px; padding: 0; font-size: 13px; color: var(--ink-3); }
dialog.modal label.check { flex-direction: row; align-items: center; gap: 6px; margin: 0; font-size: 14px; color: var(--ink-2); }
label.check input { accent-color: var(--ink); }

/* ---- dialogs (confirmations, Add creators) ---- */
dialog.modal { border: 1px solid var(--line); border-radius: 14px; padding: 24px; max-width: 460px; width: calc(100% - 32px);
               background: var(--card); color: var(--ink); box-shadow: 0 16px 48px rgba(28, 27, 25, .18); }
dialog.modal::backdrop { background: rgba(28, 27, 25, .35); }
dialog.modal h2 { margin: 0 0 10px; font-family: var(--serif); font-weight: 400; font-size: 22px; }
dialog.modal p { margin: 0 0 10px; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
dialog.modal label { display: flex; flex-direction: column; gap: 6px; margin: 14px 0 8px; font-size: 13px; color: var(--ink-3); }
dialog.modal textarea { width: 100%; min-height: 96px; resize: vertical; font-size: 14px; line-height: 1.5; }
dialog.modal .hint { font-size: 13px; color: var(--muted); }
dialog#confirm-dialog .confirm-code code { padding: 3px 8px; border-radius: 6px; background: var(--bad-bg); color: var(--bad); }
dialog#confirm-dialog .confirm-code code:empty { display: none; }
dialog#confirm-dialog [data-field]:empty, dialog#confirm-dialog .confirm-code[hidden] { display: none; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.form-error { padding: 8px 10px; border-radius: 8px; background: var(--bad-bg); color: var(--bad) !important; }

/* ---- errors ---- */
.err-pill { margin-top: 4px; width: fit-content; height: 22px; font-family: var(--mono); font-size: 11px; font-weight: 500; text-decoration: none; }
.error-card { border-color: #E9C3BD; background: #FDF6F5; display: flex; flex-direction: column; gap: 8px; }
.error-card.info { border-color: var(--line); background: var(--card); }
.error-card .error-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.error-card .code { padding: 3px 8px; border-radius: 6px; background: var(--bad-bg); color: var(--bad); }
.error-card.info .code { background: var(--chip); color: var(--ink-3); }
.error-card p { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.error-card details { font-size: 13px; color: var(--muted); }
.error-card summary { cursor: pointer; }
.error-card pre { white-space: pre-wrap; word-break: break-word; background: var(--soft); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 8px 0 0; font-size: 11px; }
.error-list { display: flex; flex-direction: column; }
.error-list article { padding: 16px 0; border-top: 1px solid var(--track); display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; }
.error-list article:target { background: #FBF6F1; }
.error-list h3 { margin: 0 0 4px; font-size: 14px; font-weight: 600; }
.error-list p { margin: 0 0 4px; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.pause-note { margin-top: 6px; }

/* ---- sign in ---- */
body.locked { overflow: hidden; }
body.locked .app { filter: blur(3px); opacity: .55; pointer-events: none; user-select: none; }
.ghost { display: block; background: var(--track); border-radius: 8px; }
body.locked nav .ghost { height: 14px; margin: 12px; }
body.locked main .ghost.title { width: 260px; height: 40px; }
body.locked .card-ghost { background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.login-backdrop { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px;
                  background: rgba(28, 27, 25, .28); }
.login-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 16px;
              padding: 32px; box-shadow: 0 20px 60px rgba(28, 27, 25, .2); display: flex; flex-direction: column; gap: 6px; }
.login-card h1 { margin: 4px 0 0; font-size: 30px; }
.login-card p { margin: 0 0 14px; font-size: 14px; color: var(--muted); }
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.login-card input[type=password] { width: 100%; height: 44px; font-size: 15px; }
.login-card input[aria-invalid=true] { border-color: var(--bad); }
.login-card .btn { height: 44px; justify-content: center; font-size: 14px; }

/* ---- responsive ---- */

/* desktop: the sidebar can slide away */
@media (min-width: 1101px) {
  .app.sidebar-collapsed aside { margin-left: -240px; visibility: hidden;
                                 transition: margin-left .28s ease, visibility 0s linear .28s; }  /* hide after sliding out */
  .app.sidebar-collapsed main { padding-left: 72px; }
  .app.sidebar-collapsed .sidebar-open { opacity: 1; visibility: visible; pointer-events: auto; }
}

/* smaller screens: tables keep even gaps, just narrower ones */
@media (max-width: 1320px) {
  .creators-table, .jobs-table { --cell-x: 10px; }
}

/* small laptops, tablets and phones: the sidebar becomes a slim top bar */
@media (max-width: 1100px) {
  .app { flex-direction: column; }
  aside { position: static; width: auto; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
          gap: 8px 16px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .aside-top { display: contents; }  /* top bar: brand, then the menu, then the lock at the end */
  .aside-actions { position: static; order: 3; margin: 0; }
  .online { order: 2; margin: 0 0 0 auto; padding: 0; }  /* top bar: before the lock, pushed right */
  .brand b { padding-right: 0; }
  .sidebar-open, .sidebar-close { display: none; }
  .brand { padding: 0; flex: 1 1 auto; }
  .brand b { font-size: 18px; }
  .brand > span:not(.env-badge) { display: none; }
  .env-badge { margin: 0 0 0 8px; vertical-align: 3px; }
  nav { flex-direction: row; gap: 4px; }
  nav a { min-height: 36px; }
  .run { margin: 0; flex: 1 1 100%; padding: 8px 12px; order: 4; }  /* its own row, below the lock too */
  .run > * { display: inline; }  /* a slim strip in the top bar: one row, parts separated by dots */
  .run > * + *::before { content: " · "; color: var(--muted); }
  main { padding: 20px 16px 48px; gap: 16px; }
  h1 { font-size: 30px; }
  .card { padding: 16px; }
  .card.flush .card-head { padding: 14px 16px 0; }
  header.page { align-items: flex-start; }
  .card.schedule { padding: 14px 16px; }
}

/* phones: every table row becomes a card with labelled values */
@media (max-width: 820px) {
  form.inline .btn { width: 100%; justify-content: center; }
  .run > b { display: block; }  /* phones: the title, then "@creator · time" */
  .run > b + *::before { content: none; }
  .sub { white-space: normal; }
  .card-note { margin: -4px 16px 12px; }
  .card-head .head-actions { width: 100%; gap: 8px; }
  .table-search { flex: 1 1 100%; order: -1; }  /* search gets its own full-width line on top */
  .table-search input { width: 100%; }
  .table-scroll { overflow-x: visible; }

  .creators-table, .creators-table tbody, .posts-table, .posts-table tbody { display: block; }
  .creators-table thead, .posts-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .creators-table tr, .posts-table tr { display: grid; gap: 10px 12px; padding: 14px 16px; border-top: 1px solid var(--track); }
  .creators-table td, .posts-table td { display: block; padding: 0 !important; border: 0; text-align: left !important; min-width: 0; }
  .creators-table td, .jobs-table td, .creators-table .cell-creator, .jobs-table .cell-result { width: auto; max-width: none; min-width: 0; }
  .creators-table .cell-creator, .creators-table .cell-action { position: static; background: transparent; box-shadow: none; }
  .table-frame::before, .table-frame::after { display: none; }
  .creators-table td[data-label]::before, .posts-table td[data-label]::before {
    content: attr(data-label); display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }

  /* creators: a compact, tappable card; the full detail is on the creator's page. Ticking rows
     for bulk actions is a desktop thing. */
  .creators-table .cell-select, .bulk-bar { display: none !important; }
  .card.selecting .head-actions > .btn { display: inline-flex; }
  .mobile-sort { display: block; padding: 0 16px 12px; }
  .mobile-sort label { flex-direction: row; align-items: center; gap: 8px; }
  .mobile-sort select { height: 34px; flex: 1 1 auto; max-width: 220px; }
  .creators-table { min-width: 0; table-layout: auto; }
  .creators-table td { white-space: normal; }
  .creators-table tr { position: relative; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
  .creators-table tr:active { background: var(--soft); }
  .creators-table tr.no-match { display: block; }
  .creators-table tr.pending .cell-pending { grid-column: 1 / -1; }
  .creators-table .cell-creator { grid-column: 1 / 3; grid-row: 1; min-width: 0; }
  .creators-table .cell-creator .who > a:first-child::after { content: ""; position: absolute; inset: 0; }  /* whole card opens the page */
  .creators-table .cell-action, .creators-table .err-pill { position: relative; z-index: 1; }
  .creators-table .cell-action { grid-column: 3; grid-row: 1; justify-self: end; align-self: start; }
  .creators-table td.key-stat { grid-row: 2; }
  .creators-table td.key-stat .sub { display: none; }
  .creators-table td.more-detail { display: none; }
  .creators-table .cell-summary { display: block; grid-column: 1 / -1; grid-row: 3; font-size: 13px; line-height: 1.5;
                                   color: var(--muted); white-space: normal; }

  /* a creator's posts */
  .posts-table tr { grid-template-columns: 52px repeat(4, minmax(0, 1fr)); }
  .posts-table .cell-thumb { grid-column: 1; grid-row: 1 / 3; width: auto; }
  .posts-table .cell-post { grid-column: 2 / -1; grid-row: 1; }
  .posts-table .col-caption { grid-column: 2 / -1; grid-row: 2; width: auto; min-width: 0; font-size: 14px; }
  .posts-table td[data-label] { grid-row: 3; }
  .posts-table td[data-label="Likes"] { grid-column: 2; }
  .posts-table td[data-label="Comments"] { grid-column: 3; }
  .posts-table td[data-label="Plays"] { grid-column: 4; }
  .posts-table td[data-label="Engagement"] { grid-column: 5; }

  /* jobs */
  .jobs-table, .jobs-table tbody { display: block; min-width: 0; }
  .jobs-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .jobs-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 12px 16px;
                   border-top: 1px solid var(--track); }
  .jobs-table td { display: block; padding: 0 !important; border: 0; white-space: normal; text-align: left !important; }
  .jobs-table .cell-id { display: none; }
  .jobs-table .cell-what { grid-column: 1; grid-row: 1; }
  .jobs-table .cell-status { grid-column: 2; grid-row: 1; justify-self: end; }
  .jobs-table .cell-when, .jobs-table .cell-took { font-size: 13px; color: var(--muted); }
  .jobs-table .cell-when { grid-column: 1; grid-row: 2; }
  .jobs-table .cell-took { grid-column: 2; grid-row: 2; justify-self: end; }
  .jobs-table .cell-result { grid-column: 1 / -1; font-size: 14px; }
  .jobs-table .cell-result:empty { display: none; }
  .jobs-table .cell-action { grid-column: 1 / -1; }
  .jobs-table .cell-action:empty { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
  aside, main, .sidebar-open { transition: none !important; }
}
