/* ============================================================
   SOVEL PI Console — dark Mission Control language
   Tokens per SOVEL PI UI Design System (v1 docs) — technical,
   operational, owner-authority first. Sharp edges (0–2px radius).
   ============================================================ */
:root {
  --sovel-bg-0: #0d1117;
  --sovel-bg-1: #11161d;
  --sovel-bg-2: #171c23;
  --sovel-border-0: #242b35;
  --sovel-border-1: #303846;
  --sovel-text-0: #f7f9fc;
  --sovel-text-1: #b7c0cc;
  --sovel-text-2: #718096;
  --sovel-cyan: #55f3df;
  --sovel-orange: #ff9f55;
  --sovel-purple: #8d5cff;
  --sovel-green: #37f5a1;
  --sovel-red: #ff5f75;
  --sovel-yellow: #ffd166;
  --sovel-sidebar: 248px;
  --sovel-topbar: 58px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--sovel-bg-0); color: var(--sovel-text-0); }
body { font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; }
.mono { font-family: 'JetBrains Mono', SFMono-Regular, Consolas, monospace; }
a { color: var(--sovel-cyan); text-decoration: none; }

/* ---- layout ---- */
.layout { display: grid; grid-template-columns: var(--sovel-sidebar) 1fr; min-height: 100vh; }
.sidebar { background: var(--sovel-bg-1); border-right: 1px solid var(--sovel-border-0); padding: 18px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.main { background: var(--sovel-bg-0); min-width: 0; }
.topbar { height: var(--sovel-topbar); border-bottom: 1px solid var(--sovel-border-0); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; background: var(--sovel-bg-1); position: sticky; top: 0; z-index: 5; }
.page { padding: 24px; animation: slide-up .25s ease-out; }
@keyframes slide-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- brand + nav ---- */
.brand { display: flex; align-items: center; gap: 12px; font-size: 13px; letter-spacing: .16em; color: var(--sovel-orange); font-weight: 800; }
.brand-mark { width: 13px; height: 13px; background: var(--sovel-orange); transform: rotate(45deg); box-shadow: 0 0 12px rgba(255,159,85,.5); }
.brand-sub { color: var(--sovel-text-2); font-size: 9px; letter-spacing: .22em; margin-top: 6px; font-weight: 700; }
.nav-section { margin-top: 30px; }
.nav-label { color: var(--sovel-text-2); font-size: 10px; letter-spacing: .18em; font-weight: 800; margin-bottom: 10px; text-transform: uppercase; }
.nav-item { display: block; color: #8fa4bd; padding: 10px 10px; font-size: 13.5px; cursor: pointer; border-left: 2px solid transparent; transition: color .15s, background .15s; }
.nav-item:hover { color: var(--sovel-text-0); background: rgba(255,255,255,.02); }
.nav-item.active { color: var(--sovel-cyan); border-left-color: var(--sovel-cyan); background: rgba(85,243,223,.06); font-weight: 700; }
.sidebar-user { margin-top: 36px; padding-top: 14px; border-top: 1px solid var(--sovel-border-0); color: var(--sovel-text-1); font-size: 12.5px; display: flex; align-items: center; }

/* ---- cards / grid ---- */
.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
@media (max-width: 1100px) { .grid-4, .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 720px)  { .layout { grid-template-columns: 1fr; } .sidebar { position: static; height: auto; } .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }
.card { background: var(--sovel-bg-2); border: 1px solid var(--sovel-border-0); padding: 18px; border-radius: 2px; }
.card + .card, .grid + .card, .card + .grid { margin-top: 14px; }
.card-title { font-size: 11px; letter-spacing: .16em; color: var(--sovel-text-2); font-weight: 800; text-transform: uppercase; }
.metric { font-size: 28px; font-weight: 900; margin-top: 8px; font-family: 'JetBrains Mono', monospace; }
.metric.cyan { color: var(--sovel-cyan); } .metric.orange { color: var(--sovel-orange); }
.metric.green { color: var(--sovel-green); } .metric.red { color: var(--sovel-red); }
.subtle { color: var(--sovel-text-2); font-size: 12px; margin-top: 6px; line-height: 1.5; }
.page-title { font-size: 19px; font-weight: 800; margin: 0 0 4px; letter-spacing: .02em; }
.page-sub { color: var(--sovel-text-2); font-size: 12.5px; margin-bottom: 20px; }

/* ---- status ---- */
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--sovel-cyan); box-shadow: 0 0 10px var(--sovel-cyan); margin-right: 8px; animation: pulse 2s ease-in-out infinite; }
.status-dot.green { background: var(--sovel-green); box-shadow: 0 0 10px var(--sovel-green); }
.status-dot.red { background: var(--sovel-red); box-shadow: 0 0 10px var(--sovel-red); animation: none; }
.status-dot.yellow { background: var(--sovel-yellow); box-shadow: 0 0 10px var(--sovel-yellow); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }

