/* ==================================================================== *
 * Pages (2026-09-28): the console redo's language — the one already on
 * Communities, the Order Book and Operations — carried to the pages that
 * were still plain Bootstrap: Customers, Expenses, Reports, the Setup
 * lists, Subscriptions, Payments and Traces. Tokens and the shared parts
 * (.nt-chip, .nt-num, .nt-tiles, .nt-empty, page_head) live in theme.css;
 * this file only arranges them. Loaded after theme.css.
 * ==================================================================== */

/* ---- Top bar: the city slot (only on a page filtered by the city) ---- */
.nt-topbar-cityname {
  margin-left: 6px;
  padding: 3px 10px;
  border: 1px solid var(--nt-line);
  border-radius: 8px;
  background-color: var(--nt-wash);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--nt-ink-2);
  white-space: nowrap;
}

/* With no switcher, the jump box takes the room the switcher had, so the bar
   still reads left name · centre search · right Live. */
.nt-topbar:not(:has(.nt-city-switch)) .nt-jump { margin-left: auto; }
.nt-topbar:not(:has(.nt-city-switch)) .nt-topbar-date { margin-left: 12px; }

@media (max-width: 860px) {
  /* A phone hides the name because the switcher fills the bar; without a
     switcher the name comes back so the bar is not an empty strip. */
  .nt-topbar:not(:has(.nt-city-switch)) .nt-topbar-name { display: block; flex: 1 1 auto; }
  .nt-topbar-cityname { margin-left: 0; }
}

/* ---- A page: head, then cards, 12px apart ---- */
.nt-page { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

/* ---- The list card: a table (or list) inside one pane ---- */
.nt-lcard {
  position: relative; /* so a positioned child (a hidden label) is clipped too */
  min-width: 0;
  background: var(--nt-shell);
  border: 1px solid var(--nt-line);
  border-radius: var(--nt-r-pane);
  overflow: hidden;
}

.nt-lcard-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--nt-line);
}

