/* greenbags dashboard — staff admin UI. */
:root {
  --ink: #1d2b22;
  --body: #3d4a41;
  --muted: #7d8a80;
  --line: #e2e7e0;
  --wash: #f4f6f2;
  --paper: #fff;
  --green: #243d2b;
  --lime: #a6cd42;
  --accent: #3c7a28;
  --danger: #b3271e;
  --focus: #1c5fd6;
}
* {
  box-sizing: border-box;
  margin: 0;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--body);
  background: var(--wash);
  font-size: 15px;
  line-height: 1.55;
}
::placeholder {
  color: rgb(125 138 128 / 0.45);
}
:is(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

.app {
  display: flex;
  min-height: 100vh;
}
.side {
  width: 210px;
  flex-shrink: 0;
  background: var(--green);
  color: #e8eee4;
  display: flex;
  flex-direction: column;
  padding: 18px 0;
  position: sticky;
  top: 0;
  height: 100vh;
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 17px;
  padding: 0 18px 16px;
  color: #fff;
}
.side-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--lime);
  display: inline-block;
}
.side nav {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.side nav a {
  color: #cdd8c6;
  text-decoration: none;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 14.5px;
  border-left: 3px solid transparent;
}
.side nav a:hover {
  color: #fff;
  background: rgb(255 255 255 / 0.06);
}
.side nav a.active {
  color: #fff;
  border-left-color: var(--lime);
  background: rgb(255 255 255 / 0.08);
}
.side-user {
  padding: 14px 18px 0;
  font-size: 12.5px;
  color: #9fb096;
  border-top: 1px solid rgb(255 255 255 / 0.12);
}
.side-user span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}
.linkish {
  background: none;
  border: none;
  color: #cdd8c6;
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 0;
  font-size: 12.5px;
}

.content {
  flex: 1;
  padding: 30px 36px 60px;
  max-width: 1080px;
}
.content-wide {
  max-width: none;
}
@media (max-width: 760px) {
  .app {
    flex-direction: column;
  }
  .side {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 8px 10px;
  }
  .side nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .side nav a {
    padding: 8px 10px;
    border-left: none;
  }
  .side-user {
    border: none;
    padding: 0 10px;
  }
  .content {
    padding: 18px 16px 50px;
  }
}

h1 {
  color: var(--ink);
  font-size: 23px;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}
h2 {
  color: var(--ink);
  font-size: 16px;
  margin: 22px 0 10px;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 13px;
}
.wrap {
  max-width: 340px;
}
code {
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 12.5px;
}

.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
}
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 18px;
  min-width: 128px;
}
.card-n {
  font-size: 26px;
  font-weight: 800;
  color: var(--ink);
}
.card-l {
  font-size: 13px;
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin: 10px 0 22px;
}
th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1.5px solid var(--line);
  background: #fafbf8;
}
td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
tr:last-child td {
  border-bottom: none;
}
tr:hover td {
  background: #fafcf7;
}
td.num,
th.num {
  text-align: right;
}
td.empty {
  text-align: center;
  color: var(--muted);
  padding: 26px;
}
.row-inactive td {
  opacity: 0.45;
}
.notes-cell {
  /* left-aligned like every other column; centring was a leftover from when
     this column held only an icon (Marianne, 4 Aug) */
  text-align: left;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 20px;
  background: #e8ebe5;
  color: #5c675f;
}
.badge-new {
  background: #dce9fb;
  color: #1c4f9c;
}
.badge-review {
  background: #fdf0d3;
  color: #8a5f00;
}
.badge-placed {
  background: #e7defa;
  color: #5b3ca8;
}
.badge-despatched {
  background: #d9f2e0;
  color: #1e6e3c;
}
.badge-delivered {
  background: #c8ecd2;
  color: #135c30;
}
/* A survey answered from a delivery the portal never placed (#12). Amber so it
   reads as "needs context", not as a lifecycle state like the badges above. */
