/* Canopy Ledger — operator workbench. Forest-dark navigation, light working surface, one blue
   accent for actions, semantic colours only for state. */
:root {
  --bg: #f3f5f3; --surface: #ffffff; --sunk: #edf1ee; --ink: #15201a; --muted: #5b6b61; --faint: #8a988f; --line: #d7dfd9; --line-soft: #e6ebe7;
  --nav: #10261d; --nav-ink: #d6e6dc; --nav-muted: #8fa99a; --nav-active: #1d4a37;
  --accent: #2457c5; --accent-ink: #ffffff; --accent-soft: #e5ecfb;
  --good: #1d7a3e; --good-soft: #e1f2e6; --warn: #9b5d00; --warn-soft: #fbefd9; --bad: #b3261e; --bad-soft: #f9e1de; --info: #2457c5; --info-soft: #e5ecfb;
  --shadow: 0 1px 2px rgba(16, 38, 29, .06), 0 4px 16px rgba(16, 38, 29, .06);
  --r: 8px; --font: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1512; --surface: #161e1a; --sunk: #1c2621; --ink: #e3ebe6; --muted: #9db0a4; --faint: #73867a; --line: #2a3731; --line-soft: #222d28;
    --nav: #0a110d; --nav-ink: #d6e6dc; --nav-muted: #7d9688; --nav-active: #183a2b;
    --accent: #7ea4ff; --accent-ink: #0d1420; --accent-soft: #1d2a47;
    --good: #5cc283; --good-soft: #15301f; --warn: #e3a84b; --warn-soft: #372811; --bad: #f2776b; --bad-soft: #3b1a17; --info: #7ea4ff; --info-soft: #1d2a47;
    --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: 1.55rem; line-height: 1.2; }
