/*
 * Hanamori GTM: the approval docket.
 * Light is the docket stock; dark is its carbon copy. Inks have fixed roles:
 * green approved, amber hold, red killed, blue in review. Nothing else is inked.
 */

:root {
  color-scheme: light;
  --paper: #efe6cf;
  --paper-deep: #e6dbbd;
  --sheet: #f8f3e6;
  --field: #fbf8ef;
  --rule: #cfd8e8;
  --rule-strong: #9fb0cf;
  --edge: #d8ccab;
  --ink: #1d2433;
  --ink-2: #474e5c;
  --ink-3: #686150;
  --green: #1e6e46;
  --green-wash: rgba(30, 110, 70, 0.1);
  --amber: #8a5406;
  --amber-bright: #c07a12;
  --amber-wash: rgba(192, 122, 18, 0.13);
  --red: #a3221b;
  --red-wash: rgba(163, 34, 27, 0.09);
  --blue: #33549a;
  --blue-wash: rgba(51, 84, 154, 0.1);
  /* The calendar's clock ("now" line, next post): a mark, not a status ink. */
  --now: #c2410c;
  --lift: 0 1px 0 rgba(20, 18, 12, 0.05), 0 8px 18px -10px rgba(20, 18, 12, 0.28);
  --lift-high: 0 2px 0 rgba(20, 18, 12, 0.05), 0 16px 26px -14px rgba(20, 18, 12, 0.4);
  --font: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --line: 1.5rem;
  --radius: 3px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  /* Names the platform-preview checks still read. */
  --ink-dim: var(--ink-3);
  --mono: var(--font);
  --hold-soft: var(--amber-wash);
  --kill-soft: var(--red-wash);
}

/* The carbon copy. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #15171c;
  --paper-deep: #101216;
  --sheet: #1c1f26;
  --field: #22262e;
  --rule: #2a3243;
  --rule-strong: #3d4a66;
  --edge: #2b2f38;
  --ink: #ece6d6;
  --ink-2: #b9b3a4;
  --ink-3: #948e80;
  --green: #5cc48e;
  --green-wash: rgba(92, 196, 142, 0.13);
  --amber: #e6aa45;
  --amber-bright: #e6aa45;
  --amber-wash: rgba(230, 170, 69, 0.14);
  --red: #f07a6e;
  --red-wash: rgba(240, 122, 110, 0.13);
  --blue: #8fa9e8;
  --blue-wash: rgba(143, 169, 232, 0.14);
  --now: #ff8a4c;
  --lift: 0 1px 0 rgba(0, 0, 0, 0.3), 0 10px 26px -12px rgba(0, 0, 0, 0.7);
  --lift-high: 0 2px 0 rgba(0, 0, 0, 0.3), 0 16px 26px -14px rgba(0, 0, 0, 0.8);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.45;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  caret-color: var(--blue);
  scrollbar-color: var(--rule-strong) transparent;
}
::selection { background: var(--blue-wash); color: var(--ink); }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--rule-strong); border-radius: 6px; border: 3px solid var(--paper); }
::-webkit-scrollbar-track { background: transparent; }

a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 2px; }

h1, h2, h3 { text-wrap: balance; }

/* ---------- Docket header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: 0 1.5rem;
  padding: 0.7rem 1.5rem 0;
  background: var(--paper-deep);
  border-bottom: 1px solid var(--rule-strong);
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding-bottom: 0.7rem;
}
.brand h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  font-stretch: 88%;
  letter-spacing: -0.01em;
}
.brand .tag {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-2);
}
.brand .tag::before { content: "/"; margin-right: 0.75rem; color: var(--rule-strong); }

/* Index tabs along the top edge of the docket. */
.docket-nav { display: flex; gap: 0.25rem; align-self: end; }
.docket-nav a {
  position: relative;
  padding: 0.45rem 0.95rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-2);
  text-decoration: none;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  margin-bottom: -1px;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.docket-nav a:hover { color: var(--ink); background: var(--paper); }
.docket-nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--rule-strong);
}
.header-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  padding-bottom: 0.55rem;
}

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.1rem;
  padding: 0.35rem 0.85rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease), transform 0.12s var(--ease);
}
.btn:hover { border-color: var(--rule-strong); background: var(--sheet); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-primary:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--paper); border-color: var(--edge); color: var(--ink); }
.icon-btn { width: 2.1rem; padding: 0; }

/* Stamps: the decisions. Dry until pressed; the current decision is inked. */
.btn-ok, .btn-hold, .btn-kill, .btn-replied, .btn-review {
  --stamp: var(--ink);
  --stamp-wash: transparent;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 800;
  font-stretch: 80%;
  color: var(--stamp);
  background: transparent;
  border: 2px solid var(--stamp);
  border-radius: 4px;
  padding: 0.3rem 0.8rem;
}
.btn-ok { --stamp: var(--green); --stamp-wash: var(--green-wash); }
.btn-hold { --stamp: var(--amber); --stamp-wash: var(--amber-wash); }
.btn-kill { --stamp: var(--red); --stamp-wash: var(--red-wash); }
.btn-replied, .btn-review { --stamp: var(--blue); --stamp-wash: var(--blue-wash); }
.btn-ok:hover, .btn-hold:hover, .btn-kill:hover, .btn-replied:hover, .btn-review:hover {
  background: var(--stamp-wash);
  border-color: var(--stamp);
}
.btn-ok:active, .btn-hold:active, .btn-kill:active, .btn-replied:active, .btn-review:active,
.btn-ok[aria-pressed="true"], .btn-hold[aria-pressed="true"], .btn-kill[aria-pressed="true"],
.btn-replied[aria-pressed="true"], .btn-review[aria-pressed="true"] {
  background: var(--stamp);
  color: var(--sheet);
}
/* No approve token: the stamps are dry, and say why. */
body:not(.has-approve) .needs-approve {
  border-style: dashed;
  opacity: 0.7;
}
.stamp-note {
  display: none;
  margin: 0;
  font-size: 0.78rem;
  color: var(--ink-3);
}
body:not(.has-approve) .stamp-note { display: block; }

