/* Independent Rate Authority Terminal Theme — Pricing Beacon (Origin 2)
   Cool archival stone + deep pine ink + crisp tabular market data. */

:root {
  --canvas: #f3f5f3;
  --surface: #ffffff;
  --surface-tint: #f8faf8;
  --ink: #12211e;
  --ink-2: #4b5e59;
  --ink-3: #738681;
  --line: #d6dedb;
  --line-strong: #b7c5bf;
  --pine: #114b43;
  --pine-hover: #0b3630;
  --pine-soft: #e7f2ef;
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  --sans: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --radius: 6px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.48;
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Slim Architectural Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 54px;
  flex-wrap: wrap;
  padding-top: 6px;
  padding-bottom: 6px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--pine);
  color: #ffffff;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  border-radius: 4px;
}

.brand-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.brand-sub {
  margin: 0;
  font-size: 12px;
  color: var(--ink-2);
}

.status-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface-tint);
  border: 1px solid var(--line);
  padding: 3px 8px;
  border-radius: 4px;
}

.chip-live {
  background: var(--pine-soft);
  border-color: #b4d8cf;
  color: var(--pine);
}

.chip-mono {
  font-family: var(--mono);
  font-size: 11px;
}

.chip-mono code {
  display: inline-block;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

.nav-ext {
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--pine);
  padding: 4px 8px;
  border-radius: 4px;
}

.nav-ext:hover { background: var(--pine-soft); }

/* Main Vertical Rhythm */
.main-flow {
  padding-top: 18px;
  padding-bottom: 36px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.secondary-block {
  background: var(--surface-tint);
}

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.block h2 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.block h3 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-2);
}

.meta-note, .muted {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-2);
}

.meta-note a { color: var(--pine); font-weight: 600; }

/* Horizontal Live Search Bar */
.search-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px auto auto;
  gap: 8px;
  margin-bottom: 12px;
}

.search-bar input, .quote-grid input {
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 13px;
  background: #ffffff;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.search-bar input:focus, .quote-grid input:focus {
  outline: none;
  border-color: var(--pine);
}

.btn {
  padding: 7px 13px;
  border-radius: 4px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-solid { background: var(--pine); color: #ffffff; border-color: var(--pine); }
.btn-solid:hover { background: var(--pine-hover); }

.btn-line { background: #ffffff; color: var(--ink); border-color: var(--line-strong); }
.btn-line:hover { background: var(--canvas); border-color: var(--pine); }

/* Segmented Filter */
.seg-group {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: var(--canvas);
}

.filter-btn {
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.filter-btn:last-child { border-right: 0; }
.filter-btn.active { background: var(--pine); color: #ffffff; }

/* Dense Rate Card Grid (4-up desktop) */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.rate-card {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface-tint);
}

.rate-card.selected {
  border-color: var(--pine);
  border-left: 3px solid var(--pine);
  background: #ffffff;
}

.rate-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.cat-pill {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--pine-soft);
  color: var(--pine);
}

.cat-pill.llm { background: #eef1f7; color: #2b3f6b; }

.rate-card h3 {
  margin: 0;
  font-size: 13.5px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
}

.rate-summary { margin: 0; font-size: 12px; color: var(--ink-2); }

.rate-metrics {
  font-size: 11.5px;
  font-family: var(--mono);
  background: #ffffff;
  border: 1px solid var(--line);
  padding: 7px 9px;
  border-radius: 4px;
  margin: 0;
  list-style: none;
}

.rate-metrics li + li { margin-top: 2px; }

.rate-footer {
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
}

.rate-footer a { color: var(--pine); font-weight: 600; text-decoration: none; }
.rate-footer a:hover { text-decoration: underline; }

.sha-short {
  font-family: var(--mono);
  color: var(--ink-3);
  font-size: 10.5px;
}

/* Tables (Live Models & Sandbox Quotes) */
.quote-results table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.quote-results th, .quote-results td {
  text-align: left;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
}

.quote-results th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  background: var(--surface-tint);
  font-weight: 600;
}

.price-cell {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--pine);
  white-space: nowrap;
}

/* Compact Sandbox Form */
.quote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.quote-grid label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
}

.quote-grid input { font-family: var(--mono); font-size: 12.5px; }

.quote-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 4px;
}

