/* ============================================================
   CP//TERMINAL — private trading desk
   Deep marine slate · amber signal · teal/coral tape
   Space Grotesk (display) · IBM Plex Sans (body) · IBM Plex Mono (data)
   ============================================================ */

:root {
  --ink: #0D1522;
  --panel: #131E30;
  --panel-2: #182539;
  --line: #24334A;
  --text: #D7E0EC;
  --muted: #7C8CA3;
  --amber: #F2B33D;
  --amber-dim: rgba(242, 179, 61, 0.14);
  --teal: #34D3A6;
  --coral: #F26D6D;
  --bs-body-bg: var(--ink);
  --bs-body-color: var(--text);
  --bs-border-color: var(--line);
  --bs-body-font-family: "IBM Plex Sans", system-ui, sans-serif;
  --bs-link-color: var(--amber);
  --bs-link-hover-color: #ffd07a;
}

html, body { background: var(--ink); }
body { font-size: 0.925rem; }
.mono { font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; }
.up { color: var(--teal) !important; }
.down { color: var(--coral) !important; }
.cp-muted { color: var(--muted) !important; }

::selection { background: var(--amber); color: var(--ink); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ---------- shell ---------- */
.cp-shell { display: flex; min-height: 100vh; }
.cp-rail {
  width: 228px; flex: 0 0 228px; position: sticky; top: 0; height: 100vh;
  background: linear-gradient(180deg, #101A2B 0%, #0D1522 100%);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 22px 16px;
}
.cp-brand {
  font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.15rem;
  letter-spacing: 0.04em; color: var(--text); text-decoration: none;
}
.cp-brand span { color: var(--amber); }
.cp-brand-sub { color: var(--muted); font-size: 0.7rem; margin: 2px 0 26px; letter-spacing: 0.06em; }
.cp-nav { display: flex; flex-direction: column; gap: 4px; }
.cp-nav-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-weight: 500; font-size: 0.9rem;
  border: 1px solid transparent; transition: color .15s, background .15s;
}
.cp-nav-link i { font-size: 1rem; }
.cp-nav-link:hover { color: var(--text); background: var(--panel); }
.cp-nav-link.active { color: var(--amber); background: var(--amber-dim); border-color: rgba(242,179,61,.25); }
.cp-rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.cp-worker { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; color: var(--muted); }
.cp-worker .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); }
.cp-worker.on .dot { background: var(--teal); animation: pulse 2s infinite; }
.cp-user { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--muted); }
.cp-user a { color: var(--muted); margin-left: auto; }
.cp-user a:hover { color: var(--coral); }

.cp-main { flex: 1; min-width: 0; }
.cp-topbar {
  position: sticky; top: 0; z-index: 100; display: flex; align-items: center; gap: 14px;
  padding: 12px 24px; background: rgba(13, 21, 34, 0.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.cp-page-title { font-family: "Space Grotesk", sans-serif; font-size: 1.05rem; font-weight: 700; margin: 0; letter-spacing: .02em; }
.cp-top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.cp-equity-readout { color: var(--muted); font-size: 0.85rem; }
.cp-equity-readout .mono { color: var(--text); }
.cp-menu-btn { display: none; color: var(--text); border: 1px solid var(--line); }
.cp-content { padding: 22px 24px 60px; max-width: 1440px; }

.mode-chip {
  font-family: "IBM Plex Mono", monospace; font-size: 0.7rem; font-weight: 600; letter-spacing: .1em;
  padding: 4px 10px; border-radius: 6px;
}
.mode-chip.paper { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(242,179,61,.35); }
.mode-chip.live { background: rgba(242,109,109,.14); color: var(--coral); border: 1px solid rgba(242,109,109,.4); }

/* ---------- cards & stats ---------- */
.cp-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.cp-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.cp-card-head h2 { font-family: "Space Grotesk", sans-serif; font-size: 0.95rem; font-weight: 700; margin: 0; letter-spacing: .02em; }
.cp-card-head .btn, .cp-card-head .bot-chip, .cp-card-head .mode-chip { margin-left: auto; }
.cp-card-note { color: var(--muted); font-size: 0.75rem; flex-basis: 100%; }
.cp-card-head .btn + .cp-card-note, .cp-card-head h2 + .cp-card-note { flex-basis: auto; margin-left: 0; }

.cp-stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; height: 100%; }
.cp-stat-label { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: .09em; }
.cp-stat-value { font-size: 1.45rem; font-weight: 600; margin: 4px 0 2px; }
.cp-stat-sub { color: var(--muted); font-size: 0.72rem; }

.cp-empty { color: var(--muted); padding: 26px 10px; text-align: center; font-size: 0.875rem; }

/* ---------- tables ---------- */
.cp-table { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--line); font-size: 0.875rem; }
.cp-table thead th { color: var(--muted); font-weight: 500; font-size: 0.7rem; text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid var(--line); }
.cp-table td { border-bottom-color: rgba(36,51,74,.5); }
.cp-table-sm { font-size: 0.78rem; }
.cp-sym-link { color: var(--text); text-decoration: none; font-weight: 600; }
.cp-sym-link:hover { color: var(--amber); }