/* ---------- Status stamps ---------- */
.stamp {
  --stamp: var(--ink-3);
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 800;
  font-stretch: 80%;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--stamp);
  border: 1.5px solid currentColor;
  border-radius: 3px;
  white-space: nowrap;
  -webkit-mask-image: var(--grain);
  mask-image: var(--grain);
}
.stamp-green { --stamp: var(--green); }
.stamp-amber { --stamp: var(--amber); }
.stamp-red { --stamp: var(--red); }
.stamp-blue { --stamp: var(--blue); }
.stamp.inked { transform: rotate(-4deg); border-width: 2px; font-size: 0.74rem; padding: 0.18rem 0.6rem; }
.stamp.just-inked { animation: ink-down 0.42s var(--ease) both; }
@keyframes ink-down {
  from { transform: rotate(-9deg) scale(1.6); opacity: 0; filter: blur(2px); }
  60% { opacity: 1; filter: blur(0); }
  to { transform: rotate(-4deg) scale(1); opacity: 1; }
}
:root {
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='60'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='4'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 -2.2 1.9'/></filter><rect width='120' height='60' filter='url(%23n)'/></svg>");
}

/* ---------- Page ---------- */
.main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 4rem;
}

/* Product index: tabs cut into the top of the sheet below. */
.product-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  border-bottom: 1px solid var(--rule-strong);
  margin-bottom: 1.5rem;
}
.product-tab {
  appearance: none;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.product-tab:hover { color: var(--ink); background: var(--paper-deep); }
.product-tab.active {
  color: var(--ink);
  font-weight: 800;
  background: var(--sheet);
  border-color: var(--rule-strong);
}

.panel { padding: 0; }

.empty-state {
  padding: 3.5rem 1.5rem;
  text-align: center;
  color: var(--ink-2);
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius);
  background: var(--sheet);
}
.empty-state h2 { margin: 0 0 0.4rem; color: var(--ink); font-size: 1.2rem; }
.empty-state p { margin: 0; }
.empty-state code { font-size: 0.85em; background: var(--field); padding: 0.1rem 0.35rem; border-radius: 3px; }

.loading {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--ink-3);
  font-weight: 600;
}
.loading::after {
  content: "";
  display: block;
  width: 7rem;
  height: 2px;
  margin: 1rem auto 0;
  background: linear-gradient(90deg, transparent, var(--rule-strong), transparent);
  background-size: 200% 100%;
  animation: rule-run 1.1s linear infinite;
}
@keyframes rule-run { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-2);
  text-decoration: none;
}
.back-link:hover { color: var(--ink); }

/* ---------- Hub: the ledger of plays ---------- */
.play-list {
  background: var(--sheet);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--lift);
}
.play-card {
  display: grid;
  grid-template-columns: 3.5rem 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--rule);
}
.play-card:last-child { border-bottom: 0; }
.play-card::before {
  counter-increment: entry;
  content: "No. " counter(entry, decimal-leading-zero);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-3);
}
.play-list { counter-reset: entry; }
.play-card h3 { margin: 0 0 0.2rem; font-size: 1.05rem; font-weight: 700; }
.play-card .meta { color: var(--ink-3); font-size: 0.82rem; }
.play-card-main { min-width: 0; }
.play-card-title { color: var(--ink); text-decoration: none; }
.play-card-title:hover { text-decoration: underline; }
.play-card-actions { display: flex; gap: 0.5rem; align-items: center; }
.play-card-reply { text-decoration: none; }

/* ---------- Badges and chips ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.1rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--paper);
  border: 1px solid var(--edge);
  border-radius: 3px;
  white-space: nowrap;
}
.badge-strong { color: var(--green); border-color: currentColor; background: transparent; }
.badge-medium { color: var(--amber); border-color: currentColor; background: transparent; }
.badge-weak { color: var(--red); border-color: currentColor; background: transparent; }
.badge-replied-flag {
  color: var(--blue);
  border: 1.5px solid currentColor;
  background: var(--blue-wash);
  font-weight: 700;
  text-decoration: none;
}
a.badge-replied-flag:hover { background: var(--blue); color: var(--sheet); }

.locks { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.75rem 0 0; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
  color: var(--ink-2);
  background: var(--field);
  border: 1px solid var(--edge);
  border-radius: 3px;
}
.chip strong { color: var(--ink); font-weight: 700; }

/* ---------- Toolbars and tallies ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 1rem;
}
input, select, textarea { font: inherit; color: var(--ink); }
.toolbar input, .toolbar select, .token-field input, .field input, .field select {
  min-height: 2.25rem;
  padding: 0.4rem 0.7rem;
  font-size: 0.88rem;
  background: var(--field);
  border: 1px solid var(--edge);
  border-bottom-color: var(--rule-strong);
  border-radius: var(--radius);
}
.toolbar input:focus, .toolbar select:focus, .token-field input:focus, .field input:focus, .field select:focus,
.editor input:focus, .editor textarea:focus, .media-caption:focus, .media-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-wash);
}
.toolbar input[type="search"] { flex: 1; min-width: 220px; }
.toolbar select { min-width: 9rem; }
::placeholder { color: var(--ink-3); opacity: 1; }

.status-counts, .chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.status-counts { margin-bottom: 1.25rem; }
.count-pill, .chip-btn {
  appearance: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  padding: 0.3rem 0.7rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--edge);
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.count-pill span, .chip-btn .n { color: var(--ink); font-weight: 800; }
.count-pill:hover, .chip-btn:hover { border-color: var(--rule-strong); color: var(--ink); background: var(--sheet); }
.count-pill.active, .chip-btn.active {
  color: var(--sheet);
  background: var(--ink);
  border-color: var(--ink);
}
.count-pill.active span, .chip-btn.active .n { color: var(--sheet); }
.chip-btn[data-ink="green"] .dot { background: var(--green); }
.chip-btn[data-ink="amber"] .dot { background: var(--amber-bright); }
.chip-btn[data-ink="red"] .dot { background: var(--red); }
.chip-btn[data-ink="blue"] .dot { background: var(--blue); }
.chip-btn .dot { width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--rule-strong); align-self: center; }

/* ---------- Docket entries (play rows, inventory) ---------- */
.play-header { margin-bottom: 1.25rem; }
.play-header h2 { margin: 0 0 0.3rem; font-size: 1.7rem; font-weight: 800; font-stretch: 92%; letter-spacing: -0.015em; }
.play-header .meta { color: var(--ink-3); font-size: 0.88rem; }

.row-list { display: grid; gap: 0.6rem; }
.row-card {
  background: var(--sheet);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--lift);
  transition: box-shadow 0.3s var(--ease), transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.row-card.expanded { box-shadow: var(--lift-high); border-color: var(--rule-strong); }