.nt-lcard-title { margin: 0; font-family: var(--nt-font-display); font-size: 15px; font-weight: 700; }
.nt-lcard-sub { font-size: 12px; color: var(--nt-muted); font-variant-numeric: tabular-nums; }
.nt-lcard-aside { margin-left: auto; display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.nt-lcard-body { padding: 12px 14px; overflow-x: auto; }
.nt-lcard-foot { padding: 8px 14px; border-top: 1px solid var(--nt-line); background: var(--nt-wash); font-size: 12.5px; color: var(--nt-ink-2); }
.nt-lcard > .nt-empty { margin: 0; border: 0; border-radius: 0; }

/* A table inside the card: no second border, the card is the frame. */
.nt-lcard > .table,
.nt-lcard > .table-scroll > .table,
.nt-lcard > form > .table,
.nt-ltable {
  margin: 0;
  font-size: 13px;
}

.nt-lcard > .table,
.nt-lcard > form > .table,
.nt-lcard > .table-scroll {
  border: 0;
  border-radius: 0;
}

.nt-ltable > tbody > tr { position: relative; }
.nt-ltable > tbody > tr:hover > * { background-color: var(--nt-wash); }
.nt-ltable .nt-lt-name { font-weight: 600; }
.nt-ltable .nt-lt-name a { color: var(--nt-ink); }
.nt-ltable .nt-lt-name a:hover { color: var(--nt-link); }
.nt-lt-sub { display: block; font-size: 11.5px; font-weight: 400; color: var(--nt-muted); }
.nt-ltable td.nt-num, .nt-ltable th.nt-num { text-align: right; white-space: nowrap; }
.nt-ltable td.nt-lt-actions { text-align: right; white-space: nowrap; }
.nt-ltable tfoot td, .nt-ltable tfoot th { font-weight: 600; background: var(--nt-wash); }

/* Money: mono, tabular, and a colour only when somebody must act. */
.nt-money { font-family: var(--nt-font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nt-money--bad { color: var(--nt-brick); font-weight: 600; }
.nt-money--ok { color: var(--nt-leaf); }
.nt-money--quiet { color: var(--nt-muted); }

/* A filter form inside a card head carries no margin of its own. */
.nt-lcard-head > .nt-xreg-filters,
.nt-lcard-head > form { margin: 0; }

/* ---- Search box + filter chips over a list ---- */
.nt-lfilters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.nt-lsearch { display: flex; align-items: center; gap: 6px; flex: 1 1 16rem; max-width: 26rem; margin: 0; }
.nt-lsearch .form-control,
.nt-lsearch .form-select { height: 32px; font-size: 13px; }
.nt-lsearch .form-select { width: auto; flex: none; padding-top: 0; padding-bottom: 0; }
.nt-fchips { display: flex; flex-wrap: wrap; gap: 6px; }
.nt-fchip {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 11px;
  border: 1px solid var(--nt-rule); border-radius: 999px; background: var(--nt-shell); color: var(--nt-ink-2);
  font-size: 12.5px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.nt-fchip:hover { background: var(--nt-wash); color: var(--nt-ink); text-decoration: none; }
.nt-fchip.is-on { border-color: var(--nt-ink); background: var(--nt-ink); color: var(--nt-shell); }
.nt-fchip .nt-num { font-size: 11.5px; opacity: .8; }

/* A small outline button inside a card (Find, Clear, Edit). */
.nt-lbtn {
  display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 11px;
  border: 1px solid var(--nt-rule); border-radius: 6px; background: var(--nt-shell); color: var(--nt-ink-2);
  font: 500 12.5px var(--nt-font-body); cursor: pointer; white-space: nowrap; text-decoration: none;
}
.nt-lbtn:hover { background: var(--nt-wash); color: var(--nt-ink); text-decoration: none; }
.nt-lbtn--primary { border-color: var(--nt-spruce); background: var(--nt-spruce); color: #fff; }
.nt-lbtn--primary:hover { background: var(--nt-link-hover); color: #fff; }

/* Controls riding in the page head's right-hand slot. */
.nt-head-filters { margin: 0; }

/* ---- A detail page: identity line under the head, tiles, sections ---- */
.nt-idline { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; color: var(--nt-ink-2); }
.nt-idline .nt-num { color: var(--nt-ink); }
.nt-wa-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--nt-leaf); }
.nt-wa-link:hover { color: var(--nt-ink); }

.nt-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: 13px; }
.nt-dl dt { font-weight: 500; color: var(--nt-muted); }
.nt-dl dd { margin: 0; }

.nt-pair { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.nt-pair > * { min-width: 0; }
@media (max-width: 960px) { .nt-pair { grid-template-columns: minmax(0, 1fr); } }

/* A compact list of recent things (orders, payments): one line each. */
.nt-mini { list-style: none; margin: 0; padding: 0; }
.nt-mini-row {
  display: grid; grid-template-columns: 7.5rem minmax(0, 1fr) auto auto; gap: 4px 12px; align-items: center;
  padding: 8px 14px; border-bottom: 1px solid var(--nt-line); font-size: 13px;
}
.nt-mini-row:last-child { border-bottom: 0; }
.nt-mini-when { font-family: var(--nt-font-mono); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.nt-mini-what { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--nt-ink-2); }

/* ---- Setup lists: the list-card look instead of striped + bordered ---- */
.nt-setup-table.table-striped > tbody > tr:nth-of-type(odd) > * { --bs-table-bg-type: transparent; }
.nt-setup-table.table-bordered > :not(caption) > * > * { border-width: 0 0 1px 0; }
.nt-setup-table { border: 1px solid var(--nt-line); border-radius: var(--nt-r-pane); font-size: 13px; }
.nt-setup-table > tbody > tr:hover > * { background-color: var(--nt-wash); }
.nt-setup-table td:last-child { white-space: nowrap; }
.nt-setup-section .form-label { font-size: 12.5px; font-weight: 600; color: var(--nt-ink-2); margin-bottom: 4px; }

/* Forms that sit on a page (not in the drawer) get a pane of their own. */
.nt-form-pane { max-width: 44rem; padding: 16px 18px; background: var(--nt-shell); border: 1px solid var(--nt-line); border-radius: var(--nt-r-pane); }
.nt-form-pane .form-label { font-size: 12.5px; font-weight: 600; color: var(--nt-ink-2); margin-bottom: 4px; }

/* ---- Phone: a table becomes a stack of cards (`.nt-stack`, labelled by
   stack_table_controller.js). 44px targets, no sideways page scroll. ---- */
@media (max-width: 640px) {
  table.nt-stack,
  table.nt-stack > tbody,
  table.nt-stack > tbody > tr,
  table.nt-stack > tbody > tr > td,
  table.nt-stack > tfoot,
  table.nt-stack > tfoot > tr,
  table.nt-stack > tfoot > tr > * {
    display: block;
    width: 100%;
    white-space: normal;
  }

  /* theme.css makes a wide table scroll sideways under 768px; a stack does
     not need to. */
  table.nt-stack { overflow: visible; }
  table.nt-stack > thead { display: none; }

  table.nt-stack > tbody > tr,
  table.nt-stack > tfoot > tr {
    position: relative;
    padding: 10px 14px;
    border-bottom: 1px solid var(--nt-line);
  }

  table.nt-stack > tbody > tr:last-child { border-bottom: 0; }

  table.nt-stack > tbody > tr > td,
  table.nt-stack > tfoot > tr > * {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 2px 0;
    border: 0;
    text-align: right;
    background: transparent;
  }

  table.nt-stack > tbody > tr > td[data-label]::before,
  table.nt-stack > tfoot > tr > [data-label]::before {
    content: attr(data-label);
    flex: none;
    font-family: var(--nt-font-body);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--nt-muted);
    text-align: left;
  }

  /* A row heading (a report's label column) is the card's title. */
  table.nt-stack > tbody > tr > th {
    display: block;
    width: 100%;
    padding: 0 0 4px;
    border: 0;
    font-weight: 600;
    text-align: left;
    background: transparent;
  }

  /* An empty cell says nothing on a card. */
  table.nt-stack > tbody > tr > td:empty { display: none; }

  /* The name is the card's title: full width, no label, bigger. */
  table.nt-stack > tbody > tr > td.nt-lt-name {
    display: block;
    padding-bottom: 4px;
    font-size: 15px;
    text-align: left;
  }

  table.nt-stack > tbody > tr > td.nt-lt-name::before { display: none; }

  /* Row actions: a line of 44px buttons at the card's foot. */
  table.nt-stack > tbody > tr > td.nt-lt-actions,
  table.nt-stack > tbody > tr > td:last-child:has(a, button) {
    justify-content: flex-start;
    flex-wrap: wrap;
    padding-top: 6px;
  }

  table.nt-stack > tbody > tr > td.nt-lt-actions::before,
  table.nt-stack > tbody > tr > td:last-child:has(a, button)::before { display: none; }

  table.nt-stack a, table.nt-stack button, table.nt-stack .btn { min-height: 44px; display: inline-flex; align-items: center; }
  table.nt-stack > tbody > tr > td.nt-lt-name a { min-height: 0; display: inline; }
  table.nt-stack > tbody > tr > td.nt-lt-name a.stretched-link { min-height: 44px; }

  /* A foot row (a total) reads label ··· figure on one line. */
  table.nt-stack > tfoot > tr { display: flex; justify-content: space-between; gap: 12px; }
  table.nt-stack > tfoot > tr > * { width: auto; padding: 0; }
  table.nt-stack > tfoot > tr > td:empty { display: none; }
  table.nt-stack > tfoot > tr > [data-label]::before { display: none; }

  /* A row being edited in place: each field full width under its label. */
  table.nt-stack > tbody > tr > td:has(input, select, textarea) { display: block; text-align: left; padding: 4px 0; }
  table.nt-stack > tbody > tr > td:has(input, select, textarea)::before { display: block; margin-bottom: 3px; }
  table.nt-stack .form-control, table.nt-stack .form-select { min-height: 44px; font-size: 16px; }

  .nt-fchip { height: 36px; padding: 0 13px; }
  .nt-lsearch { max-width: none; flex-basis: 100%; }
  .nt-lsearch .form-control, .nt-lsearch .form-select { height: 44px; font-size: 16px; }
  .nt-lbtn { height: 44px; }
  .nt-lcard-head { padding: 10px 12px; }

  .nt-mini-row { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 12px; min-height: 44px; }
  .nt-mini-what { grid-column: 1 / -1; grid-row: 2; white-space: normal; }
  .nt-dl { grid-template-columns: minmax(0, 1fr); gap: 0 0; }
  .nt-dl dd { margin-bottom: 8px; }
}

/* ---- The customer page: ledger with evidence beside the customer's
   messages (mockups/customer-ledger-evidence.html). ---- */
.nt-cl-mono { font-family: var(--nt-font-mono); font-variant-numeric: tabular-nums; font-size: 11.5px; }
.nt-idline .nt-cl-mono { background: var(--nt-wash); border-radius: var(--nt-r-ctl); padding: 1px 6px; color: var(--nt-ink-2); }
.nt-cl-sources { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.nt-cl-src { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; border: 1px solid var(--nt-line);
  border-radius: 12px; padding: 2px 9px; background: var(--nt-shell); color: var(--nt-ink); }
.nt-cl-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.nt-cl-dot--group { background: var(--nt-info); }
.nt-cl-dot--dm { background: var(--nt-ok); }

.nt-cl-tiles--money { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.nt-cl-tiles .nt-tile { min-width: 0; }

.nt-cl-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.nt-cl-pane { display: flex; flex-direction: column; }
.nt-cl-empty { margin: 14px; }

.nt-cl-ledger { display: flex; flex-direction: column; }
.nt-cl-hdr, .nt-cl-entry { display: grid; grid-template-columns: 58px minmax(0, 1fr) 96px 96px; gap: 10px; padding: 10px 14px; }
.nt-cl-hdr { padding-block: 7px; background: var(--nt-wash); }
.nt-cl-hdr span { font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--nt-muted); }
.nt-cl-hdr span:nth-child(n+3) { text-align: right; }
.nt-cl-entry { border-top: 1px solid var(--nt-line); align-items: start; outline: none; }
.nt-cl-hdr + .nt-cl-entry { border-top: 0; }
.nt-cl-entry.is-linked, .nt-cl-entry:focus-visible { background: var(--nt-saffron-wash); }
.nt-cl-entry:focus-visible { box-shadow: inset 3px 0 0 var(--nt-saffron-deep); outline: 2px solid var(--nt-saffron-deep); outline-offset: -2px; }
.nt-cl-date { font: 600 12px var(--nt-font-mono); color: var(--nt-ink-2); }
.nt-cl-date small { display: block; color: var(--nt-muted); font: 500 11px var(--nt-font-body); }
.nt-cl-what { display: flex; flex-direction: column; gap: 5px; min-width: 0; font-size: 13px; }
.nt-cl-l1 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.nt-cl-l1 b { font-weight: 600; }
.nt-cl-ev { display: flex; align-items: flex-start; gap: 7px; font-size: 12px; color: var(--nt-ink-2);
  border-left: 2px solid var(--nt-rule); padding: 3px 0 3px 8px; }
.nt-cl-ev > span { min-width: 0; }
.nt-cl-ev--missing { border-left-color: var(--nt-bad); color: var(--nt-bad); }
.nt-cl-where { color: var(--nt-muted); white-space: nowrap; }
.nt-cl-q { color: var(--nt-ink); font-style: italic; overflow-wrap: anywhere; }
.nt-cl-how { display: block; color: var(--nt-muted); font-size: 11px; }
.nt-cl-thumb { width: 34px; height: 44px; flex-shrink: 0; border-radius: 5px; object-fit: cover; background: var(--nt-carton);
  display: inline-flex; align-items: flex-end; justify-content: center; padding-bottom: 3px; font: 600 8px var(--nt-font-mono); color: var(--nt-ink-2); }
.nt-cl-amt, .nt-cl-bal { text-align: right; font: 600 13px var(--nt-font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nt-cl-amt--cr { color: var(--nt-ok); }
/* Screen-reader-only column names: the header row is aria-hidden. */
.nt-cl-cell { position: relative; }
.nt-cl-cell::before { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nt-cl-amt::before { content: "Amount "; }
.nt-cl-bal::before { content: "Balance "; }
.nt-cl-bal { color: var(--nt-ink-2); }
.nt-cl-bal.nt-ledger-balance--bad { color: var(--nt-brick); }
.nt-cl-foot { display: flex; flex-direction: column; gap: 4px; }
.nt-cl-foot .nt-ledger-note, .nt-cl-foot .nt-total { margin: 0; padding: 0; }

.nt-cl-loose { border-top: 1px solid var(--nt-line); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; background: var(--nt-saffron-wash-2); }
.nt-cl-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--nt-muted); }
.nt-cl-loose-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; border-radius: 6px; outline: none; }
.nt-cl-loose-row.is-linked, .nt-cl-loose-row:focus-visible { background: var(--nt-saffron-wash); }
.nt-cl-loose-row:focus-visible { outline: 2px solid var(--nt-saffron-deep); outline-offset: 2px; }
.nt-cl-loose-acts { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.nt-cl-loose-acts form { margin: 0; }

.nt-cl-tag { display: inline-block; margin-right: 6px; font: 700 10.5px var(--nt-font-body); border-radius: 8px; padding: 0 6px; white-space: nowrap; }
.nt-cl-tag--order { background: var(--nt-saffron-wash); color: var(--nt-warn); }
.nt-cl-tag--payment { background: var(--nt-wash-ok); color: var(--nt-ok); }
.nt-cl-tag--untied { background: var(--nt-wash-bad); color: var(--nt-bad); }

.nt-cl-chat { max-height: 680px; flex: none; }
/* Side by side, the messages pane stays in view while a long ledger scrolls:
   sticky under the 52px top bar, at most 75% of the window tall, its chat
   scrolling inside it. Stacked (≤1020px) it goes back to the page's flow. */
@media (min-width: 1021px) {
  #customer_messages_pane { position: sticky; top: 64px; max-height: 75vh; overflow: hidden; }
  #customer_messages_pane > turbo-frame { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
  #customer_messages_pane .nt-cl-chat { flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto; }
}
.nt-cl-chat .nt-wa-row { outline: none; }
.nt-cl-chat .nt-wa-row.is-linked .nt-wa-bubble,
.nt-cl-chat .nt-wa-row:focus-visible .nt-wa-bubble { box-shadow: 0 0 0 2px var(--nt-saffron); }
.nt-cl-chat .nt-wa-row:focus-visible .nt-wa-bubble { outline: 2px solid var(--nt-saffron-deep); outline-offset: 2px; }
.nt-cl-chat:focus-visible { outline: 2px solid var(--nt-saffron-deep); outline-offset: -2px; }
.nt-cl-ch { font-size: 11px; font-weight: 700; color: var(--nt-info); margin-bottom: 2px; }
.nt-cl-ch--dm { color: var(--nt-ok); }
.nt-cl-img { display: flex; align-items: center; justify-content: center; max-width: 220px; max-height: 180px; min-height: 60px; margin: 2px 0 4px;
  border-radius: 7px; object-fit: cover; background: var(--nt-carton); font: 600 11px var(--nt-font-mono); color: var(--nt-ink-2); }

@media (max-width: 1020px) {
  .nt-cl-grid { grid-template-columns: minmax(0, 1fr); }
  .nt-cl-tiles--money { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nt-cl-chat { max-height: 520px; }
}

@media (max-width: 640px) {
  .nt-cl-hdr, .nt-cl-entry { grid-template-columns: 50px minmax(0, 1fr) 84px; padding-inline: 12px; }
  .nt-cl-bal, .nt-cl-hdr span:nth-child(4) { display: none; }
  .nt-cl-entry, .nt-cl-loose-row { min-height: 44px; }
  .nt-cl-loose-acts { margin-left: 0; }
  .nt-cl-loose-acts .nt-lbtn { height: 44px; }
  .nt-cl-sources { width: 100%; }
  .nt-cl-where { white-space: normal; }
  .nt-cl-grid .nt-fchip, .nt-agent-chip { min-height: 44px; height: auto; }
  .nt-cl-l1 b a, .nt-cl-foot .nt-ledger-steps a { display: inline-flex; align-items: center; min-height: 44px; }
  .nt-cl-tiles .nt-tile-value { font-size: 1.15rem; overflow-wrap: anywhere; }
}

/* ---- Agent harness (Traces): spend, runs, one run's detail ------------ *
 * The approved mockup (docs/superpowers/mockups/agent-traces.html) in the
 * app's tokens. The runs list scrolls inside its own box with a sticky head;
 * on a phone everything is one column. */
.nt-traces { display: flex; flex-direction: column; gap: 22px; }
.nt-trace-pane { display: block; background: var(--nt-shell); border: 1px solid var(--nt-line); border-radius: var(--nt-r-pane); overflow: hidden; }
.nt-trace-detail-frame { display: block; }
.nt-trace-pick { margin: 0; }
.nt-trace-ph { display: flex; align-items: center; gap: 8px 10px; padding: 12px 16px; border-bottom: 1px solid var(--nt-line); flex-wrap: wrap; }
.nt-trace-ph h2 { font: 700 17px/1.2 var(--nt-font-display); margin: 0; }
.nt-trace-ph-end { margin-left: auto; display: inline-flex; gap: 6px; flex-wrap: wrap; }
.nt-trace-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--nt-muted); }
.nt-trace-sub { font-size: 12px; color: var(--nt-muted); }
.nt-trace-mono { font-family: var(--nt-font-mono); font-variant-numeric: tabular-nums; }
.nt-trace-bad { color: var(--nt-bad); }

.nt-trace-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.nt-trace-chips--end { margin-left: auto; }
.nt-trace-chip { font-size: 12px; font-weight: 600; border: 1px solid var(--nt-rule); border-radius: 13px; padding: 2px 10px; color: var(--nt-ink-2); background: var(--nt-shell); text-decoration: none; white-space: nowrap; }
.nt-trace-chip:hover { color: var(--nt-ink); border-color: var(--nt-edge); }
.nt-trace-chip.is-on { background: var(--nt-spruce); border-color: var(--nt-spruce); color: #fff; }
.nt-trace-chip:focus-visible, .nt-trace-tab:focus-visible, .nt-trace-node:focus-visible, .nt-trace-runs:focus-visible,
.nt-trace-when a:focus-visible { outline: 2px solid var(--nt-saffron-deep); outline-offset: 2px; }
.nt-trace-search { flex: 0 1 240px; }
.nt-trace-count { font-size: 12px; color: var(--nt-muted); margin-left: auto; }

.nt-trace-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.nt-trace-tile { padding: 13px 16px; border-left: 1px solid var(--nt-line); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.nt-trace-tile:first-child { border-left: 0; }
.nt-trace-big { font: 600 21px/1.1 var(--nt-font-mono); font-variant-numeric: tabular-nums; }

.nt-trace-spend { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); border-top: 1px solid var(--nt-line); }
.nt-trace-chart { margin: 0; padding: 14px 16px; border-right: 1px solid var(--nt-line); }
.nt-trace-chart-svg { width: 100%; height: auto; display: block; }
.nt-trace-chart-axis { font: 9px var(--nt-font-mono); fill: var(--nt-muted); }
.nt-trace-chart-day { font: 10px var(--nt-font-body); fill: var(--nt-ink-2); }
.nt-trace-legend, .nt-trace-blegend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--nt-ink-2); margin: 6px 0 0; padding: 0; list-style: none; }
.nt-trace-legend i, .nt-trace-blegend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

.nt-trace-tw { overflow-x: auto; }
.nt-trace-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.nt-trace-table th { font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--nt-muted); text-align: left; padding: 8px 12px; background: var(--nt-wash); white-space: nowrap; }
.nt-trace-table td { padding: 8px 12px; border-top: 1px solid var(--nt-line); vertical-align: middle; }
.nt-trace-table .nt-num { text-align: right; font-family: var(--nt-font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nt-trace-agent { font-weight: 600; }
.nt-trace-subj { color: var(--nt-spruce); font-weight: 600; }
a.nt-trace-subj { color: var(--nt-link); }

.nt-trace-runs { max-height: 420px; overflow: auto; overscroll-behavior: contain; }
.nt-trace-runs thead th { position: sticky; top: 0; z-index: 1; }
.nt-trace-runs tbody tr[data-trace-row] { cursor: pointer; }
.nt-trace-runs tbody tr[data-trace-row]:hover td { background: var(--nt-wash); }
.nt-trace-runs tr.is-selected td { background: var(--nt-saffron-wash-2); }
.nt-trace-when { font-family: var(--nt-font-mono); white-space: nowrap; }
.nt-trace-when a { color: var(--nt-ink); text-decoration: none; }
.nt-trace-status { white-space: nowrap; }
.nt-trace-more td { text-align: center; color: var(--nt-muted); font-size: 12px; background: var(--nt-paper); }

.nt-trace-detail { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 300px; }
.nt-trace-tree { border-right: 1px solid var(--nt-line); padding: 12px; display: flex; flex-direction: column; gap: 4px; background: var(--nt-paper); }
.nt-trace-node { border-radius: 8px; padding: 7px 9px; font-size: 12.5px; display: flex; flex-direction: column; gap: 2px; border: 1px solid transparent; color: var(--nt-ink); text-decoration: none; }
.nt-trace-node:hover { background: var(--nt-wash); color: var(--nt-ink); }
.nt-trace-node.is-on { background: var(--nt-shell); border-color: var(--nt-rule); }
.nt-trace-node.is-tool { font-family: var(--nt-font-mono); font-size: 11.5px; padding-block: 4px; }
.nt-trace-node-r { display: flex; justify-content: space-between; gap: 6px; }
.nt-trace-main { min-width: 0; }
.nt-trace-tabs { display: flex; gap: 2px; padding: 0 16px; border-bottom: 1px solid var(--nt-line); flex-wrap: wrap; }
.nt-trace-tab { padding: 10px 12px; font-size: 13px; font-weight: 600; color: var(--nt-muted); border-bottom: 2px solid transparent; text-decoration: none; }
.nt-trace-tab:hover { color: var(--nt-ink); }
.nt-trace-tab.is-on { color: var(--nt-ink); border-bottom-color: var(--nt-spruce); }
.nt-trace-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.nt-trace-body .nt-empty, .nt-trace-body p { margin: 0; }
.nt-trace-kv { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.nt-trace-kv > div { background: var(--nt-wash); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nt-trace-kv b { font: 600 14px var(--nt-font-mono); }
.nt-trace-ctx { display: flex; flex-direction: column; gap: 6px; }
.nt-trace-budget { display: flex; height: 14px; border-radius: 4px; overflow: hidden; background: var(--nt-carton); }
.nt-trace-budget i { display: block; height: 100%; }
.nt-trace-reason { border-left: 3px solid var(--nt-saffron); background: var(--nt-saffron-wash-2); border-radius: 0 8px 8px 0; padding: 10px 12px; font-size: 13px; color: var(--nt-ink-2); display: flex; flex-direction: column; gap: 6px; }
.nt-trace-reason p { margin: 0; white-space: pre-wrap; }
.nt-trace-fold summary { cursor: pointer; font-weight: 600; font-size: 13px; padding: 4px 0; }
.nt-trace-pre { margin: 0; padding: 10px 12px; background: var(--nt-wash); font: 12px/1.5 var(--nt-font-mono); color: var(--nt-ink); overflow: auto; white-space: pre; max-height: 28rem; border-radius: 6px; }
.nt-trace-pre--wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.nt-trace-call { border: 1px solid var(--nt-line); border-radius: 10px; overflow: hidden; }
.nt-trace-call-h { display: flex; gap: 8px; align-items: center; padding: 8px 10px; background: var(--nt-wash); font-size: 12.5px; flex-wrap: wrap; }
.nt-trace-call-h b { font-family: var(--nt-font-mono); }
.nt-trace-cols { display: grid; grid-template-columns: 1fr 1fr; }
.nt-trace-cols .nt-trace-pre { border-radius: 0; }
.nt-trace-cols .nt-trace-pre + .nt-trace-pre { border-left: 1px solid var(--nt-line); }
.nt-trace-ops { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 0; padding: 0; list-style: none; }
.nt-trace-op { display: flex; gap: 8px; align-items: center; font-size: 12.5px; padding: 6px 10px; border: 1px solid var(--nt-line); border-radius: 8px; flex-wrap: wrap; }
.nt-trace-op code { font: 600 12px var(--nt-font-mono); color: var(--nt-ink); }
.nt-trace-op-end { margin-left: auto; }
.nt-trace-fb { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nt-trace-fb textarea { flex: 1 1 320px; min-height: 54px; }

@media (max-width: 1000px) {
  .nt-trace-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nt-trace-tile:nth-child(n+4) { border-top: 1px solid var(--nt-line); }
  .nt-trace-spend, .nt-trace-detail { grid-template-columns: minmax(0, 1fr); }
  .nt-trace-chart { border-right: 0; border-bottom: 1px solid var(--nt-line); }
  .nt-trace-tree { border-right: 0; border-bottom: 1px solid var(--nt-line); }
  .nt-trace-kv { grid-template-columns: 1fr 1fr; }
  .nt-trace-cols { grid-template-columns: 1fr; }
  .nt-trace-cols .nt-trace-pre + .nt-trace-pre { border-left: 0; border-top: 1px solid var(--nt-line); }
}
@media (max-width: 560px) {
  .nt-trace-tiles { grid-template-columns: 1fr 1fr; }
  .nt-trace-tile { border-left: 0; border-top: 1px solid var(--nt-line); }
  .nt-trace-runs { max-height: 60vh; }
  .nt-trace-search { flex-basis: 100%; }
  .nt-trace-count { margin-left: 0; }
}

/* ---- Agents (mockup agents-inbox.html): the conversation list on the left,
   the chosen conversation on the right. On a phone the two stack: the list
   alone until a conversation is open (the frame holds .nt-agents-conv),
   then the conversation with a back arrow. ---- */
.nt-agents {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  background: var(--nt-shell);
  border: 1px solid var(--nt-line);
  border-radius: 14px;
  overflow: hidden;
  height: calc(100dvh - 12rem);
  min-height: 30rem;
}
.nt-agents-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--nt-line); }
.nt-agents-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--nt-shell); }

.nt-agents-picker { position: relative; margin: 12px; }
.nt-agents-pick {
  width: 100%; min-height: 44px; border: 1px solid var(--nt-edge); border-radius: 9px; background: var(--nt-shell);
  display: flex; align-items: center; gap: 8px; padding: 0 10px; font: 600 13.5px var(--nt-font-body); color: var(--nt-ink); cursor: pointer;
}
.nt-agents-pick small, .nt-agents-opt small { font: 600 11px var(--nt-font-mono); color: var(--nt-muted); }
.nt-agents-pick .nt-icon { margin-left: auto; color: var(--nt-muted); }
.nt-agents-pick:focus-visible, .nt-agents-opt:focus-visible, .nt-agents-row:focus-visible, .nt-agents-fchip:focus-visible {
  outline: 2px solid var(--nt-saffron-deep); outline-offset: 2px;
}
.nt-agents-menu {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 5; background: var(--nt-shell);
  border: 1px solid var(--nt-rule); border-radius: 10px; box-shadow: var(--nt-shadow); padding: 4px; display: flex; flex-direction: column;
}
.nt-agents-menu[hidden] { display: none; }
.nt-agents-opt {
  display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 0 9px; border-radius: 7px;
  font-size: 13px; color: var(--nt-ink); text-decoration: none;
}
.nt-agents-opt:hover { background: var(--nt-wash); color: var(--nt-ink); }
.nt-agents-opt.is-on { background: color-mix(in srgb, var(--nt-yolk) 12%, var(--nt-shell)); font-weight: 600; }
.nt-agents-opt-label { flex: 1; min-width: 0; }
.nt-agents-sep { height: 1px; background: var(--nt-line); margin: 4px 6px; }

.nt-agents-av {
  width: 32px; height: 32px; border-radius: 8px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  font: 700 12px var(--nt-font-display); color: var(--nt-shell); background: var(--nt-ink-2);
}
.nt-agents-av--sm { width: 22px; height: 22px; border-radius: 6px; font-size: 10px; }
.nt-agents-av--sheet { background: var(--nt-spruce); }
.nt-agents-av--community { background: var(--nt-saffron-deep); }
.nt-agents-av--customer { background: var(--nt-info); }
.nt-agents-av--operations { background: var(--nt-muted); }
.nt-agents-av--payments { background: var(--nt-ok); }
.nt-agents-av--chat { background: var(--nt-spruce-soft); }

.nt-agents-pill { font-size: 11px; font-weight: 600; border-radius: 10px; padding: 1px 7px; white-space: nowrap; background: var(--nt-wash); color: var(--nt-ink-2); }
.nt-agents-pill--warn { background: var(--nt-wash-warn); color: var(--nt-warn); }
.nt-agents-pill--ok { background: var(--nt-wash-ok); color: var(--nt-ok); }

.nt-agents-find {
  margin: 0 12px 8px; min-height: 40px; border: 1px solid var(--nt-edge); border-radius: 8px;
  display: flex; align-items: center; gap: 8px; padding: 0 10px; color: var(--nt-muted); background: var(--nt-shell);
}
.nt-agents-find:focus-within { outline: 2px solid var(--nt-saffron-deep); outline-offset: 1px; }
.nt-agents-find input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 13.5px; color: var(--nt-ink); outline: none; min-height: 38px; }

.nt-agents-filters { display: flex; gap: 6px; padding: 0 12px 10px; flex-wrap: wrap; }
.nt-agents-fchip {
  display: inline-flex; align-items: center; gap: 5px; min-height: 32px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--nt-rule); border-radius: 16px; padding: 0 11px; color: var(--nt-ink-2); text-decoration: none;
}
.nt-agents-fchip:hover { background: var(--nt-wash); color: var(--nt-ink); }
.nt-agents-fchip.is-on { background: var(--nt-spruce); border-color: var(--nt-spruce); color: var(--nt-shell); }
.nt-agents-fcount { font: 600 11px var(--nt-font-mono); }

.nt-agents-list { overflow-y: auto; flex: 1; min-height: 0; border-top: 1px solid var(--nt-line); }
.nt-agents-grp {
  margin: 0; padding: 8px 14px 4px; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--nt-muted); background: var(--nt-paper); position: sticky; top: 0; z-index: 1; font-family: var(--nt-font-body);
}
.nt-agents-row {
  display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; min-height: 56px; padding: 10px 14px;
  border-top: 1px solid var(--nt-line); align-items: start; color: var(--nt-ink); text-decoration: none;
}
.nt-agents-grp + .nt-agents-row { border-top: 0; }
.nt-agents-row:hover { background: var(--nt-wash); color: var(--nt-ink); }
.nt-agents-row.is-on { background: color-mix(in srgb, var(--nt-yolk) 12%, var(--nt-shell)); }
.nt-agents-row-text { display: flex; flex-direction: column; min-width: 0; }
.nt-agents-row-title { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nt-agents-row-preview { font-size: 12px; color: var(--nt-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nt-agents-row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font: 500 11px var(--nt-font-mono); color: var(--nt-muted); }
.nt-agents-dots { display: inline-flex; padding: 5px 8px; margin-top: 2px; }
.nt-agents-empty { margin: 0; padding: 14px; font-size: 13px; color: var(--nt-muted); }
.nt-agents-more { display: block; }

.nt-agents-blank { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--nt-muted); padding: 24px; text-align: center; }
.nt-agents-blank-title { margin: 0; font-weight: 600; color: var(--nt-ink); }
.nt-agents-blank-note { margin: 0; font-size: 13px; }

.nt-agents-conv { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.nt-agents-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--nt-line); flex-wrap: wrap; }
.nt-agents-head-text { min-width: 0; flex: 1; }
.nt-agents-head-title { margin: 0; font: 700 16px/1.25 var(--nt-font-display); color: var(--nt-ink); }
.nt-agents-head-sub { margin: 1px 0 0; font-size: 12px; color: var(--nt-muted); }
.nt-agents-head-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.nt-agents-head-acts .nt-agent-btn { display: inline-flex; align-items: center; text-decoration: none; }
.nt-agents-back { display: none; }

