/* Frontier 10k — control panel. Hand-built, no framework. Dark, dense, calm. */

:root {
  --bg: #08090b;
  --bg-elevated: #0e0f12;
  --surface: #131418;
  --surface-2: #191a1f;
  --surface-hover: #1e1f25;
  --border: #232429;
  --border-soft: #1a1b20;
  --text: #eef0f3;
  --text-muted: #9799a6;
  --text-faint: #5b5d68;
  --accent: #6e79f2;
  --accent-2: #8b93f6;
  --accent-soft: rgba(110, 121, 242, 0.14);
  --accent-soft-border: rgba(110, 121, 242, 0.32);
  --green: #4fc38a;
  --green-soft: rgba(79, 195, 138, 0.14);
  --amber: #e3a94a;
  --amber-soft: rgba(227, 169, 74, 0.14);
  --red: #ec6a6a;
  --red-soft: rgba(236, 106, 106, 0.14);
  --blue: #5b9dfa;
  --blue-soft: rgba(91, 157, 250, 0.14);
  --purple: #b389f2;
  --purple-soft: rgba(179, 137, 242, 0.14);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 1px 0 rgba(0, 0, 0, 0.4), 0 8px 24px -12px rgba(0, 0, 0, 0.55);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "SF Pro Text", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", "Cascadia Code", "Consolas", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p { margin: 0; }
button { font-family: inherit; }
.hidden { display: none !important; }
code { font-family: var(--mono); }
::selection { background: var(--accent-soft); color: var(--text); }

/* scrollbar, quiet */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--surface-hover); }

/* ---------- gate / denial screen ---------- */
.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(60vw 40vh at 20% -10%, rgba(110, 121, 242, 0.08), transparent 60%),
    var(--bg);
}
.gate-card {
  width: 100%;
  max-width: 380px;
  text-align: center;
  padding: 40px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.gate-mark {
  width: 40px; height: 40px;
  margin: 0 auto 20px;
  border-radius: 11px;
  background: linear-gradient(160deg, var(--accent-2), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.92);
}
.gate-mark-icon { width: 18px; height: 18px; }
.gate-card h1 { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.gate-text { color: var(--text-muted); font-size: 13px; line-height: 1.6; }
.gate.is-denied .gate-mark { background: linear-gradient(160deg, #ff8b8b, var(--red)); }
.gate.is-denied .gate-card h1 { color: var(--text); }

/* ---------- app shell ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(8, 9, 11, 0.86);
  backdrop-filter: blur(10px) saturate(140%);
  border-bottom: 1px solid var(--border-soft);
}
.topbar-row {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
}
.topbar-brand-row { padding-top: 18px; padding-bottom: 14px; justify-content: space-between; }

.brand { display: flex; align-items: baseline; gap: 9px; }
.brand-mark {
  width: 9px; height: 9px; border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  align-self: center;
}
.brand-name { font-size: 14px; font-weight: 650; letter-spacing: -0.01em; }
.brand-sub { font-size: 12px; color: var(--text-faint); }

.topbar-meta { display: flex; align-items: center; gap: 14px; }
.meta-item { font-size: 11.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 5px 11px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.btn-ghost:hover { border-color: var(--accent-soft-border); color: var(--text); background: var(--surface-2); }

.metrics-row {
  padding-bottom: 18px;
  gap: 28px;
  align-items: stretch;
}
.metric { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.metric-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-faint);
  font-weight: 600;
  white-space: nowrap;
}
.metric-value {
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.metric-value-sm { font-size: 17px; }
.metric-sub { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.metric-sub-line { font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }

.metric-trajectory { flex: 1 1 260px; max-width: 360px; justify-content: center; }
.metric-trajectory-head { display: flex; justify-content: space-between; align-items: baseline; }
.trajectory-bar {
  height: 7px;
  border-radius: 5px;
  background: var(--surface-2);
  overflow: hidden;
  border: 1px solid var(--border-soft);
}
.trajectory-fill {
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .5s ease;
}

.metric-pulse { justify-content: center; }
.pulse-row { display: flex; align-items: center; gap: 7px; }
.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}
.pulse-dot.is-warm { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }
.pulse-dot.is-hot { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

.tabs {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 560;
  padding: 9px 13px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .15s, background .15s;
  display: flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--text); background: var(--surface); }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }
.tab-badge {
  background: var(--accent-soft);
  color: var(--accent-2);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  line-height: 1.5;
}

.content { flex: 1; max-width: 1280px; width: 100%; margin: 0 auto; padding: 28px 28px 60px; }
.panel { display: none; animation: fade .18s ease; }
.panel.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
.panel-head { margin-bottom: 22px; }
.panel-head h2 { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; margin-bottom: 4px; }
.panel-sub { color: var(--text-muted); font-size: 12.5px; }
.subhead { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); font-weight: 650; margin: 30px 0 12px; }

.footer {
  border-top: 1px solid var(--border-soft);
  padding: 16px 28px;
  display: flex;
  justify-content: space-between;
  color: var(--text-faint);
  font-size: 11px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

/* ---------- generic card / badge ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 2.5px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-live { background: var(--green-soft); color: var(--green); }
.badge-building { background: var(--amber-soft); color: var(--amber); }
.badge-validating { background: var(--blue-soft); color: var(--blue); }
.badge-scaling { background: var(--purple-soft); color: var(--purple); }
.badge-killed { background: var(--red-soft); color: var(--red); }
.badge-life_support { background: rgba(227, 169, 74, 0.1); color: #b98847; }
.badge-neutral { background: var(--surface-2); color: var(--text-muted); }
.badge-pass { background: var(--green-soft); color: var(--green); }
.badge-pending { background: var(--surface-2); color: var(--text-faint); }

.empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 34px 20px;
  text-align: center;
  color: var(--text-faint);
  background: var(--bg-elevated);
}
.empty-title { color: var(--text-muted); font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.empty-sub { font-size: 12px; }

/* ---------- org ---------- */
.roster-wrap { display: flex; flex-direction: column; gap: 12px; }
.roster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}
.roster-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 15px;
  transition: border-color .15s;
}
.roster-card:hover { border-color: var(--accent-soft-border); }
.roster-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 9px; }
.roster-name { font-size: 13px; font-weight: 620; }
.roster-dept { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 650; }
.roster-action { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin-bottom: 8px; min-height: 18px; }
.roster-time { font-size: 10.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }

.roster-idle-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); font-weight: 650; margin: 2px 0 2px; }
.roster-idle-list { border: 1px solid var(--border-soft); border-radius: var(--radius); overflow: hidden; background: var(--bg-elevated); }
.roster-idle-row { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--border-soft); font-size: 11.5px; }
.roster-idle-row:last-child { border-bottom: none; }
.roster-idle-name { color: var(--text-muted); font-weight: 600; min-width: 110px; }
.roster-idle-dept { color: var(--text-faint); text-transform: uppercase; letter-spacing: .05em; font-size: 10px; font-weight: 650; min-width: 90px; }
.roster-idle-status { color: var(--text-faint); margin-left: auto; }