.row-list:has(.row-card.expanded) .row-card:not(.expanded) { opacity: 0.72; }
.row-list:has(.row-card.expanded) .row-card:not(.expanded):hover { opacity: 1; }
.row-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.6rem 1.25rem;
  align-items: center;
  padding: 0.95rem 1.2rem;
  cursor: pointer;
}
.row-title { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; }
.row-title h3 { margin: 0; font-size: 1.02rem; font-weight: 700; }
.row-sub { margin-top: 0.3rem; font-size: 0.82rem; color: var(--ink-3); }
.row-actions-inline { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: flex-end; }
.row-body {
  display: none;
  padding: 0.25rem 1.2rem 1.2rem;
  border-top: 1px solid var(--rule);
}
.row-card.expanded .row-body { display: block; }

.fields-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0 1.5rem;
  margin-top: 0.5rem;
}
.field { padding: 0.6rem 0; border-bottom: 1px solid var(--rule); min-width: 0; }
.field label {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-3);
}
.field .value { font-size: 0.9rem; color: var(--ink); overflow-wrap: anywhere; white-space: pre-wrap; }
.field.full { grid-column: 1 / -1; }
.field input, .field select { width: 100%; }

.editor { display: grid; gap: 0.75rem; margin-top: 1rem; }
.editor .field { border-bottom: 0; padding: 0; }

/* Ruled writing lines under every editable text. */
.editor input, .editor textarea, .media-caption, .media-input {
  width: 100%;
  padding: 0.4rem 0.7rem;
  font-size: 0.92rem;
  line-height: var(--line);
  color: var(--ink);
  background-color: var(--field);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
}
.editor textarea, .media-caption {
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--line) - 1px), var(--rule) calc(var(--line) - 1px), var(--rule) var(--line));
  background-attachment: local;
  background-position: 0 0.4rem;
  resize: vertical;
  white-space: pre-wrap;
}
.editor textarea { min-height: 12rem; overflow: hidden; field-sizing: content; }
.editor-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.mono-code { font-size: 0.95rem; font-weight: 700; letter-spacing: 0.04em; }

/* ---------- Prospect desk: draft left, dossier right ---------- */
.entry-no { font-size: 0.78rem; font-weight: 800; color: var(--ink-3); }
.row-title h3 { font-size: 1.15rem; font-weight: 800; font-stretch: 94%; }
.facts { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.15rem 0.6rem; font-size: 0.9rem; color: var(--ink-2); }
.facts b { color: var(--ink); font-weight: 700; }
.facts .sep { color: var(--rule-strong); }
.facts .verified { color: var(--green); font-weight: 700; }

.row-card.expanded .row-body { padding: 0; }
.desk { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.desk-work { display: grid; gap: 0.8rem; align-content: start; padding: 1.1rem 1.2rem 1.2rem; background: var(--paper); border-right: 1px solid var(--rule); }
.desk-work .field { border: 0; padding: 0; }
.desk-work input, .desk-work textarea { width: 100%; }
.desk-work input { min-height: 2.3rem; }
.desk-work textarea {
  min-height: 16rem;
  padding: 0.4rem 0.7rem;
  font-size: 0.95rem;
  line-height: var(--line);
  background-color: var(--field);
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--line) - 1px), var(--rule) calc(var(--line) - 1px), var(--rule) var(--line));
  background-attachment: local;
  background-position: 0 0.4rem;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  resize: vertical;
  field-sizing: content;
}
.desk-work input { padding: 0.4rem 0.7rem; font-size: 0.95rem; background: var(--field); border: 1px solid var(--edge); border-radius: var(--radius); }
.desk-work input:focus, .desk-work textarea:focus, .gift-pick select:focus, .gift-pick input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-wash); }
.desk-side { display: grid; gap: 1rem; align-content: start; padding: 1.1rem 1.2rem 1.2rem; }
.side-k { font-size: 0.74rem; font-weight: 800; color: var(--ink-3); margin-bottom: 0.25rem; }
.desk-side p { margin: 0; font-size: 0.93rem; line-height: 1.5; }
.dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.35rem 0.9rem; margin: 0; font-size: 0.88rem; }
.dl dt { color: var(--ink-3); font-weight: 700; font-size: 0.8rem; }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.desk-meta { display: flex; flex-wrap: wrap; gap: 0.3rem 1.25rem; padding: 0.65rem 1.2rem; border-top: 1px solid var(--rule); font-size: 0.8rem; color: var(--ink-3); }
.desk-meta a { color: var(--ink-3); }

/* Gift from inventory */
.gift-slot { display: grid; gap: 0.55rem; padding: 0.75rem 0.85rem; background: var(--sheet); border: 1px dashed var(--rule-strong); border-radius: var(--radius); }
.gift-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem; }
.gift-head .side-k { margin: 0; }
.gift-hint { font-size: 0.8rem; color: var(--ink-3); }
.gift-hint code, .gift-item code { font-size: 0.85em; padding: 0.05rem 0.3rem; background: var(--field); border: 1px solid var(--edge); border-radius: 3px; }
.gift-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.gift-item { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; font-size: 0.88rem; }
.gift-kind { font-weight: 700; }
.gift-note { font-size: 0.78rem; color: var(--ink-3); }
.gift-acts { margin-left: auto; display: flex; gap: 0.25rem; }
.gift-acts .btn { min-height: 1.8rem; padding: 0.2rem 0.55rem; font-size: 0.8rem; }
.gift-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; font-size: 0.88rem; color: var(--ink-2); }
.gift-pick select, .gift-pick input { min-height: 2.1rem; padding: 0.25rem 0.5rem; font-size: 0.88rem; background: var(--field); border: 1px solid var(--edge); border-radius: var(--radius); }
.gift-pick input { width: 4.2rem; }
.gift-mint { display: inline-flex; align-items: center; gap: 0.35rem; }
.gift-mint[hidden] { display: none; }

/* More menu */
.more-menu { position: relative; }
.more-menu summary { list-style: none; }
.more-menu summary::-webkit-details-marker { display: none; }
.more-menu summary::after { content: ""; width: 0.4rem; height: 0.4rem; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); margin-left: 0.2rem; }
.more-menu .menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.3rem);
  z-index: 10;
  display: grid;
  min-width: 11rem;
  padding: 0.3rem;
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  box-shadow: var(--lift-high);
}
.more-menu .menu .btn { justify-content: flex-start; }

