/* Bank observability dashboard.
   Direction: cool pale canvas, navy ink (the bank's primary from /me), fine hairlines, 8px controls / 12px panels,
   small mono chapter markers, modest figures, colour reserved for state. Nothing here names a bank. */

:root {
  --brand: #111a4a;
  --on-brand: #ffffff;
  --brand-accent: #e60012;

  --canvas: #f6f6f8;
  --surface: #ffffff;
  --surface-2: #fbfbfc;
  --panel-2: #eeeff2;
  --edge: #e3e4e8;
  --edge-2: #d6d8de;
  --ink: #12161e;
  --ink-2: #3b3e47;
  --ink-3: #575a64;
  --ink-4: #7c7f88;
  --ink-5: #a3a6ae;

  --brand-07: color-mix(in srgb, var(--brand) 7%, transparent);
  --brand-12: color-mix(in srgb, var(--brand) 12%, transparent);
  --brand-soft: color-mix(in srgb, var(--brand) 55%, white);
  --brand-pale: color-mix(in srgb, var(--brand) 22%, white);

  --ok: #167e6c;
  --ok-tint: #e6f2ef;
  --warn: #8a5a00;
  --warn-tint: #fbf1dc;
  --danger: #b42318;
  --danger-tint: #fcefed;
  --tool: #5b7fd1;
  --focus: #a2c1ed;

  --r-ctl: 8px;
  --r-panel: 12px;
  --shadow-edge: 0 0 0 1px rgba(0, 0, 0, 0.05), 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  --shadow-glass: 24px 48px 64px 0 rgba(30, 30, 44, 0.14), 0 0 0 1px #ffffff inset, 0 0 0 1px rgba(0, 0, 0, 0.04);
  --shadow-pop: 0 12px 28px rgba(20, 24, 40, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.06);

  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 0;
}

html:lang(ja) body {
  line-height: 1.65;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
blockquote,
figure,
pre {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

code,
pre,
.mono {
  font-family: var(--mono);
  font-size: 0.92em;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  flex: none;
  vertical-align: -3px;
}
.icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: 12px;
  top: 12px;
  transform: translateY(-200%);
  z-index: 50;
  padding: 8px 12px;
  border-radius: var(--r-ctl);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}
.skip:not(:focus) {
  box-shadow: none;
  opacity: 0;
  pointer-events: none;
}
.skip:focus {
  transform: none;
}

.muted {
  color: var(--ink-4);
}
.small {
  font-size: 12px;
}
.center {
  text-align: center;
  display: flex;
  justify-content: center;
}
.nowrap {
  white-space: nowrap;
}
.text-danger {
  color: var(--danger) !important;
}
.ok {
  color: var(--ok);
}

.eyebrow {
  font: 400 11px/1.5 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-4);
}

/* ---------- shell ---------- */

.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
}

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 14px 16px;
  border-right: 1px solid var(--edge);
  background: var(--surface-2);
}

.side-brand {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 8px 14px;
  border-bottom: 1px solid var(--edge);
}
.wordmark-img {
  display: block;
  height: 34px;
  width: auto;
}
.wordmark-text,
.login-mark-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  letter-spacing: 0.04em;
  color: var(--brand);
  font-size: 18px;
}
.wm-accent {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--brand-accent);
}
.side-app {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--r-ctl);
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-weight: 500;
  font-size: 14px;
  text-align: left;
  width: 100%;
  transition:
    background-color 0.2s,
    color 0.2s;
}
.nav-item:hover {
  background: rgba(17, 22, 40, 0.035);
  color: var(--ink);
}
.nav-item.is-active {
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--shadow-edge);
}
.nav-item .icon {
  width: 16px;
  height: 16px;
}
.nav-live {
  margin-left: auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 18%, transparent);
}

.side-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.side-note {
  padding: 8px 10px 0;
  border-top: 1px solid var(--edge);
  font-size: 11.5px;
  color: var(--ink-4);
  line-height: 1.6;
}

.lang {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: var(--r-ctl);
  background: var(--panel-2);
  color: var(--ink-4);
  align-self: flex-start;
}
.lang > .icon {
  margin: 0 4px 0 6px;
  width: 14px;
  height: 14px;
}
.lang-btn {
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-3);
  font-size: 12.5px;
  font-weight: 500;
}
.lang-btn.is-on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-edge);
}

.content {
  min-width: 0;
}
.main {
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px 32px 64px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  outline: none;
}