h2 { font-size: 1.1rem; }
h3 { font-size: .98rem; }
p { margin: 0; }
.mono { font-family: var(--mono); font-size: .9em; font-variant-numeric: tabular-nums; }
h1.mono { font-size: 1.45rem; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .84rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.eyebrow { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 650; color: var(--muted); }
.boot { padding: 40px; color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--nav) 232px, var(--bg) 232px); }
.nav { background: var(--nav); color: var(--nav-ink); display: flex; flex-direction: column; padding: 14px 10px; gap: 2px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 16px; font-weight: 700; font-size: 1.02rem; color: #fff; }
.brand img { width: 26px; height: 26px; }
.nav .group { margin: 14px 10px 4px; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--nav-muted); font-weight: 650; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 6px; color: var(--nav-ink); font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.nav a.active { background: var(--nav-active); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 #7fd1a8; }
.nav .count { font-family: var(--mono); font-size: .72rem; color: var(--nav-muted); }
.nav .foot { margin-top: auto; padding: 12px 10px 4px; font-size: .78rem; color: var(--nav-muted); border-top: 1px solid rgba(255,255,255,.08); }
.nav .foot b { color: #fff; font-family: var(--mono); font-weight: 600; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 10px 28px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.topbar .grow { flex: 1; }
.topbar .tenant { font-weight: 650; }
.impersonation { background: var(--warn-soft); color: var(--warn); padding: 8px 28px; font-weight: 600; display: flex; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); }
.content { padding: 24px 28px 64px; display: flex; flex-direction: column; gap: 20px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 6px; max-width: 72ch; }
.crumbs { font-size: .82rem; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .nav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 8px; }
  .nav .group, .nav .foot { display: none; }
  .brand { padding: 6px 10px; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
}

/* ---------- Building blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.card > .head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.card > .body { padding: 16px; }
.card > .body.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.kpis > div { padding: 14px 18px; border-left: 1px solid var(--line-soft); }
.kpis > div:first-child { border-left: 0; }
.kpis b { display: block; font-size: 1.75rem; font-weight: 650; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpis span { color: var(--muted); font-size: .84rem; }
@media (max-width: 700px) { .kpis { grid-template-columns: repeat(2, 1fr); } .kpis > div:nth-child(3) { border-left: 0; } .kpis > div:nth-child(n+3) { border-top: 1px solid var(--line-soft); } }

.bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--sunk); }
.bar > i { display: block; height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }

/* Tables */
.tw { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
.t th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.t td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t td.row { display: table-cell; white-space: nowrap; }
.t td.row > * { margin: 2px 4px 2px 0; }
.t td.nw { white-space: nowrap; }
.t tr.click { cursor: pointer; }
.t tr.click:hover td { background: var(--sunk); }
.t .sub { color: var(--muted); font-size: .82rem; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; padding: 2px 9px; border-radius: 99px; white-space: nowrap; background: var(--sunk); color: var(--muted); line-height: 1.6; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.plain::before { display: none; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: .78rem; font-weight: 600; background: var(--surface); white-space: nowrap; }
.flag { font-family: var(--mono); font-size: .75rem; font-weight: 600; padding: 1px 5px; border-radius: 4px; background: var(--sunk); color: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; font-size: .88rem; white-space: nowrap; color: var(--ink); text-decoration: none; }
.btn:hover { background: var(--sunk); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 10px; font-size: .8rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn .spin { width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Forms */
.field { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; color: var(--muted); min-width: 0; }
.field > span { font-weight: 600; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=url], input[type=time], select, textarea {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: .9rem; width: 100%; min-width: 0; }
textarea { resize: vertical; min-height: 80px; }
textarea.code { font-family: var(--mono); font-size: .78rem; min-height: 160px; }
textarea.code.short { min-height: 56px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input { width: auto; min-width: 150px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--surface); flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 12px; font-size: .82rem; font-weight: 600; cursor: pointer; border-left: 1px solid var(--line); color: var(--ink); }
.seg button:first-child { border-left: 0; }
.seg button[aria-pressed=true] { background: var(--ink); color: var(--surface); }
pre.code { margin: 0; font-family: var(--mono); font-size: .76rem; line-height: 1.55; background: var(--sunk); border-radius: 6px; padding: 12px 14px; overflow: auto; max-height: 460px; white-space: pre; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; margin: 0; font-size: .88rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.note { font-size: .84rem; color: var(--muted); border-left: 3px solid var(--line); padding: 2px 0 2px 10px; }
.note.warn { border-color: var(--warn); color: var(--ink); }
.note.bad { border-color: var(--bad); color: var(--ink); }
.callout { padding: 12px 14px; border-radius: 6px; background: var(--sunk); font-size: .88rem; }
.callout.info { background: var(--info-soft); }
.callout.warn { background: var(--warn-soft); }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; font-size: .9rem; }
.tabs button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .n { font-family: var(--mono); font-size: .74rem; color: var(--faint); margin-left: 4px; }

/* Validation checks */
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; padding: 11px 16px; border-top: 1px solid var(--line-soft); align-items: start; }
.checks li:first-child { border-top: 0; }
.ic { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; margin-top: 1px; }
.ic.pass { background: var(--good); } .ic.warn { background: var(--warn); } .ic.fail { background: var(--bad); } .ic.na { background: var(--faint); }
.checks .t1 { font-weight: 600; }
.checks .d { color: var(--muted); font-size: .85rem; margin-top: 2px; }
.checks .fix { font-size: .82rem; color: var(--accent); margin-top: 4px; font-weight: 600; }
.group-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--sunk); border-top: 1px solid var(--line); font-weight: 650; font-size: .86rem; }
.group-head:first-child { border-top: 0; }

/* Risk wheel */
.wheel { position: relative; width: 240px; height: 240px; margin: 4px auto; }
.wheel .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none; }
.wheel .center b { font-size: 2rem; display: block; line-height: 1; font-variant-numeric: tabular-nums; }
.wheel button { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; font-size: .64rem !important; letter-spacing: -.02em; border-radius: 50%; border: 2px solid currentColor; background: var(--surface); cursor: pointer; display: grid; place-items: center; font-size: .72rem; font-weight: 700; padding: 0; }
.wheel button:hover { transform: scale(1.08); }
.sev-0 { color: var(--good); } .sev-1 { color: #6a8f1f; } .sev-2 { color: var(--warn); } .sev-3 { color: var(--bad); }

/* Map */
.map { position: relative; overflow: hidden; background: #c9d3cc; border-radius: var(--r); touch-action: none; user-select: none; cursor: grab; }
.map.grabbing { cursor: grabbing; }
.map .tiles, .map .tiles-layer, .map svg.ov { position: absolute; inset: 0; }
.map .tiles-layer img { position: absolute; width: 256px; height: 256px; max-width: none; image-rendering: auto; }
.map svg.ov { width: 100%; height: 100%; overflow: visible; }
.map .ctrl { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 4px; z-index: 3; }
.map .ctrl button { width: 30px; height: 30px; border-radius: 6px; border: 1px solid rgba(0,0,0,.2); background: #fff; color: #15201a; font-weight: 700; cursor: pointer; font-size: 16px; line-height: 1; }
.map .attr { position: absolute; right: 0; bottom: 0; background: rgba(255,255,255,.82); color: #333; font-size: 10.5px; padding: 1px 6px; z-index: 3; max-width: 90%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map .scale { position: absolute; left: 10px; bottom: 8px; z-index: 3; font: 11px var(--mono); color: #fff; text-shadow: 0 1px 2px #000; }
.map .scale i { display: block; height: 4px; border: 2px solid #fff; border-top: 0; margin-bottom: 2px; box-shadow: 0 1px 2px rgba(0,0,0,.6); }
.map .label { position: absolute; left: 10px; top: 10px; z-index: 3; background: rgba(16,38,29,.82); color: #fff; padding: 4px 10px; border-radius: 6px; font-size: .78rem; font-weight: 600; }
.map .coord { position: absolute; left: 10px; bottom: 26px; z-index: 3; font: 11px var(--mono); color: #fff; text-shadow: 0 1px 2px #000; }
.map-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .78rem; color: var(--muted); }
.map-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -2px; }
.layer-list { display: flex; flex-direction: column; gap: 4px; font-size: .86rem; }
.layer-list label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.layer-list .na { color: var(--faint); }

/* Investigation */
.investigate { display: grid; gap: 12px; }
.investigate.double { grid-template-columns: 1fr 1fr; }
.investigate.triple { grid-template-columns: 1fr 1fr 1fr; }
.investigate.swipe { grid-template-columns: 1fr; }
@media (max-width: 1000px) { .investigate.double, .investigate.triple { grid-template-columns: 1fr; } }
.panel-map { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.panel-map .ph { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .82rem; }
.panel-map .ph b { font-size: .86rem; }
.film { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 6px; }
.film button { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 5px 8px; text-align: left; cursor: pointer; font-size: .74rem; min-width: 96px; color: var(--ink); }
.film button[aria-pressed=true] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.film button b { display: block; font-size: .78rem; }
.film .q { font-family: var(--mono); font-size: .66rem; padding: 0 4px; border-radius: 3px; background: var(--sunk); margin-left: 4px; }
.swipe-wrap { position: relative; }
.swipe-wrap .map + .map { position: absolute; inset: 0; }
.swipe-handle { position: absolute; top: 0; bottom: 0; width: 3px; background: #fff; z-index: 5; box-shadow: 0 0 4px rgba(0,0,0,.5); pointer-events: none; }

/* Timeline (history, plot checks) */
.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.timeline > li { position: relative; padding: 0 0 14px 20px; border-left: 2px solid var(--line); }
.timeline > li:last-child { border-left-color: transparent; }
.timeline > li::before { content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.timeline .when { font-size: .76rem; color: var(--faint); font-family: var(--mono); }

/* Modal & toast */
.modal-back { position: fixed; inset: 0; background: rgba(10, 20, 15, .45); z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--surface); border-radius: 10px; width: min(720px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { width: min(1080px, 100%); }
.modal > header { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal > .mb { padding: 18px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal > footer { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 10px 18px; border-radius: 8px; font-weight: 500; z-index: 200; max-width: calc(100% - 32px); box-shadow: var(--shadow); }
.toast.bad { background: var(--bad); color: #fff; }
.secret { display: flex; gap: 8px; align-items: center; background: var(--warn-soft); padding: 10px 12px; border-radius: 6px; font-family: var(--mono); font-size: .86rem; overflow-wrap: anywhere; }

/* Login */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr minmax(380px, 460px); }
.login-art { background: var(--nav); color: var(--nav-ink); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art h1 { color: #fff; font-size: 2.2rem; max-width: 18ch; margin-top: 18px; }
.login-art p { max-width: 48ch; margin-top: 12px; color: var(--nav-muted); font-size: 1rem; }
.login-art svg.contours { position: absolute; right: -80px; bottom: -80px; width: 620px; opacity: .5; }
.login-form { padding: 48px 40px; display: flex; flex-direction: column; justify-content: center; gap: 16px; background: var(--surface); }
.demo-logins { font-size: .82rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }
.demo-logins button { all: unset; cursor: pointer; color: var(--accent); font-weight: 600; }
@media (max-width: 860px) { .login-wrap { grid-template-columns: 1fr; } .login-art { display: none; } }

/* Supplier portal top navigation */
.portal-top { background: var(--nav); color: var(--nav-ink); display: flex; align-items: center; gap: 20px; padding: 0 28px; flex-wrap: wrap; }
.portal-top nav { display: flex; gap: 2px; flex-wrap: wrap; }
.portal-top nav a { color: var(--nav-ink); padding: 16px 12px; font-weight: 600; border-bottom: 3px solid transparent; }
.portal-top nav a.active { border-bottom-color: #7fd1a8; color: #fff; }
.portal-top nav a:hover { text-decoration: none; color: #fff; }
.portal-top .grow { flex: 1; }
.req-card { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; padding: 14px 16px; border-top: 1px solid var(--line-soft); }
.req-card:first-child { border-top: 0; }
.progress { height: 6px; background: var(--sunk); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--good); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Supply-chain tree */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { margin-left: 22px; padding-left: 16px; border-left: 2px solid var(--line); }
.tree li { position: relative; padding: 6px 0; }
.tree ul > li::before { content: ""; position: absolute; left: -16px; top: 28px; width: 14px; border-top: 2px solid var(--line); }
.tnode { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.tnode.self { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.tmain { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.tmeta { grid-column: 1; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .82rem; color: var(--muted); }
.tact { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tier { font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 1px 7px; border-radius: 4px; background: var(--sunk); color: var(--muted); }
.tier.t1 { background: var(--accent-soft); color: var(--accent); }
.tier.t2 { background: var(--good-soft); color: var(--good); }
.tier.t3 { background: var(--warn-soft); color: var(--warn); }
.tier.t4 { background: var(--info-soft); color: var(--info); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-check { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 99px; padding: 4px 10px; font-size: .86rem; background: var(--surface); cursor: pointer; }
.chip-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.chip-check:has(input:disabled) { cursor: default; opacity: .85; }
.perm-grid { width: 100%; border-collapse: collapse; font-size: .88rem; }
.perm-grid th, .perm-grid td { padding: 7px 8px; border-bottom: 1px solid var(--line-soft); text-align: center; }
.perm-grid th:first-child, .perm-grid td:first-child { text-align: left; }
.perm-grid thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); vertical-align: bottom; }
.perm-grid .yes { color: var(--good); font-weight: 700; }
.perm-grid .no { color: var(--line); }
@media (max-width: 720px) { .tnode { grid-template-columns: 1fr; } .tact { grid-column: 1; grid-row: auto; justify-content: flex-start; } }

/* Integration hub */
.conn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
a.conn-card { color: inherit; display: block; transition: border-color .15s; }
a.conn-card:hover { border-color: var(--accent); }
.flow-line { display: flex; align-items: center; gap: 8px; font-size: .88rem; padding: 4px 0; border-top: 1px solid var(--line-soft); }
.flow-line:first-of-type { border-top: 0; }
.dir { font-size: .7rem; font-weight: 700; letter-spacing: .03em; padding: 1px 7px; border-radius: 4px; white-space: nowrap; }
.dir.in { background: var(--good-soft); color: var(--good); }
.dir.out { background: var(--accent-soft); color: var(--accent); }
.mpill { font-family: var(--mono); font-size: .7rem; min-width: 46px; justify-content: center; }
.sugg { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: grid; gap: 6px; background: var(--surface); }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 99px; transition: background .15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--good); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-row { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 600; }
.segl { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; font-size: .84rem; font-weight: 600; border-left: 1px solid var(--line); cursor: pointer; }
.segl:first-child { border-left: 0; }
.segl input { position: absolute; opacity: 0; pointer-events: none; }
.segl:has(input:checked) { background: var(--ink); color: var(--surface); }
.segl:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }
.map-wrap { display: flex; gap: 0; align-items: stretch; border-top: 1px solid var(--line-soft); }
.fieldlist { width: 260px; flex: none; padding: 12px; border-right: 1px solid var(--line-soft); max-height: 520px; overflow: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; background: var(--sunk); }
.fchip { border: 1px solid var(--line); background: var(--surface); border-radius: 5px; padding: 2px 7px; font-family: var(--mono); font-size: .74rem; cursor: pointer; text-align: left; max-width: 100%; overflow-wrap: anywhere; color: var(--ink); }
.fchip:hover { border-color: var(--accent); color: var(--accent); }
.maptable input, .maptable select { width: 100%; min-width: 0; font-family: var(--mono); font-size: .8rem; }
.maptable td { padding: 4px 6px; }
details.cat { border-top: 1px solid var(--line-soft); padding: 6px 0; }
details.cat summary { cursor: pointer; padding: 4px 0; }
@media (max-width: 860px) { .map-wrap { flex-direction: column; } .fieldlist { width: auto; max-height: 160px; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line-soft); } }
