:root{
  --bg:#0b0f18;
  --panel:#101827;
  --panel2:#0f1626;
  --border:rgba(255,255,255,.08);
  --text:#e5e7eb;
  --muted:#a3a3a3;
  --good:#22c55e;
  --bad:#ef4444;
  --accent:#3b82f6;
  --link:#93c5fd;
}

*{box-sizing:border-box}
html,body{height:100%}

body{
  margin:0;
  font-family: ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial;
  background: radial-gradient(1200px 600px at 15% 0%, #121a2b 0%, var(--bg) 45%);
  color:var(--text);
}

/* Shell */
.app-shell{min-height:100%}
.app-header{
  padding:16px 20px;
  border-bottom:1px solid var(--border);
  background:rgba(16,24,39,.55);
  backdrop-filter: blur(8px);
}
.app-title{font-size:16px;font-weight:700}
.app-subtitle{margin-top:4px;color:var(--muted);font-size:12px}

/* Layout */
.layout{
  display:grid;
  grid-template-columns: 360px 1fr;
  gap:14px;
  padding:14px;
}
.sidebar{display:flex;flex-direction:column;gap:14px}
.main{min-width:0}

/* Panels */
.panel{
  border:1px solid var(--border);
  background: linear-gradient(180deg, rgba(16,24,39,.85), rgba(15,22,38,.85));
  border-radius:14px;
  padding:14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.panel-header{display:flex;align-items:flex-end;justify-content:space-between;margin-bottom:10px}
.panel-title{font-size:14px;font-weight:700}
.panel-title-sm{font-size:13px;font-weight:700}
.panel-subtitle{font-size:12px;color:var(--muted);margin-top:3px}

/* Cards */
.cards{display:grid;gap:10px}
.cards-2{grid-template-columns:1fr 1fr}
.card{
  border:1px solid var(--border);
  background: rgba(10,14,24,.35);
  border-radius:12px;
  padding:10px;
}
.card-k{font-size:12px;color:var(--muted)}
.card-v{font-size:20px;font-weight:800;margin-top:6px}
.card-s{margin-top:4px;font-size:12px}
.good{color:var(--good)}
.bad{color:var(--bad)}
.muted{color:var(--muted)}

/* Range form */
.range-form{display:grid;grid-template-columns:1fr 1fr;gap:10px;align-items:end;margin-bottom:12px}
.field span{display:block;font-size:12px;color:var(--muted);margin-bottom:6px}

/* Inputs */
.input,.select{
  width:100%;
  padding:10px 10px;
  border-radius:10px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.25);
  color:var(--text);
  outline:none;
}
.select{padding:10px}

/* Buttons */
.btn{
  border:1px solid var(--border);
  background: rgba(0,0,0,.20);
  color:var(--text);
  padding:10px 12px;
  border-radius:10px;
  cursor:pointer;
}
.btn:hover{border-color:rgba(255,255,255,.18)}
.btn:disabled{opacity:.5;cursor:not-allowed}
.btn.primary{background:rgba(59,130,246,.25);border-color:rgba(59,130,246,.55)}

/* Table */
.table-wrap{
  overflow:auto;
  border:1px solid var(--border);
  border-radius:12px;
}

/* Ensure we do NOT accidentally style generic HTML <table> */
table{border-collapse:unset;width:auto;background:transparent}
th,td{border:none;padding:0;font-size:inherit}

.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  min-width:1000px;
  font-size:12px;
  color:var(--text);
}
.table thead th{
  position:sticky;
  top:0;
  background: rgba(16,24,39,.95);
  border-bottom:1px solid var(--border);
  padding:10px;
  text-align:left;
  white-space:nowrap;
  color: #f3f4f6;
}
.table tbody td{
  padding:10px;
  border-bottom:1px solid rgba(255,255,255,.06);
  vertical-align:top;
  color: var(--text);
}

/* Links inside the table (avoid browser default purple/visited) */
.table a{
  color: var(--link);
  text-decoration:none;
}
.table a:visited{ color: var(--link); }
.table a:hover{ text-decoration:underline; }

/* Mono */
.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Small info blocks */
.kv{margin-top:12px;border-top:1px solid var(--border);padding-top:10px}
.kv-row{display:flex;justify-content:space-between;gap:10px;padding:6px 0}
.kv-k{color:var(--muted);font-size:12px}
.kv-v{font-size:12px}

.panel-section{margin-top:10px}
.list{margin-top:8px}
.list-row{display:flex;justify-content:space-between;gap:10px;padding:6px 0;border-bottom:1px dashed rgba(255,255,255,.06)}
.list-row:last-child{border-bottom:none}
.list-k{font-size:12px;color:var(--muted)}
.list-v{font-size:12px}

/* ----- Badges / pills (kept, but aligned to dark theme) ----- */
.badge{
  padding:2px 8px;
  border-radius:999px;
  font-size:12px;
  display:inline-block;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
  color: var(--text);
}