/* ---------- page header ---------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  padding-bottom: 4px;
}
.page-title {
  font-size: 24px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-wrap: balance;
}
.page-lead {
  margin-top: 6px;
  color: var(--ink-3);
  max-width: 64ch;
  text-wrap: pretty;
}
.page-actions,
.head-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.head-meta {
  font-size: 12.5px;
  color: var(--ink-4);
  white-space: nowrap;
}

/* ---------- controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-ctl);
  border: 0;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition:
    background-color 0.2s,
    box-shadow 0.2s;
}
.btn-primary {
  background: var(--brand);
  color: var(--on-brand);
  box-shadow:
    0 0 0 1px var(--brand),
    0 2px 4px rgba(0, 0, 0, 0.18),
    0 1px 2px rgba(0, 0, 0, 0.18);
  background-image: linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
}
.btn-primary:active {
  box-shadow:
    0 0 0 1px var(--brand),
    0 1px 2px rgba(0, 0, 0, 0.15);
}
.btn-primary:disabled {
  opacity: 0.7;
  cursor: progress;
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.7);
  color: #232730;
  box-shadow: 0 0 0 1px rgba(87, 90, 100, 0.16);
}
.btn-secondary:hover {
  background: #fff;
  box-shadow:
    0 1px 1px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(87, 90, 100, 0.22);
}
.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 13px;
}
.btn-lg {
  height: 42px;
  font-size: 15px;
}
.btn-block {
  width: 100%;
}
.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: none;
  padding: 2px 0;
  color: var(--brand);
  font-weight: 500;
  font-size: 13px;
}
.btn-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 8px;
  border-radius: 6px;
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: #c7cbe0;
  font-size: 12px;
}
.btn-icon:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}
.btn-icon .icon {
  width: 13px;
  height: 13px;
}
.link-more {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 13px;
  font-weight: 500;
  color: var(--brand);
  white-space: nowrap;
}
.link-more .icon {
  width: 14px;
  height: 14px;
}

.seg {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  border-radius: var(--r-ctl);
  background: var(--panel-2);
  flex-wrap: wrap;
}
.seg-btn {
  height: 28px;
  padding: 0 11px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.seg-btn:hover {
  color: var(--ink);
}
.seg-btn.is-on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-edge);
}

.input {
  height: 36px;
  padding: 0 12px;
  border-radius: var(--r-ctl);
  border: 1px solid var(--edge);
  background: var(--surface);
  color: var(--ink);
  width: 100%;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--brand) 45%, var(--edge));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 55%, transparent);
}
.input-lg {
  height: 42px;
  font-size: 15px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.search {
  position: relative;
  flex: 1 1 220px;
  max-width: 320px;
}
.search .input {
  padding-left: 34px;
}
.search-icon {
  position: absolute;
  left: 11px;
  top: 10px;
  color: var(--ink-4);
}
.select select {
  appearance: none;
  height: 36px;
  padding: 0 30px 0 12px;
  border-radius: var(--r-ctl);
  border: 1px solid var(--edge);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4.5 6.5 3.5 3.5 3.5-3.5' fill='none' stroke='%237c7f88' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
      no-repeat right 9px center / 14px,
    var(--surface);
  font-size: 13.5px;
  color: var(--ink-2);
  max-width: 180px;
  text-overflow: ellipsis;
}
.select select:focus {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 55%, transparent);
}
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--r-ctl);
  border: 1px solid var(--edge);
  background: var(--surface);
  font-size: 13.5px;
  color: var(--ink-2);
}
.toggle-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--edge-2);
  background: var(--surface);
}
.toggle-box .icon {
  width: 12px;
  height: 12px;
}
.toggle.is-on {
  border-color: color-mix(in srgb, var(--brand) 35%, var(--edge));
  background: var(--brand-07);
  color: var(--brand);
}
.toggle.is-on .toggle-box {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
}

/* ---------- panels + KPIs ---------- */

.panel {
  background: var(--surface);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-edge);
  padding: 20px 22px;
  min-width: 0;
}
.panel-flush {
  padding: 0;
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.panel-title {
  font-size: 15px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.panel-lead {
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink-4);
  max-width: 70ch;
  text-wrap: pretty;
}
.panel-head-text {
  flex: 1 1 320px;
  min-width: 0;
}
.panel-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sub-head {
  margin: 20px 0 10px;
}
.panel > .sub-head:first-of-type {
  margin-top: 0;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.kpi {
  background: var(--surface);
  border-radius: var(--r-ctl);
  box-shadow: var(--shadow-edge);
  padding: 15px 18px 16px;
  min-width: 0;
}
.kpi-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-3);
}
.kpi-icon {
  color: var(--ink-5);
  width: 14px;
  height: 14px;
}
.kpi-value {
  margin-top: 8px;
  font-size: 26px;
  line-height: 1.1;
  font-weight: 500;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.kpi-sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-danger .kpi-value {
  color: var(--danger);
}

.grid-2-1 {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 20px;
}
.grid-1-1 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
}

/* ---------- chart ---------- */

.chart {
  position: relative;
}
.chart-host {
  width: 100%;
  min-height: 248px;
}
.chart-svg {
  display: block;
  max-width: 100%;
}
.chart-svg:focus-visible {
  outline-offset: 4px;
}
.chart .grid {
  stroke: var(--edge);
  stroke-dasharray: 2 4;
}
.chart .axis-base {
  stroke: var(--edge-2);
}
.chart .axis-label {
  font: 400 11px var(--mono);
  fill: var(--ink-4);
}
.chart .dot-brand {
  fill: var(--brand);
}
.chart .bar-error {
  fill: var(--danger);
}
.chart .line-brand {
  fill: none;
  stroke: var(--brand);
  stroke-width: 1.75;
  stroke-linejoin: round;
}
.chart .chart-hl {
  fill: var(--brand-07);
  transition: opacity 0.12s;
}
.chart-empty {
  display: grid;
  place-items: center;
  height: 248px;
  color: var(--ink-4);
}
.chart-tip {
  position: absolute;
  top: 6px;
  transform: translateX(-50%);
  min-width: 170px;
  padding: 10px 12px;
  border-radius: var(--r-ctl);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  font-size: 12.5px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.chart-tip.is-on {
  opacity: 1;
}
.tip-time {
  font-weight: 600;
  margin-bottom: 6px;
}
.tip-row {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 8px;
  color: var(--ink-3);
}
.tip-row b {
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.tip-key {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--edge-2);
}
.tip-key-brand {
  background: var(--brand);
}
.tip-key-error {
  background: var(--danger);
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-3);
}
.legend b {
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.legend-key {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--edge-2);
  flex: none;
}
.key-brand {
  background: var(--brand);
  border-radius: 50%;
}
.key-error {
  background: var(--danger);
}