.activity-groups { display: flex; flex-direction: column; gap: 14px; }
.activity-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.activity-group-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 15px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-soft);
  font-size: 12px; font-weight: 650;
}
.activity-group-count { color: var(--text-faint); font-weight: 500; }
.activity-item { display: flex; gap: 12px; padding: 10px 15px; border-bottom: 1px solid var(--border-soft); }
.activity-item:last-child { border-bottom: none; }
.activity-time { flex: 0 0 68px; color: var(--text-faint); font-size: 11px; font-variant-numeric: tabular-nums; padding-top: 1px; }
.activity-body { flex: 1; min-width: 0; }
.activity-action { font-size: 12.5px; font-weight: 560; color: var(--text); }
.activity-asset { color: var(--accent-2); font-weight: 600; }
.activity-detail { font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.5; word-break: break-word; }
.activity-detail.is-clamped { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.activity-more {
  background: transparent; border: none; padding: 0; margin-top: 4px;
  font: inherit; font-size: 11.5px; font-weight: 650; color: var(--accent-2);
  cursor: pointer;
}
.activity-more:hover { text-decoration: underline; }

/* ---------- portfolio board ---------- */
.board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.board-col { flex: 0 0 288px; display: flex; flex-direction: column; gap: 10px; }
.board-col-head { display: flex; align-items: center; gap: 8px; padding: 2px 2px 4px; }
.board-col-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.board-col-count { font-size: 11px; color: var(--text-faint); background: var(--surface-2); border-radius: 999px; padding: 1px 7px; }

.asset-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 15px; box-shadow: var(--shadow-card); }
.asset-card.is-killed { opacity: .68; }
.asset-name { font-size: 13.5px; font-weight: 650; margin-bottom: 1px; }
.asset-slug { font-size: 10.5px; color: var(--text-faint); font-family: var(--mono); margin-bottom: 10px; }
.asset-row { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 9px; }
.asset-meta { font-size: 11.5px; color: var(--text-muted); display: flex; gap: 6px; margin-bottom: 5px; line-height: 1.5; }
.asset-meta b { color: var(--text-faint); font-weight: 600; min-width: 68px; flex-shrink: 0; }
.asset-kill { font-size: 11px; color: var(--text-faint); background: var(--bg-elevated); border-radius: var(--radius-sm); padding: 8px 9px; margin-top: 9px; line-height: 1.5; border: 1px solid var(--border-soft); }
.asset-links { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 8px; }
.asset-links a { color: var(--accent-2); font-size: 11.5px; text-decoration: none; }
.asset-links a:hover { text-decoration: underline; }

/* ---------- P&L ---------- */
.pnl-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 22px; }
.pnl-total-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.pnl-total-ccy { font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; margin-bottom: 10px; }
.pnl-total-line { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); padding: 3px 0; }
.pnl-total-line b { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 620; }
.pnl-total-line.is-net { border-top: 1px solid var(--border-soft); margin-top: 4px; padding-top: 7px; }
.pnl-total-line.is-net b.pos { color: var(--green); }
.pnl-total-line.is-net b.neg { color: var(--red); }

