/* SharpLine Billing admin — single dark theme, base #121212 */
:root {
  --bg: #121212;
  --surface: #1a1a1a;
  --surface-2: #202020;
  --line: #2b2b2b;
  --ink: #e6e6e6;
  --mut: #9a9a9a;
  --faint: #8a8a8a;
  --accent: #5167FC;          /* the only non-neutral UI color */
  --accent-bg: rgba(81, 103, 252, .14);
  --info: #5167FC;
  --ok: #3fb27f;
  --warn: #d9a04a;
  --bad: #e5484d;
  --info-bg: rgba(81, 103, 252, .14);
  --ok-bg: rgba(63, 178, 127, .12);
  --warn-bg: rgba(217, 160, 74, .13);
  --bad-bg: rgba(229, 72, 77, .12);
}
/* Type scale: every font-size is in rem, so this one number sizes the whole app.
   100% = the original design; 112.5% = 12.5% larger for readability. */
html { font-size: 112.5%; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 0.875rem/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  /* the page itself never scrolls — #view's <main> is the only scroller,
     so the sidebar can neither scroll away nor rubberband */
  overflow: hidden;
}
a { color: var(--ink); }

/* ---- layout ---- */
#shell { display: flex; height: 100dvh; }
nav {
  width: 208px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--line); padding: 20px 12px;
  display: flex; flex-direction: column; gap: 2px;
  height: 100%; z-index: 1;
  /* scrolls only if the window is shorter than the nav itself */
  overflow-y: auto; overscroll-behavior: contain;
}
nav .brand { font-weight: 700; font-size: 0.9375rem; padding: 4px 10px 18px; letter-spacing: .01em; }
nav .brand span { color: var(--faint); font-weight: 400; }
nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px;
  text-decoration: none; color: var(--mut); font-weight: 500;
}
nav a svg { width: 16px; height: 16px; flex-shrink: 0; stroke: currentColor; fill: none;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
nav a:hover { background: var(--surface-2); color: var(--ink); }
nav a.on { background: var(--accent-bg); color: var(--ink); }
nav a.on svg { stroke: var(--accent); opacity: 1; }
nav .group { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; }
nav .group-label {
  padding: 0 10px 6px; font-size: 0.6875rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--faint);
}
nav .foot { margin-top: auto; padding: 10px; color: var(--faint); font-size: 0.75rem; }
nav .foot button { width: 100%; }
main { flex: 1; padding: 28px 32px 80px; min-width: 0;
  overflow-y: auto; overscroll-behavior: contain;
  /* Content sits in one centered column capped like Stripe's dashboard, so a
     wide monitor gets margins instead of stretched tables. main itself stays
     full-width so the scrollbar hugs the window edge. */
  display: grid; grid-template-columns: minmax(0, 1460px); justify-content: center; align-content: start; }
main h1 { font-size: 1.25rem; margin: 0 0 4px; font-weight: 650; }
main .sub { color: var(--mut); margin: 0 0 22px; }

