/* Simply Black · supplier invoices. Calm, light, one strong (black) button per screen. */
:root {
  --bg: #f6f6f3; --panel: #fff; --ink: #141414; --muted: #6b6a66; --faint: #9a9993; --line: #e5e3dd; --line-strong: #cfccc4;
  --hover: #f1f0ec;
  --ok: #1d6b37; --ok-bg: #e6f3ea; --warn: #8a5200; --warn-bg: #fcf1dc; --bad: #b42318; --bad-bg: #fdecea;
  --info: #2347a8; --info-bg: #e9eefb; --purple: #5b3aa6; --purple-bg: #efeafb;
  --low-bg: #fff8e6; --low-line: #ecc56a;
  --radius: 10px; --radius-sm: 7px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 600; margin: 2px 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 15px; font-weight: 600; margin: 20px 0 10px; }
.panel > h2:first-child, .panel fieldset > h2:first-child, .card > h2:first-child { margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.err-text { color: var(--bad); }

/* Header */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 0 20px; height: 58px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { color: var(--ink); font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.brand span { color: var(--muted); font-weight: 400; margin-left: 6px; }
.brand:hover { text-decoration: none; }
.topbar nav { display: flex; gap: 2px; flex: 1; align-items: center; }
.topbar nav > a, .menu > summary { color: var(--muted); padding: 7px 12px; border-radius: var(--radius-sm); font-size: 14px; cursor: pointer; list-style: none; white-space: nowrap; }
.topbar nav > a:hover, .menu > summary:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.topbar nav > a.active, .menu.active > summary { background: var(--hover); color: var(--ink); font-weight: 600; }
.menu { position: relative; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: "▾"; font-size: 10px; margin-left: 5px; }
.menu .dropdown { position: absolute; top: 40px; left: 0; min-width: 210px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.08); z-index: 30; }
.menu.right .dropdown { left: auto; right: 0; }
.menu .dropdown a, .menu .dropdown > form > button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink); font: inherit; font-size: 14px; background: none; border: 0; cursor: pointer; }
.menu .dropdown a:hover, .menu .dropdown > form > button:hover { background: var(--hover); text-decoration: none; }
.menu .dropdown .hint { display: block; font-size: 12px; color: var(--muted); }
.count { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 600; text-align: center; line-height: 18px; margin-left: 4px; }
.count.soft { background: var(--hover); color: var(--muted); }
.who > summary { display: flex; align-items: center; gap: 8px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; }
.banner { background: var(--warn-bg); color: var(--warn); padding: 7px 24px; font-size: 13px; border-bottom: 1px solid #f2dfb5; }

/* Layout: sections in the sidebar, the current section's pages in the bar under the header */
:root { --top: 58px; --side: 216px; --sub: 46px; }
.sidebar { position: fixed; top: var(--top); left: 0; bottom: 0; width: var(--side); background: var(--panel); border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; z-index: 15; }
.sidebar a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--muted); font-size: 14.5px; }
.sidebar a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.sidebar a.active { background: var(--ink); color: #fff; font-weight: 600; }
.sidebar a.active .ico { stroke: #fff; }
.sidebar a .label { flex: 1; }
.sidebar a.active .count.soft { background: rgba(255,255,255,.2); color: #fff; }
.ico { width: 19px; height: 19px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
body.with-nav .page { margin-left: var(--side); }
.subnav { position: sticky; top: var(--top); z-index: 12; display: flex; align-items: stretch; gap: 2px; height: var(--sub); padding: 0 24px; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; }
.subnav .sectiontitle { display: flex; align-items: center; font-weight: 650; font-size: 14px; padding-right: 16px; margin-right: 6px; border-right: 1px solid var(--line); white-space: nowrap; }
.subnav a { display: flex; align-items: center; padding: 0 13px; color: var(--muted); font-size: 14px; border-bottom: 2px solid transparent; white-space: nowrap; }
.subnav a:hover { color: var(--ink); text-decoration: none; }
.subnav a.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.noaccess { max-width: 620px; margin: 40px auto; }

main { padding: 22px 24px 48px; max-width: 1440px; margin: 0 auto; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.pagehead .actionrow { margin-left: auto; }
.back { font-size: 13px; color: var(--muted); }
.meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 14px; }

/* Messages */
.flash { padding: 11px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 14px; border: 1px solid transparent; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: #cbe5d3; }
.flash.err { background: var(--bad-bg); color: var(--bad); border-color: #f5c9c4; }
.flash.info { background: var(--info-bg); color: var(--info); border-color: #cfdaf5; }

/* Buttons and inputs */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--ink); background: var(--ink); color: #fff; padding: 8px 15px; border-radius: var(--radius-sm); cursor: pointer; font: inherit; font-size: 14px; font-weight: 500; white-space: nowrap; }
.btn:hover { background: #333; text-decoration: none; }
.btn.secondary, .btn.ghost { background: var(--panel); color: var(--ink); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--hover); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { background: var(--panel); color: var(--bad); border-color: #efb8b2; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.small { padding: 5px 11px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
input, select, textarea { font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--panel); color: var(--ink); min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid #b8c7f0; outline-offset: 0; border-color: var(--info); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset:disabled input, fieldset:disabled select { background: #f4f3ef; color: var(--muted); }
.num, input.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Pills (statuses, issues) */
.pill, .status, .tag, .health, .conn { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 500; background: var(--hover); color: var(--muted); white-space: nowrap; }
.pill.warn, .status.needs_review, .health.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad, .status.failed, .status.rejected, .tag.warn, .health.fail, .conn.disconnected, .conn.not_linked { background: var(--bad-bg); color: var(--bad); }
.pill.ok, .status.posted, .status.xero_approved, .status.paid, .health.ok, .conn.connected { background: var(--ok-bg); color: var(--ok); }
.pill.info, .status.ready, .status.approved, .health.setup { background: var(--info-bg); color: var(--info); }
.pill.purple, .status.awaiting_customer_invoice, .status.on_hold { background: var(--purple-bg); color: var(--purple); }
.tag { font-size: 12px; padding: 1px 8px; margin-right: 3px; }

/* Overview tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--ink); }
.tile:hover { border-color: var(--line-strong); text-decoration: none; }
.tile.active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.tile .label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.tile .label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.tile.warn .label::before { background: #e0a020; } .tile.info .label::before { background: var(--info); }
.tile.purple .label::before { background: var(--purple); } .tile.ok .label::before { background: var(--ok); }
.tile .n { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; margin-top: 2px; }
.tile .sub { font-size: 12.5px; color: var(--muted); }

/* Toolbars and filters */
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .search { flex: 1; min-width: 220px; }
.toolbar .search input { width: 100%; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.statuses { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.statuses a { padding: 4px 8px; border-radius: var(--radius-sm); color: var(--ink); border: 1px solid transparent; }
.statuses a.active { border-color: var(--line-strong); background: var(--panel); }
.statuses a:hover { text-decoration: none; background: var(--hover); }
.check { display: flex; gap: 6px; align-items: center; font-size: 14px; }

/* The work list */
.worklist { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.workrow { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.6fr) minmax(150px, 1fr); gap: 16px; align-items: center; padding: 13px 18px; border-top: 1px solid var(--line); color: var(--ink); }
.workrow:first-child { border-top: 0; }
.workrow:hover { background: #fafaf7; text-decoration: none; }
.workrow b { font-weight: 600; }
.workrow .sub { font-size: 13px; color: var(--muted); margin-top: 1px; }
.workrow .amount { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.workrow .issue { font-size: 13px; color: var(--muted); margin-top: 3px; }
.empty { text-align: center; color: var(--muted); padding: 36px 16px; }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* Tables */
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.grid th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--muted); background: #fafaf7; border-bottom: 1px solid var(--line); }
.grid th, .grid td { padding: 10px 12px; vertical-align: top; }
.grid td { border-top: 1px solid var(--line); }
.grid tbody tr:first-child td { border-top: 0; }
.grid tbody tr[onclick] { cursor: pointer; }
.grid tbody tr[onclick]:hover { background: #fafaf7; }
.grid.compact th, .grid.compact td { padding: 6px 9px; font-size: 13px; }

/* Cards and panels */
.panel, .card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; }

/* Invoice page */
.invhead { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 6px; }
.invhead .title { flex: 1; min-width: 260px; }
.invhead .title h1 { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.invhead .total { text-align: right; }
.invhead .total .n { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.actionbar { position: sticky; top: calc(var(--top) + var(--sub)); z-index: 10; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--bg); padding: 10px 0; border-bottom: 1px solid var(--line); }
.actionbar .why { margin-left: auto; font-size: 13px; color: var(--muted); }
.actionbar .menu .dropdown { width: 310px; top: 42px; }
.actionbar .menu > summary { padding: 0; }
.actionbar .menu > summary:hover { background: none; }
.actionbar .menu > summary::after { display: none; }
.reasonform { display: flex; flex-direction: column; gap: 8px; padding: 6px; }
.reasonform label { font-size: 13px; color: var(--muted); }

.fixes { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px 6px; margin: 14px 0; }
.fixes.allclear { border-color: #cbe5d3; background: var(--ok-bg); color: var(--ok); padding: 13px 18px; }
.fixes h2 { margin: 0 0 4px; }
.fix { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.fixes h2 + .fix { border-top: 0; }
.fix .dot { flex: none; width: 12px; height: 12px; border-radius: 50%; margin-top: 5px; border: 2px solid var(--bad); background: none; }
.fix.waiting .dot { border-color: var(--faint); }
.fix.soft .dot { border-color: #e0a020; }
.fix .what { flex: 1; min-width: 0; }
.fix .what b { font-weight: 600; }
.fix.waiting .what b { color: var(--muted); font-weight: 500; }
.fix .what .d { font-size: 13px; color: var(--muted); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 4px 0 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.tabpanel[hidden] { display: none; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.viewer { position: sticky; top: calc(var(--top) + var(--sub) + 70px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.viewer .toolbar { padding: 8px 10px; border-bottom: 1px solid var(--line); margin: 0; }
.frame { height: calc(100vh - 230px); min-height: 460px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: #525659; }
.frame iframe { width: 100%; height: 100%; border: 0; transition: transform .2s; background: #fff; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.field input, .field select { font-size: 14px; color: var(--ink); }
.field.low input { background: var(--low-bg); border-color: var(--low-line); }
.field.bad input, .field.bad select, td.bad input, td.bad select, .withstar.bad input { border-color: var(--bad); background: #fff7f6; }
.field.wide2 { grid-column: span 2; }
.field.check { flex-direction: row; align-items: center; gap: 8px; padding-top: 22px; }
.conf { font-size: 11.5px; color: var(--ok); margin-left: 4px; }
.conf.low { color: var(--warn); font-weight: 600; }
.req { color: var(--bad); font-weight: 800; font-size: 15px; margin-left: 3px; cursor: help; }
.why { color: var(--bad); font-size: 12px; line-height: 1.35; display: block; }
p.why { margin: -4px 0 8px; }
.legend { margin: 0 0 12px; color: var(--muted); }
.sums { background: #fafaf7; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin-top: 12px; }
.sums .line { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 2px 0; font-variant-numeric: tabular-nums; }
.sums .line.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 7px; font-weight: 650; }
.sums .verdict { font-size: 13px; margin-top: 6px; }
.sums .verdict.ok { color: var(--ok); } .sums .verdict.bad { color: var(--bad); }
.lines input, .lines select { width: 100%; }
.lines td { padding: 5px; }
.lines td:first-child { min-width: 200px; }
.cellstar, .withstar { display: flex; align-items: center; gap: 2px; }
.cellstar .req, .withstar .req { order: 2; }
.withstar { flex: 1; min-width: 140px; }
.withstar.wide { flex: 2; }
.withstar input { flex: 1; min-width: 0; }
select.wide { width: 100%; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.actionrow { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
form.inline { display: flex; gap: 6px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
form.inline input { flex: 1; min-width: 160px; }

.checks { list-style: none; padding: 0; margin: 0; }
.checks li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.checks li:first-child { border-top: 0; }
.checks .icon { width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; }
.checks .pass .icon, .checks .ok .icon { background: var(--ok-bg); color: var(--ok); }
.checks .warn .icon { background: var(--warn-bg); color: var(--warn); }
.checks .block .icon, .checks .fail .icon { background: var(--bad-bg); color: var(--bad); }
.checks .overridden .icon { background: var(--hover); color: var(--muted); }
.exceptions { border-color: #f1c4be; background: #fffafa; }
.exc { padding: 4px 0; }
.history td:nth-child(5), .history td:nth-child(6) { max-width: 240px; overflow-wrap: anywhere; }

/* Sign-in */
.authbox { max-width: 400px; margin: 56px auto; display: flex; flex-direction: column; gap: 12px; padding: 26px; }
.codebox { border-color: #cbe5d3; background: #f4fbf6; }
.code { font: 600 26px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; margin: 4px 0 8px; }
.adduser { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.adduser h2 { width: 100%; margin: 0; }

/* Upload */
.uploadform { display: flex; flex-direction: column; gap: 14px; max-width: 900px; }
.field.drop input[type=file] { padding: 22px; border: 2px dashed var(--line-strong); background: #fafaf7; }
.planitlink input.cur { flex: 0 0 72px; min-width: 72px; }

/* Xero connections and setup */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #c9c6be; }
.dot.ok { background: var(--ok); } .dot.warn { background: #e0a020; } .dot.fail { background: var(--bad); } .dot.setup { background: #8aa4e8; }
.grid.xero tr.detail td { background: #fafaf7; }
.rowactions { display: flex; gap: 6px; white-space: nowrap; }
.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; align-items: start; }
.statuses .search input { min-width: 220px; }
.setupbar { display: inline-block; vertical-align: middle; width: 72px; height: 7px; border-radius: 4px; background: #e8e6e0; overflow: hidden; margin-right: 6px; }
.setupbar span { display: block; height: 100%; background: var(--ok); }
.setupbar.big { width: 170px; height: 9px; }
.entityform .fields { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
ol.setup { list-style: none; padding: 0; margin: 0; }
ol.setup li { display: flex; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 16px; margin-bottom: 8px; }
ol.setup li.done { background: #f6fbf7; border-color: #cfe8d6; }
ol.setup li.next { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
ol.setup .tick { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--hover); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--muted); }
ol.setup li.done .tick { background: var(--ok); color: #fff; }
ol.setup li.next .tick { background: var(--ink); color: #fff; }
ol.setup .body { flex: 1; min-width: 0; }
ol.setup .body p { margin: 4px 0; }
ol.setup .title { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

@media (max-width: 1100px) {
  .split, .twocol { grid-template-columns: 1fr; }
  .viewer { position: static; }
  .frame { height: 70vh; }
}
@media (max-width: 900px) {
  .sidebar { position: sticky; top: var(--top); bottom: auto; width: auto; flex-direction: row; padding: 6px 10px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .sidebar a { padding: 7px 11px; white-space: nowrap; }
  body.with-nav .page { margin-left: 0; }
  .subnav { top: calc(var(--top) + 50px); }
  .actionbar { top: calc(var(--top) + 50px + var(--sub)); }
}
@media (max-width: 760px) {
  .topbar { padding: 0 14px; gap: 10px; }
  .brand span, .who .name { display: none; }
  main { padding: 16px 14px 40px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workrow { grid-template-columns: minmax(0, 1fr) auto; }
  .workrow .issuecol { grid-column: 1 / -1; order: 3; }
  .actionbar { position: static; }
  .field.wide2 { grid-column: auto; }
  .grid { display: block; overflow-x: auto; }
}

/* Users and access */
.grid.users td { vertical-align: middle; }
form.access { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 13px; cursor: pointer; background: var(--panel); }
.chip:has(input:checked) { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip input { margin: 0; accent-color: var(--ink); }
.chip.fixed { background: var(--hover); color: var(--muted); cursor: default; }
.chipgroup { font-size: 12.5px; color: var(--muted); margin-left: 6px; }

/* Process flow chart */
.where-planit { --c: var(--purple); } .where-app { --c: var(--ink); } .where-people { --c: #d18f12; } .where-xero { --c: var(--ok); }
.glance { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.chipstep { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--hover); }
.chipstep .num, .node .num { width: 22px; height: 22px; border-radius: 50%; background: var(--c); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex: none; }
.glance .to { color: var(--faint); }
.legend-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; color: var(--muted); margin: 0 0 18px; }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }
.legend-row .sw { width: 12px; height: 12px; border-radius: 3px; background: var(--c); display: inline-block; }
.legend-row .sep { width: 1px; height: 16px; background: var(--line-strong); }
.badge { font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--ok-bg); color: var(--ok); }
.badge.stand-in { background: var(--warn-bg); color: var(--warn); }
.badge.planned { background: var(--hover); color: var(--muted); }
.flow { list-style: none; padding: 0; margin: 0; max-width: 1180px; }
.flowstep { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 0 34px; position: relative; padding-bottom: 38px; }
.flowstep:not(:last-child)::after { content: "↓"; position: absolute; bottom: 6px; left: calc((100% - 34px) * 0.2778 - 7px); color: var(--faint); font-size: 22px; line-height: 1; }
.node { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: var(--radius); padding: 14px 16px; }
.nodehead { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); }
.nodehead .badge { margin-left: auto; }
.node h3 { font-size: 16px; font-weight: 650; margin: 7px 0 4px; }
.node p { margin: 0; font-size: 14px; }
.details { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.details li { margin: 2px 0; }
.livebar { margin-top: 10px; font-size: 13px; background: #fafaf7; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 10px; display: flex; align-items: center; gap: 8px; }
.dotlive { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.statenote { margin-top: 8px; font-size: 12.5px; color: var(--warn); }
.branches { display: flex; flex-direction: column; gap: 9px; align-self: center; }
.branch { position: relative; border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 9px 12px; font-size: 13px; background: var(--panel); }
.branch::before { content: ""; position: absolute; left: -35px; top: 50%; width: 34px; border-top: 1px dashed var(--line-strong); }
.branch.bad { border-color: #efb8b2; } .branch.warn { border-color: #e6c27a; } .branch.wait { border-color: #c9b8ef; }
.branch b { display: block; font-weight: 600; margin-bottom: 1px; }
.branch span { color: var(--muted); }
.branch em { display: block; font-style: normal; margin-top: 4px; font-size: 12.5px; }
.bgsteps { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.changes { list-style: none; margin: 0; padding: 0; }
.changes li { display: flex; gap: 14px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.changes li:first-child { border-top: 0; }
.changes .when { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) {
  .flowstep { grid-template-columns: 1fr; gap: 10px; }
  .flowstep:not(:last-child)::after { left: 20px; }
  .branch::before { display: none; }
  .branches { padding-left: 18px; border-left: 2px dashed var(--line); }
}

/* Dashboard */
.tile.bad .label::before { background: var(--bad); }
.tile.planit .label::before { background: var(--ink); }
.dashgrid { display: grid; gap: 14px; margin-bottom: 14px; }
.dashgrid.two { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.dashgrid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dashgrid > .panel { margin-bottom: 0; }
.cardhead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.cardhead h2 { margin: 0; }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.legend i, .seglegend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.legend i + * , .legend i { margin-left: 6px; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart .grid { stroke: #ebe9e4; stroke-width: 1; }
svg.chart .axis { stroke: #cfccc4; stroke-width: 1; }
svg.chart .tick { font-size: 11px; fill: var(--muted); font-family: var(--font); }
svg.chart .hit { fill: #000; fill-opacity: 0; }
svg.chart .day:hover .hit { fill-opacity: .035; }
.tableview { margin-top: 8px; font-size: 13px; }
.tableview summary { cursor: pointer; color: var(--muted); }
.tableview table { margin-top: 8px; }
.segbar { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; background: var(--panel); margin: 4px 0 12px; }
.segbar span { min-width: 3px; }
.seglegend { list-style: none; margin: 0 0 6px; padding: 0; }
.seglegend li { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 14px; }
.seglegend li span { flex: 1; }
.seglegend li b, .countlist b { font-weight: 600; font-variant-numeric: tabular-nums; }
h3.minor { font-size: 13px; color: var(--muted); font-weight: 600; margin: 14px 0 4px; }
.moneyline { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bignum { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; }
.bignum span { font-size: 14px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.setupbar.wide { width: 100%; height: 8px; margin: 6px 0 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.plainlist { list-style: none; margin: 0 0 10px; padding: 0; font-size: 14px; }
.plainlist li { padding: 3px 0; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; margin: 0; font-size: 14px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; }
.countlist { list-style: none; margin: 0 0 10px; padding: 0; }
.countlist li { display: flex; align-items: baseline; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 14px; }
.countlist li:first-child { border-top: 0; }
.countlist li > a, .countlist li > span:first-child { flex: 1; }
.countlist .moneycol { min-width: 120px; text-align: right; }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; flex-direction: column; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.activity li:first-child { border-top: 0; }
@media (max-width: 1100px) { .dashgrid.two, .dashgrid.three { grid-template-columns: 1fr; } }

/* Access levels: View only marker, the Users list and the Edit user page */
.subnav .viewonly { align-self: center; margin-left: auto; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 500; background: var(--info-bg); color: var(--info); white-space: nowrap; cursor: help; }
.levels { display: flex; flex-wrap: wrap; gap: 6px; }
.lvl { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; white-space: nowrap; border: 1px solid transparent; }
.lvl i { font-style: normal; font-size: 11.5px; opacity: .8; }
.lvl.edit { background: var(--ok-bg); color: var(--ok); }
.lvl.view { background: var(--info-bg); color: var(--info); }
.lvl.none { background: transparent; color: var(--faint); border: 1px dashed var(--line-strong); }
table.users tr.off td { opacity: .6; }
table.users td.rowactions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.userform h2 { margin-top: 18px; }
.userform h2:first-child { margin-top: 0; }
.userform table.access { margin-top: 6px; }
.userform table.access select { min-width: 170px; }

/* Entity summary per country */
button.tile { font: inherit; text-align: left; cursor: pointer; width: 100%; }
.tile.st .label::before { background: var(--c); }
.tile.st.hollow .label::before { background: transparent; box-shadow: inset 0 0 0 2px var(--c); }
svg.tilemap { display: block; width: 100%; max-width: 760px; height: auto; margin: 4px auto 12px; }
svg.tilemap a.maptile { cursor: pointer; }
svg.tilemap a.maptile:hover rect:first-of-type { stroke: #141414; stroke-width: 1.5; }
svg.tilemap .dim { opacity: .22; }
.maplegend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); margin-top: 4px; }
.maplegend b { color: var(--ink); font-weight: 600; }
.maplegend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 6px; vertical-align: -1px; }
.maplegend i.hollow { background: transparent; box-shadow: inset 0 0 0 2px var(--c); }
.maplegend i.sq { width: 12px; height: 12px; border-radius: 3px; }
.maplegend i.tint { background: color-mix(in srgb, var(--c) 13%, #fff); box-shadow: inset 0 0 0 1px #cfccc4; }
.regionrow { padding: 8px 0; border-top: 1px solid var(--line); }
.regionrow:first-of-type { border-top: 0; padding-top: 0; }
.regionline { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.regionline a { color: var(--ink); }
.segbar.thin { height: 8px; margin: 6px 0 4px; }
.esbar { display: flex; gap: 12px; align-items: center; margin: 18px 0 4px; }
.esbar input[type=search] { width: min(360px, 100%); }
.region { margin-top: 18px; }
.regionhead { font-size: 16px; display: flex; gap: 10px; align-items: baseline; margin: 0 0 10px; }
.countrygrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.countrycard { margin: 0; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; scroll-margin-top: 130px; }
.countrycard:target { box-shadow: 0 0 0 2px var(--ink); }
.countrycard header { display: flex; flex-direction: column; gap: 2px; }
.countrycard .segbar.thin { margin: 0; }
.ctitle { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; font-size: 15px; }
.ctitle .code { font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--hover); border-radius: 4px; padding: 1px 6px; }
.entlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ent { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); font: inherit; color: var(--ink); }
button.ent { cursor: pointer; }
button.ent:hover { border-color: var(--line-strong); background: #fbfbf9; }
.ent .ename { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ent .eflags { display: flex; gap: 4px; flex-shrink: 0; }
.edot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; margin-top: 3px; background: var(--c); }
.edot.trading { --c: var(--trading); } .edot.dormant { --c: var(--dormant); } .edot.holding { --c: var(--holding); }
.edot.hollow { background: transparent; box-shadow: inset 0 0 0 2px var(--c); }
.linkbtn { background: none; border: 0; padding: 2px 0; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; text-align: left; align-self: flex-start; }
.linkbtn:hover { color: var(--ink); text-decoration: underline; }
details.tableview.panel { margin-top: 18px; }
dialog.entdialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; width: min(640px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .18); }
dialog.entdialog::backdrop { background: rgba(20, 20, 20, .35); }
dialog.entdialog h2 { margin-top: 0; }
@media (max-width: 760px) { .countrygrid { grid-template-columns: 1fr; } }
.countrycard[hidden], .region[hidden], .entlist li[hidden], .linkbtn[hidden], #ed-full[hidden] { display: none; }

/* Users: invites and delete */
.codebox .invitelink { word-break: break-all; font-size: 13px; }
.codebox details summary { cursor: pointer; color: var(--muted); }
.codebox details .code { font-size: 15px; letter-spacing: .04em; }
.btn.danger-text { color: var(--bad); }

/* Customer invoices */
.pagehead .total { text-align: right; }
.pagehead .total .n { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.actionbar .testbtns { display: inline-flex; gap: 6px; padding: 3px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); }
.cform .fields { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
ul.history { list-style: none; margin: 0; padding: 0; }
ul.history li { display: flex; gap: 14px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
ul.history li:first-child { border-top: 0; }
ul.history .when { color: var(--muted); min-width: 110px; flex-shrink: 0; }

/* Dashboard: supplier side, customer side, shared */
.side { margin-bottom: 26px; scroll-margin-top: 120px; }
.side + .side { padding-top: 22px; border-top: 1px solid var(--line-strong); }
.sidehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.sidehead h2 { font-size: 19px; margin: 0 0 2px; }
.side .dashgrid { margin-bottom: 14px; }
.sidejump { display: flex; gap: 6px; flex-wrap: wrap; }
.sidejump a { padding: 5px 12px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 13px; color: var(--ink); background: var(--panel); }
.sidejump a:hover { background: var(--hover); text-decoration: none; }