/* ---------- bars ---------- */

.bars {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.bars-tight {
  gap: 7px;
}
.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.1fr) minmax(80px, 1.4fr) auto;
  align-items: center;
  gap: 14px;
  font-size: 13.5px;
}
.bars-tight .bar-row {
  grid-template-columns: minmax(90px, 1fr) minmax(60px, 1fr) auto;
  font-size: 13px;
}
.bar-label {
  color: var(--ink-2);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-track {
  height: 8px;
  border-radius: 4px;
  background: var(--panel-2);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--brand);
  transition: width 0.4s var(--ease);
}
.bar-soft {
  background: var(--brand-soft);
}
.bar-right {
  min-width: 96px;
  text-align: right;
}
.num-pair {
  display: inline-flex;
  gap: 10px;
  justify-content: flex-end;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
.num-pair b {
  font-weight: 600;
  color: var(--ink);
}
.num-pair .muted {
  min-width: 42px;
  text-align: right;
}
.intent-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.intent-swatch {
  display: none;
}

.split {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.split-bar {
  display: flex;
  gap: 2px;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--panel-2);
}
.split-seg {
  flex-basis: 0;
  min-width: 2px;
}
.split-0 {
  background: var(--brand);
}
.split-1 {
  background: var(--brand-pale);
}
.split-2 {
  background: var(--ink-5);
}
.split-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

/* approvals funnel */
.funnel-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}
.funnel-n {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}
.funnel-label {
  color: var(--ink-3);
}
.stack-bar {
  display: flex;
  gap: 2px;
  height: 14px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--panel-2);
}
.stack-seg {
  flex-basis: 0;
  min-width: 3px;
}
.seg-executed {
  background: var(--ok);
}
.seg-declined {
  background: #9aa0ad;
}
.seg-expired {
  background: #c9ccd4;
}
.seg-failed {
  background: var(--danger);
}
.seg-pending {
  background: #d9a441;
}
.funnel-legend {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 6px 22px;
  margin-top: 12px;
}
.funnel-legend li {
  display: grid;
  grid-template-columns: 10px 1fr auto 40px;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-3);
}
.funnel-legend b {
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.funnel-legend .muted {
  text-align: right;
  font-size: 12px;
}
.refusals {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.refusals li {
  padding: 10px 12px;
  border-radius: var(--r-ctl);
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--edge);
}
.ref-top {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ref-icon {
  color: var(--ok);
}
.ref-title {
  font-weight: 600;
  font-size: 13px;
}
.ref-n {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}
.ref-body {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--ink-3);
  padding-left: 24px;
}

/* security */
.sec-list {
  display: flex;
  flex-direction: column;
}
.sec-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--edge);
}
.sec-row:first-child {
  border-top: 0;
  padding-top: 0;
}
.sec-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-ctl);
  background: var(--panel-2);
  color: var(--ink-4);
}
.has-events .sec-icon {
  background: var(--ok-tint);
  color: var(--ok);
}
.sec-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sec-title {
  font-weight: 600;
  font-size: 13.5px;
}
.is-quiet .sec-title {
  color: var(--ink-3);
}
.sec-body {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--ink-3);
  text-wrap: pretty;
}
.is-quiet .sec-body {
  color: var(--ink-4);
}
.sec-n {
  font-size: 20px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  text-align: right;
}

/* ---------- tables ---------- */

