/* imagestowords client portal. Same system as the admin dashboard: top bar with tabs, one column of cards. */
:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1e222b;
  --line: #2a2f3a;
  --fg: #f2f3f5;
  --muted: #a4abb8;
  --dim: #7b8392;
  --accent: #dc2626;
  --accent-hover: #b91c1c;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #f87171;
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--font); }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
a { color: var(--fg); text-decoration-color: var(--accent); text-underline-offset: 3px; }
button, input, select { font: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Buttons and fields */
.btn { border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 6px; padding: 9px 14px; cursor: pointer; font-weight: 600; }
.btn:hover { background: var(--accent-hover); }
.btn[disabled] { opacity: .6; cursor: default; }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--muted); }
.btn.small { padding: 5px 10px; font-size: 13px; font-weight: 500; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input, select { width: 100%; padding: 9px 11px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); }
.msg { margin: 0; font-size: 14px; min-height: 1.2em; }
.msg.err { color: var(--err); }
.msg.ok { color: var(--ok); }

/* Sign-in, invitation, reset */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; display: grid; gap: 16px; }
/* Safari makes a select as wide as its longest option; keep every field inside the card. */
.auth-card label, .auth-card form { min-width: 0; }
.auth-card select, .auth-card input:not([type=checkbox]), .auth-card textarea { width: 100%; max-width: 100%; min-width: 0; }
.auth-card select { text-overflow: ellipsis; }
.auth-card label { grid-template-columns: minmax(0, 1fr); }
.auth-card .check span { min-width: 0; overflow-wrap: anywhere; }
.auth-card .brand { font-size: 22px; }
#auth-body, #auth-body form { display: grid; gap: 14px; }
.auth-card p { margin: 0; color: var(--muted); }

/* Shell */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 17px; white-space: nowrap; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; min-width: 0; }
.nav button { background: none; border: 0; color: var(--muted); padding: 7px 11px; border-radius: 6px; cursor: pointer; }
.nav button:hover { color: var(--fg); background: var(--surface-2); }
.nav button[aria-current="page"] { color: var(--fg); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--accent); }
.nav .step-btn { display: inline-flex; align-items: center; gap: 7px; }
.nav .step-n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line); font-size: 12px; line-height: 1; }
.nav .step-btn.done .step-n { background: var(--ok); border-color: var(--ok); color: #0d0f13; font-size: 0; }
.nav .step-btn.done .step-n::after { content: "✓"; font-size: 12px; font-weight: 700; }
.nav .step-btn.next .step-n { border-color: var(--accent); color: var(--fg); }
.nav .nav-end { margin-left: auto; }
.next-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.next-bar p { margin: 0; color: var(--muted); }
.flow-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.flow-steps li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.flow-steps li.current { border-color: var(--accent); }
.flow-steps .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); font-size: 13px; }
.flow-steps li.done .dot { background: var(--ok); border-color: var(--ok); color: #0d0f13; font-weight: 700; }
.flow-steps h3 { margin: 0; font-size: 15px; }
.flow-steps p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.who { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.main { max-width: 1180px; margin: 0 auto; padding: 28px 24px 64px; display: grid; gap: 24px; }
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }
.page-head h1 { font-size: 26px; }
.page-head p { margin: 0; color: var(--muted); }

/* Cards and stats */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card h2 { font-size: 16px; margin-bottom: 14px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stats { display: grid; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stats.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat { background: var(--surface); padding: 16px 18px; display: grid; gap: 4px; box-shadow: inset -1px -1px 0 var(--line); }
.stat .label { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.stat .value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 13px; color: var(--muted); }

/* Tables */
.table-wrap { overflow-x: auto; }
.table-wrap table.wide { min-width: 600px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 18px 4px; }

/* Status pills */
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; border: 1px solid currentColor; white-space: nowrap; }
.pill.ok { color: var(--ok); }
.pill.warn { color: var(--warn); }
.pill.err { color: var(--err); }
.pill.muted { color: var(--dim); }

/* Forms on pages */
.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: end; }
.stack { display: grid; gap: 12px; max-width: 420px; }
.linkbox { display: grid; gap: 8px; margin-top: 14px; padding: 14px; border: 1px dashed var(--warn); border-radius: 6px; background: var(--surface-2); }
.linkbox code { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.confirm { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--warn); }

/* Project page */
.prose { max-width: 72ch; display: grid; gap: 10px; color: var(--muted); }
.prose p { margin: 0; }
.prose strong { color: var(--fg); }
.prose ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.checklist li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; color: var(--muted); }
.checklist .mark { font-weight: 700; }
.checklist .done .mark { color: var(--ok); }
.checklist .open .mark { color: var(--warn); }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--fg); color: var(--bg);
  padding: 9px 16px; border-radius: 6px; font-size: 14px; font-weight: 600; z-index: 10; }

