:root {
  color-scheme: dark;
  --bg: #111416;
  --surface: #171b1e;
  --surface-raised: #1d2226;
  --surface-soft: #20262a;
  --line: #30373c;
  --line-strong: #465057;
  --text: #f1f4f3;
  --muted: #95a09f;
  --quiet: #697474;
  --green: #58d68d;
  --green-dark: #173b2a;
  --cyan: #55c8dc;
  --cyan-dark: #15343b;
  --amber: #f3b95f;
  --amber-dark: #3d2d17;
  --red: #ef746f;
  --red-dark: #421f20;
  --violet: #b6a4ef;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", monospace;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
}

button, input, select { font: inherit; letter-spacing: 0; }
button { color: inherit; }
code, pre { font-family: var(--mono); }

.app-header {
  min-height: 72px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: #14181a;
}

.brand-block, .header-status, .section-heading, .workspace-heading, .command-row, .legend, .dialog-header {
  display: flex;
  align-items: center;
}

.brand-block { gap: 12px; min-width: 0; }
.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--green);
  color: #0d1d14;
  font-weight: 900;
  font-size: 19px;
  border-radius: 6px;
}
.brand-line, .eyebrow, .node-kind {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}
.brand-block h1 { margin: 2px 0 0; font-size: 17px; line-height: 1.2; font-weight: 700; }
.header-status { justify-content: flex-end; gap: 12px; min-width: 0; }
.target-label { color: var(--muted); font-family: var(--mono); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 360px; }