/* ---------- regime badges (the signature) ---------- */
.regime {
  display: inline-flex; align-items: center; gap: 7px; font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem; font-weight: 600; letter-spacing: .08em; padding: 4px 9px; border-radius: 6px;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.regime .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.regime em { font-style: normal; opacity: .7; font-weight: 400; }
.regime .vol { color: var(--amber); opacity: 1; }
.regime-trend { color: var(--teal); border-color: rgba(52,211,166,.35); background: rgba(52,211,166,.08); }
.regime-trend .dot { animation: pulse 2s infinite; }
.regime-range { color: #8FB7E8; border-color: rgba(143,183,232,.3); background: rgba(143,183,232,.07); }
.regime-unknown { color: var(--muted); }

.bot-chip {
  font-family: "IBM Plex Mono", monospace; font-size: 0.66rem; font-weight: 600; letter-spacing: .09em;
  padding: 3px 8px; border-radius: 5px; white-space: nowrap;
}
.bot-chip.armed { background: var(--amber-dim); color: var(--amber); }
.bot-chip.trade { background: rgba(52,211,166,.14); color: var(--teal); }
.bot-chip.standby { background: rgba(143,183,232,.1); color: #8FB7E8; }
.bot-chip.off { background: rgba(124,140,163,.12); color: var(--muted); }
.bot-chip.blocked { background: rgba(242,109,109,.14); color: var(--coral); }

.side { font-family: "IBM Plex Mono", monospace; font-size: 0.7rem; font-weight: 600; letter-spacing: .06em; }
.side.buy { color: var(--teal); }
.side.sell { color: var(--coral); }
.mode-tag { font-family: "IBM Plex Mono", monospace; font-size: 0.66rem; color: var(--muted); border: 1px solid var(--line); padding: 2px 7px; border-radius: 5px; text-transform: uppercase; letter-spacing: .07em; }

.order-status { font-family: "IBM Plex Mono", monospace; font-size: 0.68rem; font-weight: 600; }
.st-filled { color: var(--teal); }
.st-rejected, .st-canceled, .st-expired { color: var(--coral); }
.st-pending, .st-new, .st-active { color: var(--amber); }

.cp-champ { font-weight: 600; font-size: 0.85rem; }
.cp-score { color: var(--muted); font-size: 0.7rem; margin-left: 6px; }

/* ---------- buttons & forms ---------- */
.cp-btn-primary {
  background: var(--amber); border: 1px solid var(--amber); color: #1a1405; font-weight: 600;
  border-radius: 10px; transition: filter .15s;
}
.cp-btn-primary:hover { background: #ffc65e; border-color: #ffc65e; color: #1a1405; }
.cp-btn-primary:disabled { background: var(--amber); opacity: .5; }
.cp-btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 10px; }
.cp-btn-ghost:hover { color: var(--text); border-color: var(--muted); background: var(--panel-2); }
.cp-btn-ghost.active { color: var(--amber); border-color: rgba(242,179,61,.4); background: var(--amber-dim); }
.cp-btn-danger { background: rgba(242,109,109,.12); border: 1px solid rgba(242,109,109,.45); color: var(--coral); font-weight: 600; border-radius: 10px; }
.cp-btn-danger:hover { background: rgba(242,109,109,.22); color: #ff9c9c; }

.cp-form .form-label, .cp-card .form-label { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 4px; }
.form-control, .form-select {
  background: var(--ink); border: 1px solid var(--line); color: var(--text); border-radius: 10px; font-size: 0.875rem;
}
.form-control:focus, .form-select:focus { background: var(--ink); color: var(--text); border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-dim); }
.form-control::placeholder { color: #55647c; }
.form-check-input { background-color: var(--ink); border-color: var(--line); }
.form-check-input:checked { background-color: var(--amber); border-color: var(--amber); }
.form-check-input:focus { box-shadow: 0 0 0 3px var(--amber-dim); border-color: var(--amber); }
.cp-alert { border-radius: 10px; font-size: 0.85rem; }

/* ---------- charts ---------- */
.cp-chart { height: 420px; }
.cp-chart-sm { height: 220px; }

/* ---------- market page ---------- */
.cp-market-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.cp-market-title { font-size: 1.1rem; font-weight: 600; }
.cp-tf-label { color: var(--muted); font-size: 0.8rem; }
.cp-market-price { display: flex; align-items: baseline; gap: 10px; margin-top: 2px; }
.cp-market-price .big { font-size: 1.7rem; font-weight: 600; }
.cp-regime-panel { display: flex; flex-direction: column; gap: 10px; }
.cp-regime-metrics { display: flex; gap: 16px; color: var(--muted); }
.cp-champ-name { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1rem; color: var(--amber); }
.cp-pos-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; }
.cp-pos-grid span:nth-child(odd) { color: var(--muted); }
.cp-strategy-tile { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; height: 100%; }

/* ---------- tabs ---------- */
.cp-tabs .nav-link { color: var(--muted); border: 1px solid transparent; border-radius: 10px; padding: 6px 16px; font-size: 0.85rem; }
.cp-tabs .nav-link.active { color: var(--amber); background: var(--amber-dim); border-color: rgba(242,179,61,.3); }

/* ---------- login ---------- */
.cp-login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px;
  background: radial-gradient(1200px 600px at 70% -10%, #16233a 0%, var(--ink) 55%); }
.cp-login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 30px; }
.cp-login-card .cp-brand { font-size: 1.3rem; }
.cp-login-sub { color: var(--muted); font-size: 0.78rem; margin: 4px 0 22px; }

/* ---------- live price flash ---------- */
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes flashUp { 0% { background: rgba(52,211,166,.28); } 100% { background: transparent; } }
@keyframes flashDown { 0% { background: rgba(242,109,109,.28); } 100% { background: transparent; } }
.flash-up { animation: flashUp .7s ease-out; }
.flash-down { animation: flashDown .7s ease-out; }

/* ---------- responsive ---------- */
@media (max-width: 991.98px) {
  .cp-rail { display: none; }
  .cp-menu-btn { display: inline-flex; }
  .cp-content { padding: 16px 14px 50px; }
  .cp-topbar { padding: 10px 14px; }
  .cp-equity-readout small { display: none; }
  .cp-chart { height: 320px; }
}
.cp-rail-canvas { background: var(--panel); border-right: 1px solid var(--line); max-width: 280px; }

@media (prefers-reduced-motion: reduce) {
  .regime-trend .dot, .cp-worker.on .dot { animation: none; }
  .flash-up, .flash-down { animation: none; }
}