/* Eventra operator console. Tokens: forest #173F35, canvas #F6F3EC, soft green #D8E8DA,
   orange #F47B35 (accent, sparingly), ink #272823, border #DCE2DC. System fonts only. */
:root {
  --forest: #173F35;
  --forest-2: #1F5446;
  --canvas: #F6F3EC;
  --soft: #D8E8DA;
  --orange: #F47B35;
  --ink: #272823;
  --border: #DCE2DC;
  --muted: #565D57;
  --card: #FFFFFF;
  --ok-bg: #D8E8DA; --ok-fg: #12452D;
  --warn-bg: #FCE6D5; --warn-fg: #7D3408;
  --bad-bg: #FADDD9; --bad-fg: #8A1A10;
  --info-bg: #E1EAF3; --info-fg: #1D4A73;
  --muted-bg: #ECEAE2; --muted-fg: #454B46;
  --danger: #A32318; --danger-2: #8A1A10;
  --sunken: #FBFAF6;
  --line-strong: #A9B3AB;
  /* One spacing scale: .25 .5 .75 1 1.5 2 rem. */
  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(23, 63, 53, .08), 0 1px 1px rgba(23, 63, 53, .04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--canvas); color: var(--ink); font: 15px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
}
h1, h2, h3 { color: var(--forest); line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
a { color: var(--forest); text-underline-offset: 2px; }
a:hover { color: var(--forest-2); }
p { margin: 0 0 .75rem; }
code, pre, .mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.sub { color: var(--muted); margin: 0; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--forest); color: #fff; padding: .6rem 1rem; z-index: 100; }
.skip:focus { left: 0; }
main:focus { outline: none; }
.icon { flex: none; vertical-align: -3px; }
.spin { transform-origin: 8px 8px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spin { animation: none; }
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- shell: sidebar / rail / drawer ---------- */
.nav-toggle { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.nav-toggle:focus-visible ~ .shell .menu-btn { outline: 3px solid var(--ink); outline-offset: 2px; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 72px; background: var(--card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: .75rem .5rem; z-index: 30; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: .6rem; padding: .35rem; margin-bottom: .75rem; text-decoration: none; color: var(--forest); font-weight: 700; justify-content: center; }
.brand-text { display: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-link {
  display: flex; align-items: center; justify-content: center; gap: .65rem; min-height: 44px; padding: .5rem .65rem;
  border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 500;
}
.nav-link:hover { background: var(--soft); color: var(--forest); }
.nav-link[aria-current="page"] { background: var(--forest); color: #fff; }
.nav-link .icon { width: 18px; height: 18px; }
.nav-label {
  position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.btn.nav-close { display: none; margin-top: auto; }
.scrim { display: none; }
.content { margin-left: 72px; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem; padding: .5rem 1.25rem;
  background: var(--canvas); border-bottom: 1px solid var(--border); min-height: 56px;
}
.topbar-name { font-weight: 700; color: var(--forest); text-decoration: none; }
.spacer { flex: 1; }
.btn.menu-btn { display: none; }
.banner {
  display: flex; gap: .6rem; align-items: flex-start; padding: .45rem 1.25rem; background: var(--warn-bg); color: var(--warn-fg);
  border-bottom: 2px solid var(--orange); font-size: .85rem; line-height: 1.35;
}
.banner-sso { background: var(--info-bg, #e8f1fb); color: var(--info-fg, #123a63); border-bottom-color: var(--info-fg, #123a63); align-items: center; }
.health-link { text-decoration: none; display: inline-flex; min-height: 44px; align-items: center; }
main { padding: 1.25rem; max-width: 1400px; }

@media (min-width: 1280px) {
  .sidebar { width: 240px; padding: 1rem .75rem; }
  .content { margin-left: 240px; }
  .brand { justify-content: flex-start; }
  .brand-text { display: inline; }
  .nav-link { justify-content: flex-start; }
  .nav-label { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; }
  main { padding: 1.5rem 2rem; }
}
@media (max-width: 767.98px) {
  .sidebar {
    width: min(82vw, 300px); transform: translateX(-100%); visibility: hidden; padding: 1rem .75rem;
    transition: transform .2s ease, visibility 0s linear .2s; box-shadow: 0 0 24px rgba(0, 0, 0, .2);
  }
  .nav-toggle:checked ~ .shell .sidebar { transform: none; visibility: visible; transition: transform .2s ease; }
  .brand { justify-content: flex-start; }
  .brand-text { display: inline; }
  .nav-link { justify-content: flex-start; min-height: 48px; }
  .nav-label { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; }
  .btn.nav-close { display: inline-flex; }
  .nav-toggle:checked ~ .shell .scrim { display: block; position: fixed; inset: 0; background: rgba(39, 40, 35, .45); z-index: 25; }
  .content { margin-left: 0; }
  .btn.menu-btn { display: inline-flex; }
  .topbar { padding: .4rem .75rem; gap: .5rem; }
  .topbar-name { display: none; }
  main { padding: 1rem .75rem; }
  .banner { padding: .4rem .75rem; font-size: .8rem; }
}

/* ---------- components ---------- */
.page-head { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1rem; }
.head-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; margin-bottom: 1rem; }
.card > h2:first-child, .card > h3:first-child { margin-bottom: .75rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.metrics { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); margin-bottom: 1rem; }
.metric { margin: 0; padding: .85rem 1rem; border-left: 4px solid var(--border); }
.metric.tone-warn { border-left-color: var(--orange); }
.metric.tone-bad { border-left-color: var(--bad-fg); }
.metric.tone-ok { border-left-color: var(--forest); }
.metric-label { color: var(--muted); font-size: .85rem; }
.metric-label a { color: inherit; }
.metric-value { font-size: 1.75rem; font-weight: 700; color: var(--forest); line-height: 1.2; }
.metric-hint { color: var(--muted); font-size: .8rem; }

.badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .55rem .1rem .4rem; border-radius: 999px;
  font-size: .8rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; line-height: 1.5;
}
.tone-ok.badge { background: var(--ok-bg); color: var(--ok-fg); border-color: #b9d3bd; }
.tone-warn.badge { background: var(--warn-bg); color: var(--warn-fg); border-color: #f0c3a3; }
.tone-bad.badge { background: var(--bad-bg); color: var(--bad-fg); border-color: #efb6af; }
.tone-info.badge { background: var(--info-bg); color: var(--info-fg); border-color: #bfd0e2; }
.tone-muted.badge { background: var(--muted-bg); color: var(--muted-fg); border-color: #d6d3c8; }
.badge.tone-info:not(.tone-ok) { }
span.badge:not([class*="tone-"]) { background: var(--muted-bg); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 40px; padding: .4rem .9rem;
  border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--forest); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; line-height: 1.2;
}
.btn:hover { background: var(--soft); color: var(--forest); }
.btn-primary { background: var(--forest); color: #fff; border-color: var(--forest); }
.btn-primary:hover { background: var(--forest-2); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-2); color: #fff; }
/* Quiet danger: a row-level action that removes or overrides something. The red button is
   reserved for the confirm page's final step. */
.btn-danger-quiet { color: var(--danger); border-color: #E3B3AD; background: var(--card); }
.btn-danger-quiet:hover { background: var(--bad-bg); color: var(--danger-2); }
.btn-warn { border-color: var(--orange); }
.btn-quiet { border-color: transparent; background: transparent; }
.btn-sm { min-height: 32px; padding: .15rem .6rem; font-size: .85rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.inline-form { display: inline; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }

.alert { display: flex; gap: .6rem; padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; overflow-wrap: anywhere; }
.alert.tone-bad { background: var(--bad-bg); color: var(--bad-fg); border-color: #efb6af; }
.alert.tone-warn { background: var(--warn-bg); color: var(--warn-fg); border-color: #f0c3a3; }
.alert.tone-ok { background: var(--ok-bg); color: var(--ok-fg); border-color: #b9d3bd; }
.alert.tone-info, .alert.tone-muted { background: var(--info-bg); color: var(--info-fg); border-color: #bfd0e2; }
.toast {
  display: flex; align-items: center; gap: .6rem; padding: .7rem .9rem; margin-bottom: 1rem; border-radius: 8px;
  background: var(--forest); color: #fff; box-shadow: var(--shadow); overflow-wrap: anywhere;
}
.empty { text-align: center; padding: 2rem 1rem; background: var(--card); border: 1px dashed var(--border); border-radius: var(--radius); margin-bottom: 1rem; }
.empty p { color: var(--muted); max-width: 52ch; margin-left: auto; margin-right: auto; }
.pager { display: flex; gap: .5rem; justify-content: center; margin: 1rem 0; }

.kv-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: .75rem 1.5rem; margin: 0; }
.kv dt { color: var(--muted); font-size: .8rem; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.chip { display: inline-flex; align-items: center; min-height: 36px; padding: .15rem .75rem; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--ink); text-decoration: none; font-size: .9rem; }
.chip:hover { background: var(--soft); }
.chip[aria-current="true"], .chip[aria-current="page"] { background: var(--forest); color: #fff; border-color: var(--forest); }
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tabs a { padding: .55rem 1rem; text-decoration: none; color: var(--ink); border-bottom: 3px solid transparent; font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }
.tabs a:hover { background: var(--soft); }
.tabs a[aria-current="page"] { color: var(--forest); border-bottom-color: var(--forest); }

/* forms */
label { font-weight: 600; font-size: .9rem; }
input[type="text"], input[type="search"], input[type="password"], input[type="number"], select, textarea {
  width: 100%; min-height: 40px; padding: .4rem .6rem; font: inherit; color: var(--ink); background: #fff; border: 1px solid #A9B3AB; border-radius: 8px;
}
textarea { font-family: var(--mono); font-size: .875rem; min-height: 14rem; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 1.1rem; height: 1.1rem; accent-color: var(--forest); vertical-align: -3px; }
.stack { display: grid; gap: .6rem; }
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-bottom: 1rem; }
.filters .field { display: grid; gap: .2rem; min-width: 150px; flex: 1 1 150px; max-width: 280px; }
.filters .field.grow { flex: 2 1 240px; max-width: 420px; }
.check { display: inline-flex; align-items: center; gap: .4rem; min-height: 40px; font-weight: 500; }

/* tables: desktop table, mobile stacked cards on the same markup */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; white-space: nowrap; background: var(--sunken); }
tbody tr:hover { background: var(--sunken); }
td.num, th.num { text-align: right; }
td.wrap { overflow-wrap: anywhere; }
.err-text { color: var(--bad-fg); overflow-wrap: anywhere; }
.cell-actions { display: flex; gap: .35rem; flex-wrap: wrap; }
.table-card { padding: 0; overflow: hidden; }

/* One table -> card pattern. On phones every row becomes a card: `c-title` is its heading,
   `c-state` (a badge) sits on the heading line, the other cells are "label value" lines,
   `m-hide` cells are dropped and `has-actions` holds the buttons. */
@media (max-width: 767.98px) {
  table.rt, .rt thead, .rt tbody, .rt tr, .rt td { display: block; width: 100%; }
  .rt thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .rt tbody { display: grid; gap: var(--s3); padding: var(--s3); background: transparent; }
  .rt tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--s3); row-gap: 2px;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s3); box-shadow: var(--shadow);
  }
  .rt td {
    grid-column: 1 / -1; display: flex; gap: var(--s2); align-items: baseline; justify-content: flex-start;
    border: 0; padding: 2px 0; text-align: left; overflow-wrap: anywhere; min-width: 0;
  }
  .rt td::before { content: attr(data-label); flex: 0 0 5.2rem; color: var(--muted); font-size: .78rem; font-weight: 600; }
  .rt td.c-title { grid-column: 1; grid-row: 1; font-weight: 600; font-size: 1.02rem; padding-bottom: var(--s1); }
  .rt td.c-state { grid-column: 2; grid-row: 1; justify-content: flex-end; align-items: flex-start; }
  .rt td.c-title::before, .rt td.c-state::before, .rt td.has-actions::before { display: none; }
  .rt td.c-select { align-items: center; min-height: 44px; }
  .rt td.c-select input { width: 1.5rem; height: 1.5rem; }
  .rt td.m-hide { display: none; }
  .rt td:has(> [aria-label="none"]:only-child) { display: none; }
  .rt td.has-actions { display: block; padding-top: var(--s2); }
  .rt td.has-actions:empty { display: none; }
  .table-card { background: transparent; border: 0; box-shadow: none; }
  .btn, .chip, .check, input[type="text"], input[type="search"], input[type="password"], input[type="number"], select { min-height: 44px; }
  .btn-sm { min-height: 44px; }
  .filters .field { max-width: none; }
}

/* inbox list */
.mail-list { list-style: none; margin: 0; padding: 0; }
.mail-list li { border-bottom: 1px solid var(--border); }
.mail-list li:last-child { border-bottom: 0; }
.mail-row {
  display: grid; grid-template-columns: 14px minmax(120px, 220px) minmax(0, 1fr) auto auto auto; gap: .25rem .9rem; align-items: center;
  padding: .7rem 1rem; color: var(--ink); text-decoration: none; min-height: 56px;
}
.mail-row:hover { background: var(--sunken); }
.mail-row .dot { width: 10px; height: 10px; border-radius: 50%; }
.mail-row.unread .dot { background: var(--orange); }
.mail-row.unread .from, .mail-row.unread .subject { font-weight: 700; }
.mail-row .from, .mail-row .main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-row .snippet { color: var(--muted); font-weight: 400; }
.mail-row .clip { color: var(--muted); display: inline-flex; gap: .15rem; align-items: center; min-width: 2rem; }
.mail-row .when { color: var(--muted); white-space: nowrap; font-size: .85rem; }
.unread-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 767.98px) {
  .mail-row { grid-template-columns: 14px minmax(0, 1fr) auto; grid-template-areas: "dot from when" ". main main" ". meta meta"; padding: .8rem .75rem; row-gap: .3rem; }
  .mail-row .dot { grid-area: dot; } .mail-row .from { grid-area: from; } .mail-row .when { grid-area: when; }
  .mail-row .main { grid-area: main; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .mail-row .meta { grid-area: meta; display: flex; gap: .6rem; align-items: center; }
  .mail-row .clip { min-width: 0; }
}
@media (min-width: 768px) { .mail-row .meta { display: contents; } }
.mail-card { padding: 0; overflow: hidden; }

/* email detail */
.mail-head h1 { overflow-wrap: anywhere; }
.envelope { font-size: .9rem; }
.mail-text { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; font-family: var(--font); margin: 0; font-size: .95rem; }
.mail-frame { width: 100%; height: 70vh; min-height: 360px; border: 1px solid var(--border); border-radius: 8px; background: #fff; resize: vertical; }
.attachments { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.attachments a { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .75rem; border: 1px solid var(--border); border-radius: 8px; text-decoration: none; min-height: 40px; background: var(--card); }
.attachments a:hover { background: var(--soft); }
.code { background: var(--ink); color: #EDEFE9; padding: .75rem 1rem; border-radius: 8px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; margin: 0; max-height: 28rem; font-size: .85rem; }
details > summary { cursor: pointer; font-weight: 600; color: var(--forest); min-height: 32px; display: list-item; }
details[open] > summary { margin-bottom: .4rem; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0 0 0 .25rem; position: relative; }
.tl-item { display: flex; gap: .85rem; padding-bottom: 1.1rem; position: relative; }
.tl-item:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--border); }
.tl-mark { flex: none; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 2px solid; background: var(--card); }
.tl-item.tone-ok .tl-mark { color: var(--ok-fg); border-color: var(--ok-fg); }
.tl-item.tone-warn .tl-mark { color: var(--warn-fg); border-color: var(--orange); }
.tl-item.tone-bad .tl-mark { color: var(--bad-fg); border-color: var(--bad-fg); }
.tl-item.tone-info .tl-mark { color: var(--info-fg); border-color: var(--info-fg); }
.tl-item.tone-muted .tl-mark { color: var(--muted-fg); border-color: #A9B3AB; }
.tl-body { min-width: 0; flex: 1; }
.tl-head { margin-bottom: .15rem; }

/* chart */
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--forest); }
.chart .bar:hover { fill: var(--orange); }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .axis { stroke: var(--border); }
.attention { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.attention li { display: flex; gap: .6rem; align-items: flex-start; flex-wrap: wrap; }

/* confirm / misc */
.confirm { max-width: 720px; border-left: 4px solid var(--orange); }
.confirm-details ul { margin: .25rem 0 .5rem 1.1rem; padding: 0; }
.step-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .6rem; }
.step { display: grid; grid-template-columns: 2rem minmax(120px, 1fr) minmax(160px, 1.4fr) auto; gap: .6rem; align-items: end; padding: .6rem; border: 1px solid var(--border); border-radius: 8px; background: var(--sunken); }
.step .n { align-self: center; font-weight: 700; color: var(--forest); }
.step .field { display: grid; gap: .2rem; }
.step .ops { display: flex; gap: .3rem; flex-wrap: wrap; }
.readonly-steps { margin: 0; padding-left: 1.4rem; }
@media (max-width: 767.98px) { .step { grid-template-columns: 1.5rem 1fr; } .step .field, .step .ops { grid-column: 2; } }
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.login-card { width: min(100%, 380px); padding: 1.75rem; text-align: center; }
.login-card .stack { text-align: left; }
.login-card h1 { margin-top: .5rem; }
pre.howto { background: var(--ink); color: #EDEFE9; padding: .6rem .9rem; border-radius: 8px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.card-pad { padding: 1rem 1rem 0; }
.card-pad + .empty, .table-card > p.card-pad { margin: 0; padding: .75rem 1rem 1rem; }
[hidden] { display: none !important; }

/* ----- workflow editor ----- */
.wf-publishbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 5; }
.wf-publish-actions { display: flex; gap: .5rem; align-items: center; }
/* The graph gets the full width (it is the thing you look at); palette and inspector sit below
   it side by side from 768px, the inspector wider. On phones: graph, inspector, then palette. */
.wf-editor { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); margin-block: 1rem; }
.wf-editor > .card { margin: 0; min-width: 0; }
.wf-canvas { order: -2; }
.wf-inspector { order: -1; }
@media (min-width: 768px) {
  .wf-editor { grid-template-columns: 16rem minmax(0, 1fr); }
  .wf-editor.read-only { grid-template-columns: minmax(0, 1fr); }
  .wf-canvas { grid-column: 1 / -1; }
  .wf-palette { order: 0; }
  .wf-inspector { order: 1; }
}
.wf-palette-item { border-top: 1px solid var(--border); padding-top: .75rem; margin-top: .75rem; }
.wf-palette-item h3 { margin: 0 0 .25rem; font-size: 1rem; }
.wf-palette-filter { width: 100%; }
.wf-canvas-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--canvas);
  touch-action: pan-x pan-y; }
.wf-graph { display: block; width: 100%; height: auto; }
.wf-zoom { display: flex; gap: .25rem; margin-top: .5rem; }
.wf-zoom[aria-hidden="true"] { display: none; }
.wf-edge { fill: none; stroke: #8A968C; stroke-width: 1.6; }
.wf-arrowhead { fill: #8A968C; }
.wf-node rect { fill: var(--card); stroke: var(--border); stroke-width: 1.5; }
.wf-node .wf-title { font-weight: 600; font-size: 13px; fill: var(--ink); }
.wf-node .wf-sub { font-size: 11px; fill: var(--muted); }
.wf-trigger rect { fill: var(--forest); stroke: var(--forest); }
.wf-trigger .wf-title, .wf-trigger .wf-sub { fill: #fff; }
.wf-condition rect { stroke: #B4C8B8; stroke-dasharray: 5 3; }
.wf-transform rect { fill: #EEF4EF; }
.wf-action rect { stroke: var(--forest-2); }
.wf-node.is-selected rect { stroke: var(--orange); stroke-width: 3; }
.wf-node.has-error rect { stroke: var(--bad-fg); stroke-width: 2.5; fill: var(--bad-bg); }
.wf-node.ran rect { fill: var(--ok-bg); }
.wf-node.skipped { opacity: .45; }
a.wf-node-link:focus-visible { outline: none; }
a.wf-node-link:focus-visible rect { stroke: var(--orange); stroke-width: 3; }
.wf-hint { margin-top: 0; }
.wf-rules { display: grid; gap: .75rem; }
.wf-rule { display: grid; gap: .5rem; grid-template-columns: 1fr; padding: .5rem; border: 1px solid var(--border);
  border-radius: 8px; }
@media (min-width: 1280px) { .wf-inspector .wf-rule { grid-template-columns: 2fr 1fr 2fr 1fr auto; align-items: end; } }
.wf-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.wf-step { display: grid; gap: .25rem .75rem; grid-template-columns: 8rem 1fr auto auto; align-items: center;
  padding: .5rem .75rem; border: 1px solid var(--border); border-radius: 8px; }
.wf-step.has-error { border-color: var(--bad-fg); background: var(--bad-bg); }
.wf-step .wf-kind { font-weight: 600; }
.wf-step .ops { display: flex; flex-wrap: wrap; gap: .25rem; }
.wf-step form.inline { display: inline-flex; gap: .25rem; margin: 0; }
@media (max-width: 767.98px) {
  /* Phones: keep nodes readable at natural size and scroll sideways instead of shrinking. */
  .wf-graph { width: auto !important; max-width: none !important; }
  .wf-step { grid-template-columns: 1fr; }
  .wf-step .ops .btn { min-height: 44px; min-width: 44px; }
  .wf-publishbar { position: static; }
}
.wf-trace { list-style: none; padding: 0; display: grid; gap: .25rem; }
/* Branches and delays */
.wf-delay rect { fill: #FFF6E5; stroke: #E0B96A; }
.wf-node .wf-tag { font-size: 11px; font-weight: 600; fill: var(--forest-2); }
.wf-edge-no { stroke-dasharray: 6 4; }
.wf-edge-label { font-size: 11px; font-weight: 600; fill: var(--forest-2); paint-order: stroke; stroke: var(--canvas); stroke-width: 4px; stroke-linejoin: round; }
.wf-edge-label.is-no { fill: var(--bad-fg); }
.wf-chip { display: inline-block; padding: 0 .45rem; border-radius: 999px; background: var(--ok-bg); color: var(--ok-fg); font-size: .8125rem; line-height: 1.5; }
.wf-chip.is-no { background: var(--bad-bg); color: var(--bad-fg); }
.wf-branch .check { display: inline-flex; margin-right: 1rem; }
.field-error { color: var(--bad-fg); font-weight: 600; margin: .25rem 0 0; }
input[aria-invalid="true"] { border-color: var(--bad-fg); }
label.check { display: flex; gap: .4rem; align-items: center; min-height: 32px; }

.nowrap { white-space: nowrap; }


/* ---------- state, tiles, panels (shared by every page) ---------- */
.h1-sub { font-size: .9rem; font-weight: 400; }
.detail-head .head-main { min-width: 0; flex: 1 1 18rem; }
.detail-head h1 { overflow-wrap: anywhere; margin-bottom: var(--s1); }
.detail-head .sub { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); align-items: center; }
.back { margin: 0 0 var(--s1); }
.back a { display: inline-flex; align-items: center; min-height: 44px; margin-top: -10px; margin-bottom: -10px; }
.page-head h1 { overflow-wrap: anywhere; }

.copyable { display: inline-flex; align-items: center; gap: var(--s1); flex-wrap: wrap; min-width: 0; }
.id-text { color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.copyable .btn-sm { min-height: 28px; padding: 0 .5rem; }
@media (max-width: 767.98px) { .copyable .btn-sm { min-height: 44px; } }

.note { display: flex; gap: var(--s2); align-items: flex-start; margin: 0 0 var(--s3); font-size: .88rem; color: var(--muted-fg); overflow-wrap: anywhere; }
.note .icon { margin-top: 3px; }
.note.tone-warn { color: var(--warn-fg); }
.note.tone-ok { color: var(--ok-fg); }
.sender-check { margin-bottom: var(--s3); }
.sender-check .alert { margin-bottom: var(--s2); }

.state-panel { border-left: 4px solid var(--border); }
.state-panel.tone-bad { border-left-color: var(--danger); }
.state-panel.tone-warn { border-left-color: var(--orange); }
.state-panel.tone-info { border-left-color: var(--info-fg); }
.state-panel.tone-muted { border-left-color: var(--line-strong); }
.state-panel h2 { display: flex; align-items: center; gap: var(--s2); }
.state-panel .actions { margin-top: var(--s3); }
.state-reason { overflow-wrap: anywhere; }
.fineprint { font-size: .82rem; }
.token-box { user-select: all; font-size: .95rem; }

details.more { margin-top: var(--s3); }
details.more > summary { color: var(--forest); }
.more-rcpt { display: block; margin-top: var(--s1); font-size: .85rem; overflow-wrap: anywhere; }
.more-rcpt summary { font-weight: 500; }

/* overview */
.status-card {
  display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s4) var(--s5); margin-bottom: var(--s4);
  border: 1px solid var(--border); border-left-width: 6px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow);
}
.status-card > .icon { width: 28px; height: 28px; margin-top: 2px; }
.status-card h2 { font-size: 1.35rem; margin-bottom: var(--s1); }
.status-card.tone-ok { border-left-color: var(--forest); background: #F3F8F3; }
.status-card.tone-ok > .icon, .status-card.tone-ok h2 { color: var(--ok-fg); }
.status-card.tone-warn { border-left-color: var(--orange); background: #FFF8F2; }
.status-card.tone-warn > .icon { color: var(--warn-fg); }
.status-card.tone-bad { border-left-color: var(--danger); background: #FEF6F5; }
.status-card.tone-bad > .icon, .status-card.tone-bad h2 { color: var(--bad-fg); }
.status-flow { margin: 0 0 var(--s2); overflow-wrap: anywhere; }
.status-body { min-width: 0; }
.issues { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.issues a { display: inline-flex; gap: var(--s2); align-items: baseline; min-height: 32px; font-weight: 600; text-decoration: none; }
.issues a:hover { text-decoration: underline; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.tone-bad { background: var(--danger); } .dot.tone-warn { background: var(--orange); } .dot.tone-info { background: var(--info-fg); }
.tiles { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); margin-bottom: var(--s4); }
.tile {
  display: grid; gap: 2px; align-content: start; padding: var(--s3) var(--s4); background: var(--card); color: var(--ink);
  border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: var(--radius); text-decoration: none;
  box-shadow: var(--shadow); min-height: 44px;
}
.tile:hover { background: var(--sunken); color: var(--ink); }
.tile-count { font-size: 1.7rem; font-weight: 700; line-height: 1.15; color: var(--forest); }
.tile-label { font-weight: 600; }
.tile-hint { color: var(--muted); font-size: .8rem; }
.tile.tone-bad { border-left-color: var(--danger); } .tile.tone-bad .tile-count { color: var(--bad-fg); }
.tile.tone-warn { border-left-color: var(--orange); } .tile.tone-warn .tile-count { color: var(--warn-fg); }
.tile.tone-info { border-left-color: var(--info-fg); } .tile.tone-info .tile-count { color: var(--info-fg); }
.tile.tone-ok { border-left-color: var(--forest); }
.tile.tone-muted .tile-count { color: var(--muted); }
@media (max-width: 767.98px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
  .tile { padding: var(--s3); }
  .status-card { padding: var(--s3); }
  .status-card h2 { font-size: 1.2rem; }
}
.numbers { grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); margin-bottom: var(--s3); }
.health-list { list-style: none; margin: 0 0 var(--s3); padding: 0; display: grid; gap: var(--s2); }
.health-list li { overflow-wrap: anywhere; }

/* filters, chips, counts */
.chip-n { display: inline-block; min-width: 1.4em; padding: 0 .35em; margin-left: .2em; border-radius: 999px; background: var(--muted-bg); color: var(--muted-fg); font-size: .78rem; font-weight: 700; text-align: center; }
.chip[aria-current="true"] .chip-n { background: rgba(255, 255, 255, .22); color: #fff; }
.chip .icon { margin-right: .25rem; }
.active-filters { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin: 0 0 var(--s3); font-size: .9rem; }
.chip-x { background: var(--info-bg); border-color: #bfd0e2; color: var(--info-fg); font-weight: 600; }
.chip-x:hover { background: var(--bad-bg); color: var(--bad-fg); }
.result-count { margin: 0 0 var(--s2); font-size: .85rem; }
.bulk-bar { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: flex-end; margin-bottom: var(--s3); }
.bulk-bar .field { display: grid; gap: 2px; min-width: 12rem; }

/* live toggle */
.live-toggle[aria-pressed="true"] { background: var(--forest); color: #fff; border-color: var(--forest); }
.live-state { font-weight: 500; opacity: .85; }
.live-toggle[aria-pressed="true"] .icon { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
[data-live-region].is-updated { animation: fresh .9s ease-out; }
@keyframes fresh { from { background: rgba(244, 123, 53, .12); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) {
  .live-toggle[aria-pressed="true"] .icon, [data-live-region].is-updated { animation: none; }
}

/* mail rows: long text never pushes the badge or the time out of the row */
.mail-row .meta { min-width: 0; }
.mail-row .badge { max-width: 100%; }
.mail-row .main { min-width: 0; }
.mail-row .subject { overflow-wrap: anywhere; }
.mail-row { grid-template-columns: 14px minmax(120px, 200px) minmax(0, 1fr) auto auto auto; }
@media (min-width: 768px) { .mail-row .meta { display: flex; gap: var(--s2); align-items: center; justify-content: flex-end; flex-wrap: wrap; } .mail-row .clip { order: -1; } }
@media (max-width: 767.98px) {
  .mail-row .meta { flex-wrap: wrap; }
  .mail-row .from { font-size: .9rem; }
}
.frame-note { display: flex; gap: var(--s2); align-items: flex-start; }
.frame-note .icon { margin-top: 4px; }
.attachments .att-name { font-weight: 600; overflow-wrap: anywhere; }
.attachments a { min-height: 44px; }
.kv-list.envelope { grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); }
@media (max-width: 767.98px) { .kv-list.envelope { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2) var(--s3); } .kv-list.envelope .kv:nth-child(-n+2) { grid-column: 1 / -1; } }
.envelope .kv dd { font-size: .92rem; }
.card h2 { font-size: 1.08rem; }
.badge .icon { width: 14px; height: 14px; }
.badge { max-width: 100%; }
.badge span { overflow: hidden; text-overflow: ellipsis; }
.empty h2 { font-size: 1.15rem; }
main > .toast, main > .alert { position: relative; }
.rt td.c-title .id-text { display: block; font-weight: 400; flex: 1 0 100%; }
@media (max-width: 767.98px) { .rt td.c-title { flex-wrap: wrap; } }
.err-text code { white-space: nowrap; }

/* ---------- setup page and guide ---------- */
#gaps, #receiving, #routing, #destinations, #protection, .guide-step { scroll-margin-top: 4.5rem; }
.reg-item { border-top: 1px solid var(--border); padding: var(--s4) 0; }
.reg-item:first-of-type { border-top: 0; padding-top: 0; }
.reg-item:last-child { padding-bottom: 0; }
.reg-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s3); margin-bottom: var(--s3); }
.reg-head h3 { margin: 0; overflow-wrap: anywhere; }
.reg-badges { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; margin-left: auto; }
.reg-item .kv-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); }
.reg-item .kv dd, .reg-flow { overflow-wrap: anywhere; }
.reg-flow { margin: 0 0 var(--s2); }
.reg-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.reg-step { padding: var(--s1) var(--s2); border-left: 3px solid var(--border); background: var(--sunken); border-radius: 0 8px 8px 0; overflow-wrap: anywhere; }
.reg-step .glyph { color: var(--forest-2); }
.reg-step.d1 { margin-left: var(--s4); } .reg-step.d2 { margin-left: var(--s5); } .reg-step.d3 { margin-left: var(--s6); } .reg-step.d4 { margin-left: 2.5rem; }
.reg-step code { white-space: normal; }
@media (max-width: 767.98px) { .reg-step.d1, .reg-step.d2, .reg-step.d3, .reg-step.d4 { margin-left: var(--s3); } .reg-badges { margin-left: 0; } }
.secret-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
h4.dns-domain { margin: var(--s4) 0 var(--s2); color: var(--forest); font-size: .95rem; overflow-wrap: anywhere; }
.dns-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.dns-rec { border: 1px solid var(--border); border-radius: 8px; padding: var(--s3); background: var(--sunken); }
.dns-dl { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s2); margin: 0; }
@media (min-width: 768px) { .dns-dl { grid-template-columns: 6rem minmax(0, 1fr); } .dns-dl .kv { display: contents; } .dns-dl dt { padding-top: .4rem; } }
.dns-dl dd { margin: 0; }
.dns-name, .dns-value { overflow-wrap: anywhere; word-break: break-word; font-size: .92rem; }
.dns-rec .btn { min-height: 44px; min-width: 44px; margin-top: var(--s1); }
.dns-why { margin: var(--s2) 0 0; font-size: .88rem; }
.gap-list, .prot-list, .check-rows, .plain-list, .step-problems, .mini-steps { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--s2); }
.gap { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s2) var(--s3); align-items: center; padding: var(--s2) var(--s3); border: 1px solid var(--border); border-left-width: 4px; border-radius: 8px; background: var(--card); }
.gap.tone-bad { border-left-color: var(--danger); } .gap.tone-warn { border-left-color: var(--orange); } .gap.tone-info { border-left-color: var(--info-fg); }
.gap-text { overflow-wrap: anywhere; }
.gap-fix { white-space: nowrap; min-height: 44px; }
@media (max-width: 767.98px) { .gap { grid-template-columns: minmax(0, 1fr); } .gap-fix { justify-self: start; } }
.prot { padding: var(--s2) var(--s3); border: 1px solid var(--border); border-left-width: 4px; border-radius: 8px; background: var(--card); }
.prot.tone-ok { border-left-color: var(--forest); } .prot.tone-warn { border-left-color: var(--orange); } .prot.tone-bad { border-left-color: var(--danger); } .prot.tone-muted { border-left-color: var(--line-strong); }
.prot-main { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); align-items: center; }
.prot-value { color: var(--muted-fg); overflow-wrap: anywhere; }
.prot-advice { margin: var(--s1) 0 0; font-size: .9rem; color: var(--warn-fg); }
.prot.tone-bad .prot-advice { color: var(--bad-fg); }
.plain-list { gap: var(--s3); } .plain-list li { overflow-wrap: anywhere; }

.snippet { position: relative; margin: 0 0 var(--s3); }
.snippet pre.howto { margin: 0; padding-right: 5.5rem; font-size: .82rem; }
.snippet .btn { position: absolute; top: var(--s2); right: var(--s2); min-height: 44px; min-width: 44px; background: var(--card); }
@media (max-width: 767.98px) { .snippet pre.howto { padding-right: .9rem; padding-bottom: 3.5rem; } .snippet .btn { top: auto; bottom: var(--s2); } }

.guide-progress p { margin-bottom: 0; }
.guide-bar { width: 100%; height: 12px; accent-color: var(--forest); margin-bottom: var(--s2); }
.guide-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.guide-step { background: var(--card); border: 1px solid var(--border); border-left: 6px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--s4); }
.guide-step.is-done { border-left-color: var(--forest); }
.guide-step.is-attention { border-left-color: var(--orange); background: #FFF8F2; }
.guide-step[aria-current="step"] { border-color: var(--forest); border-left-color: var(--orange); box-shadow: 0 0 0 2px var(--soft), var(--shadow); }
.step-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); margin-bottom: var(--s2); }
.step-head h2 { margin: 0; font-size: 1.1rem; flex: 1 1 12rem; }
.step-num { flex: none; width: 2rem; height: 2rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; background: var(--muted-bg); color: var(--muted-fg); }
.is-done .step-num { background: var(--ok-bg); color: var(--ok-fg); }
.is-attention .step-num { background: var(--warn-bg); color: var(--warn-fg); }
.guide-step[aria-current="step"] .step-num { background: var(--forest); color: #fff; }
.step-summary { margin: 0 0 var(--s2); overflow-wrap: anywhere; }
.step-problems { margin-bottom: var(--s2); padding-left: 1.2rem; list-style: disc; color: var(--warn-fg); gap: var(--s1); }
.step-detail > :not(summary) { margin-top: var(--s3); }
.step-detail h3 { margin: var(--s4) 0 var(--s2); font-size: .98rem; }
.step-buttons { margin-top: var(--s3); }
.step-buttons .btn { min-height: 44px; }
.check-row { padding: var(--s2) var(--s3); border: 1px solid var(--border); border-radius: 8px; background: var(--sunken); overflow-wrap: anywhere; }
.wait-box { margin-top: var(--s3); }
.waiting { display: flex; gap: var(--s2); align-items: center; color: var(--info-fg); font-weight: 600; margin: 0; }
.dry-run { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px dashed var(--border); }
.dry-run h3 { overflow-wrap: anywhere; }
.dry-run .filters .field { max-width: none; }

.setup-card { border-left: 6px solid var(--orange); }
.setup-card summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; }
.setup-card-title { display: inline; margin: 0; }
.mini-steps { margin: var(--s2) 0 var(--s3); gap: var(--s1); }
.mini-step { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); align-items: center; min-height: 36px; }
.mini-step a { overflow-wrap: anywhere; }
@media (max-width: 767.98px) { .mini-step { min-height: 44px; } .mini-step a { display: inline-flex; align-items: center; min-height: 44px; } }
.dry-run .filters .field, .dry-run .filters .field.grow { flex: 1 1 100%; }
@media (min-width: 768px) { .dry-run .filters .field { flex: 1 1 14rem; } .dry-run .filters .field.grow { flex: 2 1 18rem; } }
.card > .empty, .reg-item > .empty { border: 0; background: var(--sunken); }
.gap .badge { justify-self: start; }
