/* tokens */
:root {
  color-scheme: light dark;
  /* Surfaces and text */
  --bg: #f7f6f2;
  --fg: #1c1b18;
  --muted: #6a675f;
  --line: #e6e3da;
  --card: #fff;
  /* Accent: active nav, links, primary actions */
  --accent: #1f5fa6;
  --accent-bg: #e4edf8;
  --accent-fg: #164a85;
  /* States: text colour, then its soft surface */
  --warn: #7a4a0a;
  --warn-bg: #f8ecd3;
  --warn-line: #ecd7a8;
  --ok: #35610f;
  --ok-bg: #e5f0dc;
  --bad: #9a2b2b;
  --bad-bg: #f8e3e1;
  --neu: #55534c;
  --neu-bg: #ecebe5;
  /* Owner role pill: reads as neither a state nor an action */
  --owner: #5b3f99;
  --owner-bg: #eee9f7;
  /* Scale */
  --radius-sm: 6px;
  --radius: 12px;
  --radius-pill: 999px;
  --side-w: 14.5rem;
  --side-w-collapsed: 4rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171715;
    --fg: #ecebe6;
    --muted: #a09f97;
    --line: #34332f;
    --card: #21211f;
    --accent: #8dbbee;
    --accent-bg: #1f3249;
    --accent-fg: #a9cdf3;
    --warn: #f2c46f;
    --warn-bg: #3b2a0d;
    --warn-line: #5a4116;
    --ok: #a4cf6b;
    --ok-bg: #1c3010;
    --bad: #f0a09a;
    --bad-bg: #3d1717;
    --neu: #c9c8c1;
    --neu-bg: #302f2b;
    --owner: #c3b0ef;
    --owner-bg: #2a2340;
  }
}
/* base */
* {
  box-sizing: border-box;
}
/* A button rendered as an anchor (.btn) carries its own colour, so the link
   rule must not match it: a:visited (0,1,1) would otherwise beat .btn (0,1,0)
   and paint the label in the fill colour. */
