:root {
  --bg: #060b14;
  --panel: rgba(13,21,38,.94);
  --panel-2: rgba(17,28,51,.96);
  --line: rgba(148,163,184,.12);
  --text: #eef4ff;
  --muted: #8fa3bf;
  --blue: #3b82f6;
  --green: #22c55e;
  --yellow: #f59e0b;
  --red: #ef4444;
  --purple: #a78bfa;
  --shadow: 0 16px 40px rgba(0,0,0,.32);
  --sidebar-w: 260px;
  --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  font-size: 13px; color: var(--text);
  background:
    radial-gradient(circle at 0 0, rgba(59,130,246,.16), transparent 24rem),
    radial-gradient(circle at 100% 0, rgba(167,139,250,.1), transparent 22rem),
    var(--bg);
}
.shell {
  display: grid;
  grid-template-columns: minmax(0, var(--sidebar-w)) minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: clip;
}
.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(6,11,20,.94);
  padding: 14px 14px;
  display: flex; flex-direction: column; gap: 12px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  min-width: 0;
}
.sidebar-user {
  padding-bottom: 10px; border-bottom: 1px solid var(--line);
  display: grid; gap: 8px; flex-shrink: 0;
}
.sidebar-user-loading { color: var(--muted); font-size: 11px; padding: 4px 2px; }
.sidebar-user-row { display: flex; align-items: center; gap: 8px; padding: 2px 4px; }
.sidebar-user-icon {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center; color: var(--blue);
  background: rgba(59,130,246,.12); border: 1px solid rgba(59,130,246,.22);
}
.sidebar-user-meta { min-width: 0; flex: 1; }
.sidebar-user-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.sidebar-user-name { font-size: 12px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-ref { font-size: 10px; color: var(--blue); margin-top: 2px; letter-spacing: .04em; }
.sidebar-logout { justify-content: center; }
.sidebar-lang {
  padding: 0 2px 8px; flex-shrink: 0;
}
.sidebar-coin,
.sidebar .coin-switch {
  display: none !important;
}
.sidebar-coin {
  padding: 0 2px 10px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.coin-switch { display: grid; gap: 4px; }
.coin-label {
  color: var(--muted); font-size: 10px; text-transform: uppercase;
  letter-spacing: .08em; margin: 0 2px 2px;
}
.coin-flags { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.coin-flag-btn {
  padding: 8px 6px 7px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: rgba(2,6,23,.45);
  display: grid; justify-items: center; gap: 4px;
  transition: .15s ease; min-width: 0;
}
.coin-flag-btn:hover { border-color: rgba(59,130,246,.45); background: rgba(59,130,246,.06); }
.coin-flag-btn.active {
  border-color: var(--blue); background: rgba(59,130,246,.12);
  box-shadow: 0 0 0 1px rgba(59,130,246,.35);
}
.coin-flag-btn[data-coin-flag="BTC"].active { border-color: #f7931a; box-shadow: 0 0 0 1px rgba(247,147,26,.35); background: rgba(247,147,26,.1); }
.coin-flag-btn[data-coin-flag="ETH"].active { border-color: #627eea; box-shadow: 0 0 0 1px rgba(98,126,234,.35); background: rgba(98,126,234,.12); }
.coin-flag-btn[data-coin-flag="SOL"].active { border-color: #14f195; box-shadow: 0 0 0 1px rgba(20,241,149,.28); background: rgba(153,69,255,.1); }
.coin-flag-icon {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 800; letter-spacing: -.02em;
}
.coin-flag-btn[data-coin-flag="BTC"] .coin-flag-icon {
  color: #fff; background: linear-gradient(135deg, #f7931a, #ffad33);
  box-shadow: 0 2px 8px rgba(247,147,26,.35);
}
.coin-flag-btn[data-coin-flag="ETH"] .coin-flag-icon {
  color: #fff; background: linear-gradient(135deg, #627eea, #8b9cff);
  box-shadow: 0 2px 8px rgba(98,126,234,.35);
}
.coin-flag-btn[data-coin-flag="SOL"] .coin-flag-icon {
  color: #fff; background: linear-gradient(135deg, #9945ff, #14f195);
  box-shadow: 0 2px 8px rgba(153,69,255,.3);
}
.coin-flag-name { font-size: 10px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.coin-flag-btn.active .coin-flag-name { color: var(--text); }
.lang-switch { display: grid; gap: 4px; }
.lang-flags { display: flex; gap: 6px; }
.lang-flag-btn {
  flex: 1; padding: 7px 10px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: rgba(2,6,23,.45);
  display: grid; place-items: center; transition: .15s ease;
}
.lang-flag-btn:hover { border-color: rgba(59,130,246,.45); background: rgba(59,130,246,.08); }
.lang-flag-btn.active {
  border-color: var(--blue); background: rgba(59,130,246,.15);
  box-shadow: 0 0 0 1px rgba(59,130,246,.35);
}
.lang-flag-svg { width: 28px; height: 20px; display: block; border-radius: 2px; }
.login-lang { position: fixed; top: 16px; right: 16px; }
.login-lang .lang-flag-btn { flex: 0; min-width: 48px; }
.sidebar-spacer { flex: 1; min-height: 8px; }
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 2px 4px 10px; border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  box-shadow: var(--shadow);
}
.brand h1 { margin: 0; font-size: 14px; font-weight: 800; letter-spacing: -.02em; }
.brand p { margin: 1px 0 0; color: var(--muted); font-size: 10px; }
.nav { display: grid; gap: 4px; }
.nav-label {
  color: var(--muted); font-size: 10px; text-transform: uppercase;
  letter-spacing: .08em; margin: 8px 4px 4px;
}
.nav-link {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 10px;
  color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600;
  border: 1px solid transparent;
}
.nav-link:hover { color: var(--text); background: rgba(148,163,184,.06); }
.nav-link.active { color: var(--text); background: rgba(59,130,246,.12); border-color: rgba(59,130,246,.25); }
body.read-only .main button,
body.read-only .main select,
body.read-only .main .strategy-card,
body.read-only .main details > summary { pointer-events: none; opacity: .58; }
body.read-only .main input[type="checkbox"],
body.read-only .main .mod-account-item { pointer-events: auto; opacity: 1; }
body.read-only .sidebar-logout { pointer-events: auto; opacity: 1; }
body.role-moderator .sidebar .side-section { display: none !important; }
body.role-user .sidebar .nav,
body.role-user .sidebar .side-section { display: none !important; }
body.role-user #accountSelect { display: none !important; }
.main {
  padding: 12px clamp(8px, 1.5vw, 16px) 24px;
  display: grid; gap: 12px; align-content: start;
  min-width: 0; width: 100%; max-width: 100%;
}
.topbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); min-width: 0;
}
.topbar h2 { margin: 0; font-size: 1.15rem; font-weight: 800; letter-spacing: -.03em; }
.topbar p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.topbar-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 9px; font-size: 11px; color: var(--muted); background: rgba(2,6,23,.35);
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.pill.ok .dot { background: var(--green); box-shadow: 0 0 6px rgba(34,197,94,.5); }
.pill.warn .dot { background: var(--yellow); }
.pill.bad .dot { background: var(--red); }
.card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); box-shadow: var(--shadow); overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  font-weight: 650; font-size: 12px;
}
.card-head-left { display: flex; align-items: center; gap: 7px; }
.card-body { padding: 10px 12px 12px; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.kpi {
  padding: 10px 11px; border-radius: 11px; border: 1px solid var(--line);
  background: rgba(2,6,23,.28);
}
.kpi-top { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.kpi-val { font-size: 1.05rem; font-weight: 800; margin-top: 5px; letter-spacing: -.02em; line-height: 1.15; }
.kpi-sub { font-size: 10px; color: var(--muted); margin-top: 3px; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.btn {
  border: 0; border-radius: 10px; padding: 8px 11px;
  color: white; background: var(--blue); font-weight: 650; font-size: 12px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: #334155; }
.btn.danger { background: #dc2626; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.block { width: 100%; justify-content: center; }
.btn.sm { padding: 5px 8px; font-size: 11px; border-radius: 8px; }
select, input {
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2); color: var(--text); padding: 8px 10px; font-size: 12px;
}
label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.form-grid { display: grid; gap: 8px; margin-top: 8px; }
.badge {
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; letter-spacing: .03em;
}
.badge.long { color: #86efac; border: 1px solid rgba(34,197,94,.28); background: rgba(34,197,94,.1); }
.badge.short { color: #fca5a5; border: 1px solid rgba(239,68,68,.28); background: rgba(239,68,68,.1); }
.badge.flat { color: var(--muted); border: 1px solid var(--line); }
.strat-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.strat-badge {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px; padding: 4px 10px; font-size: 11px; font-weight: 650;
  letter-spacing: -.01em;
}
.strat-badge.confirm {
  color: #c4b5fd; border: 1px solid rgba(167,139,250,.35); background: rgba(139,92,246,.12);
}
.strat-badge.leverage {
  color: #93c5fd; border: 1px solid rgba(59,130,246,.35); background: rgba(59,130,246,.12);
}
.strat-badge.trail {
  color: #fde68a; border: 1px solid rgba(245,158,11,.35); background: rgba(245,158,11,.12);
}
.strat-badge.flip {
  color: #86efac; border: 1px solid rgba(34,197,94,.35); background: rgba(34,197,94,.12);
}
.i { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.i svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i.lg svg { width: 18px; height: 18px; }
.i.sm svg { width: 13px; height: 13px; }
table { width: 100%; border-collapse: collapse; table-layout: auto; }
th, td {
  text-align: left; padding: 6px 7px; font-size: 11px;
  border-bottom: 1px solid var(--line); vertical-align: middle;
}
th { color: var(--muted); font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; line-height: 1.25; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-clip { max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr:hover td { background: rgba(59,130,246,.04); }
.table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-fit { overflow-x: auto; }
table.table-fit { table-layout: fixed; width: 100%; min-width: 0; }
table.table-fit .cell-clip { max-width: 100%; }
.row-link { cursor: pointer; }
.empty { color: var(--muted); text-align: center; padding: 16px; font-size: 12px; }
.grid-2 { display: grid; grid-template-columns: 1.15fr .85fr; gap: 12px; }
.chart-stage { position: relative; }
.chart-levels-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  margin-top: 5px; min-height: 0;
}
.chart-levels-bar:empty { display: none; }
.level-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 650; letter-spacing: .02em;
  padding: 2px 7px; border-radius: 6px; border: 1px solid;
  white-space: nowrap; background: rgba(2, 6, 23, .45);
}
.level-tag.side { text-transform: uppercase; letter-spacing: .05em; font-weight: 800; }
.level-dot { width: 8px; height: 3px; border-radius: 2px; flex-shrink: 0; }
.level-meta { font-size: 10px; color: var(--muted); margin-left: auto; }

/* ponytail: hide low-priority table cols before horizontal scroll kicks in */
@media (max-width: 1600px) { .col-optional { display: none; } }
@media (max-width: 1320px) { .col-extra { display: none; } }
@media (max-width: 1080px) { .col-medium { display: none; } }

.account-cards { display: none; gap: 8px; }
.account-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 11px;
  background: rgba(2,6,23,.28); cursor: pointer;
}
.account-card:hover { border-color: rgba(59,130,246,.35); }
.account-card.open { border-color: rgba(59,130,246,.45); box-shadow: inset 3px 0 0 rgba(59,130,246,.55); }
.account-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.account-card-title { font-weight: 700; font-size: 12px; line-height: 1.3; min-width: 0; }
.account-card-strat { font-size: 10px; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-card-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px;
  font-size: 10px; color: var(--muted);
}
.account-card-grid strong { display: block; color: var(--text); font-size: 11px; margin-top: 2px; }

@media (max-width: 1100px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; max-height: none; }
  .grid-2 { grid-template-columns: 1fr; }
  :root { --sidebar-w: 100%; }
}
@media (max-width: 768px) {
  .table-desktop { display: none !important; }
  .account-cards { display: grid; }
  .topbar h2 { font-size: 1rem; }
  .topbar-actions { width: 100%; }
  .topbar-actions .btn, .topbar-actions select { flex: 1; }
  .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar .nav { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .sidebar .nav-link { justify-content: center; padding: 7px 6px; font-size: 10px; }
  .sidebar .nav-label { display: none; }
  .sidebar .brand p { display: none; }
}
@media (max-width: 480px) {
  .kpi-row { grid-template-columns: 1fr; }
  .account-card-grid { grid-template-columns: 1fr 1fr; }
}