.badge-unleashed {
  background: #fdeccd;
  color: #8a5300;
  margin-left: 6px;
}
.badge-cancelled {
  background: #f7dcda;
  color: #9c2019;
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 700;
  font-size: 14.5px;
  padding: 10px 18px;
  border-radius: 8px;
  text-decoration: none;
}
.btn:hover {
  filter: brightness(1.08);
}
.btn-sm {
  padding: 7px 12px;
  font-size: 13px;
}
.btn-ghost {
  background: #fff;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}
.btn-danger {
  background: var(--danger);
}
.btn-ghost.btn-danger {
  color: var(--danger);
  border-color: var(--danger);
  background: #fff;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.filters input[type="search"],
.filters input[type="month"],
.filters input[type="email"],
.filters input:not([type]),
.filters select {
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}
.bulk-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
}

input,
select,
textarea {
  font-family: inherit;
  color: var(--ink);
}
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
}
.inline-form {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin: 4px 0;
}
.inline-form input,
.inline-form select {
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: 13.5px;
  background: #fff;
}
.input-sm {
  width: 170px;
}

.flash {
  background: #e7f4e3;
  border: 1.5px solid #b5d9aa;
  color: #245c17;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
.error {
  background: #fbe9e7;
  border: 1.5px solid #eebbb6;
  color: #8c1d15;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
/* Inline failure text inside a panel (e.g. a confirmation email that did not send). */
.error-text {
  color: var(--danger);
}
.debug-code {
  background: #fdf0d3;
  border: 1.5px solid #ecd9a0;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 10px 0;
  font-size: 14px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 900px) {
  .grid2 {
    grid-template-columns: 1fr;
  }
}
.panel-box {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 16px;
}
.panel-box h2 {
  margin-top: 0;
}
.danger-zone {
  border-color: #eebbb6;
}
dl {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 5px 12px;
  font-size: 14px;
}
dt {
  color: var(--muted);
}
dd {
  color: var(--ink);
}
.actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.add-box {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 10px 0;
}
.add-box summary {
  padding: 11px 14px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}
.add-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 4px 14px 14px;
}
.add-grid input {
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: 13.5px;
}
.add-grid .span2 {
  grid-column: span 2;
}
@media (max-width: 700px) {
  .add-grid {
    grid-template-columns: 1fr;
  }
  .add-grid .span2 {
    grid-column: span 1;
  }
}

.pick-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 16px;
}
.pick-list li a {
  display: block;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 5px;
  text-decoration: none;
  color: var(--ink);
}
.pick-list li a:hover {
  border-color: var(--accent);
}

/* One column (Jez, 2026-07-23): fields read top-to-bottom in the same order
   as the storefront page beside them; two columns cramped the textareas. */
.edit-form .field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 8px;
}
.field-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.field-block input {
  padding: 9px 11px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 400;
}
.field-block textarea {
  font-weight: 400;
}
.field-block.span2 {
  grid-column: span 2;
}
@media (max-width: 860px) {
  .field-block.span2 {
    grid-column: span 1;
  }
}
.edit-form .btn {
  margin-top: 14px;
}

/* storefront abuse limits */
.limits-form {
  display: grid;
  gap: 16px;
  max-width: 620px;
}
.limits-form label {
  display: grid;
  gap: 4px;
  font-weight: 600;
  font-size: 13.5px;
}
.limits-form label span {
  font-weight: 400;
}
.limits-form input {
  max-width: 320px;
}
/* a loosened limit is a temporary state — make it look like one */
.flash.warn {
  border-color: #b8860b;
  background: #fdf6e3;
  color: #6b4e00;
}
@media (prefers-color-scheme: dark) {
  .flash.warn {
    background: #2e2609;
    color: #f0d78c;
  }
}

/* staff previewing the council view — must never be mistaken for the real thing */
.council-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin: 0 0 18px;
  padding: 10px 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--wash);
  font-size: 13.5px;
}
.council-preview label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.council-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.council-head .linkish {
  color: var(--muted);
}