a:not(.btn),
a:not(.btn):visited {
  color: var(--accent);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* Set by app.js to filter a list; beats the component's own display. */
.hide {
  display: none !important;
}
.sprite {
  position: absolute;
  width: 0;
  height: 0;
}
.i {
  width: 1.2rem;
  height: 1.2rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font:
    16px/1.5 system-ui,
    sans-serif;
}
main {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 6rem;
}
h1 {
  font-size: 1.4rem;
  font-weight: 500;
}
h2 {
  font-size: 1.1rem;
  font-weight: 500;
  margin-top: 2rem;
}
h3 {
  font-size: 1rem;
  font-weight: 500;
  margin: 0;
}
.muted,
.help,
.sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0.25rem 0;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
/* shell */
.shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.2s;
}
.shell[data-collapsed="true"] {
  --side-w: var(--side-w-collapsed);
}
.shell > main {
  max-width: 62rem;
  margin: 0;
  padding: 2rem 2rem 6rem;
}
.side {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  padding: 1rem 0.75rem;
  background: var(--card);
  border-right: 1px solid var(--line);
}
.side .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  font-weight: 600;
  white-space: nowrap;
}
.logo {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  flex: none;
  border-radius: 8px;
  background: var(--accent-bg);
  color: var(--accent-fg);
  font-size: 0.75rem;
  font-weight: 700;
}
.brandtext {
  display: grid;
  justify-items: start;
  gap: 0.1rem;
  min-width: 0;
  line-height: 1.2;
}
.env-pill {
  padding: 0.05rem 0.4rem;
  border-radius: var(--radius-pill);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.icon-btn {
  display: none;
  place-items: center;
  width: 2rem;
  height: 2rem;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover {
  background: var(--neu-bg);
  color: var(--fg);
}
.js #sidebar-toggle,
.signout .icon-btn {
  display: grid;
}
#sidebar-toggle .i {
  transition: transform 0.2s;
}
.shell[data-collapsed="true"] #sidebar-toggle .i {
  transform: rotate(180deg);
}
.grp h4 {
  margin: 0 0 0.25rem 0.7rem;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.grp + .grp {
  margin-top: 0.6rem;
}
.side nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.side nav a:visited {
  color: var(--muted);
}
.side nav a:hover {
  background: var(--neu-bg);
  color: var(--fg);
}
.side nav a[aria-current="page"] {
  background: var(--accent-bg);
  color: var(--accent-fg);
  font-weight: 600;
}
.switcher {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0;
}
.acct {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}
.acct form {
  margin: 0;
}
.avatar {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  flex: none;
  border-radius: var(--radius-pill);
  background: var(--neu-bg);
  color: var(--neu);
  font-size: 0.8rem;
  font-weight: 600;
}
.meta {
  display: grid;
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  line-height: 1.3;
}
.meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
}
.shell[data-collapsed="true"]
  :is(.label, .brandtext, .meta, .grp h4, .switcher) {
  display: none;
}
.shell[data-collapsed="true"] .head,
.shell[data-collapsed="true"] .acct {
  flex-direction: column;
}
.shell[data-collapsed="true"] .grp + .grp {
  padding-top: 0.6rem;
  border-top: 1px solid var(--line);
}
.shell[data-collapsed="true"] .side nav a {
  justify-content: center;
  padding: 0.55rem 0;
}
@media (max-width: 46rem) {
  .shell,
  .shell[data-collapsed="true"] {
    grid-template-columns: minmax(0, 1fr);
  }
  .side {
    position: relative;
    height: auto;
    gap: 0.4rem;
    padding: 0.6rem 0.75rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .js #sidebar-toggle {
    display: none;
  }
  .side nav {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
  }
  .grp,
  .shell[data-collapsed="true"] .grp + .grp {
    display: contents;
  }
  .shell .grp h4,
  .shell .meta {
    display: none;
  }
  .shell .label,
  .shell .brandtext {
    display: inline;
  }
  .shell[data-collapsed="true"] .side nav a {
    justify-content: flex-start;
    padding: 0.5rem 0.7rem;
  }
  .shell[data-collapsed="true"] .head,
  .shell[data-collapsed="true"] .acct {
    flex-direction: row;
  }
  .acct {
    position: absolute;
    top: 0.6rem;
    right: 0.75rem;
    margin: 0;
    padding: 0;
    border: 0;
  }
  .shell > main {
    padding: 1rem 1rem 5rem;
  }
}
.app-version {
  margin-top: 2rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}
