/* OptionIQT demo terminal. System fonts only, no external assets. */
:root {
  --bg: #0a1020; --navy: #080e19; --card: #101a2a; --card-2: #16233a; --line: #24344e;
  --text: #e6edf6; --muted: #9fb0c5; --mint: #2ee7a3; --amber: #ffc770; --danger: #ff7187;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --side: 236px;
}
* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--sans); overflow-x: hidden; }
a { color: var(--mint); }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 3px; }
main:focus { outline: none; }

.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--side); flex: none; background: var(--navy); border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; color: var(--text); text-decoration: none; }
.brand-mark { width: 34px; height: 34px; flex: none; display: grid; grid-auto-flow: column; place-content: center; border: 1px solid var(--mint); border-radius: 8px; color: var(--mint); font-weight: 700; }
.brand-mark span { font-size: 9px; align-self: start; }
.brand-copy { font-weight: 700; font-size: 16px; line-height: 1.15; }
.brand-copy > span { color: var(--mint); }
.brand-copy small { display: block; font-size: 9px; font-weight: 500; letter-spacing: .1em; color: var(--muted); margin-top: 2px; }
.sidebar-label { font-size: 10px; letter-spacing: .12em; color: var(--muted); padding: 6px 8px; }
.section-gap { margin-top: 12px; }
.nav-link { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 6px; color: var(--text); text-decoration: none; border: 1px solid transparent; }
.nav-link:hover { background: var(--card); }
.nav-link.active { background: var(--card-2); border-color: var(--line); color: var(--mint); }
.nav-icon { width: 16px; text-align: center; color: var(--muted); }
.nav-link.active .nav-icon { color: var(--mint); }
.nav-short { margin-left: auto; font: 10px var(--mono); color: var(--muted); }
.side-bottom { margin-top: auto; padding: 12px 8px 2px; font-size: 12px; display: grid; grid-template-columns: auto 1fr; column-gap: 7px; align-items: center; }
.side-bottom small { grid-column: 2; font-size: 10px; color: var(--amber); letter-spacing: .06em; }
.tiny-pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); animation: pulse 2.4s ease-in-out infinite; display: inline-block; flex: none; }
@keyframes pulse { 50% { opacity: .35; } }

.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--navy); position: sticky; top: 0; z-index: 20; }
.menu-btn { display: none; }
.icon-btn { width: 34px; height: 34px; flex: none; background: var(--card); border: 1px solid var(--line); border-radius: 6px; color: var(--text); cursor: pointer; font-size: 15px; }
.icon-btn:hover { border-color: var(--mint); }
.breadcrumb { flex: 1; min-width: 0; display: flex; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.breadcrumb strong { color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.mode-pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--amber); color: var(--amber); border-radius: 999px; padding: 3px 9px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.date-txt { font: 12px var(--mono); color: var(--muted); white-space: nowrap; }
.avatar { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--card-2); border: 1px solid var(--line); font-size: 11px; font-weight: 600; flex: none; }
main { flex: 1; padding: 16px; min-width: 0; }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }

.view { display: grid; gap: 12px; }
.view-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 8px 16px; }
h1 { font-size: 20px; }
.view-sub { color: var(--muted); }
.badges { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.badges li { font: 10px var(--mono); padding: 2px 6px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); }
.sim-label { border: 1px solid var(--amber); border-left-width: 4px; border-radius: 4px; color: var(--amber); padding: 5px 10px; font-size: 12px; font-weight: 600; }