a {
  color: var(--accent);
}

/* ---------- auth ---------- */
.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: var(--green);
}
.auth-card {
  background: #fff;
  border-radius: 14px;
  padding: 34px 36px;
  width: 380px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.3);
}
.auth-card h1 {
  font-size: 20px;
  margin-bottom: 12px;
}
.auth-card label {
  display: block;
  font-weight: 700;
  color: var(--ink);
  font-size: 13.5px;
  margin: 12px 0 5px;
}
.auth-card input {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: 16px;
}
.auth-card .btn {
  width: 100%;
  margin-top: 16px;
  text-align: center;
}
.btn-google {
  background: #fff;
  color: var(--ink);
  border: 1.5px solid var(--line);
  font-weight: 700;
}
.btn-google:hover {
  filter: none;
  border-color: var(--accent);
}
.auth-or {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 4px;
  color: var(--muted, #888);
  font-size: 12.5px;
}
.auth-or::before,
.auth-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ---------- packing slips (A4 print) ---------- */
/* Amatic SC — SSS's decorative brand face on the packing slip (self-hosted). */
@font-face {
  font-family: "Amatic SC";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/amatic-sc-400.woff2") format("woff2");
}
@font-face {
  font-family: "Amatic SC";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/amatic-sc-700.woff2") format("woff2");
}
.slips-body {
  background: #888;
  padding: 20px;
}
.slip-toolbar {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 16px;
}
.slip {
  background: #fff;
  width: 210mm;
  min-height: 285mm;
  margin: 0 auto 20px;
  /* bottom padding reserves the footer artwork's zone (it is ~103mm tall at
     full width and absolutely positioned) so flow content never sits under it */
  padding: 18mm 16mm 112mm;
  font-size: 13.5px;
  color: #222;
  position: relative;
  page-break-after: always;
}
/* One size for every body element — the address and contact rows drifted
   apart and Mel asked for standardised sizing (25 Aug). */
.slip p,
.slip td,
.slip th {
  font-size: 13.5px;
}
.slip-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  /* 6mm, not 14 — the top fold panel must total ≤76mm (fold discipline). */
  margin-bottom: 6mm;
}
.slip-co {
  font-weight: 700;
  color: #2e7d32;
  font-size: 14px;
  letter-spacing: 0.02em;
}
.slip-sub {
  color: #2e7d32;
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.5;
}
/* Circle artwork enlarged into the page margins (Mel, 25 Aug: "kill the
   border above and RHS, enlarge the picture"). Negative offsets pull it past
   the fold-panel's padding box toward the page edge, keeping ~6mm printer-safe
   margin; 76mm wide × ~86mm tall bottoms out ~7mm above the 99mm fold. */
.slip-circle {
  position: absolute;
  top: -12mm;
  right: -10mm;
  width: 76mm;
  object-fit: contain;
}
.slip-meta {
  width: auto;
  border: none;
  margin: 0 0 6mm;
  background: none;
}
.slip-meta td {
  border: none;
  padding: 1.5mm 8mm 1.5mm 0;
}
.slip-label {
  font-weight: 700;
  margin: 5mm 0 1mm;
}
.slip-label-plain {
  margin: 5mm 0 1mm;
}
.slip-strong {
  font-weight: 700;
}
.slip-notes {
  font-style: italic;
}
.slip-addr {
  white-space: pre-line;
}
/* No rule under the title (Emily, 10 Sep) — the rules sit on the table:
   under the header row and under the product row, like their own slip. */
.slip-summary {
  padding-bottom: 1mm;
  margin-top: 8mm;
}
.slip-items {
  border: none;
  background: none;
  margin: 2mm 0;
}
.slip-items th {
  background: none;
  color: #222;
  text-transform: none;
  font-size: 13.5px;
  letter-spacing: 0;
  padding: 2mm 6mm 2mm 0;
  border-bottom: 1px solid #999;
}
.slip-items td {
  border-bottom: 1px solid #999;
  padding: 2.5mm 6mm 2.5mm 0;
}
/* SSS footer artwork — full-bleed across the bottom of the page */
.slip-footer-img {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  display: block;
}