.side .app-version {
  margin: 0;
  padding: 0 0.7rem;
  text-align: left;
}
.shell[data-collapsed="true"] .side .app-version {
  padding: 0;
  text-align: center;
}
/* controls */
input,
select,
textarea,
button,
.btn {
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--fg);
}
input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
}
textarea {
  resize: vertical;
}
/* A field paired with a small action on one line, e.g. the generated ID. */
.inline {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.inline input {
  flex: 1;
}
input[readonly] {
  background: var(--neu-bg);
  color: var(--muted);
}

/* Buttons (V171-01). A form has one primary action; everything else is
   secondary, danger or ghost. A bare <button> and .btn-primary are the
   primary action, so existing forms keep their look. The global :focus-visible
   ring in base.css covers all five. */
button,
.btn,
.btn-primary {
  cursor: pointer;
  text-decoration: none;
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 500;
}
.btn-secondary {
  background: transparent;
  color: var(--fg);
  border-color: var(--line);
}
.btn-danger {
  background: transparent;
  color: var(--bad);
  border-color: var(--bad);
}
.btn-ghost {
  background: transparent;
  color: var(--accent-fg);
  border-color: transparent;
}
button:disabled,
.btn:disabled {
  background: var(--neu-bg);
  color: var(--muted);
  border-color: var(--line);
  cursor: not-allowed;
}
/* Small layout helpers shared by the V171 pages. */
.row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}
.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}
.actions {
  justify-content: space-between;
}
.row-actions {
  text-align: right;
}
.once {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin: 0;
}
.pick {
  background: var(--accent-bg);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin: 0.75rem 0;
  font-size: 0.9rem;
}
.pick .row {
  margin-top: 0.4rem;
}
.switch {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  margin: 0.75rem 0;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch i {
  position: relative;
  width: 2.4rem;
  height: 1.35rem;
  border-radius: var(--radius-pill);
  background: var(--neu-bg);
  border: 1px solid var(--line);
  transition: background 0.15s;
  flex: none;
}
.switch i::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--line);
  transition: left 0.15s;
}
.switch input:checked + i {
  background: var(--accent);
  border-color: var(--accent);
}
.switch input:checked + i::after {
  left: 1.1rem;
}
.switch input:focus-visible + i {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (max-width: 36rem) {
  .two {
    grid-template-columns: 1fr;
  }
}
.pill {
  display: inline-block;
  padding: 0.05rem 0.55rem;
  border-radius: var(--radius-pill);
  background: var(--neu-bg);
  color: var(--neu);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}
.pill[data-state="ok"] {
  background: var(--ok-bg);
  color: var(--ok);
}
.pill[data-state="attention"] {
  background: var(--warn-bg);
  color: var(--warn);
}
.pill[data-state="bad"] {
  background: var(--bad-bg);
  color: var(--bad);
}
.pill[data-state="accent"] {
  background: var(--accent-bg);
  color: var(--accent-fg);
}
.pill[data-state="owner"] {
  background: var(--owner-bg);
  color: var(--owner);
}
/* Voided is a deliberate state, not an error, so the badge is neutral. */
.badge {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--neu-bg);
  color: var(--neu);
  vertical-align: middle;
}
/* wizard */
/* The New workshop wizard (V171-03): step list, the steps themselves, the
   review list and the footer. Without JavaScript every step shows and the
   submit is visible; app.js hides the submit and drives the footer. */
.steps {
  display: flex;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}
.steps li {
  flex: 1;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  background: var(--neu-bg);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
}
.steps li[data-state="current"] {
  background: var(--accent-bg);
  color: var(--accent-fg);
}
.steps li[data-state="done"] {
  background: var(--ok-bg);
  color: var(--ok);
}

.js .step {
  display: none;
}
.js .step[data-open] {
  display: block;
}

details.more {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
}
details.more summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent-fg);
}

.review {
  margin: 0;
}
.review-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}
.review-label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}
.review-value {
  display: block;
  margin-top: 0.1rem;
  font-weight: 600;
}