@media (max-width: 980px) {
  .desk { grid-template-columns: 1fr; }
  .desk-work { border-right: 0; border-bottom: 1px solid var(--rule); }
}

/* ---------- Media board ---------- */
.media-toolbar {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.6rem 1rem;
  align-items: center;
  margin-bottom: 2rem;
}
.media-toolbar .row-label { font-size: 0.78rem; font-weight: 700; color: var(--ink-3); }
.media-count { grid-column: 1 / -1; margin: 0.25rem 0 0; font-size: 0.85rem; color: var(--ink-3); }

.media-concept { margin-bottom: 2.75rem; }
.media-concept-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: 0.6rem;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--ink);
}
.media-concept-head .no { font-size: 0.85rem; font-weight: 800; color: var(--ink-3); }
.media-concept-head h2 { margin: 0; font-size: 1.45rem; font-weight: 800; font-stretch: 92%; letter-spacing: -0.015em; }
.media-concept-head .meta { margin-left: auto; font-size: 0.82rem; color: var(--ink-3); white-space: nowrap; }
.media-bulk { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.media-bulk .btn[disabled] { opacity: 0.5; cursor: default; }
.media-bulk-note { font-size: 0.8rem; color: var(--ink-3); }
.media-bulk .card-error { flex-basis: 100%; margin: 0; }

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}
.media-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1rem 1.1rem 1.1rem;
  background: var(--sheet);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--lift);
  transition: box-shadow 0.35s var(--ease), transform 0.35s var(--ease), opacity 0.35s var(--ease);
}
.media-card:focus-within { box-shadow: var(--lift-high); transform: translateY(-3px); }
.media-grid:has(.media-card:focus-within) .media-card:not(:focus-within) { opacity: 0.66; }
.media-grid:has(.media-card:focus-within) .media-card:not(:focus-within):hover { opacity: 1; }
.media-card-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--rule);
}
.media-card-head .entry-no { font-size: 0.78rem; font-weight: 800; color: var(--ink-3); }
.media-card-head .platform { font-size: 0.95rem; font-weight: 800; }
.media-card-head .aspect { font-size: 0.8rem; color: var(--ink-3); }
.media-promo { margin: 0.25rem 0 0.5rem; font-size: 0.8rem; color: var(--ink-3); }
.media-promo.is-live { color: var(--ink-2); font-weight: 700; }
.media-promo.is-error { color: var(--red, #b3261e); }
.media-card-head .account { font-size: 0.78rem; font-weight: 700; color: var(--ink-2); border: 1px solid var(--rule-strong); border-radius: 999px; padding: 0 0.45rem; }
.media-card-head .stamp.inked { margin-left: auto; }

.media-preview {
  padding: 1rem 0 0.25rem;
  background: var(--paper);
  border-radius: var(--radius);
}
.media-card .field { border-bottom: 0; padding: 0; }
.media-caption { min-height: calc(var(--line) * 5 + 0.8rem); }
.media-input { min-height: 2.3rem; }
.media-notes-box { border-top: 1px solid var(--rule); padding-top: 0.6rem; }
.media-notes-box summary { cursor: pointer; font-size: 0.8rem; font-weight: 700; color: var(--ink-3); }
.media-notes-box summary:hover { color: var(--ink); }
.media-notes { margin-top: 0.5rem; font-size: 0.8rem; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }

.media-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--rule);
}
/* Stamps first, on their own row; saving and the token note follow. */
.media-actions .btn-save { order: 10; }
.media-actions .stamp-note { order: 11; flex-basis: 100%; }
.media-card[aria-busy] .media-actions .btn { cursor: progress; opacity: 0.7; }
.media-actions .btn-save[aria-pressed="true"] { border-color: var(--green); color: var(--green); }
.card-error { margin: 0.4rem 0 0; font-size: 0.8rem; font-weight: 700; color: var(--red); }
.media-actions .card-error { order: 12; flex-basis: 100%; margin: 0; }
/* A card or list writing in the background: its controls wait, the rest of the page does not. */
.row-card[aria-busy] .btn { cursor: progress; opacity: 0.7; }
.row-list[aria-busy] { opacity: 0.6; transition: opacity 0.15s; }

/* ---------- Token slip and toast ---------- */
.token-panel {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(20, 18, 12, 0.45);
}
.token-panel.open { display: flex; }
.token-modal {
  width: min(440px, 100%);
  padding: 1.4rem 1.5rem 1.3rem;
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  box-shadow: var(--lift-high);
  animation: slip-in 0.35s var(--ease) both;
}
@keyframes slip-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.token-modal h2 { margin: 0 0 0.4rem; padding-bottom: 0.5rem; font-size: 1.2rem; font-weight: 800; border-bottom: 2px solid var(--ink); }
.token-modal p { margin: 0 0 1rem; font-size: 0.88rem; color: var(--ink-2); }
.token-field { display: grid; gap: 0.35rem; margin-bottom: 0.85rem; }
.token-field label { font-size: 0.78rem; font-weight: 700; color: var(--ink-3); }
.token-modal .row { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.4rem; }

.toast {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 60;
  max-width: min(380px, calc(100vw - 2.5rem));
  padding: 0.7rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--sheet);
  background: var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--lift-high);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--red); color: #fff; }