@media (max-width: 720px) {
  .topbar { padding: 10px 16px; gap: 8px 12px; }
  .brand { flex: 1; }
  .who { width: auto; }
  .nav { order: 3; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; }
  .nav button { white-space: nowrap; }
  .nav .nav-end { margin-left: 0; }
  .main { padding: 20px 16px 48px; }
  /* Workspace list on its own row, full width, under the name and the sign-out button. */
  #ws-switch { order: 2; flex: 0 0 100%; }
  #ws-switch .ws-select { max-width: none; width: 100%; }
}
@media (max-width: 560px) {
  #who { display: none; }
  .who { gap: 6px; }
}
@media (prefers-reduced-motion: no-preference) {
  .nav button, .btn { transition: background-color .15s ease, color .15s ease, border-color .15s ease; }
}

/* Portal extras */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.step { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.step .dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  border: 2px solid var(--line); color: var(--muted); }
.step.done .dot { border-color: var(--ok); color: var(--ok); }
.step h3 { font-size: 15px; margin: 0 0 2px; }
.step p { margin: 0; color: var(--muted); font-size: 14px; }
.providers { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.provider { display: grid; gap: 10px; align-content: start; }
.provider h3 { font-size: 16px; margin: 0; }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 14px; color: var(--muted); }
.crumbs button { background: none; border: 0; color: var(--fg); cursor: pointer; padding: 2px 4px; border-radius: 4px; text-decoration: underline; text-decoration-color: var(--line); }
.folders { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.folders button { width: 100%; text-align: left; background: var(--surface-2); border: 1px solid var(--line); color: var(--fg);
  padding: 10px 12px; border-radius: 6px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folders button:hover { border-color: var(--muted); }
.thumbs { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; background: var(--surface-2); display: block; }
.check { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 10px; align-items: start; color: var(--fg); font-size: 14px; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
textarea { width: 100%; min-height: 96px; padding: 9px 11px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg);
  color: var(--fg); font: inherit; resize: vertical; }
.fields { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.fields .wide { grid-column: 1 / -1; }
.hint { font-size: 13px; color: var(--dim); }

/* Posts */
.highlight { border-color: var(--accent); }
.linkish { background: none; border: 0; padding: 0; margin-bottom: 6px; color: var(--muted); font: inherit; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.pack-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.pack-link { text-align: left; color: var(--fg); cursor: pointer; font: inherit; }
.pack-link:hover { border-color: var(--muted); }
.pack-link p { margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { background: none; border: 0; color: var(--muted); padding: 6px 12px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--fg); box-shadow: inset 0 -2px 0 var(--accent); }
.post-list { display: grid; gap: 18px; }
.post { display: grid; grid-template-columns: minmax(220px, 380px) minmax(0, 1fr); gap: 20px; padding: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.post-photo { display: grid; gap: 8px; align-content: start; justify-items: start; }
.post-photo img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 6px; background: var(--surface-2); display: block; }
.photo-btn { padding: 0; border: 0; background: none; cursor: zoom-in; width: 100%; }
.post-body { display: grid; gap: 12px; align-content: start; min-width: 0; }
.post-body h3 { font-size: 16px; }
.post-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font-size: 13px; }
.caption { margin: 0; white-space: pre-wrap; max-width: 68ch; }
.tags { margin: 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.post-body details summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.post-body details p { margin: 6px 0 0; font-size: 14px; }
.feedback { margin: 0; color: var(--warn); font-size: 14px; white-space: pre-wrap; }
.review { display: grid; gap: 8px; }
img.broken { opacity: .3; }
@media (max-width: 720px) {
  .post { grid-template-columns: 1fr; padding: 14px; }
}
.carousel { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; width: 100%; }
.carousel img { aspect-ratio: 1; }
.updated { margin: 0; color: var(--ok); font-size: 14px; }
.publish { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.schedule { display: grid; gap: 10px; max-width: 420px; }
.published { margin: 0; color: var(--ok); font-size: 14px; }
.plan-all { display: grid; gap: 12px; }
.sets-card { display: grid; gap: 10px; }
.ws-select { max-width: 220px; }
.set-folders { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.set-folders legend { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.plan-all input[type=datetime-local] { min-width: 0; }
.plan-week { display: grid; gap: 8px; }
.plan-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; width: 100%;
  background: none; border: 0; border-top: 1px solid var(--line); padding: 10px 0 2px; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.plan-row img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; }
.plan-text, .plan-when { display: grid; gap: 2px; min-width: 0; }
.plan-when { text-align: right; font-size: 14px; }
@media (max-width: 560px) {
  .plan-row { grid-template-columns: 48px minmax(0, 1fr); }
  .plan-row img { width: 48px; height: 48px; }
  .plan-when, .plan-row .pill { grid-column: 2; text-align: left; justify-self: start; }
}
.check.inline { display: inline-grid; grid-template-columns: auto auto; gap: 6px; margin-right: 14px; }
input[type="datetime-local"] { color-scheme: dark; }

/* Language switch, plans */
.lang { width: auto; padding: 4px 6px; font-size: 13px; background: var(--surface-2); }
.auth-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.plans { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.plan { display: grid; gap: 10px; align-content: start; }
.plan.current { border-color: var(--ok); }
.plan h3 { font-size: 18px; }
.plan .price { margin: 0; font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.plan .price small { font-size: 14px; font-weight: 500; color: var(--muted); }
.confirm { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--warn); }

/* Agency: bar inside a client workspace, and the shared pack screens (pack-editor.js) */
.agency-bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: center; padding: 10px 16px;
  background: color-mix(in srgb, var(--warn) 18%, var(--surface)); border-bottom: 1px solid var(--warn); font-size: 14px; }
.small { font-size: 13px; }
.linkish.muted { color: var(--muted); }
.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: end; }
.langs { border: 0; padding: 0; margin: 0; }
.langs legend { font-size: 13px; color: var(--muted); padding: 0; margin-bottom: 6px; }
.pack-status { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.stages { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 14px 0 0; counter-reset: step; }
.stages li { counter-increment: step; font-size: 13px; color: var(--dim); padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; }
.stages li::before { content: counter(step) ". "; }
.stages li.done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.stages li.now { color: var(--fg); border-color: var(--accent); background: var(--surface-2); }
.qlist { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--muted); }
.post-fields { display: grid; gap: 12px; min-width: 0; }
.post-fields details summary, .card details summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.client-state p { margin: 6px 0 0; font-size: 14px; color: var(--warn); white-space: pre-wrap; }
.brief { white-space: pre-wrap; margin-top: 12px; color: var(--muted); font-size: 14px; max-width: 90ch; overflow-wrap: anywhere; }
.photo-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-top: 12px; }
.photo-grid figure { margin: 0; display: grid; gap: 4px; font-size: 12px; }
.photo-grid img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 6px; background: var(--bg); display: block; }
.photo-grid figure.picked img { outline: 2px solid var(--ok); outline-offset: 1px; }
.photo-grid figcaption { display: grid; gap: 2px; }
.rewrite { display: grid; gap: 8px; }
.newpost { display: grid; gap: 8px; margin: 12px 0; padding: 12px; border: 1px dashed var(--line); border-radius: 6px; max-width: 640px; }
.pick { display: inline-flex; gap: 6px; align-items: center; color: var(--fg); font-size: 12px; cursor: pointer; }
.pick input { width: auto; margin: 0; }

.kicker { margin: 0 0 4px; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }

.section-title { font-size: 18px; margin: 10px 0 0; }

.sched-card { display: grid; gap: 12px; }
.week-grid { display: grid; gap: 6px; }
.week-row { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.week-day { font-weight: 600; font-size: 14px; }
.week-times { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.time-chip { display: inline-flex; align-items: center; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 2px 4px 2px 8px; }
.time-chip input { background: transparent; border: 0; color: var(--fg); font: inherit; padding: 2px 0; width: auto; }
.chip-x { background: none; border: 0; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; padding: 2px 6px; }
.chip-x:hover { color: var(--fg); }
.queue-list { display: grid; gap: 4px; }
.queue-row { display: grid; grid-template-columns: 24px 48px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.queue-row img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.queue-n { color: var(--muted); font-size: 13px; text-align: center; }
.queue-actions { flex-wrap: nowrap; }
@media (max-width: 560px) {
  .week-row { grid-template-columns: minmax(0, 1fr); }
  .queue-row { grid-template-columns: 24px 48px minmax(0, 1fr); }
  .queue-row .plan-when, .queue-row .queue-actions { grid-column: 3; text-align: left; }
}

/* iPhones zoom in on form fields under 16 px, after which the page slides sideways. */
@media (max-width: 560px) {
  input, select, textarea { font-size: 16px !important; }
}

/* Image report (Beeldscan / Beeldstrategie) */
.report h3 { font-size: 14px; margin: 16px 0 8px; }
.report-summary { font-size: 15px; line-height: 1.6; margin: 0; }
.report-list { margin: 0; padding-left: 20px; display: grid; gap: 8px; line-height: 1.5; }
.report-list.ideas li::marker { font-weight: 700; }
.best-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.best-photo, .lib-photo { margin: 0; min-width: 0; }
.best-photo img, .lib-photo img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: var(--line); display: block; }
.best-photo figcaption { font-size: 13px; line-height: 1.45; margin-top: 6px; }
.lib-group { border-top: 1px solid var(--line); padding: 10px 0; }
.lib-group summary { cursor: pointer; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-weight: 600; }
.lib-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); margin: 10px 0; }
.lib-photo figcaption { font-size: 12px; line-height: 1.35; margin-top: 4px; color: var(--muted, #8a8f98); overflow-wrap: anywhere; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 12px; }
.section-head h2 { font-size: 18px; margin: 0; }

.set-count { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