/* If you output strategy_status_class, these will work */
.badge-green{ background: rgba(34,197,94,.18); border-color: rgba(34,197,94,.35); color:#bbf7d0; }
.badge-red  { background: rgba(239,68,68,.18); border-color: rgba(239,68,68,.35); color:#fecaca; }
.badge-blue { background: rgba(59,130,246,.18); border-color: rgba(59,130,246,.35); color:#bfdbfe; }
.badge-gray { background: rgba(148,163,184,.12); border-color: rgba(148,163,184,.25); color:#e5e7eb; }

/* Long / short row background */
tr.side-long  { background: rgba(34,197,94, 0.06); }
tr.side-short { background: rgba(239,68,68, 0.06); }

/* Side pill */
.pill-side{
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  text-transform: uppercase;
}
.pill-long  { background: rgba(34,197,94,.18); color: #bbf7d0; }
.pill-short { background: rgba(239,68,68,.18); color: #fecaca; }

/* PnL */
.pnl{font-weight:600;font-variant-numeric:tabular-nums}
.pnl-pos{ color: var(--good); }
.pnl-neg{ color: var(--bad); }

.status-details{
  margin-top:4px;
  font-size:11px;
  color: rgba(229,231,235,.75);
  display:flex;
  flex-direction:column;
  gap:2px;
}

/* Broker status pills */
.pill-broker{
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  border:1px solid rgba(255,255,255,.10);
}
.status-not_sent   { background: rgba(148,163,184,.15); color: #e5e7eb; }
.status-sent       { background: rgba(59,130,246,.20); color: #bfdbfe; }
.status-executed   { background: rgba(34,197,94,.20); color: #bbf7d0; }
.status-completed  { background: rgba(245,158,11,.18); color: #fde68a; }


/* LONG / SHORT text color */
.side-long-txt { color: #22c55e; font-weight: 800; }
.side-short-txt { color: #ef4444; font-weight: 800; }

/* PnL formatting */
.pnl-pos { color: #22c55e; font-weight: 800; }
.pnl-neg { color: #ef4444; font-weight: 800; }

/* Trade status background by EXIT type */
.status-exit-tgt   { background: rgba(34,197,94,.18); border:1px solid rgba(34,197,94,.35); }
.status-exit-sl    { background: rgba(239,68,68,.18); border:1px solid rgba(239,68,68,.35); }
.status-exit-trail { background: rgba(59,130,246,.18); border:1px solid rgba(59,130,246,.35); }
.status-exit-eod   { background: rgba(245,158,11,.18); border:1px solid rgba(245,158,11,.35); }
.status-entry      { background: rgba(148,163,184,.12); border:1px solid rgba(148,163,184,.25); }

/* SIDE background colors */
.side-pill{
  display:inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,.12);
}
.side-pill.long  { background: rgba(34,197,94,.18); color:#bbf7d0; }
.side-pill.short { background: rgba(239,68,68,.18); color:#fecaca; }

/* Broker status pill */
.broker-pill{
  display:inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(148,163,184,.15);
  color: #e5e7eb;
}

/* Status color mapping (tune as your broker statuses evolve) */
.broker-not-sent   { background: rgba(148,163,184,.15); color:#e5e7eb; }
.broker-sent       { background: rgba(59,130,246,.20);  color:#bfdbfe; }
.broker-accepted   { background: rgba(16,185,129,.18);  color:#a7f3d0; }
.broker-rejected   { background: rgba(239,68,68,.20);   color:#fecaca; }
.broker-executed   { background: rgba(34,197,94,.20);   color:#bbf7d0; }
.broker-completed  { background: rgba(245,158,11,.18);  color:#fde68a; }


.send-btn {
  margin-bottom: 6px;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(59,130,246,.25);
  color: #e5e7eb;
  cursor: pointer;
}
.send-btn:hover {
  border-color: rgba(59,130,246,.6);
}
.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}


.clock{
  display:flex;
  align-items:center;
  gap:8px;
  padding:6px 10px;
  border:1px solid rgba(255,255,255,.12);
  border-radius:12px;
  background: rgba(0,0,0,.20);
  white-space: nowrap;
}
.clock-time{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-weight: 900;
  font-size: 14px;
  letter-spacing: .5px;
  line-height: 1;
}
.clock-tz{
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  line-height: 1;
}
.clock-sub{
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

.mkt-pill{
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(148,163,184,.15);
  color: #e5e7eb;
  white-space: nowrap;
}
.mkt-open{
  background: rgba(34,197,94,.20);
  color: #bbf7d0;
  border-color: rgba(34,197,94,.35);
}
.mkt-closed{
  background: rgba(239,68,68,.20);
  color: #fecaca;
  border-color: rgba(239,68,68,.35);
}

.trades-sticky-header{
  position: sticky;
  top: 0;
  z-index: 50;
  padding-top: 10px;
  background: linear-gradient(180deg, rgba(16,24,39,.95), rgba(16,24,39,.75));
  backdrop-filter: blur(8px);
}

.trades-fixed-top{
  position: fixed;
  top: 10px;
  left: 380px;   /* adjust based on sidebar width */
  right: 14px;
  z-index: 999;
}

.top-banner{
  position: sticky;
  top: 0;
  z-index: 200;
  border-bottom: 1px solid rgba(255,255,255,.10);
  background: rgba(10,14,24,.75);
  backdrop-filter: blur(10px);
  overflow: hidden;
  padding: 6px 0;
}

.banner-track{
  display: inline-flex;
  gap: 36px;
  white-space: nowrap;
  will-change: transform;
  animation: bannerScroll 22s linear infinite;
  padding-left: 100%;
}

.banner-item{
  font-size: 12px;
  color: var(--text);
  opacity: 0.9;
}

@keyframes bannerScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}