/* ---- table ---- */
.table { width: 100%; border-collapse: collapse; margin-top: 14px; }
.table th { color: var(--sovel-text-2); text-align: left; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; border-bottom: 1px solid var(--sovel-border-0); padding: 10px; }
.table td { border-bottom: 1px solid var(--sovel-border-0); padding: 12px 10px; font-size: 13px; height: 44px; }
.table tr:hover td { background: rgba(255,255,255,.015); }

/* ---- badges / buttons ---- */
.badge { display: inline-flex; align-items: center; padding: 4px 8px; border: 1px solid var(--sovel-border-1); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; border-radius: 2px; font-weight: 700; }
.badge-cyan   { color: var(--sovel-cyan);   background: rgba(85,243,223,.08); border-color: rgba(85,243,223,.35); }
.badge-orange { color: var(--sovel-orange); background: rgba(255,159,85,.08); border-color: rgba(255,159,85,.35); }
.badge-green  { color: var(--sovel-green);  background: rgba(55,245,161,.08); border-color: rgba(55,245,161,.35); }
.badge-red    { color: var(--sovel-red);    background: rgba(255,95,117,.08); border-color: rgba(255,95,117,.35); }
.badge-purple { color: var(--sovel-purple); background: rgba(141,92,255,.08); border-color: rgba(141,92,255,.35); }
.badge-gray   { color: var(--sovel-text-2); }
.button { background: rgba(85,243,223,.08); color: var(--sovel-cyan); border: 1px solid rgba(85,243,223,.4); padding: 9px 14px; font-weight: 800; letter-spacing: .08em; font-size: 11px; text-transform: uppercase; cursor: pointer; border-radius: 2px; font-family: inherit; transition: background .15s; }
.button:hover { background: rgba(85,243,223,.16); }
.button.orange { color: var(--sovel-orange); border-color: rgba(255,159,85,.4); background: rgba(255,159,85,.08); }
.button.orange:hover { background: rgba(255,159,85,.16); }
.button.danger { color: var(--sovel-red); border-color: rgba(255,95,117,.4); background: rgba(255,95,117,.08); }
.button.ghost { color: var(--sovel-text-1); border-color: var(--sovel-border-1); background: transparent; }

/* ---- forms ---- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--sovel-text-2); font-weight: 800; margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; background: var(--sovel-bg-0); border: 1px solid var(--sovel-border-1); color: var(--sovel-text-0); padding: 10px 12px; font-size: 13px; border-radius: 2px; font-family: inherit; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--sovel-cyan); }

/* ---- recommendation / reason trail ---- */
.reason { border-left: 2px solid var(--sovel-orange); padding: 2px 0 2px 12px; color: var(--sovel-text-1); font-size: 13px; line-height: 1.55; margin: 8px 0; }
.approval-bar { display: flex; gap: 10px; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--sovel-border-0); }
.doctrine-note { color: var(--sovel-text-2); font-size: 11.5px; font-style: italic; }

/* ---- agent console ---- */
.agent-log { background: var(--sovel-bg-0); border: 1px solid var(--sovel-border-0); padding: 16px; height: 340px; overflow-y: auto; font-size: 13px; line-height: 1.6; }
.agent-msg-user { color: var(--sovel-cyan); margin: 8px 0 2px; }
.agent-msg-bot { color: var(--sovel-text-1); margin: 2px 0 10px; border-left: 2px solid var(--sovel-purple); padding-left: 10px; }
.agent-input-row { display: flex; gap: 10px; margin-top: 12px; }
.agent-input-row input { flex: 1; }

/* ---- usage meter ---- */
.meter { height: 6px; background: var(--sovel-border-0); margin-top: 10px; border-radius: 2px; overflow: hidden; }
.meter-fill { height: 100%; background: var(--sovel-cyan); transition: width .6s ease; }
.meter-fill.warn { background: var(--sovel-yellow); }
.meter-fill.danger { background: var(--sovel-red); }

/* ---- misc ---- */
.empty { color: var(--sovel-text-2); font-size: 13px; padding: 26px 0; text-align: center; }
.right { text-align: right; }
.spacer { flex: 1; }
.topbar-meta { display: flex; align-items: center; gap: 18px; color: var(--sovel-text-1); font-size: 12.5px; }
.kbd { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--sovel-text-2); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