/* ---------- Media: Board / Calendar ---------- */
.view-switch { display: flex; gap: 0.3rem; margin: -0.5rem 0 1.25rem; }
.cal-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.9rem; }
.cal-nav { display: flex; align-items: center; gap: 0.35rem; }
.cal-nav .icon-btn { font-size: 1.2rem; }
.cal-month { margin: 0 0.4rem; font-size: 1.5rem; font-weight: 800; font-stretch: 92%; letter-spacing: -0.015em; min-width: 11ch; text-align: center; }
.cal-count-line { font-size: 0.85rem; color: var(--ink-3); }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.25rem; align-items: start; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--sheet);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--lift);
  overflow: hidden;
}
.cal-weekday { padding: 0.45rem 0.6rem; font-size: 0.74rem; font-weight: 800; color: var(--ink-3); border-bottom: 2px solid var(--ink); }
.cal-day { min-height: 7.2rem; padding: 0.35rem 0.4rem 0.45rem; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); display: flex; flex-direction: column; gap: 0.25rem; transition: background 0.15s var(--ease); }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.weekend { background: color-mix(in srgb, var(--paper) 55%, var(--sheet)); }
.cal-day.out { background: var(--paper); }
.cal-day.out .cal-date span:first-child { color: var(--ink-3); opacity: 0.6; }
.cal-day.drop { background: var(--blue-wash); outline: 2px dashed var(--blue); outline-offset: -3px; }
.cal-date { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.82rem; font-weight: 800; }
.cal-day.today .cal-date span:first-child { color: var(--sheet); background: var(--blue); border-radius: 3px; padding: 0 0.35rem; }
.cal-n { font-size: 0.7rem; font-weight: 700; color: var(--ink-3); }
.cal-chips { display: grid; gap: 0.2rem; }
.cal-chip {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  width: 100%;
  min-width: 0;
  padding: 0.18rem 0.35rem;
  font: inherit;
  font-size: 0.74rem;
  text-align: left;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--edge);
  border-radius: 3px;
  cursor: grab;
}
.cal-chip:hover { border-color: var(--rule-strong); }
.cal-chip.selected { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.cal-chip.dragging { opacity: 0.4; }
.cal-chip .dot { width: 0.45rem; height: 0.45rem; flex: none; border-radius: 50%; background: var(--rule-strong); }
.cal-chip[data-ink="green"] .dot { background: var(--green); }
.cal-chip[data-ink="amber"] .dot { background: var(--amber-bright); }
.cal-chip[data-ink="red"] .dot { background: var(--red); }
.cal-chip[data-ink="blue"] .dot { background: var(--blue); }
.cal-chip .t { font-weight: 700; color: var(--ink-2); }
.cal-chip .pl { flex: none; font-size: 0.66rem; font-weight: 800; padding: 0 0.25rem; border: 1px solid var(--edge); border-radius: 2px; color: var(--ink-2); }
.cal-chip .c { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-side { position: sticky; top: 4.5rem; display: grid; gap: 0.7rem; padding: 1rem; max-height: calc(100vh - 6rem); overflow: auto; background: var(--sheet); border: 1px solid var(--edge); border-radius: var(--radius); box-shadow: var(--lift); }
.cal-side-head { display: flex; align-items: center; gap: 0.5rem; }
.cal-side-head .platform { font-size: 1rem; font-weight: 800; }
.cal-side-head .btn { margin-left: auto; }
.cal-count { margin-left: auto; font-weight: 800; color: var(--ink-3); }
.cal-side-title { margin: 0; font-weight: 700; }
.cal-note { margin: 0; font-size: 0.8rem; color: var(--ink-3); }
.cal-tray { display: grid; gap: 0.8rem; }
.cal-group { display: grid; gap: 0.25rem; }
.cal-group-title { font-size: 0.78rem; font-weight: 800; color: var(--ink-2); }
.cal-when { display: grid; gap: 0.45rem; padding-top: 0.6rem; border-top: 1px solid var(--rule); }
.cal-when label { font-size: 0.74rem; font-weight: 800; color: var(--ink-3); }
.cal-when input { min-height: 2.3rem; padding: 0.35rem 0.6rem; font-size: 0.92rem; background: var(--field); border: 1px solid var(--edge); border-radius: var(--radius); }
.cal-when input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-wash); }
.cal-when-acts { display: flex; gap: 0.4rem; }
.cal-side .pv-phone { width: 270px; }
.view-sep { width: 1px; margin: 0 0.35rem; background: var(--rule-strong); }
.view-switch-group { display: flex; gap: 0.3rem; }
/* Week: the grid takes the full width; the post detail is a drawer, the unscheduled tray sits below. */
.wk-layout { grid-template-columns: minmax(0, 1fr); }
.wk-layout.has-selection .cal-side { position: fixed; top: 4.5rem; right: 1rem; z-index: 20; width: min(380px, calc(100vw - 2rem)); max-height: calc(100vh - 5.5rem); }
.wk-grid {
  position: relative;
  display: grid;
  grid-template-columns: 3.6rem repeat(7, minmax(0, 1fr));
  background: var(--sheet);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--lift);
  overflow: hidden;
}
.wk-corner { padding: 0.45rem 0.4rem; font-size: 0.66rem; font-weight: 800; color: var(--ink-3); border-bottom: 2px solid var(--ink); }
.wk-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.3rem; padding: 0.45rem 0.5rem; font-size: 0.78rem; font-weight: 800; border-bottom: 2px solid var(--ink); border-left: 1px solid var(--rule); }
.wk-head.today span:first-child { color: var(--sheet); background: var(--blue); border-radius: 3px; padding: 0 0.35rem; }
.wk-head.drop, .wk-cell.drop { background: var(--blue-wash); outline: 2px dashed var(--blue); outline-offset: -3px; }
.wk-time { grid-column: 1; padding: 0.3rem 0.4rem; font-size: 0.74rem; font-weight: 800; color: var(--ink-2); border-bottom: 1px solid var(--rule); }
/* An hour with no posts all week stays in the grid, compact (28px) and quieter. */
.wk-time.quiet { font-weight: 600; color: var(--ink-3); }
.wk-cell { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); align-content: start; gap: 0.3rem; min-height: 1.75rem; padding: 0.3rem; border-left: 1px solid var(--rule); border-bottom: 1px solid var(--rule); transition: background 0.15s var(--ease); }
.wk-cell.weekend, .wk-head.weekend { background: color-mix(in srgb, var(--paper) 55%, var(--sheet)); }
.wk-post {
  appearance: none;
  display: grid;
  gap: 0.18rem;
  min-width: 0;
  padding: 0.3rem 0.4rem 0.35rem;
  font: inherit;
  font-size: 0.74rem;
  line-height: 1.3;
  text-align: left;
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--edge);
  border-left: 4px solid var(--rule-strong);
  border-radius: 3px;
  cursor: grab;
}
.wk-post:hover { border-color: var(--rule-strong); }
.wk-post.selected { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.wk-post.dragging { opacity: 0.4; }
.wk-post[data-ink="green"] { border-left-color: var(--green); }
.wk-post[data-ink="amber"] { border-left-color: var(--amber-bright); }
.wk-post[data-ink="red"] { border-left-color: var(--red); }
.wk-post[data-ink="blue"] { border-left-color: var(--blue); }
.wk-top { display: flex; align-items: center; gap: 0.3rem; min-width: 0; }
.wk-t { font-weight: 800; }
.wk-post .pl { flex: none; font-size: 0.64rem; font-weight: 800; padding: 0 0.25rem; border: 1px solid var(--edge); border-radius: 2px; color: var(--ink-2); }
.wk-acct { min-width: 0; font-size: 0.68rem; font-weight: 700; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-title { font-weight: 700; white-space: normal; overflow-wrap: anywhere; }
.wk-meta { display: flex; align-items: center; gap: 0.3rem; font-size: 0.68rem; color: var(--ink-3); }
.wk-meta .dot { width: 0.45rem; height: 0.45rem; flex: none; border-radius: 50%; background: var(--rule-strong); }
.wk-post[data-ink="green"] .dot { background: var(--green); }
.wk-post[data-ink="amber"] .dot { background: var(--amber-bright); }
.wk-post[data-ink="red"] .dot { background: var(--red); }
.wk-post[data-ink="blue"] .dot { background: var(--blue); }
/* The "now" line: a faint guide across the week, the 2px bar across today, and a "now HH:MM" pill on the
   bar at the left of today's column, clear of the gutter's hour label. */
.wk-now { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed color-mix(in srgb, var(--now) 35%, transparent); pointer-events: none; z-index: 2; }
.wk-now-bar { position: absolute; top: -1.5px; height: 2px; background: var(--now); }
.wk-now-label { position: absolute; top: -0.5rem; padding: 0 0.22rem; font-size: 0.62rem; font-weight: 800; line-height: 1rem; white-space: nowrap; color: var(--sheet); background: var(--now); border-radius: 2px; }
.wk-post.is-next { outline: 2px solid color-mix(in srgb, var(--now) 70%, transparent); outline-offset: 1px; }
.wk-next-chip { justify-self: start; padding: 0 0.25rem; font-size: 0.64rem; font-weight: 800; color: var(--now); border: 1px solid var(--now); border-radius: 2px; }
.media-promo.is-warn { color: var(--amber-bright); font-weight: 700; }
.zernio-bar { grid-column: 1 / -1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.8rem; margin: -0.4rem 0 1rem; font-size: 0.82rem; }
.zernio-bar:empty { display: none; }
.zernio-label { color: var(--ink-2); font-weight: 700; }
.zernio-trial { font-weight: 700; color: var(--ink); }
.zernio-drift-banner { flex-basis: 100%; padding: 0.6rem 0.8rem; border: 1px solid var(--red); background: var(--red-wash); color: var(--red); border-radius: var(--radius); }
.zernio-drift-banner a { color: inherit; font-weight: 700; text-decoration: underline; }
.zernio-drift-banner details { margin-top: 0.3rem; color: var(--ink); }
.zernio-sync-ok { flex-basis: 100%; margin: 0; color: var(--green); }
.zernio-counts { font-weight: 700; }
.zernio-plan .chip-btn { margin-left: 0.3rem; }
.zernio-preview { flex-basis: 100%; }
.zernio-preview summary { cursor: pointer; font-weight: 700; color: var(--ink-2); }
.zernio-plan { margin: 0.4rem 0 0; padding-left: 1.1rem; display: grid; gap: 0.2rem; }
.wk-drift, .drift-mark { justify-self: start; font-size: 0.66rem; font-weight: 800; padding: 0 0.3rem; border-radius: 2px; color: var(--sheet); background: var(--red); }
.drift-mark { flex: none; }
.drift-note { color: var(--red); font-weight: 700; }
.confirm-dialog { max-width: 26rem; padding: 1.2rem 1.3rem; color: var(--ink); background: var(--sheet); border: 1px solid var(--edge); border-radius: var(--radius); box-shadow: var(--lift); }
.confirm-dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.confirm-dialog h2 { margin: 0 0 0.5rem; font-size: 1.1rem; }
.confirm-dialog p { margin: 0 0 1rem; font-size: 0.9rem; }
.confirm-acts { display: flex; justify-content: flex-end; gap: 0.5rem; }
.wk-code { justify-self: start; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.02em; padding: 0 0.3rem; border: 1px dashed var(--ink-3); border-radius: 2px; color: var(--ink-2); }
/* Phone width: the days stack, each with its own times; empty slots and the time gutter go. */
@media (max-width: 760px) {
  .wk-grid { display: flex; flex-direction: column; }
  .wk-grid > * { order: var(--o, 0); }
  .wk-corner, .wk-time, .wk-cell.empty { display: none; }
  .wk-head { border-left: 0; }
  .wk-cell { border-left: 0; grid-template-columns: 1fr; }
}
@media (max-width: 1100px) {
  .cal-layout { grid-template-columns: 1fr; }
  .cal-side { position: static; max-height: none; }
}
@media (max-width: 640px) {
  .cal-day { min-height: 4.5rem; }
  .cal-chip .c, .cal-chip .t { display: none; }
}

/* Signed in through Cloudflare Access: no token box. */
body.signed-in #btn-token { display: none; }

/* ---------- Small screens ---------- */
@media (max-width: 860px) {
  .app-header { grid-template-columns: 1fr auto; padding: 0.6rem 1rem 0; }
  .docket-nav { grid-column: 1 / -1; grid-row: 2; }
  .brand { padding-bottom: 0.4rem; }
  .header-actions { padding-bottom: 0.4rem; }
}
@media (max-width: 640px) {
  .main { padding: 1.25rem 1rem 3rem; }
  .brand .tag { display: none; }
  .row-head { grid-template-columns: 1fr; }
  .row-actions-inline { justify-content: flex-start; }
  .play-card { grid-template-columns: 1fr; gap: 0.5rem; }
  .media-grid { grid-template-columns: 1fr; }
  .product-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .product-tab { flex: none; }
  /* Five section tabs are wider than a phone: they scroll sideways, like the product tabs. */
  .docket-nav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .docket-nav a { flex: none; }
  .media-toolbar { grid-template-columns: 1fr; }
  .media-concept-head { flex-wrap: wrap; }
  .media-concept-head .meta { margin-left: 0; }
  .btn-text-hide { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}


/* ---------- Platform previews (media-preview.js) ---------- */
.media-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
}
.pv-ic { flex: none; display: block; }
.pv-dim { opacity: 0.62; }
.pv-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #111;
  font-weight: 600;
  flex: none;
  font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
}
.pv-verified { flex: none; }

/* Phones: a 9:16 video canvas with the app's UI drawn over it. */
.pv-phone {
  --pv-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  width: 300px;
  padding: 9px;
  border-radius: 38px;
  background: #050505;
  box-shadow: 0 0 0 1px #2c2c2e, 0 18px 40px rgba(0, 0, 0, 0.45);
  font-family: var(--pv-font);
}
.pv-screen {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: 30px;
  overflow: hidden;
  background: #000;
  color: #fff;
}
.pv-video, .pv-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
}
.pv-video { cursor: pointer; }
.pv-poster {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 1.5rem;
  text-align: center;
  background: radial-gradient(120% 80% at 50% 30%, #2a2f3a 0%, #0d0f14 70%);
}
.pv-poster-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
  text-wrap: balance;
}
.pv-poster-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  pointer-events: auto;
}
.pv-ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  font-size: 13px;
  line-height: 1.3;
}
.pv-ui button, .pv-ui a { pointer-events: auto; }
.pv-top {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 18px;
}
.pv-rail {
  position: absolute;
  right: 8px;
  bottom: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.pv-act {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
}
.pv-act .pv-ic { width: 27px; height: 27px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); }
.pv-bottom {
  position: absolute;
  left: 12px;
  right: 64px;
  bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.pv-who {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
}
.pv-follow, .pv-sub {
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 7px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 600;
}
.pv-sub { background: #fff; color: #0f0f0f; border-color: #fff; border-radius: 999px; text-shadow: none; }
.pv-audio {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
}
.pv-audio span { overflow: hidden; text-overflow: ellipsis; }
.pv-tag { font-weight: 600; }

/* Clamped captions with the app's own "more". */
/* The flex parent gives the clamped text a definite height, so the ::before
   spacer can push the floated "more" down onto the last visible line. */
.pv-clamp { display: flex; font-size: 13.5px; line-height: 1.3; }
.pv-clamp-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--pv-lines);
  overflow: hidden;
}
.pv-clamp-text::before {
  content: "";
  float: right;
  height: calc(100% - 1.3em);
}
.pv-more {
  appearance: none;
  float: right;
  clear: both;
  border: 0;
  background: none;
  padding: 0 0 0 0.3em;
  font: inherit;
  font-weight: 600;
  color: inherit;
  opacity: 0.72;
  cursor: pointer;
  pointer-events: auto;
}
.pv-more[hidden] { display: none; }
.pv-clamp-full {
  display: none;
  max-height: 14em;
  overflow: auto;
  cursor: pointer;
  pointer-events: auto;
}
.pv-clamp.open .pv-clamp-text { display: none; }
.pv-clamp.open .pv-clamp-full { display: block; }