/* ---- components ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 22px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.tile b { display: block; font-size: 1.375rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile span { color: var(--mut); font-size: 0.75rem; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 22px; }
.panel > h2 {
  font-size: 0.75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--mut);
  margin: 0; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 600;
}
.panel .body { padding: 16px; }

.wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.8125rem; }
th {
  text-align: left; color: var(--mut); font-weight: 600; padding: 9px 14px;
  border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 0.75rem;
}
td { padding: 8px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
.rowlink { color: var(--ink); text-decoration: none; display: block; }
.rowlink:hover { text-decoration: underline; }
td .sub2 { color: var(--faint); font-size: 0.75rem; }
.empty { color: var(--faint); padding: 28px 16px; text-align: center; }
.right { text-align: right; }

.pill { display: inline-block; border-radius: 99px; padding: 1px 9px; font-size: 0.71875rem; font-weight: 600; }
.p-info { background: var(--info-bg); color: #8a9aff; }
.p-ok   { background: var(--ok-bg);   color: var(--ok); }
.p-warn { background: var(--warn-bg); color: var(--warn); }
.p-bad  { background: var(--bad-bg);  color: var(--bad); }
.p-mut  { background: var(--surface-2); color: var(--mut); }

button {
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 12px; font: inherit; font-size: 0.8125rem;
  font-weight: 550; cursor: pointer;
}
button:hover { border-color: var(--faint); }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.primary:hover { background: #6478ff; border-color: #6478ff; }
button.danger { color: var(--bad); }
button.small { padding: 3px 9px; font-size: 0.75rem; }
button:disabled { opacity: .5; cursor: default; }

input, select {
  background: var(--bg); color: var(--ink); border: 1px solid var(--line);
  border-radius: 6px; padding: 7px 10px; font: inherit;
}
input:focus, select:focus, button:focus-visible,
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px;
  color: var(--mut); cursor: pointer; font-size: 0.78125rem; background: none; font-weight: 550;
}
.chip.on { background: var(--accent-bg); color: var(--ink); border-color: var(--accent); }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.formrow { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.formrow label { display: flex; flex-direction: column; gap: 4px; font-size: 0.75rem; color: var(--mut); }

.hbar-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--mut); margin: 0 0 10px; font-weight: 600; }
.hbar-row { display: grid; grid-template-columns: 92px 1fr auto; gap: 10px;
  align-items: center; padding: 3px 0; font-size: 0.78125rem; }
.hbar-label { color: var(--mut); white-space: nowrap; }
.hbar-track { background: var(--surface-2); border-radius: 3px; height: 14px; min-width: 40px; }
.hbar-fill { background: var(--accent); border-radius: 3px; height: 100%; min-width: 1px; }
.hbar-val { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* today card */
.today-card { margin-bottom: 66px; } /* 16px + 50px: the date range below applies only to the metric cards */
.today-head { display: flex; gap: 48px; margin-bottom: 6px; }
.today-head .mval.yday { color: var(--mut); }