.table-wrap {
  overflow-x: auto;
}
.panel > .table-wrap {
  margin: 0 -22px -20px;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table th {
  text-align: left;
  font: 400 11px/1.4 var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding: 10px 14px;
  border-bottom: 1px solid var(--edge);
  background: var(--surface-2);
  white-space: nowrap;
}
.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--edge);
  vertical-align: middle;
}
.table tbody tr:last-child td {
  border-bottom: 0;
}
.table th:first-child,
.table td:first-child {
  padding-left: 22px;
}
.table th:last-child,
.table td:last-child {
  padding-right: 22px;
}
.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.table tr.is-link {
  cursor: pointer;
}
.table tbody tr {
  transition: background-color 0.15s;
}
.table tbody tr:hover,
.table tr.is-link:focus-visible {
  background: #f8f9fb;
}
.table tr.is-link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}
.strong-link {
  font-weight: 500;
  color: var(--ink);
}
.strong-link:hover {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.cell-tester {
  white-space: nowrap;
}
.cell-persona {
  font-weight: 500;
  white-space: nowrap;
}
.cell-intents {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  flex-wrap: nowrap;
}
.cell-last {
  min-width: 240px;
  max-width: 420px;
}
.last-msg {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--ink-2);
}
.cell-last {
  position: relative;
}
.err-mark {
  float: left;
  color: var(--danger);
  margin-right: 6px;
}
.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--ok);
  vertical-align: 1px;
}
.transfers-cell b {
  font-weight: 600;
}
.col-latbar {
  width: 22%;
  min-width: 140px;
}
.latbar {
  position: relative;
  height: 8px;
  border-radius: 4px;
  background: var(--panel-2);
}
.latbar-p90,
.latbar-p50 {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 4px;
}
.latbar-p90 {
  background: var(--brand-pale);
}
.latbar-p50 {
  background: var(--brand);
}
.amount {
  font-weight: 600;
}
.ap-title {
  font-weight: 500;
}
.ap-sub {
  display: flex;
  flex-wrap: nowrap;
  overflow: hidden;
  max-width: 460px;
  white-space: nowrap;
  gap: 2px 14px;
  margin-top: 2px;
  font-size: 12px;
  color: var(--ink-4);
}
.ap-sub span {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.ap-result {
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
}
.load-more {
  padding: 16px 0 0;
}

/* tool names */
.tool-name {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.tool-friendly {
  font-weight: 500;
  color: var(--ink);
}
.tool-raw {
  font-size: 11.5px;
  color: var(--ink-4);
}

/* ---------- badges, chips, pills ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge .icon {
  width: 12px;
  height: 12px;
}
.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-4);
}
.badge-web .badge-dot {
  background: var(--brand);
}
.badge-imessage .badge-dot {
  background: #2f9e4f;
}
.badge-mono {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
}
.badge-live {
  background: var(--ok-tint);
  color: var(--ok);
}
.chip {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  background: var(--brand-07);
  color: color-mix(in srgb, var(--brand) 80%, var(--ink));
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.chip-intent.chip-i-off_topic,
.chip-intent.chip-i-security_concern {
  background: var(--warn-tint);
  color: var(--warn);
}
.chip-more,
.chip-kind {
  background: var(--panel-2);
  color: var(--ink-3);
}
.chip-kind {
  font-family: var(--mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.count-badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 600;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px 0 8px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--panel-2);
  color: var(--ink-3);
}
.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.pill-executed,
.pill-ok {
  background: var(--ok-tint);
  color: var(--ok);
}
.pill-approved {
  background: var(--brand-07);
  color: var(--brand);
}
.pill-pending {
  background: var(--warn-tint);
  color: var(--warn);
}
.pill-failed {
  background: var(--danger-tint);
  color: var(--danger);
}
.pill-declined,
.pill-expired,
.pill-superseded {
  background: var(--panel-2);
  color: var(--ink-3);
}
.meta-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--edge);
  color: var(--ink-3);
  font-size: 11.5px;
  font-family: var(--mono);
  white-space: nowrap;
}
.meta-ok {
  color: var(--ok);
  background: var(--ok-tint);
  box-shadow: none;
}
.meta-think {
  color: var(--brand);
  background: var(--brand-07);
  box-shadow: none;
}

/* ---------- states ---------- */

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 48px 20px;
  color: var(--ink-3);
}
.state-icon {
  width: 22px;
  height: 22px;
  color: var(--ink-5);
  margin-bottom: 4px;
}
.state-title {
  font-weight: 600;
  color: var(--ink-2);
}
.state-body {
  font-size: 13px;
  max-width: 46ch;
  color: var(--ink-4);
}
.state-error .state-icon {
  color: var(--danger);
}
.state .btn {
  margin-top: 10px;
}
.boot-error {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.skel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.skel-block {
  border-radius: var(--r-ctl);
  background: linear-gradient(90deg, #eceef2 0%, #f4f5f8 40%, #eceef2 80%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.skel-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.skel-kpi {
  height: 98px;
}
.skel-chart {
  height: 320px;
  border-radius: var(--r-panel);
}
.skel-row {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 20px;
}
.skel-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.skel-card {
  height: 240px;
  border-radius: var(--r-panel);
}
.skel-chat {
  height: 560px;
  border-radius: var(--r-panel);
}
.skel-line {
  height: 44px;
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ---------- conversation detail ---------- */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  margin-bottom: -8px;
}
.back-link:hover {
  color: var(--brand);
}
.detail-head .page-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.title-sub {
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-4);
  letter-spacing: 0;
}
.head-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--surface);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-edge);
}
.stat {
  padding: 12px 18px;
  border-left: 1px solid var(--edge);
  min-width: 0;
}
.stat:first-child {
  border-left: 0;
}
.stat-label {
  font-size: 12px;
  color: var(--ink-4);
  white-space: nowrap;
}
.stat-value {
  margin-top: 2px;
  font-size: 16px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-danger .stat-value {
  color: var(--danger);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(330px, 400px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.chat-col {
  position: sticky;
  top: 16px;
  height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--r-panel);
  box-shadow: var(--shadow-edge);
  overflow: hidden;
}
.chat-head {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--edge);
}
.chat-scroll {
  flex: 1;
  overflow-y: auto;
  background: #f7f8fa;
  scroll-behavior: smooth;
}
.chat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 12px 24px;
}
.chat-turn {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 6px 4px;
  border-radius: 10px;
  transition: background-color 0.3s;
}
.chat-turn.is-current {
  background: var(--brand-07);
}
.chat-turn.is-flash,
.turn.is-flash {
  animation: flash 1.6s var(--ease);
}
@keyframes flash {
  0%,
  30% {
    box-shadow:
      0 0 0 2px var(--focus),
      var(--shadow-edge);
  }
  100% {
    box-shadow: var(--shadow-edge);
  }
}
.chat-turn.is-flash {
  animation-name: flash-plain;
}
@keyframes flash-plain {
  0%,
  30% {
    box-shadow: 0 0 0 2px var(--focus);
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}
.bubble {
  max-width: 86%;
  padding: 9px 13px;
  border: 0;
  border-radius: 18px;
  text-align: left;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  transition:
    transform 0.15s var(--ease),
    box-shadow 0.15s;
}
.bubble:hover {
  box-shadow: 0 0 0 2px var(--focus);
}
.bubble:active {
  transform: scale(0.99);
}
.bubble-user {
  align-self: flex-end;
  background: var(--brand);
  color: var(--on-brand);
  border-bottom-right-radius: 5px;
}
.bubble-bot {
  align-self: flex-start;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--edge);
  border-bottom-left-radius: 5px;
  white-space: normal;
}
.chat-imessage .bubble-user {
  background: #0a6cd6;
  color: #fff;
}
.chat-imessage .bubble-bot {
  background: #e9e9eb;
  box-shadow: none;
}
.rich p + p,
.rich p + ul,
.rich ul + p {
  margin-top: 6px;
}
.rich ul {
  list-style: disc;
  padding-left: 18px;
}
.rich li + li {
  margin-top: 2px;
}
.rich strong {
  font-weight: 600;
}
.bubble-failed {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: var(--danger-tint);
  color: var(--danger);
  font-size: 12.5px;
}
.chat-meta {
  align-self: center;
  font-size: 11px;
  color: var(--ink-5);
  font-family: var(--mono);
}
.chat-notice {
  align-self: center;
  max-width: 90%;
  text-align: center;
  font-size: 12px;
  color: var(--ink-4);
  padding: 4px 10px;
  white-space: pre-wrap;
}