.receipt-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: 4px;
  background: var(--pine-soft);
  border: 1px solid #b4d8cf;
  font-size: 12.5px;
}

.receipt-box pre {
  margin: 8px 0 0;
  padding: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 11.5px;
}

/* Interop & Copy Snippet */
.interop-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 18px;
}

.clean-list {
  margin: 0;
  padding-left: 16px;
  font-size: 12.5px;
}

.clean-list li + li { margin-top: 4px; }
.clean-list a { color: var(--pine); font-weight: 600; }

.snippet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.snippet-head h3 { margin: 0; }

.copy-bar {
  display: flex;
  gap: 6px;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 11.5px;
}

.code-snippet {
  margin: 0 0 8px;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--pine);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11.5px;
  overflow-x: auto;
}

/* Assistant Section */
.status-line { margin: 0 0 10px; font-size: 12.5px; color: var(--ink-2); }
.assistant-note { margin: 10px 0 0; font-size: 12px; color: var(--ink-3); }

#agent-app {
  --ns-font: var(--sans);
  --ns-bg: #ffffff;
  --ns-fg: var(--ink);
  --ns-primary: #114b43;
  --ns-accent: #114b43;
  --ns-border: var(--line);
  --ns-panelbg: #ffffff;
  --ns-msgbg: var(--canvas);
  --ns-muted: var(--ink-2);
}

.assistant-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 14px;
  margin-top: 10px;
}

#agent-app.ns-composed-app [data-ns-slot="chat"] { height: 520px; }
#agent-app .ns-chat { background: var(--ns-bg); }
#agent-app input[type="checkbox"],
#agent-app input[type="radio"] { width: auto; }
#agent-app .ns-header { flex-wrap: wrap; }
#agent-app .ns-settings-body label { margin: 4px 0; font-weight: 400; color: var(--ink); }
#agent-app .ns-w-label { font-family: inherit; }
#agent-app .ns-widget label { margin: 0; }
#agent-app .ns-w-radio label,
#agent-app .ns-w-multi label,
#agent-app .ns-w-toggle { font-weight: 400; }
#agent-app .ns-w-toggle { font-size: 13px; }
#agent-app button { margin: 0; }
#agent-app .ns-w-choice { color: var(--ns-fg); }
#agent-app .ns-devtoggle:not(.on):hover,
#agent-app .ns-modal-close:hover { background: transparent; }
#agent-app .ns-w-choice:disabled:hover { background: #fafbfc; }
#agent-app .ns-consent { background: #fef8ec; }
#agent-app .ns-msgs:has(.ns-consent-actions) > .ns-turn-status { display: none; }
#agent-app .ns-msg { overflow-wrap: break-word; }
#agent-app .ns-consent-actions { flex-wrap: wrap; }
#agent-app .ns-consent-actions button { white-space: nowrap; }

body > dialog h2 { margin: 0 0 10px; font: 700 1.15em var(--sans); }
body > dialog button { margin-right: 8px; }
.assistant-review { max-width: 600px; width: 88%; max-height: 85vh; overflow: auto; border: 1px solid var(--ink); border-radius: 6px; padding: 20px 22px; font: 14px var(--sans); }
.assistant-review dl { display: grid; grid-template-columns: fit-content(40%) 1fr; gap: 5px 16px; margin: 12px 0; }
.assistant-review dt { font-weight: 600; color: var(--ink-2); }
.assistant-review dd { margin: 0; overflow-wrap: anywhere; }
.assistant-review details { margin: 10px 0; }
.assistant-review pre { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: 12px; }
.assistant-review .assistant-decline { background: transparent; color: inherit; border: 1px solid var(--line-strong); }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 14px 0 24px;
  color: var(--ink-3);
  font-size: 12px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
}

.site-footer a { color: var(--pine); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

@media (max-width: 820px) {
  .search-bar { grid-template-columns: 1fr; }
  .interop-grid { grid-template-columns: 1fr; }
  .assistant-panels { grid-template-columns: 1fr; }
  .assistant-review dl { grid-template-columns: 1fr; gap: 0; }
  .assistant-review dd { margin-bottom: 8px; }
}
