/* AL Social — admin panel. "AUDI Latvija dark" visual system (spec §4).
   Mobile-first; desktop layout from 768px. No inline styles anywhere (CSP style-src 'self'). */

/* ---------- Fonts (SIL OFL 1.1, licences next to the files) ---------- */
@font-face {
  font-family: "Barlow Condensed";
  src: url("fonts/BarlowCondensed-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Barlow Condensed";
  src: url("fonts/BarlowCondensed-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Work Sans";
  src: url("fonts/WorkSans-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Roboto Mono";
  src: url("fonts/RobotoMono-Variable.ttf") format("truetype");
  font-weight: 100 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #0d0e10;
  --surface: #151619;
  --surface-2: #14171d;
  --line: #2b2d32;
  --text: #f1efe9;
  --muted: #a8aab0;
  --dim: #6d6f76;
  --accent: #d81f2e;
  --ok: #3fae6a;
  --warn: #d4af37;
  --danger-bg: #2a1013;
  --danger-tx: #f0ac93;

  /* derived tints (same hues, low alpha) */
  --accent-press: #b81927;
  --warn-bg: rgba(212, 175, 55, .10);
  --ok-bg: rgba(63, 174, 106, .12);
  --hover: rgba(241, 239, 233, .05);

  --f-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --f-body: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "Roboto Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --r-sm: 6px;
  --r: 8px;
  --r-lg: 10px;
  --gutter: 16px;
  --topbar-h: 56px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tap: 44px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.5 var(--f-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font: 600 .9375rem/1 var(--f-display);
  letter-spacing: .05em;
  text-transform: uppercase;
  text-decoration: none;
}
.skip:focus { top: 8px; }

/* ---------- Type helpers ---------- */
.h {
  font-family: var(--f-display);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  line-height: 1.1;
}
.m {
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: .75rem;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

/* ---------- Logo ---------- */
.logo {
  display: inline-flex;
  align-items: center;
  gap: .28em;
  min-height: var(--tap);
  font-family: var(--f-display);
  font-size: 1.375rem;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: .05em;
  text-decoration: none;
  white-space: nowrap;
}
.logo__al { font-weight: 600; color: var(--text); }
.logo__social { font-weight: 700; color: var(--accent); }
.logo--lg { font-size: 2.25rem; min-height: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  min-height: var(--tap);
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 1.0625rem;
  line-height: 1;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.btn:hover { border-color: var(--dim); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}
.btn--primary:hover { background: var(--accent-press); border-color: var(--accent-press); }
.btn--primary:active { background: var(--accent-press); }
.btn--ghost { background: transparent; color: var(--text); }
.btn--ghost:hover { background: var(--hover); }
.btn--sm { min-height: 36px; padding: 0 12px; font-size: .9375rem; }
.btn--block { width: 100%; }
/* A small visual button still gets a 44px hit area. */
.btn--sm { position: relative; }
.btn--sm::after { content: ""; position: absolute; inset: -4px 0; }

/* ---------- Top bar + tabs ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar__in {
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.add { margin-left: auto; }
.add__text { display: none; }
/* Phone: the red square "+" */
.add {
  width: var(--tap);
  padding: 0;
  font-size: 1.75rem;
  font-weight: 600;
}
.add__plus { transform: translateY(-1px); }

/* Phone: tabs live in a bar at the bottom, in thumb reach. */
.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.tab {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  text-decoration: none;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: .875rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  line-height: 1;
  transition: color .15s var(--ease);
}
.tab:hover { color: var(--text); }
.tab__icon {
  width: 22px; height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tab__label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 5px;
}
.tab[aria-current="page"] { color: var(--text); }
.tab[aria-current="page"] .tab__label::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--accent);
}

.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger-bg);
  color: var(--danger-tx);
  font: 500 .6875rem/1 var(--f-mono);
  letter-spacing: 0;
}

/* ---------- Page ---------- */
.panel { padding-bottom: calc(var(--tabbar-h) + var(--safe-b)); }
.page {
  display: block;
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px var(--gutter) 24px;
}
.page:focus { outline: none; }
.foot {
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px var(--gutter) 24px;
  display: flex;
  justify-content: flex-end;
}
.foot .btn { min-height: var(--tap); padding: 0 16px; color: var(--muted); border-color: transparent; }
.foot .btn:hover { color: var(--text); border-color: var(--line); }

/* ---------- Banners & flash ---------- */
.banner { border-bottom: 1px solid var(--line); }
.banner__in {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px var(--gutter);
  min-height: 48px;
}
.banner__text { flex: 1 1 14em; font-size: .9375rem; font-weight: 500; }
.banner__link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  font: 600 .9375rem/1 var(--f-display);
  letter-spacing: .06em;
  text-transform: uppercase;
  text-underline-offset: 4px;
}
.banner--warn { background: var(--warn-bg); border-bottom-color: rgba(212, 175, 55, .35); }
.banner--warn .banner__text { color: var(--text); }
.banner--warn .banner__text::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  margin-right: 10px;
  background: var(--warn);
  transform: rotate(45deg) translateY(-2px);
}
.banner--warn .banner__link { color: var(--warn); }
.banner--err { background: var(--danger-bg); border-bottom-color: rgba(240, 172, 147, .25); }
.banner--err .banner__text, .banner--err .banner__link { color: var(--danger-tx); }
.banner--err .banner__text::before {
  content: "!";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  margin-right: 10px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  font: 700 .75rem/1 var(--f-mono);
  vertical-align: 1px;
}