.ap-card {
  align-self: flex-start;
  width: 86%;
  text-align: left;
  border: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow:
    0 0 0 1px var(--edge),
    0 1px 2px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ap-card:hover {
  box-shadow: 0 0 0 2px var(--focus);
}
.ap-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ap-card-title {
  font-weight: 600;
  font-size: 13.5px;
}
.ap-card-amount {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.ap-lines {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  font-size: 12.5px;
}
.ap-lines dt {
  color: var(--ink-4);
}
.ap-lines dd {
  color: var(--ink-2);
  text-align: right;
}
.ap-lines-inline dd {
  text-align: left;
}
.ap-card-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px dashed var(--edge);
  font-size: 12px;
  color: var(--ink-3);
}
.ap-ref {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--ink-2);
}
.receipt {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--edge);
  font-size: 12px;
  color: var(--ink-3);
}
.receipt-executed > .icon {
  color: var(--ok);
}

.trace-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.trace-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 2px 0;
}
.trace-actions {
  display: flex;
  gap: 14px;
}

.memory {
  padding: 0;
}
.memory-sum {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  cursor: pointer;
  list-style: none;
}
.memory-sum::-webkit-details-marker,
.json-block summary::-webkit-details-marker,
.ctx summary::-webkit-details-marker {
  display: none;
}
.memory[open] .json-caret,
.json-block[open] > summary .json-caret,
.ctx[open] .json-caret {
  transform: rotate(90deg);
}
.json-caret {
  color: var(--ink-4);
  transition: transform 0.15s var(--ease);
}
.memory-body {
  padding: 0 20px 16px;
}
.memory-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
}
.memory-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: baseline;
  padding: 8px 0;
  border-top: 1px solid var(--edge);
  font-size: 13.5px;
}

.turn {
  padding: 0;
  scroll-margin-top: 16px;
}
.turn-error {
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--danger) 30%, transparent),
    0 1px 3px rgba(0, 0, 0, 0.05);
}
.turn-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px 12px;
}
.turn-head-main {
  min-width: 0;
}
.turn-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.turn-topic {
  margin-top: 6px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  text-wrap: pretty;
}
.turn-head-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex: none;
}
.turn-total {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.wf {
  padding: 0 20px 14px;
  border-bottom: 1px solid var(--edge);
}
.wf-bar {
  position: relative;
  display: flex;
  gap: 2px;
  height: 10px;
}
.wf-seg {
  flex-basis: 0;
  min-width: 3px;
  border-radius: 3px;
}
.wf-model {
  background: var(--brand);
}
.wf-tool {
  background: var(--tool);
}
.wf-other {
  background: #d9dbe2;
}
.wf-first {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2px;
  margin-left: -1px;
  background: var(--ok);
  border-radius: 1px;
}
.wf-first-key {
  width: 2px;
  height: 12px;
  border-radius: 1px;
  background: var(--ok);
}
.wf-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 8px;
}
.wf-legend .legend {
  font-size: 11.5px;
}
.legend-right {
  margin-left: auto;
  font-family: var(--mono);
  color: var(--ink-3);
}