/* home toolbar: Date range | Granularity | Compare */
.home-toolbar { position: relative; gap: 8px; margin-bottom: 18px; }
.seg {
  display: inline-flex; align-items: stretch; height: 30px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface);
}
.segbtn, .segx {
  background: none; border: 0; border-radius: 0; padding: 0 10px; display: inline-flex;
  align-items: center; gap: 6px; font-size: 0.78125rem; font-weight: 600; color: var(--ink); height: 100%;
}
.segbtn:hover, .segx:hover { background: var(--surface-2); border-color: transparent; }
.segbtn .seglab { color: var(--mut); font-weight: 550; padding-right: 10px; border-right: 1px solid var(--line); margin-right: 2px; }
.segbtn .seglab.solo { border-right: 0; padding-right: 0; margin-right: 0; }
.segbtn .segval { color: #8a9aff; }
.segbtn .chev { width: 12px; height: 12px; stroke: var(--mut); fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.segx { padding: 0 6px 0 9px; color: var(--mut); border-right: 1px solid var(--line); }
.segx svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.4; stroke-linecap: round; }
.segx:hover { color: var(--ink); }

.pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; max-width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .55); overflow: auto;
}
.menu { padding: 6px; min-width: 190px; display: flex; flex-direction: column; gap: 1px; }
.mitem {
  background: none; border: 0; text-align: left; padding: 8px 10px; border-radius: 6px;
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  font-weight: 500; font-size: 0.84375rem; color: var(--ink);
}
.mitem:hover { background: var(--surface-2); }
.chk { width: 15px; height: 15px; flex-shrink: 0; }
.chk circle { fill: var(--ink); }
.chk .tick { fill: none; stroke: var(--surface); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* date range picker */
.rp { display: flex; gap: 20px; padding: 14px; }
.rp-presets { display: flex; flex-direction: column; gap: 2px; width: 150px; flex-shrink: 0; }
.rp-preset {
  background: none; border: 0; text-align: left; padding: 7px 10px; border-radius: 6px;
  color: var(--ink); font-weight: 500; font-size: 0.84375rem;
}
.rp-preset:hover { background: var(--surface-2); }
.rp-preset.on { background: var(--accent-bg); color: #8a9aff; }
.rp-main { display: flex; flex-direction: column; gap: 14px; }
.rp-inputs { display: flex; align-items: center; gap: 10px; }
.rp-lab { color: var(--mut); font-size: 0.8125rem; }
.dfield {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px 6px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg); font-variant-numeric: tabular-nums;
}
.dfield:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.dfield input {
  border: 0; background: none; padding: 3px 2px; width: 28px; text-align: center; border-radius: 4px;
  font-variant-numeric: tabular-nums; font-size: 0.84375rem;
}
.dfield input.yy { width: 46px; }
.dfield input:focus { outline: none; background: var(--accent-bg); }
.dfield input::placeholder { color: var(--faint); }
.dfield span { color: var(--mut); }
.rp-cals { display: flex; gap: 12px; align-items: flex-start; }
.rp-nav { background: none; border: 0; color: var(--mut); font-size: 1.25rem; line-height: 1; padding: 2px 6px; margin-top: 4px; }
.rp-nav:hover { color: var(--ink); }
.cal { width: 280px; }
.cal-title { text-align: center; font-weight: 600; font-size: 0.875rem; margin-bottom: 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; }
.cal-dow { text-align: center; color: var(--mut); font-size: 0.75rem; padding: 4px 0 6px; }
.cal-day {
  background: none; border: 0; border-radius: 0; height: 34px; padding: 0; position: relative;
  color: var(--ink); font-size: 0.8125rem; font-weight: 500;
}
.cal-day span { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; }
.cal-day:hover:not(:disabled) span { background: var(--surface-2); }
.cal-day:disabled { color: var(--faint); opacity: .55; cursor: default; }
.cal-day.today span { text-decoration: underline; text-underline-offset: 3px; }
.cal-day.in { background: var(--accent-bg); }
.cal-day.st { border-radius: 17px 0 0 17px; }
.cal-day.en { border-radius: 0 17px 17px 0; }
.cal-day.st.en { border-radius: 17px; }
.cal-day.st span, .cal-day.en span, .cal-day.st:hover span, .cal-day.en:hover span { background: var(--accent); color: #fff; font-weight: 600; }
.rp-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: auto; }
.cmp-custom { padding: 12px 14px; gap: 10px; }
.cmp-custom .rp-foot { margin-top: 4px; }

/* metric cards dim while a new window loads; the page itself never repaints */
.mgrid { transition: opacity .15s; }
.mgrid.loading { opacity: .55; pointer-events: none; }

/* home metric cards */
.mgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .mgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .mgrid { grid-template-columns: 1fr; } }
.mcard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px 12px; min-width: 0; }
.mtitle { font-weight: 600; font-size: 0.84375rem; display: flex; align-items: center; gap: 6px; }
.help {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px;
  border: 1px solid var(--faint); border-radius: 3px; color: var(--faint); font-size: 0.59375rem;
  font-weight: 700; cursor: help; font-style: normal; line-height: 1;
}
#tip {
  position: fixed; z-index: 1000; width: 240px; pointer-events: none;
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 10px; font-size: 0.75rem; font-weight: 400; line-height: 1.4;
  white-space: normal; text-align: left; box-shadow: 0 6px 20px rgba(0, 0, 0, .45);
}

.mchart-wrap { position: relative; }
.hovercard {
  position: absolute; z-index: 1000; pointer-events: none; min-width: 170px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font-size: 0.78125rem; box-shadow: 0 6px 20px rgba(0, 0, 0, .45);
}
.hc-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.hc-head b { font-weight: 600; }
.hc-row { display: grid; grid-template-columns: 12px 1fr auto; gap: 8px; align-items: center; padding: 2px 0; color: var(--mut); }
.hc-row b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw.cur { background: var(--accent); }
.sw.prev { background: #8a8a8a; }
.mval { font-size: 1.375rem; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 4px; display: flex; align-items: baseline; gap: 8px; }
.delta { font-size: 0.8125rem; font-weight: 600; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--mut); }
.mprev { color: var(--mut); font-size: 0.8125rem; margin-bottom: 8px; }
.mchart { width: 100%; display: block; cursor: crosshair; }
.mfoot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: 0.75rem; }
.mfoot a { color: var(--mut); text-decoration: none; }
.mfoot a:hover { color: var(--ink); }

#toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--ink); border-radius: 8px;
  padding: 10px 16px; opacity: 0; transition: opacity .2s; pointer-events: none;
  max-width: 380px; font-size: 0.8125rem; z-index: 1001;
}
#toast.show { opacity: 1; }
#toast.err { border-color: var(--bad); }