.flash, .alert {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: .9375rem;
}
.flash--ok { background: var(--ok-bg); border-color: rgba(63, 174, 106, .35); }
.flash--err, .alert { background: var(--danger-bg); border-color: rgba(240, 172, 147, .25); color: var(--danger-tx); }

/* ---------- Cards, chips, fields ---------- */
.card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font: 500 .6875rem/1 var(--f-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.chip--ok { color: var(--ok); border-color: rgba(63, 174, 106, .45); background: var(--ok-bg); }
.chip--warn { color: var(--warn); border-color: rgba(212, 175, 55, .45); background: var(--warn-bg); }
.chip--err { color: var(--danger-tx); border-color: rgba(240, 172, 147, .25); background: var(--danger-bg); }
.chip--ai { color: var(--text); border-color: var(--muted); }

.stack { display: grid; gap: 16px; }

.field { display: grid; gap: 6px; }
.field__label { font-size: .875rem; font-weight: 500; color: var(--muted); }
.field__hint { font-size: .8125rem; color: var(--muted); }
.field__err { font-size: .875rem; color: var(--danger-tx); }
.field__input,
.field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem; /* ≥16px: no iOS zoom on focus */
  line-height: 1.4;
  transition: border-color .15s var(--ease);
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:hover, .field select:hover, .field textarea:hover, .field__input:hover { border-color: #3a3d44; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible, .field__input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: transparent;
}
.field--err input, .field--err select, .field--err textarea, .field--err .field__input { border-color: var(--danger-tx); }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: 1; } /* --dim is 3.6:1: too faint for text */

/* Segmented toggle: buttons with aria-pressed/aria-selected, or radio + label pairs. */
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg__opt, .seg label, .seg button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  font: 600 .9375rem/1 var(--f-display);
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}
.seg__opt[aria-pressed="true"], .seg__opt[aria-selected="true"], .seg__opt[aria-current],
.seg button[aria-pressed="true"], .seg input:checked + label {
  background: var(--line);
  color: var(--text);
}
.seg input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- Plan slots ---------- */
.slot {
  display: grid;
  grid-template-columns: 52px 56px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 8px 12px 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  color: inherit;
  text-decoration: none;
}
a.slot:hover { border-color: #3a3d44; }
.slot__time { font: 500 .8125rem/1 var(--f-mono); letter-spacing: .04em; color: var(--text); }
.slot__thumb {
  width: 56px; height: 56px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--line);
}
.slot__body { display: grid; gap: 4px; min-width: 0; }
.slot__title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--muted); font-size: .875rem; }
.slot--empty {
  background: transparent;
  border-style: dashed;
  color: var(--muted);
  min-height: 52px;
}
.slot--empty .slot__time { color: var(--muted); }
.slot--warn { border-color: var(--warn); }