.trace {
  padding: 14px 20px 18px;
}
.step {
  position: relative;
  padding: 0 0 16px 26px;
}
.step::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 14px;
  bottom: -2px;
  width: 1px;
  background: var(--edge);
}
.step:last-child {
  padding-bottom: 0;
}
.step:last-child::before {
  display: none;
}
.step-node {
  position: absolute;
  left: 2px;
  top: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 0 0 1.5px var(--ink-5);
}
.step-customer .step-node {
  background: var(--brand);
  box-shadow: 0 0 0 1.5px var(--brand);
}
.step-round .step-node {
  box-shadow: 0 0 0 1.5px var(--brand);
}
.step-bank .step-node {
  box-shadow: 0 0 0 1.5px var(--tool);
}
.step-approval .step-node {
  box-shadow: 0 0 0 1.5px var(--ok);
}
.step-event .step-node {
  background: var(--warn-tint);
  box-shadow: 0 0 0 1.5px var(--warn);
}
.step-reply .step-node {
  background: var(--ok);
  box-shadow: 0 0 0 1.5px var(--ok);
}
.step-error .step-node {
  background: var(--danger);
  box-shadow: 0 0 0 1.5px var(--danger);
}
.step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 20px;
}
.step-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.step-title > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.step-title .icon {
  width: 14px;
  height: 14px;
  color: var(--ink-4);
}
.step-right {
  font-size: 12px;
}
.round-ms,
.tool-ms,
.bank-ms {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.step-main > :not(.step-head) {
  margin-top: 8px;
}
.quote {
  padding: 8px 12px;
  border-left: 2px solid var(--brand-pale);
  background: var(--surface-2);
  border-radius: 0 6px 6px 0;
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.ctx summary {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  list-style: none;
}
.ctx-pre {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--edge);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink-2);
  max-height: 320px;
  overflow: auto;
}
.round-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.narration {
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--brand-07);
  font-size: 13px;
  color: var(--ink-2);
}
.narration-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--brand);
  margin-bottom: 2px;
}
.narration-label .muted {
  font-weight: 400;
}
.tools {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tool {
  border-radius: 10px;
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--edge);
  padding: 10px 12px;
}
.tool-error {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--danger) 35%, transparent);
  background: #fffafa;
}
.tool-refused {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--warn) 30%, transparent);
  background: #fffcf5;
}
.tool-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tool-head .tool-ms {
  margin-left: auto;
}
.tool-status {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex: none;
}
.tool-status .icon {
  width: 12px;
  height: 12px;
}
.tool-status .icon svg {
  stroke-width: 2;
}
.ts-ok {
  background: var(--ok-tint);
  color: var(--ok);
}
.ts-error {
  background: var(--danger-tint);
  color: var(--danger);
}
.ts-refused {
  background: var(--warn-tint);
  color: var(--warn);
}
.refusal {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  background: var(--warn-tint);
  color: var(--warn);
  font-size: 12.5px;
  font-weight: 500;
}
.refusal code {
  margin-left: auto;
  font-size: 11px;
}
.tool-io {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

/* JSON viewer: a navy code panel; syntax colours stay inside code. */
.json-block {
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--edge);
  overflow: hidden;
}
.json-block > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 10px;
  cursor: pointer;
  list-style: none;
}
.json-block > summary:hover {
  background: var(--surface-2);
}
.json-label {
  flex: none;
  font: 500 10.5px var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  min-width: 44px;
}
.json-preview {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-4);
}
.json-block[open] .json-preview {
  visibility: hidden;
}
.json-block.is-error .json-label {
  color: var(--danger);
}
.json-body {
  position: relative;
  background: #0e1430;
}
.json-tools {
  position: absolute;
  top: 8px;
  right: 8px;
}
.json {
  padding: 12px 14px;
  max-height: 420px;
  overflow: auto;
  font: 12px/1.6 var(--mono);
  color: #d6dbf0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
}
.j-key {
  color: #a2c1ed;
}
.j-str {
  color: #9fdcc4;
}
.j-num {
  color: #f3c38a;
}
.j-bool,
.j-null {
  color: #f0a3b8;
}
.j-p {
  color: #7d86ad;
}
.j-raw {
  color: #d6dbf0;
}

.bank {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--edge);
}
.bank-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 40px 62px minmax(90px, 26%);
  gap: 10px;
  align-items: center;
  min-height: 26px;
  font-size: 12px;
}
.method {
  font: 600 10.5px var(--mono);
  letter-spacing: 0.04em;
  color: var(--tool);
}
.m-post {
  color: var(--ok);
}
.bank-path {
  font-size: 11.5px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.http {
  font: 500 11px var(--mono);
  text-align: center;
  border-radius: 4px;
  padding: 1px 0;
}
.http-2xx {
  color: var(--ok);
  background: var(--ok-tint);
}
.http-4xx {
  color: var(--warn);
  background: var(--warn-tint);
}
.http-5xx {
  color: var(--danger);
  background: var(--danger-tint);
}
.bank-ms {
  text-align: right;
}
.bank-track {
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: var(--panel-2);
}
.bank-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 3px;
  background: var(--tool);
}
.bank-bar.is-bad {
  background: var(--danger);
}

.trace-approvals {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.trace-ap {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--edge);
}
.trace-ap-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.trace-ap-title {
  font-weight: 600;
  font-size: 13px;
}
.trace-ap-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-3);
}
.trace-ap .ap-lines {
  margin-top: 6px;
}