.status-badge, .micro-status, .count-label, .tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1;
  font-weight: 800;
}
.status-badge { height: 28px; padding: 0 10px; gap: 7px; border: 1px solid var(--line); color: var(--muted); background: var(--surface); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--quiet); }
.status-online { color: var(--green); border-color: #2c6445; background: var(--green-dark); }
.status-online .status-dot { background: var(--green); box-shadow: 0 0 0 3px rgb(88 214 141 / 12%); }
.status-offline { color: var(--red); border-color: #704044; background: var(--red-dark); }
.status-offline .status-dot { background: var(--red); }
.status-warning { color: var(--amber); border-color: #725227; background: var(--amber-dark); }
.status-warning .status-dot { background: var(--amber); }

.icon-button, .inline-icon {
  border: 1px solid var(--line);
  background: var(--surface-raised);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.icon-button { width: 34px; height: 34px; border-radius: 6px; font-size: 20px; }
.inline-icon { width: 35px; height: 35px; border-radius: 0 5px 5px 0; font-size: 17px; }
.icon-button:hover, .inline-icon:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.auth-button { font-size: 14px; }
.auth-button.authenticated { color: var(--green); border-color: #2c6445; background: var(--green-dark); }

.view-tabs {
  height: 43px;
  padding: 0 24px;
  display: flex;
  align-items: stretch;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: #14181a;
}
.view-tab {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 2px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}
.view-tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: transparent; }
.view-tab.active { color: var(--text); }
.view-tab.active::after { background: var(--green); }
.tab-count { min-width: 18px; height: 18px; margin-left: 5px; padding: 0 5px; background: var(--surface-soft); color: var(--muted); }

.view { display: none; }
.view.active { display: block; }
.flow-shell { display: grid; grid-template-columns: minmax(330px, 390px) minmax(0, 1fr); min-height: calc(100vh - 116px); }
.control-rail { border-right: 1px solid var(--line); background: #14181a; }
.control-section { padding: 20px 22px 22px; border-bottom: 1px solid var(--line); }
.section-heading, .workspace-heading { justify-content: space-between; gap: 14px; }
.section-heading { margin-bottom: 16px; }
.section-heading > div { display: flex; align-items: center; gap: 9px; min-width: 0; }
.section-index { font-family: var(--mono); color: var(--quiet); font-size: 10px; }
.section-heading h2, .workspace-heading h2, .dialog-header h2 { margin: 0; font-size: 14px; line-height: 1.3; font-weight: 750; }
.micro-status { height: 21px; padding: 0 7px; color: var(--muted); background: var(--surface-soft); border: 1px solid var(--line); }
.micro-status.success { color: var(--green); border-color: #2d6246; background: var(--green-dark); }
.micro-status.working { color: var(--cyan); border-color: #2d5e67; background: var(--cyan-dark); }
.micro-status.failed { color: var(--red); border-color: #704044; background: var(--red-dark); }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field > span { color: var(--muted); font-size: 11px; font-weight: 650; }
input, select {
  width: 100%;
  height: 36px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
  padding: 0 10px;
  outline: none;
}
input::placeholder { color: #596362; }
input:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 0 2px rgb(85 200 220 / 10%); }
.input-action { display: grid; grid-template-columns: minmax(0, 1fr) 35px; }
.input-action input { border-radius: 5px 0 0 5px; }
.identity-map { margin-top: 12px; padding: 9px 10px; border-left: 2px solid var(--cyan); background: var(--cyan-dark); display: grid; gap: 3px; min-width: 0; }
.identity-map span { color: var(--muted); font-size: 10px; }
.identity-map code { color: var(--cyan); font-size: 11px; overflow-wrap: anywhere; }

.command-row { gap: 9px; }
.button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  transition: filter 120ms ease, border-color 120ms ease, background 120ms ease;
}
.button:hover:not(:disabled) { filter: brightness(1.08); }
.button:disabled { cursor: not-allowed; opacity: .4; }
.button.primary { flex: 1; background: var(--green); border-color: var(--green); color: #102218; }
.button.secondary { flex: 1; background: var(--surface-raised); color: var(--text); }
.button.action { width: 100%; margin-top: 12px; background: var(--cyan); border-color: var(--cyan); color: #102127; }
.button.danger { background: var(--red-dark); border-color: #724145; color: #ffaaa6; }
.button.warning { flex: 1; background: var(--amber-dark); border-color: #725227; color: var(--amber); }
.button.full { width: 100%; }

.price-strip { margin: 14px 0; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.price-strip div { min-width: 0; padding: 8px; border-right: 1px solid var(--line); background: var(--surface); }
.price-strip div:last-child { border-right: 0; }
.price-strip dt { color: var(--quiet); font-size: 9px; text-transform: uppercase; font-weight: 800; }
.price-strip dd { margin: 2px 0 0; font-family: var(--mono); font-size: 11px; overflow: hidden; text-overflow: ellipsis; }
.price-strip .price-total { background: var(--green-dark); }
.price-strip .price-total dd { color: var(--green); }

.app-action { margin-top: 12px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.app-action-header { height: 32px; padding: 0 10px; display: flex; align-items: center; justify-content: space-between; background: var(--surface-soft); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.app-action-header span:last-child { color: var(--quiet); }
.app-action.ready { border-color: #2d6246; }
.app-action.ready .app-action-header span:last-child { color: var(--green); }
.action-fields { padding: 10px; color: var(--quiet); font-size: 11px; }
.action-fields dl { margin: 0; display: grid; gap: 5px; }
.action-fields div { display: grid; grid-template-columns: 85px minmax(0, 1fr); gap: 8px; }
.action-fields dt { color: var(--muted); }
.action-fields dd { margin: 0; font-family: var(--mono); color: var(--text); overflow-wrap: anywhere; }
.refund-fields { margin: 12px 0; }
.cancel-row { margin-top: 9px; }

.workspace { min-width: 0; padding: 24px; display: grid; gap: 22px; align-content: start; }
.workspace > section, .events-layout > section, .contract-section { min-width: 0; }
.workspace-heading { margin-bottom: 14px; }
.workspace-heading > div { min-width: 0; }
.workspace-heading h2 { margin-top: 3px; font-size: 16px; }
.workspace-heading.compact h2 { font-size: 14px; }
.updated-at, .count-label { color: var(--quiet); font-family: var(--mono); font-size: 10px; }

.topology-section { padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.topology { display: grid; grid-template-columns: minmax(125px, 1fr) minmax(58px, .55fr) minmax(145px, 1.15fr) minmax(58px, .55fr) minmax(125px, 1fr) minmax(58px, .55fr) minmax(135px, 1fr); align-items: center; gap: 0; min-width: 0; }
.system-node { height: 98px; padding: 15px; border: 1px solid var(--line); border-top-width: 3px; border-radius: 6px; background: var(--surface); display: flex; flex-direction: column; justify-content: center; min-width: 0; transition: box-shadow 160ms ease, border-color 160ms ease; }
.system-node strong { margin-top: 8px; font-size: 13px; overflow-wrap: anywhere; }
.system-node small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.node-app { border-top-color: var(--violet); }
.node-lab { border-top-color: var(--green); }
.node-unibee { border-top-color: var(--cyan); }
.node-pay { border-top-color: var(--amber); }
.system-node.active { border-color: var(--green); box-shadow: inset 0 0 0 1px rgb(88 214 141 / 22%), 0 0 18px rgb(88 214 141 / 8%); }
.flow-link { position: relative; height: 66px; display: grid; place-items: center; min-width: 0; }
.flow-link i { position: absolute; left: 7px; right: 7px; top: 34px; height: 1px; background: var(--line-strong); }
.flow-link i::after { content: ""; position: absolute; right: -1px; top: -4px; border-left: 6px solid var(--line-strong); border-top: 4px solid transparent; border-bottom: 4px solid transparent; }
.flow-link.bidirectional i::before { content: ""; position: absolute; left: -1px; top: -4px; border-right: 6px solid var(--line-strong); border-top: 4px solid transparent; border-bottom: 4px solid transparent; }
.flow-link span { position: relative; z-index: 1; align-self: start; margin-top: 13px; padding: 2px 5px; color: var(--quiet); background: var(--bg); font-size: 9px; white-space: nowrap; }
.flow-link.active i { background: var(--green); }
.flow-link.active i::after { border-left-color: var(--green); }
.flow-link.active i::before { border-right-color: var(--green); }
.flow-link.active span { color: var(--green); }
.callback-line { width: calc(100% - 20%); margin: 18px auto 0; height: 36px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; color: var(--muted); font-size: 10px; }
.callback-line i { height: 1px; background: var(--cyan); position: relative; }
.callback-line i::after { content: ""; position: absolute; left: -1px; top: -4px; border-right: 6px solid var(--cyan); border-top: 4px solid transparent; border-bottom: 4px solid transparent; }
.callback-line code { color: var(--cyan); font-size: 10px; }

.empty-state { min-height: 72px; border: 1px dashed var(--line); display: grid; place-items: center; color: var(--quiet); font-size: 12px; }
.hidden { display: none !important; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--quiet); background: var(--surface); font-size: 9px; text-transform: uppercase; }
td { font-family: var(--mono); font-size: 10px; }
tbody tr:last-child td { border-bottom: 0; }
.entity-cell { display: grid; gap: 2px; }
.entity-cell strong { color: var(--text); font-size: 10px; }
.entity-cell small { color: var(--quiet); font-size: 9px; }
.state-pill { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted); background: var(--surface-soft); font-family: var(--sans); font-size: 9px; font-weight: 800; }
.state-pill.active, .state-pill.success, .state-pill.paid { color: var(--green); border-color: #2d6246; background: var(--green-dark); }
.state-pill.pending, .state-pill.created, .state-pill.processing { color: var(--amber); border-color: #725227; background: var(--amber-dark); }
.state-pill.failed, .state-pill.expired, .state-pill.cancelled { color: var(--red); border-color: #704044; background: var(--red-dark); }

.legend { gap: 6px; }
.legend span { padding: 3px 6px; border-radius: 3px; font-size: 9px; font-weight: 800; }
.legend-app { color: var(--violet); background: #302a45; }
.legend-api { color: var(--cyan); background: var(--cyan-dark); }
.legend-hook { color: var(--green); background: var(--green-dark); }
.interaction-list { border-top: 1px solid var(--line); }
.interaction-item { width: 100%; min-height: 53px; padding: 9px 4px; border: 0; border-bottom: 1px solid var(--line); background: transparent; display: grid; grid-template-columns: 74px minmax(160px, 1.2fr) minmax(180px, 2fr) 70px 64px; align-items: center; gap: 10px; cursor: pointer; text-align: left; }
.interaction-item:hover { background: var(--surface); }
.interaction-time { color: var(--quiet); font-family: var(--mono); font-size: 9px; }
.direction-tag { width: max-content; padding: 3px 6px; border-radius: 3px; font-size: 9px; font-weight: 800; }
.direction-APP_TO_LAB { color: var(--violet); background: #302a45; }
.direction-LAB_TO_UNIBEE { color: var(--cyan); background: var(--cyan-dark); }
.direction-UNIBEE_TO_LAB { color: var(--green); background: var(--green-dark); }
.interaction-operation { min-width: 0; }
.interaction-operation strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.interaction-operation small { color: var(--quiet); font-family: var(--mono); font-size: 9px; }
.http-status { justify-self: end; font-family: var(--mono); font-size: 10px; color: var(--green); }
.http-status.error { color: var(--red); }
.duration { justify-self: end; color: var(--quiet); font-family: var(--mono); font-size: 9px; }

.response-section pre, .contract-detail pre, .detail-dialog pre {
  margin: 0;
  border: 1px solid var(--line);
  background: #0d1012;
  color: #cbd5d2;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow: auto;
  font-size: 11px;
  line-height: 1.65;
}
.response-section pre { max-height: 360px; min-height: 130px; padding: 14px; }
.text-button { border: 0; background: transparent; color: var(--cyan); padding: 4px; cursor: pointer; font-size: 11px; font-weight: 700; }
.text-link { text-decoration: none; white-space: nowrap; }
.text-link:hover { text-decoration: underline; }
.danger-text { color: var(--red); }

.page-width { width: min(1440px, 100%); margin: 0 auto; padding: 28px 24px 48px; }
.events-layout { display: grid; gap: 30px; }
.webhook-list, .ledger-list { border-top: 1px solid var(--line); }
.webhook-item, .ledger-item { min-height: 66px; border-bottom: 1px solid var(--line); padding: 11px 4px; display: grid; align-items: center; gap: 12px; }
.webhook-item { grid-template-columns: 170px 130px minmax(170px, 1fr) 120px 80px; cursor: pointer; }
.webhook-item:hover, .ledger-item:hover { background: var(--surface); }
.webhook-type { font-family: var(--mono); font-size: 11px; color: var(--green); }
.webhook-id, .ledger-id { color: var(--muted); font-family: var(--mono); font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.verified-label { color: var(--green); font-size: 9px; font-weight: 800; }
.duplicate-label { color: var(--amber); font-size: 9px; font-weight: 800; }
.ledger-item { grid-template-columns: minmax(190px, 1.3fr) minmax(150px, 1fr) 120px 120px 150px; }
.ledger-main { display: grid; gap: 3px; min-width: 0; }
.ledger-main strong { font-family: var(--mono); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-item span { color: var(--muted); font-family: var(--mono); font-size: 10px; }

.contract-grid { display: grid; grid-template-columns: minmax(300px, .9fr) minmax(420px, 1.4fr); gap: 28px; align-items: start; }
.contract-section { padding-bottom: 24px; }
.identity-contract { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 24px; }
.endpoint-list { border-top: 1px solid var(--line); }
.endpoint { width: 100%; min-height: 52px; border: 0; border-bottom: 1px solid var(--line); background: transparent; display: grid; grid-template-columns: 42px minmax(170px, 1fr) auto; align-items: center; gap: 10px; padding: 8px 4px; text-align: left; cursor: pointer; }
.endpoint:hover, .endpoint.active { background: var(--surface); }
.endpoint code { font-size: 10px; color: var(--text); overflow-wrap: anywhere; }
.endpoint > span:last-child { color: var(--quiet); font-size: 10px; text-align: right; }
.method { width: 38px; padding: 3px 0; border-radius: 3px; text-align: center; font-size: 8px; font-weight: 900; }
.method.get { color: var(--cyan); background: var(--cyan-dark); }
.method.post { color: var(--green); background: var(--green-dark); }
.contract-detail pre { min-height: 470px; max-height: 650px; padding: 16px; }
.definition-list { display: grid; grid-template-columns: repeat(5, minmax(140px, 1fr)); margin: 0; border: 1px solid var(--line); }
.definition-list div { min-width: 0; padding: 12px; border-right: 1px solid var(--line); }
.definition-list div:last-child { border-right: 0; }
.definition-list dt { color: var(--quiet); font-size: 9px; text-transform: uppercase; font-weight: 800; }
.definition-list dd { margin: 5px 0 0; overflow-wrap: anywhere; }
.definition-list code { color: var(--cyan); font-size: 10px; }

.detail-dialog { width: min(900px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface-raised); color: var(--text); box-shadow: 0 24px 80px rgb(0 0 0 / 55%); }
.detail-dialog::backdrop, .auth-dialog::backdrop { background: rgb(4 7 8 / 75%); }
.dialog-header { min-height: 64px; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin-top: 3px; }
.detail-dialog pre { max-height: calc(100vh - 150px); border: 0; padding: 16px; }
.auth-dialog { width: min(420px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface-raised); color: var(--text); box-shadow: 0 24px 80px rgb(0 0 0 / 55%); }
.auth-form { margin: 0; }
.auth-body { padding: 18px 16px; display: grid; gap: 16px; }
.auth-actions { justify-content: flex-end; }
.auth-actions .button { width: auto; min-width: 92px; }

.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 20; display: grid; gap: 8px; width: min(360px, calc(100vw - 40px)); pointer-events: none; }
.toast { padding: 11px 13px; border: 1px solid var(--line); border-left-width: 3px; border-radius: 5px; background: var(--surface-raised); box-shadow: 0 12px 30px rgb(0 0 0 / 35%); font-size: 11px; animation: toast-in 180ms ease-out; }
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.info { border-left-color: var(--cyan); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Lifecycle timeline ── */
.lifecycle-layout { display: flex; flex-direction: column; gap: 16px; }
.lifecycle-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.lifecycle-id { display: flex; align-items: center; gap: 8px; }
.lifecycle-id span { color: var(--muted); font-size: 11px; font-weight: 650; }
.lifecycle-id code { font-family: var(--mono); font-size: 12px; padding: 4px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.lifecycle-note { margin: -4px 0 4px; color: var(--muted); font-size: 12px; max-width: 70ch; line-height: 1.6; }

.lifecycle-state { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.ls-cell { background: var(--surface); padding: 12px 14px; min-width: 0; }
.ls-label { display: block; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.ls-cell .entity-cell strong { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

.timeline-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 11px; color: var(--muted); }
.tl-key { display: inline-flex; align-items: center; gap: 6px; }
.tl-key i { width: 9px; height: 9px; border-radius: 2px; }
.tl-key.lane-app i { background: var(--violet); }
.tl-key.lane-unibee i { background: var(--cyan); }
.tl-key.lane-hook i { background: var(--green); }

.timeline { list-style: none; margin: 0; padding: 0 0 0 26px; position: relative; display: flex; flex-direction: column; gap: 10px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-node {
  position: relative; display: grid;
  grid-template-columns: 76px 118px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 11px 14px; background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong); border-radius: 8px; cursor: pointer; text-align: left;
}
.tl-node:hover { background: var(--surface-raised); }
.tl-node:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.tl-node::before { content: ""; position: absolute; left: -23px; top: 50%; transform: translateY(-50%); width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--bg); background: var(--line-strong); }
.tl-node.lane-app { border-left-color: var(--violet); }
.tl-node.lane-app::before { background: var(--violet); }
.tl-node.lane-unibee { border-left-color: var(--cyan); }
.tl-node.lane-unibee::before { background: var(--cyan); }
.tl-node.lane-hook { border-left-color: var(--green); }
.tl-node.lane-hook::before { background: var(--green); }
.tl-time { color: var(--quiet); font-family: var(--mono); font-size: 10px; }
.tl-lane { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.tl-main { min-width: 0; }
.tl-main strong { display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-main small { color: var(--quiet); font-family: var(--mono); font-size: 10px; overflow-wrap: anywhere; }
.tl-badge { justify-self: end; font-family: var(--mono); font-size: 10px; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line); }
.tl-badge.ok { color: var(--green); border-color: var(--green-dark); }
.tl-badge.dup { color: var(--amber); border-color: var(--amber-dark); }

@media (max-width: 1180px) {
  .topology { grid-template-columns: 1fr 42px 1.08fr 42px 1fr 42px 1fr; }
  .flow-link span { display: none; }
  .system-node { padding: 11px; }
  .interaction-item { grid-template-columns: 65px minmax(140px, 1fr) minmax(150px, 1.5fr) 54px; }
  .duration { display: none; }
  .definition-list { grid-template-columns: repeat(3, 1fr); }
  .definition-list div { border-bottom: 1px solid var(--line); }
}

@media (max-width: 900px) {
  .app-header { align-items: flex-start; }
  .header-status { flex-wrap: wrap; }
  .target-label { width: 100%; order: 3; text-align: right; }
  .flow-shell { grid-template-columns: 1fr; }
  .control-rail { border-right: 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; }
  .control-section { border-right: 1px solid var(--line); }
  .aftercare-section { grid-column: 1 / -1; border-right: 0; }
  .refund-fields { grid-template-columns: 1fr 1fr; }
  .contract-grid { grid-template-columns: 1fr; }
  .identity-contract { grid-column: auto; }
  .webhook-item { grid-template-columns: 150px 110px minmax(150px, 1fr) 70px; }
  .webhook-item > :nth-child(4) { display: none; }
  .ledger-item { grid-template-columns: minmax(170px, 1.4fr) minmax(130px, 1fr) 100px 110px; }
  .ledger-item > :last-child { display: none; }
}

@media (max-width: 640px) {
  .app-header { padding: 12px 14px; min-height: 66px; }
  .brand-mark { width: 36px; height: 36px; }
  .brand-block h1 { font-size: 14px; }
  .header-status { gap: 7px; }
  .target-label { display: none; }
  .view-tabs { padding: 0 14px; gap: 18px; }
  .flow-shell { min-height: auto; }
  .control-rail { display: block; }
  .control-section { padding: 18px 16px; border-right: 0; }
  .workspace { padding: 20px 14px 36px; }
  .topology { grid-template-columns: minmax(0, 1fr); gap: 0; width: min(300px, 100%); margin: 0 auto; }
  .topology > * { grid-column: 1 !important; grid-row: auto !important; margin: 0 !important; transform: none !important; }
  .system-node { height: 84px; }
  .system-node strong { font-size: 11px; }
  .system-node small { display: none; }
  .flow-link { height: 38px; }
  .flow-link i { left: 50%; right: auto; top: 4px; bottom: 4px; width: 1px; height: auto; }
  .flow-link i::after { right: -4px; top: auto; bottom: -1px; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 6px solid var(--line-strong); border-bottom: 0; }
  .flow-link.bidirectional i::before { left: -4px; top: -1px; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 6px solid var(--line-strong); border-top: 0; }
  .flow-link.active i::after { border-left-color: transparent; border-right-color: transparent; border-top-color: var(--green); }
  .flow-link.active i::before { border-left-color: transparent; border-right-color: transparent; border-bottom-color: var(--green); }
  .callback-line { width: 100%; grid-template-columns: auto 1fr; }
  .callback-line code { display: none; }
  .interaction-item { grid-template-columns: 62px minmax(125px, 1fr) 48px; gap: 6px; }
  .interaction-operation small, .interaction-item > .direction-tag { display: none; }
  .page-width { padding: 22px 14px 36px; }
  .webhook-item { grid-template-columns: minmax(150px, 1fr) 74px; }
  .webhook-item > :not(:first-child):not(:last-child) { display: none; }
  .ledger-item { grid-template-columns: minmax(150px, 1fr) 90px; }
  .ledger-item > :not(:first-child):not(:nth-child(3)) { display: none; }
  .endpoint { grid-template-columns: 42px minmax(0, 1fr); }
  .endpoint > span:last-child { display: none; }
  .definition-list { grid-template-columns: 1fr; }
  .definition-list div { border-right: 0; }
  .price-strip { grid-template-columns: 1fr 1fr; }
  .price-strip div:nth-child(2) { border-right: 0; }
  .price-strip div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .lifecycle-state { grid-template-columns: 1fr 1fr; }
  .tl-node { grid-template-columns: 60px minmax(0, 1fr) auto; gap: 8px; }
  .tl-node .tl-lane { display: none; }
}