/* key gate */
#gate {
  position: fixed; inset: 0; background: var(--bg); display: flex;
  align-items: center; justify-content: center; z-index: 2000;
}
#gate .card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 28px; width: 340px; display: flex; flex-direction: column; gap: 12px;
}
#gate h1 { font-size: 1.0625rem; margin: 0; }
#gate p { color: var(--mut); margin: 0; font-size: 0.8125rem; }
#gate .err { color: var(--bad); font-size: 0.8125rem; min-height: 18px; margin: 0; }

.backlink { color: var(--mut); text-decoration: none; font-size: 0.8125rem; display: inline-block; margin-bottom: 12px; }
.backlink:hover { color: var(--ink); }

@media (max-width: 760px) {
  #shell { flex-direction: column; }
  nav { width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
    overflow-y: visible; flex-shrink: 0; }
  nav .brand { padding-bottom: 4px; }
  nav .group { display: contents; }
  nav .group-label { display: none; }
  nav .foot { margin: 0; }
  main { padding: 20px 16px 60px; }
}

/* payment routing */
.route { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.route-step {
  display: flex; align-items: center; gap: 12px; flex: 1 1 260px; min-width: 0;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px;
}
.route-pos {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-bg); color: var(--ink); font-weight: 650; font-size: 0.78125rem;
}
.route-body { flex: 1; min-width: 0; }
.route-name { font-weight: 600; font-size: 0.84375rem; display: flex; gap: 8px; align-items: baseline; }
.route-meta { color: var(--mut); font-size: 0.75rem; margin-top: 2px; }
.route-arrow { color: var(--faint); font-size: 1.125rem; flex-shrink: 0; }
.route-end { margin-top: 14px; color: var(--mut); font-size: 0.78125rem; display: flex; gap: 8px; align-items: baseline; }
.route-end code { font: 0.75rem ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink); }
.rules { margin: 0; padding-left: 18px; color: var(--mut); font-size: 0.8125rem; }
.rules li { margin-bottom: 8px; }
.rules b { color: var(--ink); font-weight: 600; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 110px; }
.spark-col { flex: 1; height: 100%; display: flex; align-items: flex-end; border-radius: 2px; min-width: 3px; }
.spark-col:hover, .spark-col:focus-visible { background: var(--surface-2); outline: none; }
.spark-bar { width: 100%; min-height: 2px; background: var(--accent); border-radius: 2px 2px 0 0; display: flex; flex-direction: column; }
.spark-err { background: var(--bad); border-radius: 2px 2px 0 0; }
.spark-axis { display: flex; justify-content: space-between; color: var(--faint); font-size: 0.6875rem; margin-top: 4px; }
.legend { display: flex; gap: 6px; align-items: center; color: var(--mut); font-size: 0.75rem; margin-top: 12px; }
.legend .sw + .sw, .legend i + i { margin-left: 8px; }
.sw.bad { background: var(--bad); }