.events {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.event {
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--warn-tint);
  border-left: 3px solid var(--warn);
}
.event-tool_error,
.event-model_refusal {
  background: var(--danger-tint);
  border-left-color: var(--danger);
}
.event-off_topic,
.event-rate_limited {
  background: var(--panel-2);
  border-left-color: var(--ink-4);
}
.event-kind {
  font-weight: 600;
  font-size: 12.5px;
}
.event-detail {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.reply {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--edge);
  font-size: 13.5px;
}
.mem-added {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mem-added li {
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--brand-07);
  font-size: 13px;
}
.err-pre {
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--danger-tint);
  color: var(--danger);
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- tools page ---------- */

.err-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.err-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--edge);
}
.err-item:first-child {
  border-top: 0;
  padding-top: 0;
}
.err-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.err-open {
  margin-left: auto;
}

/* ---------- live ---------- */

.live-status {
  display: flex;
  align-items: center;
  gap: 12px;
}
.live-ind {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 12px;
  border-radius: 15px;
  background: var(--ok-tint);
  color: var(--ok);
  font-weight: 600;
  font-size: 13px;
}
.live-pulse {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}
.live-pulse::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid currentColor;
  opacity: 0;
  animation: pulse 2s var(--ease) infinite;
}
.live-ind.is-paused {
  background: var(--panel-2);
  color: var(--ink-3);
}
.live-ind.is-paused .live-pulse::after,
.live-ind.is-offline .live-pulse::after {
  animation: none;
}
.live-ind.is-offline {
  background: var(--warn-tint);
  color: var(--warn);
}
@keyframes pulse {
  0% {
    transform: scale(0.6);
    opacity: 0.7;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}
.live-banner {
  display: none;
  padding: 8px 12px;
  border-radius: var(--r-ctl);
  background: var(--warn-tint);
  color: var(--warn);
  font-size: 13px;
}
.live-banner.is-on {
  display: block;
}
.panel-feed {
  padding: 0;
  overflow: hidden;
}
.feed-item {
  border-top: 1px solid var(--edge);
}
.feed-item:first-child {
  border-top: 0;
}
.feed-item.is-new {
  animation: feed-in 0.9s var(--ease);
}
@keyframes feed-in {
  0% {
    opacity: 0;
    transform: translateY(-6px);
    background: var(--brand-12);
  }
  25% {
    opacity: 1;
    transform: none;
  }
  100% {
    background: transparent;
  }
}
.feed-link {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 90px;
  gap: 16px;
  padding: 14px 22px;
  transition: background-color 0.15s;
}
.feed-link:hover {
  background: #f8f9fb;
}
.feed-link:focus-visible {
  outline-offset: -2px;
}
.feed-time {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  font-weight: 500;
}
.feed-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.feed-persona {
  font-weight: 600;
}
.feed-text {
  margin-top: 6px;
  font-size: 14px;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.feed-reply {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  font-size: 13px;
  color: var(--ink-3);
}
.feed-reply span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.feed-reply .icon {
  color: var(--ink-5);
  margin-top: 2px;
}
.feed-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.feed-ms {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-4);
}
.feed-ms b {
  font-weight: 500;
  color: var(--ink-2);
}
.has-error .feed-ms b {
  color: var(--danger);
}
.feed-empty .state {
  padding: 64px 20px;
}

/* ---------- login ---------- */

body.is-login {
  overflow-x: hidden;
}
.login {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 48px 20px;
  overflow: hidden;
  background:
    radial-gradient(60% 55% at 62% 45%, color-mix(in srgb, var(--focus) 26%, transparent) 0%, transparent 70%),
    var(--canvas);
}
.halftone {
  position: absolute;
  width: min(1100px, 120vw);
  height: auto;
  left: 50%;
  top: 50%;
  transform: translate(-38%, -50%);
  -webkit-mask-image: radial-gradient(closest-side, #000 55%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 55%, transparent 100%);
  pointer-events: none;
}
.login-top {
  position: absolute;
  top: 20px;
  right: 24px;
}
.login-card {
  position: relative;
  width: min(400px, 100%);
  padding: 32px 32px 26px;
  border-radius: var(--r-panel);
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-glass);
}
.login-mark {
  margin-bottom: 22px;
}
.login-mark-img {
  height: 40px;
  width: auto;
  display: block;
}
.login-title {
  margin-top: 4px;
  font-size: 26px;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.login-lead {
  margin-top: 8px;
  color: var(--ink-3);
  font-size: 14px;
  text-wrap: pretty;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
}
.field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}
.form-error {
  min-height: 18px;
  font-size: 12.5px;
  color: var(--danger);
}
.login-foot {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--edge);
  font-size: 12px;
  color: var(--ink-4);
}
.login-foot .icon {
  width: 14px;
  height: 14px;
  margin-top: 1px;
}

/* ---------- money ---------- */

