body { font-feature-settings: "tnum", "cv02", "cv03", "cv04", "cv11"; }
.num, .font-mono { font-variant-numeric: tabular-nums; }

.nav-link.active { background: #eff6ff; color: #1565c0; }
.nav-link.active svg { color: #1e88e5; }
.nav-badge { font: 600 10px "JetBrains Mono", monospace; padding: 1px 6px; border-radius: 4px; background: #f1f5f9; color: #475569; }

.card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #f1f5f9; }
.card-title { font-size: 13px; font-weight: 600; color: #0f172a; display: flex; align-items: center; gap: 8px; }
.card-title svg { width: 16px; height: 16px; color: #94a3b8; }
.card-sub { font-size: 11px; color: #94a3b8; font-weight: 400; }
.card-body { padding: 16px; }

.kpi { padding: 14px 16px; }
.kpi .label { font-size: 11px; color: #64748b; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .label svg { width: 14px; height: 14px; }
.kpi .value { font: 600 20px/1.3 "JetBrains Mono", monospace; color: #0f172a; margin-top: 4px; }
.kpi .hint { font-size: 11px; color: #94a3b8; margin-top: 2px; }

.badge { display: inline-flex; align-items: center; gap: 4px; font: 600 10.5px "JetBrains Mono", monospace; padding: 2px 8px; border-radius: 999px; background: #f1f5f9; color: #475569; letter-spacing: .02em; white-space: nowrap; }
.badge-blue { background: #eff6ff; color: #1565c0; }
.badge-green { background: #e6f4ea; color: #0e8a16; }
.badge-red { background: #fce8e6; color: #cf1322; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-solid-red { background: #dc2626; color: #fff; }

.btn { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 6px 12px; border-radius: 8px; border: 1px solid #e2e8f0; background: #fff; color: #334155; transition: background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; }
.btn-primary { background: #1e88e5; border-color: #1e88e5; color: #fff; }
.btn-primary:hover { background: #1565c0; border-color: #1565c0; }
.btn-danger { background: #fff; border-color: #fecaca; color: #dc2626; }
.btn-danger:hover { background: #fef2f2; border-color: #fca5a5; }
.btn-sm { padding: 3px 8px; font-size: 11px; }

.input, .select { font-size: 13px; padding: 6px 10px; border-radius: 8px; border: 1px solid #e2e8f0; background: #fff; color: #0f172a; outline: none; }
.input:focus, .select:focus { border-color: #1e88e5; box-shadow: 0 0 0 3px rgba(30, 136, 229, .15); }
.field-label { font-size: 12px; font-weight: 500; color: #334155; }
.field-help { font-size: 11px; color: #94a3b8; margin-top: 3px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 34px; height: 19px; border-radius: 999px; background: #cbd5e1; position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s; }
.switch input:checked + .track { background: #00b852; }
.switch input:checked + .track::after { left: 17px; }
.switch input:focus-visible + .track { outline: 2px solid #1e88e5; outline-offset: 2px; }
.switch.sm .track { width: 28px; height: 16px; } .switch.sm .track::after { width: 12px; height: 12px; }
.switch.sm input:checked + .track::after { left: 14px; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; flex: none; display: inline-block; }
.dot.on { background: #00b852; box-shadow: 0 0 0 3px rgba(0, 184, 82, .15); }
.dot.off { background: #eb5757; }

.tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl th { text-align: left; font-weight: 500; font-size: 11px; color: #64748b; background: #f8fafc; padding: 8px 12px; border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; white-space: nowrap; z-index: 1; }
.tbl td { padding: 8px 12px; border-bottom: 1px solid #f1f5f9; white-space: nowrap; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #f8fafc; }
.tbl .r { text-align: right; }
.tbl .wrap { white-space: normal; word-break: break-word; min-width: 220px; }
.tbl .empty { text-align: center; color: #94a3b8; padding: 28px 12px; }
.scroll { overflow: auto; }

.up { color: #0e8a16; } .down { color: #cf1322; } .muted { color: #94a3b8; }
.side-buy, .side-long { color: #0e8a16; font-weight: 600; }
.side-sell, .side-short { color: #cf1322; font-weight: 600; }

.tabs { display: inline-flex; background: #f1f5f9; border-radius: 8px; padding: 2px; gap: 2px; }
.tabs button { font-size: 12px; font-weight: 500; padding: 4px 12px; border-radius: 6px; color: #64748b; }
.tabs button.on { background: #fff; color: #0f172a; box-shadow: 0 1px 2px rgba(0,0,0,.06); }

.flash-up { animation: flashUp .6s; } .flash-down { animation: flashDown .6s; }
@keyframes flashUp { from { background: #e6f4ea; } to { background: transparent; } }
@keyframes flashDown { from { background: #fce8e6; } to { background: transparent; } }

.log-line { font: 11.5px/1.6 "JetBrains Mono", monospace; padding: 3px 0; border-bottom: 1px dashed #f1f5f9; word-break: break-word; }

.toast { font-size: 12.5px; padding: 10px 14px; border-radius: 8px; background: #0f172a; color: #fff; box-shadow: 0 8px 24px rgba(15,23,42,.18); max-width: 360px; animation: toastIn .2s; }
.toast.error { background: #b91c1c; } .toast.ok { background: #047857; }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } }

#modal.open { display: flex; }

/* Scrolling price ticker under the header */
.marquee { overflow: hidden; height: 30px; display: flex; align-items: center; background: #0f172a; border-bottom: 1px solid #1e293b; }
.marquee-track { display: inline-flex; white-space: nowrap; will-change: transform; animation: marquee var(--marquee-duration, 30s) linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-item { display: inline-flex; align-items: center; gap: 8px; padding: 0 22px; font: 500 12px "JetBrains Mono", monospace; color: #e2e8f0;
  font-variant-numeric: tabular-nums; border-right: 1px solid #1e293b; }
.marquee-item .sym { color: #94a3b8; font-weight: 600; letter-spacing: .02em; }
.marquee-item .px { padding: 1px 4px; border-radius: 4px; }
.marquee-item .chg { font-size: 11px; color: #94a3b8; }
.marquee .up { color: #34d399; } .marquee .down { color: #f87171; }
.marquee .flash-up { animation: mqUp .8s; } .marquee .flash-down { animation: mqDown .8s; }
.marquee-item.stale .px { color: #64748b; }
.marquee-item.stale .chg { color: #fbbf24; font-weight: 600; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes mqUp { from { background: rgba(52, 211, 153, .3); } to { background: transparent; } }
@keyframes mqDown { from { background: rgba(248, 113, 113, .3); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .marquee-track { animation: none; } .marquee { overflow-x: auto; } }

/* SL -> entry -> TP gauge on positions */
.lv { position: relative; height: 8px; min-width: 110px; }
.lv-track { position: absolute; inset: 2px 0; border-radius: 4px; background: linear-gradient(90deg, #fecaca, #f1f5f9 50%, #bbf7d0); }
.lv-track.rev { background: linear-gradient(90deg, #bbf7d0, #f1f5f9 50%, #fecaca); }
.lv-entry { position: absolute; top: 0; width: 2px; height: 8px; margin-left: -1px; background: #64748b; }
.lv-mark { position: absolute; top: -2px; width: 8px; height: 12px; margin-left: -4px; border-radius: 3px; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(15,23,42,.2); }
.lv-mark.pos { background: #00b852; } .lv-mark.neg { background: #eb5757; }

/* 24h range: low ... high with the last price */
.range { position: relative; height: 4px; border-radius: 2px; background: #e2e8f0; }
.range span { position: absolute; top: -3px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: #1e88e5; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(15,23,42,.15); }

/* usage meter (daily loss used) */
.meter { height: 6px; border-radius: 3px; background: #f1f5f9; overflow: hidden; }
.meter > div { height: 100%; border-radius: 3px; transition: width .4s; }

.pill { display: inline-flex; align-items: center; gap: 3px; font: 600 11px "JetBrains Mono", monospace; padding: 2px 7px; border-radius: 6px; }
.pill.up { background: #e6f4ea; color: #0e8a16; } .pill.down { background: #fce8e6; color: #cf1322; } .pill.flat { background: #f1f5f9; color: #64748b; }
.stat-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: #94a3b8; font-weight: 600; }
.stat-value { font: 600 13px "JetBrains Mono", monospace; color: #0f172a; font-variant-numeric: tabular-nums; }
.chip { font-size: 11.5px; font-weight: 500; padding: 4px 10px; border-radius: 6px; border: 1px solid #e2e8f0; background: #fff; color: #475569; }
.chip.on { border-color: #1e88e5; background: #eff6ff; color: #1565c0; }
.skeleton { background: linear-gradient(90deg, #f1f5f9, #e2e8f0, #f1f5f9); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 6px; color: transparent !important; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* market-data banner */
.banner { display: flex; align-items: flex-start; gap: .6rem; padding: .55rem 1.5rem; font-size: 12.5px; line-height: 1.4; border-bottom: 1px solid; }
.banner-down { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.banner-warn { background: #fffbeb; color: #92400e; border-color: #fde68a; }
/* event log levels */
.log-line.lvl-error { background: #fef2f2; }
.log-line.lvl-warning { background: #fffbeb; }

/* TB-AI: marks everything written by TradeBuddy AI (Mistral), on every page */
.badge-ai { background: linear-gradient(90deg, #6d28d9, #2563eb); color: #fff; font-weight: 700; letter-spacing: .05em; border: 0; }
.badge-ai::before { content: "✦"; margin-right: 3px; font-size: 9px; }
.ai-box { border: 1px solid #ddd6fe; background: linear-gradient(180deg, #faf5ff, #ffffff); border-radius: 10px; }
.st-good { color: #047857; background: #d1fae5; } .st-watch { color: #92400e; background: #fef3c7; } .st-act { color: #991b1b; background: #fee2e2; }