.pnl-strip { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.pnl-row { display: grid; grid-template-columns: 1.4fr .7fr 1fr 1fr 1fr; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--border-soft); align-items: center; }
.pnl-row:last-child { border-bottom: none; }
.pnl-row.is-head { background: var(--surface-2); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 700; }
.pnl-asset { font-size: 12.5px; font-weight: 600; }
.pnl-ccy { font-size: 11.5px; color: var(--text-muted); font-family: var(--mono); }
.pnl-num { font-variant-numeric: tabular-nums; font-size: 12.5px; text-align: right; }
.pnl-num.pos { color: var(--green); }
.pnl-num.neg { color: var(--red); }

/* ---------- decisions ---------- */
.decisions-list { display: flex; flex-direction: column; gap: 12px; }
.decision-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.decision-card.is-reserved { border-color: var(--accent-soft-border); background: linear-gradient(180deg, var(--accent-soft), transparent 40%), var(--surface); }
.decision-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.decision-question { font-size: 13.5px; font-weight: 620; line-height: 1.5; }
.decision-context { font-size: 12px; color: var(--text-muted); line-height: 1.6; margin-bottom: 10px; }
.decision-options { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.decision-option { font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 4px 9px; color: var(--text-muted); }
.decision-meta { font-size: 11px; color: var(--text-faint); margin-bottom: 10px; }
.decision-answer-note { border-top: 1px solid var(--border-soft); padding-top: 11px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.decision-answer-text { font-size: 11.5px; color: var(--text-faint); }
.decision-mailto { font-size: 12px; color: var(--accent-2); text-decoration: none; font-weight: 600; white-space: nowrap; }
.decision-mailto:hover { text-decoration: underline; }

/* ---------- reports ---------- */
.reports-list { display: flex; flex-direction: column; gap: 8px; }
.report-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.report-item-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 17px; cursor: pointer; user-select: none; }
.report-item-head:hover { background: var(--surface-2); }
.report-item-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.report-title { font-size: 13px; font-weight: 620; }
.report-period { font-size: 11.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.report-chevron { color: var(--text-faint); transition: transform .15s; flex-shrink: 0; }
.report-item.is-open .report-chevron { transform: rotate(90deg); }
.report-body { display: none; border-top: 1px solid var(--border-soft); padding: 18px 22px 22px; background: var(--bg-elevated); }
.report-item.is-open .report-body { display: block; }
.report-md { font-size: 13px; line-height: 1.7; color: var(--text-muted); max-width: 720px; }
.report-md h1, .report-md h2, .report-md h3 { color: var(--text); font-weight: 650; margin: 18px 0 8px; letter-spacing: -0.005em; }
.report-md h1 { font-size: 16px; }
.report-md h2 { font-size: 14.5px; }
.report-md h3 { font-size: 13px; }
.report-md h1:first-child, .report-md h2:first-child, .report-md h3:first-child { margin-top: 0; }
.report-md p { margin: 0 0 12px; }
.report-md ul, .report-md ol { margin: 0 0 12px; padding-left: 20px; }
.report-md li { margin-bottom: 4px; }
.report-md strong { color: var(--text); font-weight: 650; }
.report-md code { background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 4px; padding: 1px 5px; font-size: 12px; color: var(--accent-2); }
.report-md a { color: var(--accent-2); }
.report-md hr { border: none; border-top: 1px solid var(--border-soft); margin: 16px 0; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .metrics-row { flex-wrap: wrap; gap: 16px 24px; }
  .metric-trajectory { flex-basis: 100%; max-width: none; order: 3; }
  .board { flex-direction: column; }
  .board-col { flex: 1 1 auto; }
  .pnl-row { grid-template-columns: 1.2fr .6fr 1fr 1fr 1fr; }
}

@media (max-width: 600px) {
  .topbar-row, .tabs, .content, .footer { padding-left: 16px; padding-right: 16px; }
  .topbar-brand-row { padding-top: 14px; padding-bottom: 10px; }
  .brand-sub { display: none; }
  .metrics-row { padding-bottom: 12px; gap: 14px 20px; }
  .metric { min-width: 42%; }
  .metric-value { font-size: 18px; }
  .content { padding-top: 20px; padding-bottom: 48px; }
  .panel-head h2 { font-size: 16px; }
  .roster-grid { grid-template-columns: 1fr; }
  .roster-idle-row { flex-wrap: wrap; gap: 4px 12px; }
  .roster-idle-status { margin-left: 0; flex-basis: 100%; }
  .pnl-row { grid-template-columns: 1fr; gap: 3px; padding: 12px 14px; }
  .pnl-row.is-head { display: none; }
  .pnl-num { text-align: left; }
  .pnl-num::before { content: attr(data-label); color: var(--text-faint); font-weight: 600; margin-right: 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; }
  .decision-head { flex-direction: column; }
  .footer { flex-direction: column; gap: 4px; }
  .activity-time { flex-basis: 56px; }
}