.foot {
  display: flex;
  justify-content: space-between;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.wizard-nav {
  display: none;
}
.js .wizard-nav {
  display: flex;
}
.js .wizard-submit {
  display: none;
}

@media (max-width: 36rem) {
  .steps li {
    font-size: 0.8rem;
    padding: 0.5rem;
  }
}

/* cards */
.status {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.status strong {
  display: block;
  font-size: 1.15rem;
}
.status p {
  margin: 0;
  font-size: 0.9rem;
}
.status .dot {
  flex: none;
  width: 0.65rem;
  height: 0.65rem;
  margin-top: 0.5rem;
  border-radius: var(--radius-pill);
  background: currentColor;
}
.status[data-state="ok"] {
  background: var(--ok-bg);
  border-color: var(--ok-bg);
  color: var(--ok);
}
.status[data-state="attention"] {
  background: var(--warn-bg);
  border-color: var(--warn-line);
  color: var(--warn);
}
.status[data-state="bad"] {
  background: var(--bad-bg);
  border-color: var(--bad-bg);
  color: var(--bad);
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.75rem;
}
.card {
  display: grid;
  align-content: start;
  gap: 0.15rem;
  padding: 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.card h2 {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}
.card .value {
  margin: 0.15rem 0;
  font-size: 1.6rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.card .sub {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.card-action {
  margin-top: 0.4rem;
  font-size: 0.85rem;
}
.code {
  font-family: ui-monospace, monospace;
  font-size: 0.75rem;
}
.card h2 a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted var(--muted);
}
/* tables */
/* Access: a row's panel and the Add account panel are collapsed until opened
   (V171-04). Without script they stay open, so the form still works. */
.js tr.panel {
  display: none;
}
.js tr.panel[data-open] {
  display: table-row;
}
.js #access-add-panel,
.js #recipient-add-panel {
  display: none;
}
.js #access-add-panel[data-open],
.js #recipient-add-panel[data-open] {
  display: block;
}
.table-wrap {
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
table {
  width: 100%;
  min-width: 32rem;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th,
td {
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.75rem;
}
tbody tr:last-child td {
  border-bottom: 0;
}
td strong a {
  font-weight: 600;
}
td code {
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  word-break: break-word;
}
.dim {
  color: var(--muted);
  opacity: 0.7;
}
tr[data-quiet] {
  opacity: 0.6;
}
.empty {
  color: var(--muted);
  padding: 1rem 0;
}
.search {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}
.search input[type="text"] {
  flex: 1;
  min-width: 12rem;
}
/* Phone: the order list stacks each row into a small card; the other
   tables keep their columns and scroll sideways inside .table-wrap. */
@media (max-width: 36rem) {
  .table-wrap[data-stack] table {
    min-width: 0;
  }
  .table-wrap[data-stack] thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .table-wrap[data-stack] tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.2rem 0.75rem;
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid var(--line);
  }
  .table-wrap[data-stack] tbody tr:last-child {
    border-bottom: 0;
  }
  .table-wrap[data-stack] td {
    display: block;
    padding: 0;
    border: 0;
  }
  .table-wrap[data-stack] td:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
  }
  .table-wrap[data-stack] td:nth-child(4) {
    grid-column: 2;
    grid-row: 1;
  }
  .table-wrap[data-stack] td:nth-child(3) {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .table-wrap[data-stack] td:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 3;
    font-size: 0.85rem;
    color: var(--muted);
  }
  .table-wrap[data-stack] td:nth-child(2):not(.has-due) {
    display: none;
  }
  .table-wrap[data-stack] td.has-due::before {
    content: "Due ";
  }
}
/* settings */
.group {
  margin: 0 0 1.5rem;
}
.group > h2 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}
.panel {
  margin: 0 0 0.75rem;
  padding: 0 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.stage {
  margin: 0.75rem 0;
  padding: 0 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.stage h3 {
  padding-top: 0.9rem;
}
.stage > .muted {
  margin: 0;
  padding-bottom: 0.6rem;
}
.setting {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: 0.5rem 1.5rem;
  padding: 0.9rem 0;
  border-top: 1px solid var(--line);
}
.stage > .setting:first-child {
  border-top: 0;
}
.setting-info label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
}
.setting-info .help {
  margin: 0.2rem 0 0;
}
.setting-control {
  min-width: 0;
}
.setting-control > .help,
.setting-control > .muted {
  margin: 0.4rem 0 0;
}
.setting.dirty,
.setting.has-error {
  margin: 0 -1rem;
  padding: 0.9rem 1rem;
  border-radius: 8px;
}
.setting.dirty {
  background: var(--accent-bg);
  border-top-color: transparent;
}
.setting.has-error {
  background: var(--bad-bg);
  border-top-color: transparent;
}
.setting.dirty .setting-info label::after {
  content: "Edited";
  margin-left: 0.5rem;
  padding: 0.05rem 0.5rem;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--card);
  font-size: 0.65rem;
  font-weight: 600;
  vertical-align: middle;
}
.control-line {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.control-line input {
  max-width: 14rem;
}
.unit {
  color: var(--muted);
}
.field-error {
  color: var(--bad);
  font-size: 0.85rem;
  margin: 0.4rem 0 0;
}
.field-error:empty {
  display: none;
}
.fld.has-error input,
.fld.has-error select,
.fld.has-error textarea {
  border-color: var(--bad);
}
.confirm-row {
  margin-top: 0.5rem;
}
.js .confirm-row {
  display: none;
}
.js .confirm-row.show {
  display: block;
}
.save-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-end;
  padding: 0.75rem 0;
  background: var(--bg);
  border-top: 1px solid var(--line);
  margin-top: 1.5rem;
}
.save-bar span {
  flex: 1;
  color: var(--muted);
  font-size: 0.9rem;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.4rem 0;
}
.chip {
  padding: 0.15rem 0.5rem;
  font-size: 0.8rem;
  font-family: ui-monospace, monospace;
}
.preview {
  background: var(--bg);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.25rem 0;
}
/* Settings and Messages layout (V171-05): a section list beside collapsible
   sections, and a grouped list with tabs. */
.settings-tools {
  margin: 0 0 1rem;
}
.settings-tools input {
  max-width: 26rem;
}
.set {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}
.toc {
  position: sticky;
  top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.toc a {
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  color: var(--fg);
  text-decoration: none;
  font-size: 0.9rem;
}
.toc a:hover {
  background: var(--neu-bg);
}
.toc a.cur {
  background: var(--accent-bg);
  color: var(--accent-fg);
  font-weight: 600;
}
.sec {
  margin: 0 0 0.75rem;
}
.sec > summary {
  cursor: pointer;
  padding: 0.9rem 1rem;
  font-weight: 600;
  list-style: none;
}
.sec > summary::-webkit-details-marker {
  display: none;
}
.sec > summary::after {
  content: "+";
  float: right;
  color: var(--muted);
}
.sec[open] > summary::after {
  content: "\2212";
}
.sec .body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--line);
}
.tabs {
  margin: 0 0 0.75rem;
}
.messages .clip {
  display: inline-block;
  max-width: 30rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
.messages .msg-roles {
  white-space: nowrap;
}
.messages tr.msg.dirty {
  background: var(--accent-bg);
}
.messages tr.msg.dirty .msg-when::after {
  content: "Edited";
  margin-left: 0.5rem;
  padding: 0.05rem 0.5rem;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--card);
  font-size: 0.65rem;
  font-weight: 600;
}
.preview .unknown {
  color: var(--bad);
  font-weight: 600;
}
@media (max-width: 46rem) {
  .set {
    grid-template-columns: minmax(0, 1fr);
  }
  .toc {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    overflow: auto;
  }
}
@media (max-width: 36rem) {
  .setting {
    grid-template-columns: minmax(0, 1fr);
  }
  .setting.dirty,
  .setting.has-error {
    margin: 0 -0.5rem;
    padding: 0.9rem 0.5rem;
  }
}
/* recipients */
/* Coverage strip (V171-09): one cell per role, amber when nobody holds it,
   red when everyone who does has muted alerts. */