/* Instagram Reels */
.pv-ig-top span { font-size: 21px; }
.pv-ig-audio, .pv-yt-audio {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 2px solid #fff;
}

/* TikTok */
.pv-tt-top { justify-content: center; gap: 18px; font-size: 16px; }
.pv-tt-top .pv-ic { position: absolute; right: 0; }
.pv-tt-fyp { border-bottom: 2px solid #fff; padding-bottom: 3px; }
.pv-tt .pv-rail { bottom: 96px; gap: 14px; }
.pv-tt .pv-bottom { bottom: 60px; }
.pv-tt-av { position: relative; margin-bottom: 6px; }
.pv-tt-av .pv-avatar { border: 2px solid #fff; }
.pv-tt-plus {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fe2c55;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pv-tt-disc {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1e1e1e;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 7px solid #2b2b2b;
}
.pv-tt-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 48px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: space-around;
  font-size: 10.5px;
  text-shadow: none;
}
.pv-tt-add {
  width: 38px;
  height: 25px;
  border-radius: 8px;
  background: #fff;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: -3px 0 0 #25f4ee, 3px 0 0 #fe2c55;
}

/* YouTube Shorts */
.pv-yt-top { font-size: 0; gap: 14px; justify-content: flex-start; }
.pv-yt-top span { flex: 1; }
.pv-yt-title { font-size: 14px; font-weight: 500; }

/* Facebook Reels */
.pv-fb-top span { font-size: 18px; flex: 1; margin-left: 10px; }

/* Feed cards: X, LinkedIn, Threads. Light, as most people read them. */
.pv-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  color: #0f1419;
  border-radius: 14px;
  border: 1px solid #e1e8ed;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.35;
  overflow: hidden;
}
.pv-card .pv-video, .pv-card .pv-poster { position: static; aspect-ratio: 16 / 9; height: auto; }
.pv-card .pv-portrait .pv-video, .pv-card .pv-portrait .pv-poster { aspect-ratio: 4 / 5; }
.pv-card .pv-poster-title { font-size: 1rem; }
.pv-x { padding: 12px 14px 8px; }
.pv-x-row { display: flex; gap: 10px; align-items: flex-start; }
.pv-x-body { flex: 1; min-width: 0; }
.pv-x-head { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.pv-x-head .pv-dim { overflow: hidden; text-overflow: ellipsis; }
.pv-x-more { margin-left: auto; color: #536471; }
.pv-x-text { margin: 2px 0 10px; overflow-wrap: anywhere; }
.pv-x .pv-tag, .pv-x .pv-link { color: #1d9bf0; font-weight: 400; }
.pv-x-media { border-radius: 16px; overflow: hidden; border: 1px solid #cfd9de; }
.pv-x-actions {
  display: flex;
  justify-content: space-between;
  color: #536471;
  font-size: 13px;
  margin: 10px 0 2px;
}
.pv-x-actions span { display: inline-flex; align-items: center; gap: 4px; }

.pv-li { font-size: 14px; color: rgba(0, 0, 0, 0.9); border-radius: 10px; }
.pv-li-head { display: flex; gap: 8px; padding: 12px 14px 8px; align-items: flex-start; }
.pv-li-head .pv-avatar { border-radius: 4px; }
.pv-li-who { display: flex; flex-direction: column; flex: 1; min-width: 0; font-size: 12px; }
.pv-li-who strong { font-size: 14px; }
.pv-li-who .pv-dim { display: inline-flex; align-items: center; gap: 4px; }
.pv-li-follow { display: inline-flex; align-items: center; gap: 3px; color: #0a66c2; font-weight: 600; font-size: 14px; }
.pv-li-text { padding: 0 14px 10px; font-size: 14px; }
.pv-li .pv-tag, .pv-li .pv-link { color: #0a66c2; font-weight: 600; }
.pv-li .pv-more { color: rgba(0, 0, 0, 0.6); opacity: 1; font-weight: 400; }
.pv-li-counts {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid #e8e8e8;
}
.pv-li-actions {
  display: flex;
  justify-content: space-around;
  padding: 6px 4px;
  color: rgba(0, 0, 0, 0.6);
  font-weight: 600;
  font-size: 13px;
}
.pv-li-actions span { display: inline-flex; align-items: center; gap: 5px; }

.pv-th { padding: 12px 14px 10px; }
.pv-th .pv-tag, .pv-th .pv-link { color: #0095f6; font-weight: 400; }
.pv-th-actions { display: flex; gap: 16px; margin-top: 10px; color: #424242; }

/* Checks under each preview. */
.pv-checks {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
}
.pv-check { padding: 0.3rem 0.55rem; border-radius: 6px; }
.pv-check.pv-ok { color: var(--ink-3); font-weight: 600; }
.pv-check.pv-warn { background: var(--amber-wash); color: var(--amber); font-weight: 600; }
.pv-check.pv-bad { background: var(--red-wash); color: var(--red); font-weight: 600; }
.media-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.badge-ok { background: var(--ok-soft); color: #9aefc4; }
.badge-hold { background: var(--hold-soft); color: #f5d98a; }
.badge-kill { background: var(--kill-soft); color: #f5a8ad; }

/* Zernio, live (one read per load) */
.zernio-live:empty { display: none; }
[data-zlive]::after { margin-left: 0.3rem; font-weight: 800; }
[data-zlive="in"]::after, [data-zlive="published"]::after { content: "✓"; color: var(--green); }
[data-zlive="syncing"]::after { content: "…"; color: var(--ink-3); }
[data-zlive="failed"]::after, [data-zlive="blocked"]::after { content: "!"; color: var(--red); }

/* Outreach today */
.outreach-caps { margin: 0 0 1.2rem; }
.outreach-day { margin: 0 0 2rem; }
.outreach-day > h2 { font-size: 1.15rem; margin: 0 0 0.8rem; border-bottom: 2px solid var(--ink); padding-bottom: 0.3rem; }
.outreach-group > h3 { font-size: 0.95rem; margin: 1rem 0 0.5rem; }
.outreach-card { border: 1px solid var(--edge); background: var(--sheet); box-shadow: var(--lift); padding: 0.9rem 1rem; margin: 0 0 0.8rem; border-radius: var(--radius); }
.outreach-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.4rem 1rem; }
.outreach-links { display: flex; gap: 0.8rem; align-items: baseline; }
.outreach-subject { margin: 0.5rem 0 0; }
.outreach-text { white-space: pre-wrap; word-break: break-word; font: inherit; font-size: 0.92rem; margin: 0.6rem 0; padding: 0.6rem 0.7rem; background: var(--field); border-left: 3px solid var(--rule-strong); }
.outreach-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.outreach-actions .cal-note { margin-right: auto; }

/* ---------- Paid ads (ads.html) ---------- */
.ads-month { border: 1px solid var(--edge); background: var(--sheet); box-shadow: var(--lift); border-radius: var(--radius); padding: 0.9rem 1rem; margin: 0 0 1.6rem; }
.ads-month-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.3rem 1rem; }
.ads-month-head h2 { margin: 0; font-size: 1.15rem; }
.ads-month-figures { margin: 0; font-variant-numeric: tabular-nums; font-weight: 700; }
.ads-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0.7rem 0 0; }
.ads-ceiling { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.85rem; color: var(--ink-2); }
.ads-ceiling input, .ads-account-form input, .ads-account-form select, .ad-spend-form input, .ad-field input, .ad-field textarea {
  font: inherit; font-size: 0.88rem; background: var(--field); color: var(--ink); border: 1px solid var(--edge); border-radius: var(--radius); padding: 0.3rem 0.45rem;
}
.ads-ceiling input { width: 6.5rem; font-variant-numeric: tabular-nums; }
.ads-accounts { margin: 0.8rem 0 0; font-size: 0.88rem; }
.ads-accounts summary { cursor: pointer; font-weight: 700; color: var(--ink-2); }
.ads-accounts ul { margin: 0.5rem 0; padding-left: 1.1rem; }
.ads-account-form { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.ads-account-form input { flex: 1 1 10rem; min-width: 0; }

/* Spend against a cap: the inks keep their meanings (green fine, amber near, red at the cap). */
.spend-bar { height: 0.5rem; margin: 0.55rem 0 0.4rem; background: var(--paper-deep); border: 1px solid var(--edge); border-radius: 999px; overflow: hidden; }
.spend-fill { display: block; height: 100%; background: var(--green); transition: width 0.4s var(--ease, ease-out); }
.spend-warn .spend-fill { background: var(--amber-bright); }
.spend-stop .spend-fill { background: var(--red); }

.ad-body { display: grid; grid-template-columns: minmax(0, 14rem) minmax(0, 1fr); gap: 0.9rem; margin: 0.6rem 0; }
.ad-body:not(:has(.ad-media)) { grid-template-columns: minmax(0, 1fr); }
.ad-media { margin: 0; }
.ad-media video { display: block; width: 100%; max-height: 16rem; background: var(--paper-deep); border: 1px solid var(--edge); border-radius: var(--radius); }
.ad-media figcaption { margin-top: 0.3rem; }
.ad-facets { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.5rem 0; }
/* Targeting lists (communities, keywords) are long: they wrap inside the card on a phone. */
.ad-facets .badge { white-space: normal; overflow-wrap: anywhere; max-width: 100%; height: auto; }
.ad-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.3rem 1rem; margin: 0.5rem 0 0; }
.ad-facts div { min-width: 0; }
.ad-facts dt { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
.ad-facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.ad-steps { margin: 0.5rem 0 0; padding-left: 1.2rem; font-size: 0.88rem; }
.ad-steps li { margin: 0.15rem 0; }
.ad-edit { display: grid; gap: 0.5rem; margin: 0.6rem 0; padding: 0.7rem; background: var(--paper); border: 1px dashed var(--rule-strong); border-radius: var(--radius); }
.ad-edit-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: 0.5rem; }
.ad-field { display: grid; gap: 0.2rem; font-size: 0.78rem; font-weight: 700; color: var(--ink-3); }
.ad-field input, .ad-field textarea { width: 100%; box-sizing: border-box; font-weight: 400; }
.ad-spend-form { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.ad-spend-form input { width: 7rem; }

@media (max-width: 640px) {
  .ad-body { grid-template-columns: minmax(0, 1fr); }
}