@media print {
  .no-print {
    display: none !important;
  }
  .slips-body {
    background: #fff;
    padding: 0;
  }
  /* A full A4 page per slip so the absolutely-positioned footer artwork
     lands on the bottom edge of the paper (Emily, 10 Sep: "as low as
     possible"). min-height:auto used to let the page collapse to its
     content, which is why the footer floated mid-page in print. */
  .slip {
    margin: 0;
    width: auto;
    height: 297mm;
    min-height: 297mm;
    box-sizing: border-box;
    overflow: hidden;
    box-shadow: none;
    break-after: page;
    page-break-after: always;
  }
  .slip:last-child {
    break-after: auto;
    page-break-after: auto;
  }
  @page {
    size: A4;
    margin: 0;
  }
}

/* ---------- StarshipIT push queue (Orders) ---------- */
.push-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 8px;
  background: #eef6ee;
  border: 1px solid #bfdbbf;
  font-size: 14px;
}
.push-banner-warn {
  background: #fff7e6;
  border-color: #f0c36d;
}
.push-flag {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  color: #8a6d1d;
  background: #fff3cd;
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
}
.push-flag-err {
  color: #8b1a1a;
  background: #fde2e2;
}
.bulk-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 18px;
  padding-left: 18px;
  border-left: 1px solid #d5d5d5;
}

/* ---------- program edit: sections + live preview ---------- */
.edit-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.edit-head h1 {
  margin: 0;
}
/* Form column caps at a readable width; the preview takes everything else
   (Jez, 2026-07-23 — on wide monitors the preview is the star). */
.edit-layout {
  display: grid;
  grid-template-columns: minmax(0, 620px) minmax(360px, 1fr);
  gap: 22px;
  align-items: start;
  margin-top: 10px;
}
.edit-section {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
}
.edit-section > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-weight: 700;
  color: var(--ink);
  user-select: none;
}
.edit-section > summary::-webkit-details-marker {
  display: none;
}
.edit-section > summary::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.15s;
  flex: none;
}
.edit-section[open] > summary::before {
  transform: rotate(45deg);
}
.edit-section[open] > summary {
  border-bottom: 1px solid var(--line);
}
.edit-section .field-grid,
.edit-section > p,
.edit-section .img-slots,
.edit-section .history-table {
  margin: 12px 16px;
}
.sec-title {
  flex: 1;
}
.sec-meta {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: rgb(60 122 40 / 0.09);
  border-radius: 99px;
  padding: 2px 10px;
}
.colour-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.colour-row input[type="color"] {
  width: 42px;
  height: 38px;
  padding: 2px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  cursor: pointer;
  flex: none;
}
.colour-row input:not([type="color"]) {
  flex: 1;
}
.save-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 12px 4px;
  background: linear-gradient(to top, var(--wash) 75%, transparent);
}
.dirty-note {
  font-size: 13px;
  font-weight: 700;
  color: #9a6b00;
}
.dirty-note::before {
  content: "● ";
}

/* per-council sending address */
.sender-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* images */
.img-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.img-slot {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--wash);
}
.img-slot-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
}
.img-thumb {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--paper);
}
.img-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
}
.img-upload {
  display: flex;
  gap: 6px;
  align-items: center;
}
.img-upload input[type="file"] {
  font-size: 11.5px;
  min-width: 0;
  flex: 1;
}

/* history */
.history-table {
  width: calc(100% - 32px);
}
.history-what {
  font-size: 12.5px;
  color: var(--muted);
  max-width: 380px;
}
.history-what em {
  color: var(--accent);
  font-style: normal;
  font-weight: 600;
}

