@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

body {
  font-family: "Inter", sans-serif;
}
.font-mono {
  font-family: "JetBrains Mono", monospace;
}
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* ── Sidebar nav: active state (orange bg) ── */
.nav-item.active {
  background-color: rgba(249, 115, 22, 0.12);
  color: #fb923c;
}
.nav-item.active:hover {
  background-color: rgba(249, 115, 22, 0.18);
}

/* ── Sortable table headers ── */
.sortable {
  cursor: pointer;
  user-select: none;
}
.sortable:hover {
  color: #f8fafc;
}
.sort-arrow {
  font-size: 10px;
}

/* ==========================================================
   LIGHT THEME — Warm Palette (data-theme="light-warm")
   Easy on eyes: warm off-white bg, soft-black text, reduced contrast
   ========================================================== */
[data-theme="light-warm"] main,
[data-theme="light-warm"] header {
  background-color: #f5f0eb !important;
  color: #2c2c2c !important;
}
[data-theme="light-warm"] main .bg-slate-950 { background-color: #f5f0eb !important; }
[data-theme="light-warm"] main .bg-slate-900 { background-color: #faf8f5 !important; }
[data-theme="light-warm"] main .bg-slate-800 { background-color: #f7f4f0 !important; }
[data-theme="light-warm"] main .bg-slate-700 { background-color: #efeae4 !important; }
[data-theme="light-warm"] main .bg-slate-800\/50 { background-color: rgba(247,244,240,0.5) !important; }
[data-theme="light-warm"] main .bg-slate-900\/60 { background-color: rgba(250,248,245,0.6) !important; }
[data-theme="light-warm"] main .bg-slate-950\/30,
[data-theme="light-warm"] main .bg-slate-950\/40,
[data-theme="light-warm"] main .bg-slate-950\/50 { background-color: rgba(245,240,235,0.8) !important; }

/* Borders */
[data-theme="light-warm"] main .border-slate-800 { border-color: #e0d8d0 !important; }
[data-theme="light-warm"] main .border-slate-700 { border-color: #d5cdc5 !important; }
[data-theme="light-warm"] main .border-slate-900 { border-color: #e0d8d0 !important; }

/* Text */
[data-theme="light-warm"] main .text-slate-200,
[data-theme="light-warm"] main .text-slate-100,
[data-theme="light-warm"] main .text-slate-50 { color: #2c2c2c !important; }
[data-theme="light-warm"] main .text-slate-300 { color: #3a3a3a !important; }
[data-theme="light-warm"] main .text-slate-400 { color: #5a5a5a !important; }
[data-theme="light-warm"] main .text-slate-500 { color: #8a8a8a !important; }
[data-theme="light-warm"] main .text-slate-600 { color: #9a9a9a !important; }

/* Icon colors — darken in light mode so they pop on white bg */
[data-theme="light-warm"] main .text-blue-400   { color: #2563eb !important; }
[data-theme="light-warm"] main .text-emerald-400 { color: #059669 !important; }
[data-theme="light-warm"] main .text-red-400     { color: #dc2626 !important; }
[data-theme="light-warm"] main .text-amber-400   { color: #d97706 !important; }
[data-theme="light-warm"] main .text-purple-400  { color: #7c3aed !important; }
[data-theme="light-warm"] main .text-orange-400  { color: #ea580c !important; }
[data-theme="light-warm"] main .text-indigo-400  { color: #4f46e5 !important; }
[data-theme="light-warm"] main .text-sky-400     { color: #0284c7 !important; }
[data-theme="light-warm"] main .text-pink-400    { color: #db2777 !important; }
[data-theme="light-warm"] main .text-yellow-400  { color: #ca8a04 !important; }
[data-theme="light-warm"] main .text-teal-400    { color: #0d9488 !important; }
[data-theme="light-warm"] main .text-cyan-400    { color: #0891b2 !important; }
[data-theme="light-warm"] main .text-violet-400  { color: #7c3aed !important; }

/* Form elements */
[data-theme="light-warm"] main input,
[data-theme="light-warm"] main select,
[data-theme="light-warm"] main textarea {
  background-color: #ffffff !important;
  border-color: #d5cdc5 !important;
  color: #2c2c2c !important;
}
[data-theme="light-warm"] main input::placeholder,
[data-theme="light-warm"] main select::placeholder,
[data-theme="light-warm"] main textarea::placeholder {
  color: #b0a8a0 !important;
}
[data-theme="light-warm"] main select option {
  background-color: #ffffff !important;
  color: #2c2c2c !important;
}

/* Button text on colored backgrounds */
[data-theme="light-warm"] main .bg-blue-600,
[data-theme="light-warm"] main .bg-blue-700 { color: #ffffff !important; }
[data-theme="light-warm"] main .bg-emerald-600,
[data-theme="light-warm"] main .bg-emerald-700 { color: #ffffff !important; }
[data-theme="light-warm"] main .bg-red-600,
[data-theme="light-warm"] main .bg-red-700 { color: #ffffff !important; }
[data-theme="light-warm"] main .bg-amber-600,
[data-theme="light-warm"] main .bg-amber-700 { color: #ffffff !important; }
[data-theme="light-warm"] main .bg-purple-600,
[data-theme="light-warm"] main .bg-purple-700 { color: #ffffff !important; }
[data-theme="light-warm"] main .bg-orange-600,
[data-theme="light-warm"] main .bg-orange-700 { color: #ffffff !important; }
[data-theme="light-warm"] main .bg-indigo-600,
[data-theme="light-warm"] main .bg-indigo-700 { color: #ffffff !important; }
[data-theme="light-warm"] main .bg-sky-600,
[data-theme="light-warm"] main .bg-sky-700 { color: #ffffff !important; }
[data-theme="light-warm"] main .bg-violet-600,
[data-theme="light-warm"] main .bg-violet-700 { color: #ffffff !important; }
[data-theme="light-warm"] main .bg-pink-600,
[data-theme="light-warm"] main .bg-pink-700 { color: #ffffff !important; }
[data-theme="light-warm"] main .bg-yellow-600 { color: #ffffff !important; }
[data-theme="light-warm"] main .bg-teal-600   { color: #ffffff !important; }
[data-theme="light-warm"] main .bg-cyan-600   { color: #ffffff !important; }
[data-theme="light-warm"] main .bg-slate-700,
[data-theme="light-warm"] main .bg-slate-800 { color: #2c2c2c !important; }

/* Table headers */
[data-theme="light-warm"] main thead { background-color: #ffffff !important; }
[data-theme="light-warm"] main table thead .text-slate-400 { color: #5a5a5a !important; }

/* Row dividers */
[data-theme="light-warm"] main .divide-y > :not([hidden]) ~ :not([hidden]) {
  border-color: #e0d8d0 !important;
}
[data-theme="light-warm"] main .divide-slate-800 > :not([hidden]) ~ :not([hidden]) {
  border-color: #e0d8d0 !important;
}
[data-theme="light-warm"] main tbody tr {
  border-color: #e0d8d0 !important;
}

/* Badge / stat-box backgrounds */
[data-theme="light-warm"] main .bg-slate-800.text-slate-400,
[data-theme="light-warm"] main .bg-slate-800.text-slate-500,
[data-theme="light-warm"] main .bg-slate-700.text-slate-200,
[data-theme="light-warm"] main .rounded-lg.bg-slate-800\/30 {
  background-color: #e8e3dd !important;
  color: #5a5a5a !important;
}

/* Progress bar track */
[data-theme="light-warm"] main .bg-slate-700.rounded-full {
  background-color: #e0d8d0 !important;
}

/* Code blocks */
[data-theme="light-warm"] main .bg-slate-950,
[data-theme="light-warm"] main code.text-slate-300 {
  background-color: #f0ebe5 !important;
  color: #3a3a3a !important;
}

/* Sortable header hover */
[data-theme="light-warm"] main .sortable:hover {
  color: #2c2c2c !important;
}

/* Sidebar: stays dark */
[data-theme="light-warm"] aside {
  background-color: #0f172a !important;
}
[data-theme="light-warm"] aside .text-slate-400 { color: #94a3b8 !important; }
[data-theme="light-warm"] aside .nav-item.active { color: #fb923c !important; }

/* Theme toggle button */
[data-theme="light-warm"] #theme-toggle {
  background-color: #ffffff !important;
  border-color: #d5cdc5 !important;
  color: #3a3a3a !important;
}
[data-theme="light-warm"] #theme-toggle:hover {
  background-color: #f0ebe5 !important;
}

/* API status badge */
[data-theme="light-warm"] #api-status-badge {
  background-color: rgba(255,255,255,0.6) !important;
  border-color: #d5cdc5 !important;
}
[data-theme="light-warm"] #api-status-text { color: #5a5a5a !important; }

/* Modal overrides (modals are siblings of main) */
[data-theme="light-warm"] #optimization-modal .bg-slate-900,
[data-theme="light-warm"] #component-modal .bg-slate-900,
[data-theme="light-warm"] #add-path-modal .bg-slate-900 {
  background-color: #ffffff !important;
  border-color: #d5cdc5 !important;
}
[data-theme="light-warm"] #optimization-modal .text-slate-100,
[data-theme="light-warm"] #component-modal .text-slate-100,
[data-theme="light-warm"] #add-path-modal .text-slate-200 {
  color: #2c2c2c !important;
}
[data-theme="light-warm"] #optimization-modal .text-slate-400,
[data-theme="light-warm"] #component-modal .text-slate-400,
[data-theme="light-warm"] #add-path-modal .text-slate-400 {
  color: #5a5a5a !important;
}
[data-theme="light-warm"] #optimization-modal .bg-slate-800,
[data-theme="light-warm"] #component-modal .bg-slate-800,
[data-theme="light-warm"] #add-path-modal .bg-slate-800 {
  background-color: #f7f4f0 !important;
}
[data-theme="light-warm"] #optimization-modal .text-slate-200,
[data-theme="light-warm"] #component-modal .text-slate-200 {
  color: #2c2c2c !important;
}
[data-theme="light-warm"] #optimization-modal .text-violet-400 { color: #7c3aed !important; }
[data-theme="light-warm"] #optimization-modal .text-slate-300 { color: #3a3a3a !important; }
[data-theme="light-warm"] #component-modal .text-amber-600 { color: #d97706 !important; }

/* ==========================================================
   LIGHT THEME — Cool Palette (data-theme="light-cool")
   Modern SaaS look: white cards, cool slate bg
   ========================================================== */
[data-theme="light-cool"] main,
[data-theme="light-cool"] header {
  background-color: #f1f5f9 !important;
  color: #1e293b !important;
}
[data-theme="light-cool"] main .bg-slate-950 { background-color: #f1f5f9 !important; }
[data-theme="light-cool"] main .bg-slate-900 { background-color: #ffffff !important; }
[data-theme="light-cool"] main .bg-slate-800 { background-color: #f8fafc !important; }
[data-theme="light-cool"] main .bg-slate-700 { background-color: #f1f5f9 !important; }
[data-theme="light-cool"] main .bg-slate-800\/50 { background-color: rgba(248,250,252,0.5) !important; }
[data-theme="light-cool"] main .bg-slate-900\/60 { background-color: rgba(255,255,255,0.6) !important; }
[data-theme="light-cool"] main .bg-slate-950\/30,
[data-theme="light-cool"] main .bg-slate-950\/40,
[data-theme="light-cool"] main .bg-slate-950\/50 { background-color: rgba(241,245,249,0.8) !important; }

/* Borders */
[data-theme="light-cool"] main .border-slate-800 { border-color: #e2e8f0 !important; }
[data-theme="light-cool"] main .border-slate-700 { border-color: #cbd5e1 !important; }
[data-theme="light-cool"] main .border-slate-900 { border-color: #e2e8f0 !important; }

/* Text */
[data-theme="light-cool"] main .text-slate-200,
[data-theme="light-cool"] main .text-slate-100,
[data-theme="light-cool"] main .text-slate-50 { color: #1e293b !important; }
[data-theme="light-cool"] main .text-slate-300 { color: #334155 !important; }
[data-theme="light-cool"] main .text-slate-400 { color: #475569 !important; }
[data-theme="light-cool"] main .text-slate-500 { color: #64748b !important; }

/* Icon colors */
[data-theme="light-cool"] main .text-blue-400   { color: #2563eb !important; }
[data-theme="light-cool"] main .text-emerald-400 { color: #059669 !important; }
[data-theme="light-cool"] main .text-red-400     { color: #dc2626 !important; }
[data-theme="light-cool"] main .text-amber-400   { color: #d97706 !important; }
[data-theme="light-cool"] main .text-purple-400  { color: #7c3aed !important; }
[data-theme="light-cool"] main .text-orange-400  { color: #ea580c !important; }
[data-theme="light-cool"] main .text-indigo-400  { color: #4f46e5 !important; }
[data-theme="light-cool"] main .text-sky-400     { color: #0284c7 !important; }
[data-theme="light-cool"] main .text-pink-400    { color: #db2777 !important; }
[data-theme="light-cool"] main .text-yellow-400  { color: #ca8a04 !important; }
[data-theme="light-cool"] main .text-teal-400    { color: #0d9488 !important; }
[data-theme="light-cool"] main .text-cyan-400    { color: #0891b2 !important; }
[data-theme="light-cool"] main .text-violet-400  { color: #7c3aed !important; }

/* Form elements */
[data-theme="light-cool"] main input,
[data-theme="light-cool"] main select,
[data-theme="light-cool"] main textarea {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #1e293b !important;
}
[data-theme="light-cool"] main input::placeholder,
[data-theme="light-cool"] main select::placeholder,
[data-theme="light-cool"] main textarea::placeholder {
  color: #94a3b8 !important;
}
[data-theme="light-cool"] main select option {
  background-color: #ffffff !important;
  color: #1e293b !important;
}

/* Button text */
[data-theme="light-cool"] main .bg-blue-600,
[data-theme="light-cool"] main .bg-blue-700 { color: #ffffff !important; }
[data-theme="light-cool"] main .bg-emerald-600,
[data-theme="light-cool"] main .bg-emerald-700 { color: #ffffff !important; }
[data-theme="light-cool"] main .bg-red-600,
[data-theme="light-cool"] main .bg-red-700 { color: #ffffff !important; }
[data-theme="light-cool"] main .bg-amber-600,
[data-theme="light-cool"] main .bg-amber-700 { color: #ffffff !important; }
[data-theme="light-cool"] main .bg-purple-600,
[data-theme="light-cool"] main .bg-purple-700 { color: #ffffff !important; }
[data-theme="light-cool"] main .bg-orange-600,
[data-theme="light-cool"] main .bg-orange-700 { color: #ffffff !important; }
[data-theme="light-cool"] main .bg-indigo-600,
[data-theme="light-cool"] main .bg-indigo-700 { color: #ffffff !important; }
[data-theme="light-cool"] main .bg-sky-600,
[data-theme="light-cool"] main .bg-sky-700 { color: #ffffff !important; }
[data-theme="light-cool"] main .bg-violet-600,
[data-theme="light-cool"] main .bg-violet-700 { color: #ffffff !important; }
[data-theme="light-cool"] main .bg-pink-600,
[data-theme="light-cool"] main .bg-pink-700 { color: #ffffff !important; }
[data-theme="light-cool"] main .bg-yellow-600 { color: #ffffff !important; }
[data-theme="light-cool"] main .bg-teal-600   { color: #ffffff !important; }
[data-theme="light-cool"] main .bg-cyan-600   { color: #ffffff !important; }
[data-theme="light-cool"] main .bg-slate-700,
[data-theme="light-cool"] main .bg-slate-800 { color: #1e293b !important; }

/* Table headers */
[data-theme="light-cool"] main thead { background-color: #ffffff !important; }
[data-theme="light-cool"] main table thead .text-slate-400 { color: #475569 !important; }

/* Dividers */
[data-theme="light-cool"] main .divide-y > :not([hidden]) ~ :not([hidden]) {
  border-color: #e2e8f0 !important;
}
[data-theme="light-cool"] main .divide-slate-800 > :not([hidden]) ~ :not([hidden]) {
  border-color: #e2e8f0 !important;
}
[data-theme="light-cool"] main tbody tr {
  border-color: #e2e8f0 !important;
}

/* Badges */
[data-theme="light-cool"] main .bg-slate-800.text-slate-400,
[data-theme="light-cool"] main .bg-slate-800.text-slate-500,
[data-theme="light-cool"] main .bg-slate-700.text-slate-200,
[data-theme="light-cool"] main .rounded-lg.bg-slate-800\/30 {
  background-color: #e2e8f0 !important;
  color: #475569 !important;
}

/* Progress bar */
[data-theme="light-cool"] main .bg-slate-700.rounded-full {
  background-color: #e2e8f0 !important;
}

/* Code */
[data-theme="light-cool"] main .bg-slate-950,
[data-theme="light-cool"] main code.text-slate-300 {
  background-color: #f1f5f9 !important;
  color: #334155 !important;
}

/* Sortable header hover */
[data-theme="light-cool"] main .sortable:hover {
  color: #1e293b !important;
}

/* Sidebar */
[data-theme="light-cool"] aside {
  background-color: #0f172a !important;
}
[data-theme="light-cool"] aside .text-slate-400 { color: #94a3b8 !important; }
[data-theme="light-cool"] aside .nav-item.active { color: #fb923c !important; }

/* Theme toggle */
[data-theme="light-cool"] #theme-toggle {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}
[data-theme="light-cool"] #theme-toggle:hover {
  background-color: #f1f5f9 !important;
}

/* API badge */
[data-theme="light-cool"] #api-status-badge {
  background-color: rgba(255,255,255,0.6) !important;
  border-color: #cbd5e1 !important;
}
[data-theme="light-cool"] #api-status-text { color: #475569 !important; }

/* Modal overrides (cool) */
[data-theme="light-cool"] #optimization-modal .bg-slate-900,
[data-theme="light-cool"] #component-modal .bg-slate-900,
[data-theme="light-cool"] #add-path-modal .bg-slate-900 {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
}
[data-theme="light-cool"] #optimization-modal .text-slate-100,
[data-theme="light-cool"] #component-modal .text-slate-100,
[data-theme="light-cool"] #add-path-modal .text-slate-200 {
  color: #1e293b !important;
}
[data-theme="light-cool"] #optimization-modal .text-slate-400,
[data-theme="light-cool"] #component-modal .text-slate-400,
[data-theme="light-cool"] #add-path-modal .text-slate-400 {
  color: #475569 !important;
}
[data-theme="light-cool"] #optimization-modal .bg-slate-800,
[data-theme="light-cool"] #component-modal .bg-slate-800,
[data-theme="light-cool"] #add-path-modal .bg-slate-800 {
  background-color: #f8fafc !important;
}
[data-theme="light-cool"] #optimization-modal .text-slate-200,
[data-theme="light-cool"] #component-modal .text-slate-200 {
  color: #1e293b !important;
}
[data-theme="light-cool"] #optimization-modal .text-violet-400 { color: #7c3aed !important; }
[data-theme="light-cool"] #optimization-modal .text-slate-300 { color: #334155 !important; }
[data-theme="light-cool"] #component-modal .text-amber-600 { color: #d97706 !important; }

/* ── Universal Interactive Tooltips ── */
.has-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
}
.has-tooltip .tooltip-box {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 240px;
  background-color: #0f172a; /* slate-900 */
  border: 1px solid #334155; /* slate-700 */
  color: #cbd5e1; /* slate-300 */
  font-size: 11px;
  line-height: 1.35;
  font-weight: 400;
  padding: 6px 10px;
  border-radius: 6px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  z-index: 9999;
  transition: opacity 0.15s ease-in-out, visibility 0.15s ease-in-out;
  white-space: normal;
  text-align: left;
}
.has-tooltip .tooltip-box::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: #334155 transparent transparent transparent;
}
.has-tooltip:hover .tooltip-box,
.has-tooltip:focus-within .tooltip-box {
  visibility: visible;
  opacity: 1;
}

/* ------------------------------------------------------------------
   Paper trading table: 100% zoom fit + the Dual column toggle.

   The compiled Tailwind CSS in this tree does not emit arbitrary-value
   utilities (max-w-[128px], text-[10px], after:content-['']) and does not
   emit the peer-checked variants, so the badge columns were never bounded
   (the table overflowed 1080p with a horizontal scrollbar) and the Dual
   toggle rendered as a zero-width pill with no knob and no colour change
   on toggle.  These rules are explicit so they hold regardless of what
   the CSS build emits.
   ------------------------------------------------------------------ */

/* Bounded, ellipsised badge columns. */
.paper-col-instrument,
.paper-col-expiry,
.paper-col-schedule {
  max-width: 118px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
.paper-col-expiry { max-width: 82px; }
.paper-col-schedule { max-width: 98px; }

/* The Dual toggle: a real 24x12 track with a 8px knob that moves. */
.paper-dual-track {
  position: relative;
  display: inline-block;
  width: 24px;
  height: 12px;
  border-radius: 9999px;
  background-color: #334155;   /* slate-700 */
  transition: background-color 150ms ease-in-out;
  cursor: pointer;
  flex: 0 0 auto;
}
.paper-dual-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background-color: #ffffff;
  transition: transform 150ms ease-in-out;
}
.peer.group-dual-toggle:checked + .paper-dual-track {
  background-color: #059669;   /* emerald-600 */
}
.peer.group-dual-toggle:checked + .paper-dual-track::after {
  transform: translateX(12px);
}
.paper-dual-track:hover { background-color: #475569; }
.peer.group-dual-toggle:checked + .paper-dual-track:hover { background-color: #047857; }