/* Platform marks IG · FB · ST — state by colour AND line style (never colour alone). */
.plats { display: inline-flex; gap: 4px; }
.plat {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 20px;
  padding: 0 5px;
  border: 1px dashed var(--dim);
  border-radius: 3px;
  color: var(--muted);
  font: 500 .6875rem/1 var(--f-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.plat[data-state="ok"] { border-style: solid; border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.plat[data-state="err"] {
  border-style: solid;
  border-color: rgba(240, 172, 147, .5);
  background: var(--danger-bg);
  color: var(--danger-tx);
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}

/* ---------- Empty state ---------- */
.empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 40px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--r-lg);
  text-align: center;
}
.empty__h { font-size: 1.375rem; color: var(--text); }
.empty__text { color: var(--muted); max-width: 32ch; }
.empty .btn { margin-top: 8px; }

/* ---------- Sticky action bar (phone: above the tab bar, in thumb reach) ---------- */
.sticky-bar {
  position: sticky;
  bottom: calc(var(--tabbar-h) + var(--safe-b));
  z-index: 10;
  display: flex;
  gap: 8px;
  margin: 16px calc(var(--gutter) * -1) 0;
  padding: 10px var(--gutter);
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.sticky-bar > .btn { flex: 1 1 auto; }

/* ---------- Sheet: bottom sheet on phone, dialog on desktop (use on <dialog>) ---------- */
.sheet {
  position: fixed;
  inset: auto 0 0 0;
  width: 100%;
  max-width: none;
  max-height: 85vh;
  max-height: 85dvh;
  margin: 0;
  padding: 8px var(--gutter) calc(20px + var(--safe-b));
  overflow: auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
}
.sheet::before {
  content: "";
  display: block;
  width: 36px; height: 4px;
  margin: 0 auto 12px;
  border-radius: 2px;
  background: var(--line);
}
.sheet::backdrop { background: rgba(0, 0, 0, .6); }
.sheet__h { font-size: 1.25rem; margin-bottom: 12px; }
dialog.sheet:not([open]) { display: none; }
@media (prefers-reduced-motion: no-preference) {
  dialog.sheet[open] { animation: sheet-up .22s var(--ease); }
  @keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
}

/* ---------- Standalone pages (login, errors) ---------- */
.solo {
  display: grid;
  place-items: center;
  padding: 24px var(--gutter) calc(24px + var(--safe-b));
  background: var(--bg);
}
.solo__main { width: 100%; max-width: 380px; display: grid; gap: 24px; }
.solo__brand { display: grid; justify-items: center; gap: 6px; text-align: center; }
.solo__sub { color: var(--muted); }
.solo__card {
  position: relative;
  padding: 28px 20px 24px;
  border-top: 2px solid var(--accent);
  border-top-left-radius: 2px;
  border-top-right-radius: 2px;
}
.solo__h { font-size: 1.75rem; margin-bottom: 20px; }
.solo__code { margin-bottom: 8px; }
.solo__card .alert { margin-bottom: 16px; }
.solo__card .btn--primary { margin-top: 8px; min-height: 48px; font-size: 1.125rem; }

/* ---------- Desktop ≥ 768px ---------- */
@media (min-width: 768px) {
  :root { --gutter: 32px; --topbar-h: 64px; }
  .panel { padding-bottom: 0; }

  .tabs {
    position: static;
    height: auto;
    padding: 0;
    background: none;
    border: 0;
    gap: 4px;
    margin-left: 24px;
    align-self: stretch;
  }
  .tab {
    flex: 0 0 auto;
    flex-direction: row;
    padding: 0 14px;
    font-size: 1.0625rem;
  }
  .tab__icon { display: none; }
  .tab__label { padding-bottom: 0; align-self: stretch; }
  .tab[aria-current="page"] .tab__label::after { bottom: -1px; }

  .add { width: auto; padding: 0 18px; font-size: 1.0625rem; gap: .4em; }
  .add__plus { font-size: 1.375rem; transform: translateY(-1px); }
  .add__text { display: inline; }

  .page { padding-top: 28px; }
  .empty { padding: 72px 32px; }

  .sticky-bar {
    position: static;
    margin: 24px 0 0;
    padding: 0;
    background: none;
    border: 0;
    justify-content: flex-end;
  }
  .sticky-bar > .btn { flex: 0 0 auto; }

  .sheet {
    inset: 0;
    width: min(480px, calc(100vw - 64px));
    max-height: min(80vh, 720px);
    margin: auto;
    padding: 24px;
    border-bottom: 1px solid var(--line);
    border-radius: var(--r-lg);
  }
  .sheet::before { display: none; }

  .solo__card { padding: 36px 32px 32px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Upload ---------- */
.upload { max-width: 640px; }
.upload__title { font-size: 1.75rem; margin-bottom: 16px; }
.upload__row { display: grid; grid-template-columns: 1fr 96px; gap: 12px; }
.upload__mode { border: 0; padding: 0; margin: 0; min-width: 0; }
.upload__mode .seg { display: flex; }
.upload__mode .seg { gap: 2px; }
.upload__mode .seg label { flex: 1 1 0; min-width: 0; padding: 0 4px; letter-spacing: .02em; font-size: .875rem; white-space: nowrap; }
.upload__file { width: 100%; min-height: var(--tap); color: var(--muted); font: inherit; }
.upload__file::file-selector-button {
  min-height: var(--tap);
  margin-right: 12px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--text);
  font: 600 1.0625rem/1 var(--f-display);
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
}
.upload__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.upload__grid:empty { display: none; }
.upload__item {
  position: relative;
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
}
.upload__thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.upload__item--err .upload__thumb { border-color: var(--danger-tx); }
.upload__item--ok .upload__thumb { border-color: var(--ok); }
.upload__remove {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1.125rem;
  cursor: pointer;
}
.upload__remove::before {
  content: "\2715";
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(13, 14, 16, .8);
}
.upload__remove:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.upload__bar {
  width: 100%;
  height: 6px;
  border: 0;
  border-radius: 3px;
  background: var(--line);
  accent-color: var(--accent);
  appearance: none;
}
.upload__bar::-webkit-progress-bar { background: var(--line); border-radius: 3px; }
.upload__bar::-webkit-progress-value { background: var(--accent); border-radius: 3px; }
.upload__bar::-moz-progress-bar { background: var(--accent); border-radius: 3px; }
.upload__bar[hidden] { display: none; }
.upload__msg { font-size: .8125rem; line-height: 1.3; color: var(--muted); overflow-wrap: anywhere; }
.upload__item--err .upload__msg { color: var(--danger-tx); }
@media (min-width: 768px) {
  .upload__grid { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- Editor (spec §5.3) ----------
   The photo is the hero: a dark stage with a viewfinder reticle (focus) and a pinned @handle (tag).
   Everything else stays quiet. Phone: one column + sticky action bar; desktop: two columns. */
.ed { display: grid; gap: 14px; }
.ed__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.ed__back {
  display: grid;
  place-items: center;
  flex: 0 0 var(--tap);
  width: var(--tap);
  height: var(--tap);
  margin-left: -10px;
  border-radius: var(--r);
  color: var(--text);
  font: 400 2rem/1 var(--f-display);
  text-decoration: none;
}
.ed__back:hover { background: var(--hover); }
.ed__who { flex: 1 1 auto; min-width: 0; display: grid; gap: 3px; }
.ed__author {
  font: 600 1.375rem/1.05 var(--f-display);
  letter-spacing: .03em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ed__meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .8125rem; }
.ed__pos { font: 500 .75rem/1 var(--f-mono); letter-spacing: .08em; color: var(--text); }
.ed__status { color: var(--muted); }
.ed__save {
  flex: 0 1 auto;
  max-width: 46%;
  font: 500 .75rem/1.3 var(--f-mono);
  letter-spacing: .04em;
  color: var(--muted);
  text-align: right;
}
.ed__save[data-state="ok"] { color: var(--ok); }
.ed__save[data-state="err"] { color: var(--danger-tx); }
.ed__save button {
  min-height: var(--tap);
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ⋯ menu */
.menu { position: relative; flex: 0 0 auto; }
.menu__btn {
  display: grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 1.375rem;
  line-height: 1;
  list-style: none;
  cursor: pointer;
}
.menu__btn::-webkit-details-marker { display: none; }
.menu[open] .menu__btn { background: var(--line); }
.menu__list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  display: grid;
  min-width: 232px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
}
.menu__item {
  width: 100%;
  min-height: var(--tap);
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  text-align: left;
  font-size: .9375rem;
}
.menu__item:hover { background: var(--hover); }
.menu__item--danger { color: var(--danger-tx); }

/* Series strip */
.strip { margin: 0 calc(var(--gutter) * -1); }
.strip__list {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 4px var(--gutter) 6px;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: thin;
}
.strip__item { position: relative; flex: 0 0 auto; touch-action: pan-x; }
.strip__link {
  position: relative;
  display: block;
  width: 64px;
  height: 64px;
  border-radius: var(--r-sm);
  outline-offset: 2px;
}
.strip__img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.strip__item.is-active .strip__img { border: 2px solid var(--accent); }
.strip__item--rejected .strip__img { opacity: .35; }
.strip__mark {
  position: absolute;
  right: 3px;
  bottom: 3px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font: 700 .75rem/1 var(--f-body);
}
.strip__mark--ok { background: var(--ok); color: #0d0e10; }
.strip__mark--x { background: var(--danger-bg); color: var(--danger-tx); border: 1px solid var(--danger-tx); }
.strip__item.is-lifted { z-index: 2; }
.strip__item.is-lifted .strip__img { transform: scale(1.08); box-shadow: 0 8px 20px rgba(0, 0, 0, .6); border-color: var(--text); }
@media (prefers-reduced-motion: no-preference) {
  .strip__img { transition: transform .12s var(--ease); }
}
/* Series-order result (live region under the strip); cleared by series-sort.js after a few seconds. */
.strip__state { margin-top: 8px; font: 500 .75rem/1.3 var(--f-mono); letter-spacing: .04em; color: var(--muted); }
.strip__state:empty { display: none; }
.strip__state[data-state="ok"] { color: var(--ok); }
.strip__state[data-state="err"] { color: var(--danger-tx); }
/* Keyboard-only move buttons: invisible until focused. */
.sr-focusable:focus, .sr-focusable:focus-visible {
  position: absolute !important;
  left: 50%;
  top: 100%;
  z-index: 5;
  width: auto;
  height: auto;
  min-height: var(--tap);
  margin: 4px 0 0;
  padding: 0 12px;
  clip: auto;
  clip-path: none;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--text);
  font: 600 .875rem/1 var(--f-display);
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.strip__list:focus-within { padding-bottom: 56px; }

.ed__locked {
  padding: 12px 14px;
  border: 1px solid rgba(212, 175, 55, .45);
  border-radius: var(--r);
  background: var(--warn-bg);
  font-size: .9375rem;
}

.ed__cols { display: grid; gap: 20px; }
.ed__visual { display: grid; gap: 14px; align-content: start; min-width: 0; }

/* Stage: the stage hugs the image, so % positions of the markers are image coordinates. */
.stage {
  position: relative;
  justify-self: center;
  width: fit-content;
  max-width: 100%;
  margin: 0 calc(var(--gutter) * -1);
  background: #000;
  touch-action: manipulation;
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
}
.stage__img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 64vh;
  max-height: 64dvh;
  pointer-events: none;
}
.stage__focus {
  position: absolute;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .55), inset 0 0 0 1px rgba(0, 0, 0, .55);
  pointer-events: none;
}
/* viewfinder ticks */
.stage__focus::before, .stage__focus::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .45);
}
.stage__focus::before { width: 2px; height: 14px; margin: -7px 0 0 -1px; }
.stage__focus::after { width: 14px; height: 2px; margin: -1px 0 0 -7px; }
.stage__tag {
  position: absolute;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .5);
  pointer-events: none;
}
.stage__tag-text {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  padding: 5px 9px;
  border-radius: 4px;
  background: rgba(13, 14, 16, .88);
  color: #fff;
  font: 500 .8125rem/1 var(--f-body);
  white-space: nowrap;
}
.stage__tag-text::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  margin-left: -5px;
  border: 5px solid transparent;
  border-top-color: rgba(13, 14, 16, .88);
}
.stage[data-mode="tag"] .stage__focus, .stage[data-mode="focus"] .stage__tag { opacity: .55; }
.stage:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ed__mode { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.ed__mode-label { font-size: .875rem; color: var(--muted); }
.ed__hint { flex: 1 1 100%; font-size: .8125rem; color: var(--muted); }

/* Preview IG 4:5 / Story 9:16 (works without JS via :has) */
.pv { display: grid; gap: 10px; justify-items: start; }
.pv__seg input { position: absolute; opacity: 0; }
.pv__frames { width: 100%; }
.pv__frame { margin: 0; }
.pv__frame img { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
.pv__frame--feed img { width: min(100%, 360px); height: auto; }
.pv__frame--story img { width: auto; max-width: 100%; height: min(70vh, 560px); }
.pv:has(#pv-feed:checked) .pv__frame--story, .pv:has(#pv-story:checked) .pv__frame--feed { display: none; }
.pv__none { padding: 24px; border: 1px dashed var(--line); border-radius: var(--r); color: var(--muted); font-size: .875rem; }

/* Fields */
.ed__panel { display: grid; gap: 0; align-content: start; min-width: 0; }
.ed__set { display: grid; gap: 22px; margin: 0; padding: 0; border: 0; min-width: 0; }
.ed__set:disabled { opacity: .7; }
.ed__group { display: grid; gap: 12px; }
.ed__h {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font: 600 1rem/1 var(--f-display);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.ed__row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ed__row2--year { grid-template-columns: 1fr 96px; }
.ed__credit { border: 0; padding: 0; margin: 0; min-width: 0; }
.ed__credit .seg { display: flex; gap: 2px; }
.ed__credit .seg label { flex: 1 1 0; min-width: 0; padding: 0 4px; font-size: .875rem; letter-spacing: .02em; white-space: nowrap; }
.field [aria-invalid="true"] { border-color: var(--danger-tx); }

.caption__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.caption__reset {
  min-height: var(--tap);
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-size: .875rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.caption textarea { min-height: 128px; font-size: .9375rem; }
.caption--off textarea { opacity: .55; }
.caption--off .field__label::after { content: " · netiks publicēts"; color: var(--muted); font-weight: 400; }
.plats { margin: 0; padding: 0; border: 0; min-width: 0; gap: 4px; }
.plats legend { width: 100%; margin-bottom: 8px; }
.caption__count { font: 400 .75rem/1.4 var(--f-mono); color: var(--muted); }
.caption.field--err .caption__count { color: var(--danger-tx); }
.caption__state { color: var(--muted); }

/* Checkbox with a 44px row */
.check { display: flex; align-items: center; gap: 12px; min-height: var(--tap); cursor: pointer; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check__box {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--muted);
  border-radius: 5px;
  background: var(--surface-2);
}
.check input:checked + .check__box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .check__box::after {
  content: "";
  display: block;
  width: 7px;
  height: 12px;
  margin: 3px 0 0 7.5px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
.check input:focus-visible + .check__box { outline: 2px solid var(--accent); outline-offset: 2px; }
.check__text { font-weight: 500; }
.check__hint { color: var(--muted); font: 400 .8125rem/1 var(--f-mono); margin-left: 6px; }

.ed__nojs-save { margin-top: 4px; }
.ed__nojs-time { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; flex: 1 1 100%; }
.ed__actions { flex-wrap: wrap; align-items: center; }
.ed__time { flex: 0 1 auto; font-family: var(--f-mono); font-weight: 500; font-size: .875rem; letter-spacing: .04em; }
.ed__actions .ed__approve { flex: 1 1 auto; }
.ed__notes { display: contents; }
.ed__why { font-size: .875rem; color: var(--danger-tx); }
.ed__warn {
  padding: 10px 12px;
  border: 1px solid rgba(212, 175, 55, .45);
  border-radius: var(--r);
  background: var(--warn-bg);
  font-size: .875rem;
}
.ed__warn[data-kind="err"] { border-color: rgba(240, 172, 147, .35); background: var(--danger-bg); color: var(--danger-tx); }

/* Time sheet */
.tsheet__note { margin: -6px 0 10px; font-size: .875rem; color: var(--muted); }
.tsheet__status { font-size: .875rem; color: var(--muted); }
.tsheet__status:empty { display: none; }
.tsheet__list { display: grid; gap: 6px; margin: 8px 0; padding: 0; list-style: none; }
.tsheet__slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
  font: 500 1rem/1 var(--f-mono);
  letter-spacing: .04em;
  text-align: left;
}
.tsheet__slot:hover { border-color: var(--dim); }
.tsheet__slot[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.tsheet__tag { font: 400 .75rem/1 var(--f-body); color: var(--muted); }
.tsheet__other {
  width: 100%;
  min-height: var(--tap);
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.tsheet__other[aria-expanded="true"] { color: var(--muted); }
.tsheet__custom { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 8px; }
.tsheet__warn {
  display: grid;
  gap: 4px;
  margin: 8px 0;
  padding: 10px 12px 10px 28px;
  border: 1px solid rgba(212, 175, 55, .45);
  border-radius: var(--r);
  background: var(--warn-bg);
  color: var(--text);
  font-size: .875rem;
}
.tsheet__foot { display: flex; gap: 8px; margin-top: 12px; }
.tsheet__foot .btn { flex: 1 1 0; }

@media (min-width: 768px) {
  .ed { gap: 18px; }
  .ed__author { font-size: 1.75rem; }
  .strip { margin: 0; }
  .strip__list { padding: 4px 0 6px; }
  .ed__cols {
    grid-template-columns: minmax(0, 1.25fr) minmax(360px, 1fr);
    gap: 32px;
    align-items: start;
  }
  .stage { margin: 0; justify-self: start; }
  .stage__img { max-height: calc(100vh - var(--topbar-h) - 220px); }
  /* Same tracks as .ed__cols, so the action row and its notes sit under the right column. */
  .ed { grid-template-columns: minmax(0, 1.25fr) minmax(360px, 1fr); column-gap: 32px; }
  .ed > * { grid-column: 1 / -1; }
  .ed > .ed__actions, .ed__notes > * { grid-column: 2; }
  .ed__actions { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); justify-content: flex-end; }
  .ed__actions .ed__approve { flex: 0 0 auto; min-width: 200px; }
}

/* ---------- Plan (spec §5.2) ----------
   One page, two layouts. Phone: Iesūtne/Plāns toggle, day list with sticky day headings.
   Desktop: inbox column + week grid (a timing board: mono times down the side, today ruled in red). */
.plan { display: grid; gap: 16px; }
.plan__toggle { display: flex; }
.plan__toggle .seg__opt { flex: 1 1 0; }
.seg__n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--danger-bg);
  color: var(--danger-tx);
  font: 500 .75rem/1 var(--f-mono);
  letter-spacing: 0;
}
.plan__status:empty { display: none; }
/* Drag result: a toast, so the grid never shifts under the pointer. */
.plan__status {
  position: fixed;
  left: var(--gutter);
  right: var(--gutter);
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px);
  z-index: 30;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
  font-size: .9375rem;
}
.plan__status--err { background: var(--danger-bg); border-color: rgba(240, 172, 147, .25); color: var(--danger-tx); }
.plan__h { display: flex; align-items: center; gap: 8px; font-size: 1.25rem; margin-bottom: 12px; }

/* Phone: only the chosen half of the toggle is shown; the week grid is desktop-only. */
.plan__week { display: none; }
.plan[data-view="inbox"] .plan__days { display: none; }
.plan[data-view="plan"] .plan__inbox { display: none; }
.plan__inbox .plan__h { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Inbox cards */
.inbox { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.icard {
  display: grid;
  grid-template-columns: 64px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 80px;
  padding: 8px 12px 8px 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  text-decoration: none;
  color: inherit;
}
.icard:hover { border-color: #3a3d44; }
.icard__img { width: 64px; height: 64px; border-radius: var(--r-sm); object-fit: cover; background: var(--line); }
.icard__body { display: grid; gap: 6px; min-width: 0; }
.icard__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icard__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.icard__time { font: 400 .8125rem/1 var(--f-mono); color: var(--muted); }
.chip--ch { color: var(--danger-tx); border-color: rgba(240, 172, 147, .25); background: var(--danger-bg); }
.chip__n { font-weight: 500; color: var(--text); }

/* Day list */
.day + .day { margin-top: 8px; }
.day__h {
  position: sticky;
  top: var(--topbar-h);
  z-index: 5;
  margin: 0 calc(var(--gutter) * -1) 8px;
  padding: 12px var(--gutter) 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-size: 1.125rem;
  color: var(--muted);
}
.day__h--today { color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.day__list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.day__none { padding: 4px 0 8px; color: var(--muted); font-size: .9375rem; }
.day__more { margin-top: 16px; }
.slot__free { grid-column: 2 / -1; font: 500 .75rem/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; }
.slot__ser { font: 500 .75rem/1 var(--f-mono); color: var(--muted); letter-spacing: .04em; }
.slot__model { color: var(--muted); }
.slot.slot--warn { background: var(--warn-bg); }

@media (min-width: 768px) {
  .plan {
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 28px;
    align-items: start;
  }
  .plan__toggle, .plan__days { display: none !important; }
  .plan__inbox, .plan__week { display: block !important; }
  .plan__status { left: auto; right: 32px; bottom: 24px; max-width: 420px; }
  .plan__inbox {
    position: sticky;
    top: calc(var(--topbar-h) + 20px);
    max-height: calc(100vh - var(--topbar-h) - 40px);
    overflow: auto;
  }
  .plan__inbox .plan__h { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
  .plan__inbox .empty { padding: 32px 16px; }
  .icard { grid-template-columns: 56px 1fr; min-height: 72px; }
  .icard__img { width: 56px; height: 56px; }
  .icard[draggable="true"] { cursor: grab; }

  /* Week board */
  .wk__head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-bottom: 12px; }
  .wk__title { font-size: 1.5rem; min-width: 7.5em; text-align: center; }
  .wk__nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--tap);
    height: var(--tap);
    border: 1px solid var(--line);
    border-radius: var(--r);
    color: var(--text);
    font-size: 1.5rem;
    text-decoration: none;
  }
  .wk__nav:hover { background: var(--hover); }
  .wk__now { margin-left: 8px; }
  .wk__hint { flex-basis: 100%; color: var(--muted); font-size: .8125rem; }
  .wk__empty { margin-bottom: 12px; color: var(--muted); }

  .wk { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0; }
  .wk th, .wk td { border-bottom: 1px solid var(--line); }
  .wk__corner { width: 56px; }
  .wk__day {
    padding: 10px 6px 8px;
    border-top: 2px solid transparent;
    text-align: left;
    font: 600 .9375rem/1.1 var(--f-display);
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .wk__dn { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .wk__dd { font: 400 .8125rem/1.4 var(--f-mono); letter-spacing: .04em; }
  .wk__day--today { border-top-color: var(--accent); color: var(--text); background: var(--surface); }
  .wk__time {
    padding: 10px 8px 0 0;
    vertical-align: top;
    text-align: right;
    font: 500 .8125rem/1 var(--f-mono);
    color: var(--muted);
    letter-spacing: .04em;
  }
  .wk__cell { padding: 6px 4px; vertical-align: top; border-left: 1px solid var(--line); }
  .wk__cell > * + * { margin-top: 6px; }
  .wk__cell--today { background: var(--surface); }
  .wk__cell--off {
    background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(43, 45, 50, .55) 6px 7px);
  }
  .wk__free {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    padding: 0;
    font: 500 .6875rem/1 var(--f-mono);
    letter-spacing: .08em;
    text-transform: uppercase;
    transition: background-color .12s var(--ease), border-color .12s var(--ease), color .12s var(--ease);
  }
  .plan.is-dragging .wk__free { border-color: var(--muted); color: var(--muted); }
  .plan .wk__free.slot--drop { border: 1px solid var(--accent); background: rgba(216, 31, 46, .16); color: var(--text); }
  .wk__free.is-busy { opacity: .6; }
  /* Drop zone under a taken slot (another platform): only while something is being dragged. */
  .wk__free--more { display: none; min-height: 36px; }
  .plan.is-dragging .wk__free--more { display: flex; }
  .wk__gone { display: block; min-height: 56px; }

  .wk__ph {
    display: grid;
    gap: 5px;
    padding: 4px 4px 6px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r);
    color: inherit;
    text-decoration: none;
  }
  .wk__ph:hover { border-color: #3a3d44; }
  .wk__ph[draggable="true"] { cursor: grab; }
  .wk__ph.slot--warn { border-color: var(--warn); }
  .wk__ph--manual { border-style: dashed; }
  .wk__img { width: 100%; height: 56px; border-radius: var(--r-sm); object-fit: cover; background: var(--line); }
  .wk__name { padding: 0 2px; font-size: .8125rem; font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .wk__meta { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 2px; }
  .wk__meta .plat { min-width: 24px; height: 18px; padding: 0 3px; font-size: .625rem; }
  .wk__meta .chip { height: 18px; padding: 0 5px; font-size: .625rem; }
  .is-dragging.icard, .is-dragging.wk__ph { opacity: .45; }
}

/* ---------- Publicēts (spec §5.5) ----------
   A results sheet, not a card grid: one panel, rows ruled by hairlines. Each row reads left → right as
   who · when · where it went. Problems carry a red rule on the left edge and their two actions;
   the platform marks are the only links out to Meta (solid = live, struck through = failed). */
.pub { display: grid; gap: 16px; }
.pub__head { display: grid; gap: 12px; }
.pub__h { font-size: 1.75rem; }
.pub__filter { display: flex; }
.pub__filter .seg__opt { flex: 1 1 0; padding: 0 10px; }
.pub__note { color: var(--muted); font-size: .875rem; }

.plist {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.prow {
  display: grid;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  border-left: 3px solid transparent;
}
.prow + .prow { border-top: 1px solid var(--line); }
.prow[data-state="err"] { border-left-color: var(--accent); background: linear-gradient(90deg, rgba(216, 31, 46, .07), transparent 60%); }
.prow[data-state="warn"] { border-left-color: var(--warn); }

.prow__main {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  grid-template-areas: "img who" "img time";
  column-gap: 12px;
  row-gap: 2px;
  align-items: center;
  min-height: var(--tap);
  color: inherit;
  text-decoration: none;
  border-radius: var(--r-sm);
}
.prow__main:hover .prow__name { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--dim); }
.prow__img { grid-area: img; width: 56px; height: 56px; border-radius: var(--r-sm); object-fit: cover; background: var(--line); }
.prow__who { grid-area: who; display: grid; min-width: 0; align-self: end; }
.prow__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow__model { color: var(--muted); font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow__time { grid-area: time; align-self: start; font: 500 .8125rem/1.3 var(--f-mono); letter-spacing: .04em; color: var(--muted); }

.prow__out { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.prow__chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.plats--links { gap: 8px; }
.plats--links .plat { min-width: 34px; height: 28px; font-size: .75rem; }
/* A live post: 44×44 tap target — 44px wide, and the 28px mark gets 8px of invisible hit area above and below. */
.plats--links .plat--link { position: relative; min-width: var(--tap); gap: 3px; text-decoration: none; }
.plat--link::before { content: ""; position: absolute; inset: -8px 0; }
.plat--link::after { content: "↗"; font-size: .75em; }
.plat--link:hover { background: rgba(63, 174, 106, .22); }

.perr { flex-basis: 100%; display: grid; gap: 4px; margin: 2px 0 0; padding: 0; list-style: none; font-size: .875rem; color: var(--danger-tx); }
.perr li { display: flex; gap: 8px; min-width: 0; }
.perr__t { flex: 0 0 auto; font: 500 .75rem/1.6 var(--f-mono); letter-spacing: .06em; color: var(--muted); }
.perr__x { min-width: 0; overflow-wrap: anywhere; }

.prow__act { display: flex; gap: 8px; }
.prow__act form { display: flex; flex: 1 1 0; }
.prow__act .btn { flex: 1 1 auto; padding: 0 14px; font-size: .9375rem; }
.prow__nojs { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 auto; }
.prow__nojs input {
  min-height: var(--tap);
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg);
}

.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pager__n { font: 500 .8125rem/1 var(--f-mono); color: var(--muted); letter-spacing: .06em; }

/* Editor, read-only: where the photo went live. */
.ed__locked { display: grid; gap: 10px; }
.ed__live .perr { margin-top: 8px; }
.ed__live-link { color: var(--text); font-size: .9375rem; text-underline-offset: 3px; }

@media (min-width: 768px) {
  .pub__head { grid-template-columns: 1fr auto; align-items: end; }
  .pub__filter { display: inline-flex; }
  .pub__filter .seg__opt { flex: 0 0 auto; padding: 0 16px; }
  .prow {
    /* Fixed action track, so the platform column lines up on rows with and without actions. */
    grid-template-columns: minmax(260px, 1fr) minmax(0, 1.3fr) 268px;
    align-items: center;
    column-gap: 24px;
    padding: 10px 16px 10px 14px;
  }
  .prow__main { grid-template-columns: 56px minmax(0, 1fr) auto; grid-template-areas: "img who time"; }
  .prow__time { align-self: center; text-align: right; }
  .prow__who { align-self: center; }
  .prow__act { grid-column: 3; justify-content: flex-end; }
  .prow__act form { flex: 0 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .plat--link { transition: none; }
}

/* ---------- Settings ---------- */
.set { max-width: 960px; margin: 0 auto; }
.set__title { font-size: 1.75rem; }
.set__sec { scroll-margin-top: 72px; }
.set__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.set__h { font-size: 1.25rem; }
.set__status { font-size: 1.0625rem; font-weight: 500; }
.set__note { color: var(--muted); font-size: .875rem; max-width: 68ch; }
.set__empty { color: var(--muted); }
.set__rules { display: grid; gap: 16px; }
.set__pw { max-width: 420px; }
.slotdays { display: grid; gap: 4px; align-items: start; }
.slotday { display: grid; gap: 4px; padding: 8px 0; border-top: 1px solid var(--line); }
.slotday__h { font-size: .875rem; font-weight: 600; color: var(--muted); }
.slotday__list { list-style: none; display: grid; gap: 4px; margin: 0; padding: 0; }
.slotrow { display: flex; align-items: center; gap: 8px; min-height: 48px; }
.slotrow__t { flex: 1 1 auto; font: 500 1.125rem/1 var(--f-mono); letter-spacing: .04em; }
.slotrow--off .slotrow__t { color: var(--muted); text-decoration: line-through; }
.slotrow__f { margin: 0; }
.slotrow__b { min-width: 44px; min-height: 44px; }
.slotadd { display: grid; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.slotadd__go { align-self: end; }
.tpl { display: grid; gap: 24px; }
.tpl__label { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: .875rem; font-weight: 500; color: var(--muted); }
.tpl__count { font: 500 .8125rem/1 var(--f-mono); }
.tpl__out {
  margin: 0; padding: 12px 14px; min-height: 96px;
  border: 1px dashed var(--line); border-radius: var(--r); background: var(--bg);
  font: inherit; font-size: .9375rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
}
.tpl__warn { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; color: var(--warn); font-size: .875rem; }
.tpl__warn:empty { display: none; }
#tpl-form textarea { font-family: var(--f-mono); font-size: .9375rem; }

@media (min-width: 768px) {
  .set__rules { grid-template-columns: repeat(3, 1fr); }
  .slotdays { grid-template-columns: repeat(2, 1fr); column-gap: 32px; }
  .slotadd { grid-template-columns: 1fr 1fr auto; align-items: start; }
  .slotadd__go { align-self: start; padding-top: 26px; }
  .tpl { grid-template-columns: 1fr 1fr; }
}