.nt-agents-pending {
  display: flex; gap: 10px; align-items: center; padding: 9px 16px; background: var(--nt-wash-yolk);
  border-bottom: 1px solid var(--nt-line); font-size: 12.5px; flex-wrap: wrap; color: var(--nt-ink);
}
.nt-agents-pending-sub { color: var(--nt-ink-2); }
.nt-agents-pending-act { margin-left: auto; }
.nt-agents-pending-act .nt-agent-btn { display: inline-flex; align-items: center; text-decoration: none; }
.nt-agents-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.nt-agents-chat .nt-agent-chat { flex: 1; }

.nt-agents-findings { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: var(--nt-paper); }
.nt-agents-finding { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; padding: 12px; background: var(--nt-shell); border: 1px solid var(--nt-line); border-radius: 10px; }
.nt-agents-shot { width: 96px; height: 128px; border-radius: 8px; overflow: hidden; background: var(--nt-wash); display: flex; align-items: center; justify-content: center; color: var(--nt-muted); }
.nt-agents-shot img { width: 100%; height: 100%; object-fit: cover; }
.nt-agents-finding-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.nt-agents-read { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; }
.nt-agents-read dt { font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--nt-muted); }
.nt-agents-read dd { margin: 0; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.nt-agents-mono { font-family: var(--nt-font-mono); font-size: 12px !important; }
.nt-agents-match { margin: 0; font-size: 13px; color: var(--nt-ink-2); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nt-agents-finding-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nt-agents-finding-acts .nt-agent-btn { min-height: 36px; display: inline-flex; align-items: center; text-decoration: none; }
.nt-agents-reject { display: inline; }
.nt-agents-run { font-size: 12px; margin-left: auto; }

@media (max-width: 767.98px) {
  .nt-agents { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - 12rem); }
  .nt-agents-side { border-right: 0; }
  .nt-agents-main { display: none; }
  .nt-agents:has(.nt-agents-conv) .nt-agents-side { display: none; }
  .nt-agents:has(.nt-agents-conv) .nt-agents-main { display: flex; }
  .nt-agents-back {
    display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-left: -10px;
    font-size: 18px; color: var(--nt-ink); text-decoration: none;
  }
  .nt-agents .nt-agent-btn { min-height: 44px; }
  .nt-agents-finding { grid-template-columns: 72px minmax(0, 1fr); }
  .nt-agents-shot { width: 72px; height: 96px; }
  .nt-agents-read { grid-template-columns: 1fr 1fr; }
}

/* ---- Autopilot feed (AutopilotController) ------------------------------- */
.nt-autopilot { display: grid; gap: 1.25rem; max-width: 72rem; }
.nt-ap-state { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .75rem 1rem; border: 1px solid var(--bs-border-color); border-radius: .5rem; background: var(--bs-body-bg); }
.nt-ap-state.is-paused { border-color: var(--bs-warning); background: var(--bs-warning-bg-subtle); }
.nt-ap-state-main { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.nt-ap-reason { color: var(--bs-warning-text-emphasis); }
.nt-ap-meta, .nt-ap-item-meta, .nt-ap-note { color: var(--bs-secondary-color); font-size: .85rem; }
.nt-ap-summary { margin: 0; font-weight: 500; }
.nt-ap-h2 { font-size: 1rem; font-weight: 600; margin: 0 0 .5rem; }
.nt-ap-switch-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.nt-ap-switch-list form { margin: 0; }
.nt-ap-switch { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--bs-border-color);
  border-radius: 999px; padding: .2rem .7rem; background: var(--bs-body-bg); font-size: .85rem; }
.nt-ap-switch .nt-ap-dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--bs-secondary-color); }
.nt-ap-switch.is-on .nt-ap-dot { background: var(--bs-success); }
.nt-ap-switch.is-off { opacity: .7; text-decoration: line-through; }
.nt-ap-table { font-size: .85rem; }
.nt-ap-actions-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .5rem; }
.nt-ap-filters { display: flex; gap: .5rem; flex-wrap: wrap; }
.nt-ap-filter { font-size: .85rem; text-decoration: none; padding: .1rem .5rem; border-radius: .35rem; }
.nt-ap-filter.is-on { background: var(--bs-secondary-bg); font-weight: 600; }
.nt-ap-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.nt-ap-item { display: grid; grid-template-columns: 1fr auto; gap: .25rem .75rem; padding: .6rem .75rem;
  border: 1px solid var(--bs-border-color); border-radius: .5rem; }
.nt-ap-item.is-review { border-color: var(--bs-warning); }
.nt-ap-item.is-undone { opacity: .6; }
.nt-ap-item-main { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; min-width: 0; }
.nt-ap-item-meta { grid-column: 1; overflow-wrap: anywhere; }
.nt-ap-undo { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.nt-ap-chip { font-size: .75rem; font-weight: 600; padding: .05rem .45rem; border-radius: .35rem; background: var(--bs-secondary-bg); white-space: nowrap; }
.nt-ap-item.is-review .nt-ap-chip { background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); }
.nt-ap-summary-text { overflow-wrap: anywhere; }
.nt-agents-autopilot { font-size: .85rem; text-decoration: none; }