/* preview pane */
.edit-preview {
  position: sticky;
  top: 14px;
}
.preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.preview-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.preview-tab {
  border: 1.5px solid var(--line);
  background: var(--paper);
  border-radius: 99px;
  padding: 4px 11px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--body);
  cursor: pointer;
}
.preview-tab.active {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.preview-widths {
  display: flex;
  gap: 4px;
}
.preview-width {
  border: 1.5px solid var(--line);
  background: var(--paper);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--body);
}
.preview-width[aria-pressed="true"] {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.preview-frame-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 6px rgb(29 43 34 / 0.07);
}
.preview-frame-wrap iframe {
  display: block;
  width: 100%;
  height: min(80vh, 920px);
  border: 0;
}
/* Fixed-width device previews centre the iframe on a wash background. */
.preview-frame-wrap[data-width] {
  background: var(--wash);
}
.preview-frame-wrap[data-width] iframe {
  max-width: 100%;
  margin: 0 auto;
  background: #fff;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.preview-frame-wrap[data-width="390"] iframe {
  width: 390px;
}
.preview-frame-wrap[data-width="768"] iframe {
  width: 768px;
}
.preview-frame-wrap[data-width="1140"] iframe {
  width: 1140px;
}
.preview-note {
  margin-top: 8px;
}
@media (max-width: 1150px) {
  .edit-layout {
    grid-template-columns: 1fr;
  }
  .edit-preview {
    position: static;
    order: -1;
  }
  .preview-frame-wrap iframe {
    height: 60vh;
  }
}