.tiles { display: grid; gap: 10px; }
.tiles-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-width: 0; }
.tile-label { font-size: 11px; color: var(--muted); }
.tile-value { font: 600 18px var(--mono); margin-top: 2px; overflow-wrap: anywhere; }
.tile-note { font-size: 11px; color: var(--muted); margin-top: 2px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px; min-width: 0; display: grid; gap: 10px; align-content: start; }
.panel h2 { font-size: 13px; font-weight: 600; }
.panel h3 { font-size: 12px; margin-bottom: 2px; }
.panel .tile { background: var(--card-2); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.note { color: var(--muted); font-size: 12px; }
.note strong { color: var(--text); }
.form-error { color: var(--danger); font-weight: 600; }

.tag { display: inline-block; font: 600 10px var(--mono); padding: 1px 5px; border-radius: 3px; border: 1px solid currentColor; white-space: normal; overflow-wrap: anywhere; }
.tag-good { color: var(--mint); } .tag-warn { color: var(--amber); } .tag-bad { color: var(--danger); } .tag-neutral { color: var(--muted); }

table.data { width: 100%; border-collapse: collapse; font-size: 12px; }
table.data th, table.data td { text-align: left; padding: 5px 7px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { color: var(--muted); font-weight: 500; font-size: 11px; }
table.data .num { text-align: right; font-family: var(--mono); }
table.data td.empty { text-align: center; color: var(--muted); padding: 16px; }
.sort { all: unset; cursor: pointer; }
.sort:hover { color: var(--text); }
.sort:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 3px; }
.tk { font: 600 12px var(--mono); }
.score { font-family: var(--mono); }
.meter { display: block; width: 100%; min-width: 44px; height: 4px; margin-top: 2px; }
.meter-track { fill: var(--line); } .meter-fill { fill: var(--mint); }
.tbl { display: grid; gap: 8px; min-width: 0; }
.tbl-tools, .pf-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.field { display: grid; gap: 2px; font-size: 11px; color: var(--muted); min-width: 0; flex: 1 1 130px; max-width: 240px; }
.field-wide { max-width: 360px; }
input[type="search"], input[type="number"], select { width: 100%; min-width: 0; background: var(--navy); color: var(--text); border: 1px solid var(--line); border-radius: 5px; padding: 6px 8px; font: 13px var(--sans); min-height: 32px; }
.pager { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 11px; color: var(--muted); }
.pager span { margin-right: auto; }
.btn { background: var(--card-2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 7px 12px; font: 600 13px var(--sans); cursor: pointer; justify-self: start; }
.btn:hover:not(:disabled) { border-color: var(--mint); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--mint); color: #05231a; border-color: var(--mint); }
.btn-small { padding: 3px 9px; font-size: 11px; }
.ticket { display: grid; gap: 8px; }
.ticket .field { max-width: none; }

.funnel, .rubric, .feed, .heat, .steps { list-style: none; margin: 0; padding: 0; }
.funnel, .rubric { display: grid; gap: 7px; }
.funnel li { display: grid; grid-template-columns: 150px minmax(0, 1fr) 22px; gap: 8px; align-items: center; }
.funnel li > .score { text-align: right; }
.rubric li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 26px; gap: 8px; align-items: center; font-size: 12px; }
.rubric small { color: var(--muted); }
.feed { display: grid; gap: 6px; font-size: 12px; }
.feed li { border-bottom: 1px solid var(--line); padding-bottom: 5px; overflow-wrap: anywhere; }
.feed-time { font-family: var(--mono); color: var(--muted); }
.heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.cell { display: grid; padding: 7px 8px; border-radius: 5px; border: 1px solid var(--line); font-size: 11px; min-width: 0; overflow-wrap: anywhere; }
.cell strong { font: 600 14px var(--mono); }
.cell small { font-size: 10px; color: var(--muted); }
.cell-up { background: rgba(46, 231, 163, .12); } .cell-down { background: rgba(255, 113, 135, .12); }
.steps { display: flex; flex-wrap: wrap; gap: 5px; counter-reset: step; }
.steps li { counter-increment: step; font-size: 11px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--card-2); }
.steps li::before { content: counter(step) ". "; color: var(--mint); font-family: var(--mono); }
.spark { display: block; width: 100%; height: 110px; }
.spark polyline { fill: none; stroke: var(--mint); stroke-width: 2; vector-effect: non-scaling-stroke; }
.payoff { display: block; width: 100%; height: auto; background: var(--navy); border: 1px solid var(--line); border-radius: 6px; }
.payoff .pl { fill: none; stroke: var(--mint); stroke-width: 2.5; }
.payoff .zero { stroke: var(--muted); stroke-width: 1; }
.payoff .be { stroke: var(--amber); stroke-width: 1.5; stroke-dasharray: 6 4; }
.payoff .spot { stroke: var(--text); stroke-width: 1; stroke-dasharray: 2 4; }
.payoff .ax { fill: var(--muted); font: 12px var(--mono); }
.chart-key { font-size: 11px; color: var(--muted); }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.checks { display: grid; gap: 8px; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--mint); }

.toast { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); max-width: calc(100vw - 24px); background: var(--card-2); border: 1px solid var(--mint); border-radius: 6px; padding: 8px 14px; font-size: 13px; visibility: hidden; opacity: 0; transition: opacity .2s; z-index: 60; }
.toast.show { visibility: visible; opacity: 1; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(4, 8, 16, .75); display: grid; place-items: center; padding: 14px; z-index: 50; }
.modal-backdrop.hidden { display: none; }
.modal-card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; max-width: 480px; width: 100%; max-height: calc(100vh - 28px); overflow-y: auto; display: grid; gap: 10px; }
.modal-card h2 { font-size: 16px; padding-right: 30px; }
.modal-close { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; background: none; border: 1px solid var(--line); border-radius: 5px; color: var(--text); font-size: 16px; cursor: pointer; }
.nav-scrim { display: none; }

@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .date-txt { display: none; }
}
@media (max-width: 860px) {
  .menu-btn { display: block; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; height: auto; width: min(260px, 82vw); transform: translateX(-100%); visibility: hidden; transition: transform .18s ease, visibility .18s; z-index: 40; }
  .sidebar.open { transform: none; visibility: visible; }
  .nav-scrim.show { display: block; position: fixed; inset: 0; background: rgba(4, 8, 16, .6); z-index: 35; }
  .nav-link { padding: 10px 8px; }
  main { padding: 12px; }
}
/* Phones: wide tables become labelled cards, so the page never scrolls sideways. */
@media (max-width: 640px) {
  .tiles-3 { grid-template-columns: minmax(0, 1fr); }
  .breadcrumb > span { display: none; }
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data thead { display: block; }
  table.data thead tr { display: flex; flex-wrap: wrap; gap: 3px 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
  table.data th { border: 0; padding: 2px 0; }
  table.data tbody tr { padding: 7px 0; border-bottom: 1px solid var(--line); }
  table.data td, table.data td.num { display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr); gap: 8px; align-items: center; text-align: left; border: 0; padding: 2px 0; overflow-wrap: anywhere; }
  table.data td::before { content: attr(data-label); color: var(--muted); font: 11px var(--sans); }
  table.data td.empty { display: block; text-align: center; }
  table.data td.empty::before { content: none; }
  .field { flex: 1 1 100%; max-width: none; }
  .funnel li { grid-template-columns: minmax(0, 132px) minmax(0, 1fr) 20px; }
  .rubric li { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 24px; }
  .footer { font-size: 10px; }
}
@media (max-width: 400px) {
  .avatar { display: none; }
  .topbar { padding: 8px 10px; gap: 7px; }
  .top-actions { gap: 6px; }
  .mode-pill { font-size: 10px; padding: 3px 7px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