.cov {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
  gap: 0.5rem;
  margin: 0 0 0.75rem;
}
.cov .c {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  background: var(--card);
  font-size: 0.85rem;
}
.cov .c b {
  font-size: 0.9rem;
}
.cov .c span {
  color: var(--muted);
}
.cov .c.warn {
  background: var(--warn-bg);
  border-color: var(--warn-line);
}
.cov .c.warn span {
  color: var(--warn);
}
.cov .c.bad {
  background: var(--bad-bg);
  border-color: var(--bad);
}
.cov .c.bad span {
  color: var(--bad);
}
.owner-alerts {
  margin: 0 0 1rem;
}
.warn-text {
  color: var(--warn);
}
.chat code {
  margin-right: 0.35rem;
}
.row-error td {
  padding-top: 0;
}
.row-error .field-error {
  margin: 0;
}
.switch-form {
  margin: 0;
}
.rcpt {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 1.2fr;
  gap: 0.6rem 1rem;
  align-items: end;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
}
.rcpt:last-child {
  border-bottom: 0;
}
.rcpt[data-active="false"] {
  opacity: 0.65;
}
.rcpt > .badge {
  grid-column: 1 / -1;
  justify-self: start;
}
.fld {
  display: grid;
  gap: 0.2rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.fld input,
.fld select {
  width: 100%;
  font-size: 1rem;
  color: var(--fg);
}
.tog {
  grid-column: 1 / 3;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-size: 0.9rem;
}
.tog input {
  accent-color: var(--accent);
}
.act {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}
.rcpt > .confirm-row {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.rcpt .confirm-row label {
  display: grid;
  gap: 0.25rem;
}
.rcpt .confirm-row input {
  font-size: 1rem;
  color: var(--fg);
}
@media (max-width: 36rem) {
  .rcpt {
    grid-template-columns: minmax(0, 1fr);
  }
  .tog {
    grid-column: auto;
  }
  .act {
    justify-content: flex-start;
  }
}
/* orders */
.crumb {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
}
.order-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}
.order-title h1 {
  margin: 0;
}
.order-head {
  margin: 0.5rem 0 0;
}
.order-head p {
  margin: 0.25rem 0;
}
.waiting {
  color: var(--warn);
  font-weight: 500;
}
.day {
  margin: 1.25rem 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.timeline {
  list-style: none;
  margin: 0 0 0 0.45rem;
  padding: 0;
  border-left: 2px solid var(--line);
}
.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 0.25rem 1rem;
  padding: 0.5rem 0 0.5rem 1.25rem;
  font-size: 0.9rem;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: -0.43rem;
  top: 0.95rem;
  width: 0.7rem;
  height: 0.7rem;
  border: 2px solid var(--muted);
  border-radius: var(--radius-pill);
  background: var(--card);
}
.timeline li[data-kind="alert"]::before {
  border-color: var(--warn);
  background: var(--warn-bg);
}
.timeline li[data-kind="failed-send"]::before {
  border-color: var(--bad);
  background: var(--bad-bg);
}
.timeline li[data-kind="alert"] strong {
  color: var(--warn);
}
.timeline li[data-kind="failed-send"] strong {
  color: var(--bad);
}
.timeline time {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.timeline time small {
  display: block;
  font-size: 0.78rem;
}
.timeline code {
  display: block;
  margin-top: 0.15rem;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  color: var(--muted);
  word-break: break-word;
}
.void-confirm {
  margin: 0.5rem 0;
}
.void-confirm label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}
@media (max-width: 36rem) {
  .timeline li {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }
  .timeline time small {
    display: inline;
    margin-left: 0.5rem;
  }
}
/* Danger zone: reserved for destructive actions such as voiding an order. */
.zone {
  margin-top: 2rem;
  padding: 1rem;
  background: var(--card);
  border: 1px solid var(--bad-bg);
  border-radius: var(--radius);
}
.zone h3 {
  color: var(--bad);
}
/* The Orders filters (V171-06): search, state, stage and the two due dates. */
.filters {
  display: grid;
  grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 0.75rem;
}
.filters-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.5rem;
}
@media (max-width: 46rem) {
  .filters {
    grid-template-columns: minmax(0, 1fr);
  }
}
.zone .help {
  margin: 0.2rem 0 0.6rem;
}
.notice {
  margin-top: 2rem;
  padding: 1rem;
  background: var(--neu-bg);
  border-radius: var(--radius);
}
.notice p {
  margin: 0;
}
/* banners */
.env {
  padding: 0.35rem 1rem;
  font-size: 0.8rem;
  text-align: center;
}
.env-staging {
  background: var(--warn-bg);
  color: var(--warn);
}
.env-production {
  background: var(--bad-bg);
  color: var(--bad);
}
.banner {
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--line);
}
.banner.ok {
  background: var(--ok-bg);
  color: var(--ok);
}
.banner.error {
  background: var(--bad-bg);
  color: var(--bad);
}
.login-card {
  max-width: 22rem;
  margin: 3rem auto;
  padding: 1.5rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.login-card h1 {
  margin-top: 0;
}
.login-card form {
  display: grid;
  gap: 0.6rem;
}