/* gateways */
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.lead { margin: 0; font-size: 0.8125rem; line-height: 1.5; }
.warn-panel { border-color: var(--bad); }
.warn-panel .body { display: flex; gap: 10px; align-items: center; color: var(--mut); font-size: 0.8125rem; }
.route-pos.small { width: 22px; height: 22px; font-size: 0.71875rem; }
.credk { color: var(--faint); }
.gw-actions { white-space: nowrap; }
td.wrapcell { white-space: normal; min-width: 200px; max-width: 300px; line-height: 1.35; }
.gw-actions button { margin-left: 4px; }
.gw-form .gw-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 18px; margin-bottom: 14px; }
.gw-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.75rem; color: var(--mut); }
.gw-form input, .gw-form select { width: 100%; }
.gw-form .hint { color: var(--faint); font-size: 0.71875rem; line-height: 1.4; }
.gw-form .req { color: var(--bad); }
.gw-note { margin: 0 0 12px; font-size: 0.78125rem; line-height: 1.5; max-width: 720px; }
.gw-submit { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* routing editor */
.rt-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.rt-spacer { flex: 1; }
.rt-canvas {
  position: relative; display: grid; grid-template-columns: 170px 1fr; gap: 0 36px; align-items: center;
  padding: 22px 18px; border-radius: 10px; border: 1px solid var(--line);
  background-color: var(--bg);
  background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 16px 16px;
}
.rt-wires { position: absolute; inset: 0; pointer-events: none; }
.rt-wires path { fill: none; stroke: var(--faint); stroke-width: 1.5; stroke-dasharray: 4 4; }
.rt-start-col { display: flex; align-items: center; gap: 12px; }
.rt-start { background: #2a2a2a; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 9px 18px; font-weight: 650; }
.rt-split { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.rt-split svg { width: 16px; height: 16px; stroke: var(--mut); fill: none; stroke-width: 1.8; }
.rt-branches { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.rt-branch { display: grid; grid-template-columns: 280px 34px 1fr; align-items: center; min-width: 0; border-radius: 10px; }
.rt-branch.is-over { outline: 2px dashed var(--accent); outline-offset: 4px; }
.rt-node {
  display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 12px 8px 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font: inherit; color: var(--ink);
  min-width: 0;
}
.rt-node:hover { border-color: var(--faint); }
.rt-branch.is-selected .rt-node { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.rt-branch.is-off .rt-node { opacity: .55; }
.rt-node-static { cursor: default; }
.rt-node-static:hover { border-color: var(--line); }
.rt-badge { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-bg); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 650; flex-shrink: 0; }
.rt-node-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.rt-node-text b { font-weight: 600; font-size: 0.8125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-node-text .sub2 { font-size: 0.71875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-line { height: 0; border-top: 1.5px solid var(--faint); position: relative; margin: 0 4px; }
.rt-line::after { content: ''; position: absolute; right: -1px; top: -4px; border: 4px solid transparent; border-left: 6px solid var(--faint); }
.rt-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 8px; min-height: 58px; min-width: 0; }
.rt-card.is-over { border-color: var(--accent); background: var(--accent-bg); }
.rt-card.is-empty { border-style: dashed; }
.rt-card-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 30px; }
.rt-card-foot { color: var(--faint); font-size: 0.6875rem; margin-top: 6px; text-align: center; }
.rt-empty { color: var(--faint); font-size: 0.78125rem; }
.rt-arrow { color: var(--faint); font-size: 0.875rem; }
.rt-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 8px 4px 4px; border-radius: 7px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 0.78125rem; font-weight: 550; cursor: grab; user-select: none;
}
.rt-chip:active { cursor: grabbing; }
.rt-chip.is-dragging { opacity: .4; }
.rt-chip.is-off { opacity: .45; cursor: not-allowed; }
.rt-logo { width: 22px; height: 22px; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-weight: 800; font-size: 0.75rem; color: #fff; }
.rt-logo-nmi { background: #2f6fed; }
.rt-logo-mock { background: #7a7a7a; }
.rt-x { background: none; border: none; color: var(--faint); font-size: 0.9375rem; line-height: 1; padding: 0 2px; cursor: pointer; }
.rt-x:hover { color: var(--bad); border: none; }
.rt-palette { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.rt-inspector { margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.rt-insp-head { display: flex; gap: 16px; align-items: end; flex-wrap: wrap; }
.rt-name { display: flex; flex-direction: column; gap: 4px; font-size: 0.75rem; color: var(--mut); flex: 1 1 260px; }
.rt-enabled { display: flex; align-items: center; gap: 6px; font-size: 0.8125rem; padding-bottom: 7px; }
.rt-conds { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.rt-cond { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rt-toggles { display: flex; gap: 6px; flex-wrap: wrap; }
.rt-preview { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 0.8125rem; }
.rt-preview select { padding: 4px 8px; font-size: 0.78125rem; }
@media (max-width: 900px) {
  .rt-canvas { grid-template-columns: 1fr; gap: 16px; }
  .rt-wires { display: none; }
  .rt-branch { grid-template-columns: 1fr; gap: 6px; }
  .rt-line { display: none; }
}

/* invoice detail: charge history */
.run-head td { background: var(--surface-2); color: var(--mut); font-size: 0.75rem; padding: 6px 14px; }
.run-head b { color: var(--ink); font-weight: 600; }
.card-brand { display: inline-block; font-size: 0.59375rem; font-weight: 800; letter-spacing: .04em; padding: 1px 4px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--line); color: var(--mut); vertical-align: middle; }
.mono { font: 0.75rem ui-monospace, SFMono-Regular, Menlo, monospace; }
.rt-logo-none { background: #444; }
table.charges td { vertical-align: top; }
table.charges td .rt-logo { vertical-align: middle; margin-right: 2px; }