/* activity page */
.audit-subject {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.audit-detail summary {
  cursor: pointer;
  font-size: 12.5px;
  color: var(--accent);
}
.audit-detail code {
  display: block;
  font-size: 11.5px;
  max-width: 420px;
  overflow-wrap: anywhere;
  background: var(--wash);
  border-radius: 6px;
  padding: 6px 8px;
  margin-top: 4px;
}
.nowrap {
  white-space: nowrap;
}

/* ---------- system / requirements register ---------- */
.req-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 8px;
}
.req-chip {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.req-met {
  background: #d9f2e0;
  color: #1e6e3c;
}
.req-enhanced {
  background: #eaf6c8;
  color: #4c6b06;
}
.req-partial {
  background: #fdf0d3;
  color: #8a5f00;
}
.req-later {
  background: #e8ebe5;
  color: #5c675f;
}
.req-deviates {
  background: #dce9fb;
  color: #1c4f9c;
}
.req-section {
  margin-top: 26px;
}
.req-table .req-quote {
  font-style: italic;
  color: var(--body);
  max-width: 360px;
  font-size: 13.5px;
}
.req-table .req-how {
  max-width: 440px;
  font-size: 13.5px;
}
.req-links {
  display: block;
  margin-top: 4px;
}
.req-links a {
  margin-right: 12px;
  font-size: 13px;
  font-weight: 600;
}
.sys-flow {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  margin: 18px 0 6px;
}
.sys-flow h2 {
  margin-top: 0;
}
.sys-flow-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.sys-flow-box {
  flex: 1;
  min-width: 190px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13.5px;
}
.sys-flow-box strong {
  color: var(--ink);
}
.sys-flow-arrow {
  align-self: center;
  color: var(--muted);
  font-size: 18px;
}

/* formatting toolbar (textareas in the program editor) */
.fmt-bar {
  display: flex;
  gap: 4px;
  margin: 2px 0 4px;
}
.fmt-bar button {
  border: 1.5px solid var(--line);
  background: var(--paper);
  border-radius: 6px;
  min-width: 30px;
  padding: 2px 7px;
  font-size: 13px;
  cursor: pointer;
  color: var(--body);
  line-height: 1.5;
}
.fmt-bar button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* requirement groups with source-page images */
.req-group-imaged {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.req-page {
  display: block;
  text-decoration: none;
  position: sticky;
  top: 14px;
}
.req-page img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 5px rgb(29 43 34 / 0.08);
}
.req-page span {
  display: block;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
@media (max-width: 900px) {
  .req-group-imaged {
    grid-template-columns: 1fr;
  }
}

.field-block select {
  padding: 9px 11px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 400;
  background: #fff;
}
.settings-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  margin: 14px 0 22px;
  max-width: 620px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.settings-row:last-child {
  border-bottom: none;
}
.secret-code {
  display: block;
  margin-top: 6px;
  padding: 8px 10px;
  font: 13px/1.4 ui-monospace, Menlo, monospace;
  background: var(--paper-2, #f3f4f1);
  border: 1px solid var(--line);
  border-radius: 6px;
  word-break: break-all;
  user-select: all;
}
.secret-reveal summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--muted, #666);
  margin-top: 4px;
}
.settings-row .btn-sm {
  flex: none;
}
.practice-pill {
  display: inline-block;
  background: #fdf0d3;
  color: #8a5f00;
  font-size: 12px;
  font-weight: 700;
  border-radius: 20px;
  padding: 3px 10px;
  margin-left: 8px;
}

.slip-brand-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}
.slip-brand-form .field-block {
  width: 100%;
}

/* ---------- registry CSV import + add-council wizard ---------- */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
form.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 620px;
  margin-bottom: 22px;
}
form.card > label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}
form.card input[type="text"],
form.card input:not([type]),
form.card input[type="number"],
form.card select {
  font: inherit;
  font-weight: 400;
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
form.card button.btn {
  align-self: flex-start;
}
.mode-pick {
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mode-pick label {
  font-weight: 400;
  font-size: 14px;
  line-height: 1.45;
}
.field-row {
  display: flex;
  gap: 14px;
}
.field-row label {
  flex: 1;
}
.field-row input {
  width: 100%;
}
.slug-line {
  display: flex;
  align-items: center;
  gap: 6px;
}
.slug-line input {
  max-width: 220px;
}
.sample-list {
  columns: 2;
  font-size: 14px;
  color: var(--muted);
  margin: 8px 0 22px;
  padding-left: 20px;
}
.import-actions {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  max-width: none;
}
.import-actions form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.confirm-line {
  font-weight: 400;
  font-size: 14px;
  display: flex;
  gap: 8px;
  align-items: center;
}
@media (max-width: 700px) {
  .sample-list {
    columns: 1;
  }
  .field-row {
    flex-direction: column;
  }
}

/* ---------- analytics mini bars ---------- */
.chart-table {
  width: 100%;
}
.chart-table td {
  padding: 3px 8px 3px 0;
  border: 0;
}
.mini-bar {
  background: #eef2ec;
  border-radius: 4px;
  height: 14px;
  overflow: hidden;
}
.mini-bar-fill {
  background: var(--accent, #578c32);
  height: 100%;
  border-radius: 4px;
}

/* ---------- orders queue: sort, pager, case-management cues ---------- */
.sort-link {
  color: inherit;
  text-decoration: none;
}
.sort-link:hover {
  text-decoration: underline;
}
.archive-toggle {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  white-space: nowrap;
}
.pager {
  display: flex;
  gap: 16px;
  align-items: center;
  margin: 10px 0;
}
/* An active order sitting 5+ business days reads as a case, not a row. */
.bizdays-warn {
  color: var(--danger, #b3261e);
  font-weight: 700;
}

/* First fold panel: A4 folds in thirds (Mel's fold-marked slip, 5 Aug).
   99mm fold minus the 18mm top page padding = 81mm, so Delivery Address
   opens the middle panel. min-height so long notes push rather than clip. */
.slip-fold-panel {
  /* 99mm fold − 18mm page padding − 5mm .slip-label top margin, so the
     "Delivery Address" TEXT lands exactly on the fold line */
  min-height: 76mm;
  position: relative; /* anchors the circle artwork */
  padding-right: 68mm; /* text column never runs under the (enlarged) circle */
}