.panel-money .panel-head {
  margin-bottom: 18px;
}
.money-hero {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--edge);
}
.money-total {
  display: flex;
  flex-direction: column;
  padding-right: 24px;
  border-right: 1px solid var(--edge);
}
.money-big {
  margin-top: 6px;
  font-size: 40px;
  line-height: 1.05;
  font-weight: 500;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  color: var(--brand);
  overflow-wrap: anywhere;
}
.money-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  margin-top: 26px;
}
.money-facts dt {
  font-size: 12px;
  color: var(--ink-4);
}
.money-facts dd {
  margin-top: 2px;
  font-size: 16px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.money-chart {
  min-width: 0;
}
.money-chart-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.chart-money .chart-host {
  min-height: 236px;
}
.chart .bar-cap {
  fill: var(--brand-soft);
}
.chart .line-cum {
  fill: none;
  stroke: var(--brand);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart .dot-cum {
  fill: var(--surface);
  stroke: var(--brand);
  stroke-width: 2;
}
.chart .axis-label-line {
  fill: var(--brand-soft);
}
.key-soft {
  background: var(--brand-pale);
}
.key-line {
  width: 14px;
  height: 2px;
  border-radius: 1px;
  background: var(--brand);
}
.tip-key-soft {
  background: var(--brand-pale);
}
.money-splits {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 28px;
  padding-top: 18px;
}
.money-split .sub-head {
  margin-top: 0;
}
.money-split-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.money-split-rows li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  grid-template-areas: "k l v" ". m m";
  column-gap: 8px;
  align-items: center;
  font-size: 13px;
}
.money-split-rows .legend-key {
  grid-area: k;
}
.msr-label {
  grid-area: l;
  color: var(--ink-2);
}
.msr-vol {
  grid-area: v;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.msr-meta {
  grid-area: m;
  font-size: 12px;
}
.panel-recent > .table-wrap {
  margin: 0 -22px -20px;
}
.cell-fromto {
  min-width: 260px;
}
.cell-fromto > span {
  vertical-align: middle;
}
.ft-from {
  color: var(--ink-3);
}
.ft-arrow {
  margin: 0 8px;
  color: var(--ink-5);
}
.ft-to {
  font-weight: 500;
  margin-right: 8px;
}
.muted-2 {
  color: var(--ink-3);
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---------- responsive ---------- */

@media (max-width: 1360px) {
  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .stat:nth-child(5) {
    border-left: 0;
  }
  .stat:nth-child(n + 5) {
    border-top: 1px solid var(--edge);
  }
}

@media (max-width: 1199px) {
  .shell {
    display: block;
  }
  .side {
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--edge);
    background: rgba(251, 251, 252, 0.92);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }
  .side-brand {
    padding: 0;
    border: 0;
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }
  .side-app,
  .side-note {
    display: none;
  }
  .wordmark-img {
    height: 26px;
  }
  .nav {
    flex-direction: row;
    gap: 2px;
    flex: 1;
    overflow-x: auto;
  }
  .nav-item {
    width: auto;
    height: 34px;
    white-space: nowrap;
  }
  .side-foot {
    margin: 0;
    flex-direction: row;
    align-items: center;
  }
  .nav-logout .nav-label {
    display: none;
  }
  .main {
    padding: 22px 20px 56px;
  }
  .chat-col {
    top: 70px;
    height: calc(100vh - 86px);
  }
  .turn {
    scroll-margin-top: 70px;
  }
}

@media (max-width: 1100px) {
  .grid-2-1,
  .grid-1-1 {
    grid-template-columns: minmax(0, 1fr);
  }
  .money-hero {
    grid-template-columns: minmax(0, 1fr);
  }
  .money-total {
    border-right: 0;
    padding-right: 0;
  }
  .money-facts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .money-splits {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .money-splits > :last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 960px) {
  .kpis,
  .skel-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .chat-col {
    position: relative;
    top: 0;
    height: 520px;
  }
  .nav-label {
    display: none;
  }
  .nav-item.is-active .nav-label {
    display: inline;
  }
  .feed-link {
    grid-template-columns: 90px minmax(0, 1fr) 70px;
    padding: 12px 16px;
  }
  .bank-row {
    grid-template-columns: 42px minmax(0, 1fr) 38px 56px;
  }
  .bank-track {
    display: none;
  }
}

@media (max-width: 640px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stat:nth-child(odd) {
    border-left: 0;
  }
  .stat:nth-child(n + 3) {
    border-top: 1px solid var(--edge);
  }
  .bar-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .bar-row .bar-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- customer files (chat column + trace) ---------- */
.dash-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 86%;
}
.dash-files.is-end {
  align-self: flex-end;
  justify-content: flex-end;
}
.step .dash-files {
  margin-top: 8px;
  max-width: none;
}
.dash-file-photo {
  position: relative;
  display: block;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--edge);
  background: var(--surface-2);
}
.dash-file-photo img {
  display: block;
  max-width: 200px;
  max-height: 220px;
  width: auto;
  height: auto;
}
.dash-file {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 180px;
  max-width: 280px;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--edge);
  color: var(--ink);
  text-decoration: none;
}
.dash-file:hover {
  background: var(--surface-2);
}
.dash-file .icon {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--brand);
}
.dash-file-text {
  display: grid;
  min-width: 0;
}
.dash-file-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-file-meta {
  font-size: 11.5px;
  color: var(--ink-2);
}
.dash-file-flag {
  font-size: 11px;
  color: var(--warn, #9a5b00);
}
.dash-file-photo .dash-file-flag {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
}
