:root {
  --bg: #020914;
  --bg-panel: rgba(7, 18, 34, 0.9);
  --text: #eef8ff;
  --muted: #93a9bb;
  --accent: #08d8ff;
  --accent-2: #5fe6ff;
  --danger: #ff5f7a;
  --border: rgba(95, 230, 255, 0.22);
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.38);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 700px at 14% 8%, #0d2344 0%, var(--bg) 68%);
  min-height: 100vh;
}
body.auth-locked #appShell { display: none; }
body:not(.auth-locked) #authGate { display: none; }

/* ── Page loader overlay ──────────────────────────────────────── */
.page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(1200px 700px at 14% 8%, #0e1520 0%, #0a0a0f 68%);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.page-loader.loader-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: fit-content;
}
.loader-brand {
  font-family: "Sora", sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: #ffffff;
  text-transform: uppercase;
}
.loader-sub {
  font-family: "Sora", sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(8,216,255,0.5);
  text-transform: uppercase;
  margin-top: -18px;
  text-align: center;
  width: 100%;
  letter-spacing: 0.18em;
}
.ekg-wrap {
  width: 100%;
  overflow: hidden;
  position: relative;
}
.ekg-canvas {
  display: block;
  width: 100%;
  height: 120px;
}
.loader-msg {
  margin: 0;
  font-family: "Sora", sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  color: rgba(8, 216, 255, 0.7);
  letter-spacing: 0.06em;
  text-align: center;
  min-height: 1.4em;
  transition: opacity 0.3s ease;
}
.loader-msg.fading { opacity: 0; }
/* ───────────────────────────────────────────────────────────── */

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.24;
  pointer-events: none;
}
.orb-a { width: 260px; height: 260px; background: var(--accent); top: -40px; right: 15%; }
.orb-b { width: 320px; height: 320px; background: #1493d1; bottom: -80px; left: -60px; }

.auth-gate {
  min-height: 100vh;
  display: grid;
  align-items: center;
  padding: 28px;
  justify-content: center;
}
.auth-gate-card {
  width: min(1040px, 96vw);
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  overflow: hidden;
}
.auth-gate-left {
  min-height: 420px;
  padding: 24px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  border-right: 1px solid var(--border);
  background: linear-gradient(145deg, rgba(8, 216, 255, 0.07), rgba(95, 230, 255, 0.03));
  text-align: center;
}
.auth-gate-left h1 {
  margin: 0;
  font-family: "Sora", sans-serif;
  font-size: clamp(1.8rem, 3vw, 2.7rem);
}
.auth-gate-left p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}
.auth-brand {
  font-family: "Sora", sans-serif;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 0.3em;
  color: #ffffff;
  text-transform: uppercase;
  white-space: nowrap;
}
.auth-brand-sub {
  font-family: "Sora", sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  color: rgba(8,216,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-top: -4px;
}
.auth-gate-left .ekg-wrap {
  width: 100%;
  max-width: 420px;
}
.auth-gate-right {
  padding: 26px;
  display: grid;
  gap: 10px;
  align-content: center;
}
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 4px;
}
.auth-tab {
  flex: 1;
  padding: 8px 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  font-family: "Sora", sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
  transition: color 0.2s, border-color 0.2s;
}
.auth-tab:first-child { border-radius: 8px 0 0 8px; }
.auth-tab:last-child { border-radius: 0 8px 8px 0; }
.auth-tab:hover:not(.auth-tab-active) {
  color: #c0e8ef;
  border-color: rgba(8, 216, 255, 0.25);
}
.auth-tab-active {
  color: #fff;
  border-color: #08d8ff;
  background: #0e3a4a;
  box-shadow: 0 0 12px rgba(8, 216, 255, 0.3), inset 0 0 8px rgba(8, 216, 255, 0.15);
  border-bottom: 2px solid #08d8ff;
}
.auth-verified-banner {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #86efac;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  text-align: center;
}
.auth-gate-right h2 {
  margin: 0;
  font-family: "Sora", sans-serif;
}
.auth-gate-right label {
  color: var(--muted);
  font-size: 0.86rem;
  display: grid;
  gap: 6px;
}
.auth-gate-right #loginBtn,
.auth-gate-right #signupBtn {
  margin-top: 6px;
  border-color: rgba(8, 216, 255, 0.64);
  background: linear-gradient(120deg, rgba(8, 216, 255, 0.3), rgba(95, 230, 255, 0.14));
  color: #e7fbff;
  font-weight: 700;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0;
  color: var(--muted);
  font-size: 0.8rem;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.google-sign-in-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.google-sign-in-btn:hover {
  background: rgba(255,255,255,0.12);
}
.google-auth-section {
  display: grid;
  gap: 10px;
}

.access-request-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.access-request-hint {
  margin: 0 0 10px;
  font-size: 0.82rem;
  color: var(--muted);
}
.access-request-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.access-request-form input {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.88rem;
}
.access-request-form button {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.84rem;
  cursor: pointer;
  white-space: nowrap;
}
.access-request-form button:hover {
  background: rgba(255,255,255,0.1);
}
.auth-status.ok { color: #5ef6a3; margin-top: 8px; }
.auth-status.err { color: #ff8fa3; margin-top: 8px; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 12px;
  padding: 12px 16px 0;
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.nav-dock {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0 8px;
}
.nav-dock:empty { display: none; }
.topbar h1 {
  margin: 0;
  font-family: "Sora", sans-serif;
  font-size: clamp(1rem, 2.2vw, 1.3rem);
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: #ffffff;
  text-align: center;
}
.app-subtitle {
  margin: 2px 0 0;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(8,216,255,0.5);
  text-align: center;
}
.subtitle { margin: 6px 0 0; color: var(--muted); }

.topbar-controls { display: flex; align-items: center; gap: 10px; }
.auth-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.topbar-controls select,
.topbar-controls button,
.auth-gate-right input,
.auth-gate-right button,
.auth-controls input,
.auth-controls button,
.inline-fields input,
.row-actions button {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
}
.auth-controls input {
  min-width: 140px;
}
.auth-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin: -4px 0 8px 0;
  padding: 0;
}
.auth-status {
  font-size: 0.8rem;
  color: var(--muted);
  height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  box-sizing: border-box;
}
.auth-clock {
  border-style: solid;
}
.broker-indicator {
  border-style: solid;
  border-color: rgba(168, 130, 255, 0.35);
}
.broker-indicator.is-set {
  color: #d8c6ff;
  border-color: rgba(168, 130, 255, 0.65);
  background: rgba(140, 100, 255, 0.1);
}

/* Platform switcher dropdown */
.platform-switcher-wrap {
  position: relative;
}
.platform-switcher-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  background: rgba(140, 100, 255, 0.1);
  border: 1px solid rgba(168, 130, 255, 0.55);
  border-radius: 10px;
  color: #d8c6ff;
  font-size: 0.75rem;
  padding: 0 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  box-sizing: border-box;
}
.platform-switcher-btn:hover {
  background: rgba(140, 100, 255, 0.2);
}
.platform-switcher-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 190px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 0;
  z-index: 4000;
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
}
.platform-switcher-dropdown.is-hidden { display: none; }
.platform-switcher-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 14px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.platform-switcher-item:hover { background: rgba(255,255,255,0.05); }
.platform-switcher-item.is-selected { color: #d8c6ff; font-weight: 600; }
#platformSwitcherLabel {
  display: flex;
  align-items: center;
  gap: 6px;
}
.psw-icon {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  vertical-align: middle;
  flex-shrink: 0;
}
.platform-switcher-item .psw-check { width: 14px; color: #a882ff; }
.platform-switcher-item .psw-active-badge {
  margin-left: auto;
  font-size: 0.68rem;
  background: rgba(140,100,255,0.18);
  color: #c4aaff;
  border: 1px solid rgba(168,130,255,0.4);
  border-radius: 6px;
  padding: 1px 6px;
}
.platform-switcher-item .psw-inactive-badge {
  margin-left: auto;
  font-size: 0.68rem;
  background: rgba(120,120,140,0.15);
  color: #8899aa;
  border: 1px solid rgba(120,130,150,0.3);
  border-radius: 6px;
  padding: 1px 6px;
}
.acct-active-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--muted);
}
.acct-active-toggle input { cursor: pointer; }
.acct-toggle-label { user-select: none; }
.bot-indicator {
  border-style: solid;
  border-color: rgba(105, 210, 255, 0.35);
}
.bot-indicator.is-active {
  color: #b6fff0;
  border-color: rgba(100, 248, 210, 0.75);
  background: rgba(70, 230, 185, 0.12);
}
.bot-indicator.is-idle {
  color: #d7edff;
  border-color: rgba(95, 190, 255, 0.6);
  background: rgba(49, 126, 205, 0.16);
}
.bot-indicator.is-down {
  color: #ffd8d8;
  border-color: rgba(255, 125, 125, 0.75);
  background: rgba(220, 72, 72, 0.16);
}
.conn-indicator {
  font-size: 0.8rem;
  height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  white-space: nowrap;
  font-weight: 600;
  transition: color 0.3s, border-color 0.3s, background 0.3s;
  color: var(--muted);
  border-style: solid;
  border-color: rgba(105, 210, 255, 0.35);
  box-sizing: border-box;
}
.conn-indicator.is-ok {
  color: #b6fff0;
  border-color: rgba(100, 248, 210, 0.75);
  background: rgba(70, 230, 185, 0.12);
}
.conn-indicator.is-pending {
  color: #ffe0a0;
  border-color: rgba(255, 200, 80, 0.5);
  background: rgba(255, 180, 50, 0.1);
}
.conn-indicator.is-stale {
  color: #ffd8d8;
  border-color: rgba(255, 125, 125, 0.75);
  background: rgba(220, 72, 72, 0.16);
}

.row-actions .danger { border-color: rgba(255,95,122,0.55); color: #ffd6de; }

.view-menu {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
}
.view-menu::-webkit-scrollbar { display: none; }
.nav-date-range {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(99,102,241,0.12);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
  margin-left: 8px;
  cursor: pointer;
}
.menu-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 9px;
  padding: 8px 16px;
  font-size: 0.84rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
  font-family: inherit;
  letter-spacing: 0.01em;
}
.menu-btn.is-active {
  color: #e7fbff;
  background: rgba(8, 216, 255, 0.15);
  font-weight: 600;
  box-shadow: 0 1px 8px rgba(8, 216, 255, 0.12);
}
.menu-btn:not(.is-active):hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
.view-hint {
  margin: 0;
  padding: 0 24px 8px;
  color: var(--muted);
  font-size: 0.9rem;
}
/* ── Alert stack ───────────────────────────────────────────── */
.alert-stack {
  position: fixed;
  right: 18px;
  bottom: 16px;
  z-index: 40;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  max-width: 420px;
  pointer-events: none;
}
.alert-stack > * { pointer-events: auto; }

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: rgba(255, 186, 73, 0.18);
  border: 1px solid rgba(255, 186, 73, 0.7);
  color: #ffe8bf;
  padding: 10px 12px;
  border-radius: 10px;
  backdrop-filter: blur(8px);
  font-size: 0.85rem;
  animation: alert-slide-in 0.2s ease;
}
.alert-item .alert-msg { flex: 1; }
.alert-item .alert-time {
  font-size: 0.7rem;
  color: rgba(255,228,191,0.5);
  white-space: nowrap;
  margin-top: 1px;
}
.alert-item .alert-close {
  background: none;
  border: none;
  color: rgba(255,228,191,0.6);
  cursor: pointer;
  padding: 0 2px;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}
.alert-item .alert-close:hover { color: #fff; }

.alert-overflow-badge {
  background: rgba(255, 120, 60, 0.22);
  border: 1px solid rgba(255, 120, 60, 0.7);
  color: #ffd0b0;
  padding: 10px 14px;
  border-radius: 10px;
  backdrop-filter: blur(8px);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  animation: alert-slide-in 0.2s ease;
}
.alert-overflow-badge:hover {
  background: rgba(255, 120, 60, 0.32);
}

@keyframes alert-slide-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Alert log in settings ─────────────────────────────────── */
.alert-log-subhead {
  margin: 20px 0 8px;
  font-size: 0.95rem;
  color: var(--fg);
}
.alert-log-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.alert-log-entry {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 6px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.8rem;
}
.alert-log-entry.is-critical { border-color: rgba(255,100,100,0.4); background: rgba(255,80,80,0.06); }
.alert-log-entry.is-warning  { border-color: rgba(255,186,73,0.3); }
.alert-log-entry .alert-log-time {
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 140px;
}
.alert-log-entry .alert-log-severity {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  min-width: 60px;
  flex-shrink: 0;
}
.alert-log-entry.is-critical .alert-log-severity { color: #ff8888; }
.alert-log-entry.is-warning .alert-log-severity  { color: #ffcc70; }
.alert-log-entry .alert-log-code {
  color: var(--muted);
  font-family: monospace;
  font-size: 0.75rem;
  min-width: 120px;
  flex-shrink: 0;
}
.alert-log-entry .alert-log-msg { color: #ffe8bf; flex: 1; }

/* ── Alert calendar ────────────────────────────────────────── */
.alert-calendar { margin-bottom: 6px; }
.alert-calendar-month {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: 0.05em;
}
.alert-day-card.is-empty {
  opacity: 0.35;
  border-color: rgba(255,255,255,0.05);
}
.alert-day-card.is-future {
  opacity: 0.15;
  pointer-events: none;
}
.alert-calendar-head {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 4px;
}
.alert-calendar-head > div {
  text-align: center;
  color: #9eb0df;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.alert-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.alert-day-pad { min-height: 52px; }
.alert-day-card {
  min-height: 52px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 4px 5px;
  background: rgba(255,255,255,0.02);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: default;
}
.alert-day-card.is-today {
  box-shadow: inset 0 0 0 1.5px rgba(8,216,255,0.4);
}
.alert-day-card.is-selected {
  box-shadow: inset 0 0 0 2px #08d8ff;
  background: rgba(8,216,255,0.12);
}
.alert-day-card:not(.is-future):hover {
  background: rgba(255,255,255,0.06);
}
.alert-day-card.has-warning {
  background: rgba(255,186,73,0.14);
  border-color: rgba(255,186,73,0.5);
}
.alert-day-card.has-critical {
  background: rgba(255,80,80,0.16);
  border-color: rgba(255,100,100,0.6);
}
.alert-day-top {
  display: flex;
  justify-content: flex-end;
}
.alert-day-count {
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
  padding: 1px 5px;
  font-size: 0.7rem;
  font-weight: 700;
}
.alert-day-card.has-warning .alert-day-count {
  background: rgba(255,186,73,0.25);
  border: 1px solid rgba(255,186,73,0.6);
  color: #ffe0a0;
}
.alert-day-card.has-critical .alert-day-count {
  background: rgba(255,80,80,0.25);
  border: 1px solid rgba(255,100,100,0.7);
  color: #ffb0b0;
}
.alert-day-date {
  color: #95b9d3;
  font-size: 0.65rem;
  margin-top: 3px;
}
.alert-item.is-critical {
  background: rgba(255, 80, 80, 0.18);
  border-color: rgba(255, 100, 100, 0.7);
  color: #ffd0d0;
}

/* ── Alert calendar side panel offset ──────────────────────── */
.alert-cal-panel {
  top: auto;
  bottom: 16px;
  transform: none;
  z-index: 10;
}
.alert-cal-panel .cal-panel-tab {
  border-color: rgba(255, 100, 100, 0.35);
}
.alert-cal-panel.is-stowed .cal-panel-tab {
  background: rgba(255, 80, 80, 0.08);
  border-color: rgba(255, 100, 100, 0.35);
}
.alert-cal-panel.is-stowed .cal-panel-tab:hover {
  background: rgba(255, 80, 80, 0.18);
}
.alert-cal-panel .cal-panel-tab svg { color: #ff9090; }
.alert-cal-panel .alert-calendar-grid,
.alert-cal-panel .alert-calendar-head { gap: 3px; }
.alert-cal-panel .alert-day-card { min-height: 48px; padding: 3px; border-radius: 6px; }
.alert-cal-panel .alert-day-date { font-size: 0.58rem; }
.alert-cal-panel .alert-day-count { font-size: 0.65rem; min-width: 18px; }

/* ── Report a Problem side panel ──────────────────────────── */
.report-panel .cal-panel-tab {
  border-color: rgba(255, 186, 73, 0.35);
}
.report-panel.is-stowed .cal-panel-tab {
  background: rgba(255, 186, 73, 0.08);
  border-color: rgba(255, 186, 73, 0.35);
}
.report-panel.is-stowed .cal-panel-tab:hover {
  background: rgba(255, 186, 73, 0.18);
}
.report-panel .cal-panel-tab svg { color: #ffbe60; }
.report-name-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.report-name-fields.is-hidden { display: none; }
.report-name-label {
  font-size: 0.72rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.report-name-input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  padding: 6px 8px;
  box-sizing: border-box;
}
.report-name-input:focus {
  outline: none;
  border-color: rgba(255, 186, 73, 0.5);
}
.report-textarea {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  padding: 8px 10px;
  resize: vertical;
  margin-bottom: 10px;
  box-sizing: border-box;
}
.report-textarea:focus {
  outline: none;
  border-color: rgba(255, 186, 73, 0.5);
}
.report-submit-btn {
  width: 100%;
  margin-bottom: 10px;
}
.report-status {
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-all;
}
.report-status.ok { color: #4deba0; }
.report-status.err { color: var(--danger); }
.report-status a { color: #08d8ff; text-decoration: underline; }

.topbar-controls button.live-on {
  border-color: rgba(8, 216, 255, 0.68);
  color: #d5f6ff;
  background: linear-gradient(120deg, rgba(8, 216, 255, 0.22), rgba(95, 230, 255, 0.1));
}
.layout {
  padding: 6px 12px 16px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  transition: opacity 150ms ease;
}
/* Non-widget panels and the customize bar always span all columns */
.panel { grid-column: 1 / -1; }
.widget-customize-wrap { grid-column: 1 / -1; }
.is-hidden { display: none !important; }
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 8px;
  backdrop-filter: blur(10px);
}
.panel h2 { margin: 0 0 6px; font-size: 0.95rem; }
.section-label { margin: 6px 0 4px; color: var(--muted); font-size: 0.78rem; }
.has-tip {
  cursor: help;
}
.has-tip:focus-visible {
  outline: 2px solid rgba(8, 216, 255, 0.75);
  outline-offset: 2px;
}
.tooltip-float {
  position: fixed;
  z-index: 9999;
  min-width: 170px;
  max-width: min(340px, 88vw);
  white-space: normal;
  text-align: left;
  line-height: 1.3;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(8, 216, 255, 0.5);
  background: rgba(8, 12, 23, 0.96);
  color: #dbe6ff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.34);
  pointer-events: none;
  font-size: 0.82rem;
}
.tooltip-float[hidden] { display: none; }

.kpi-grid {
  display: grid;
  /* columns set dynamically by JS from available width */
  gap: 10px;
}
.kpi-slot {
  border-radius: 12px;
  border: 1px dashed rgba(255,255,255,0.08);
  min-height: 62px;
  transition: border-color 0.15s, background 0.15s;
}
.kpi-slot.kpi-slot-hover {
  border-color: var(--accent);
  background: rgba(8,216,255,0.06);
}
.kpi {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 10px;
  transition: box-shadow 0.1s, opacity 0.1s, border-color 0.1s;
  position: relative;
  z-index: 1;
}
.kpi[draggable="true"] { cursor: grab; user-select: none; }
.kpi[draggable="true"]:active { cursor: grabbing; }
.kpi.kpi-dragging { opacity: 0.35; }
.kpi.kpi-swap-hover { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.kpi .k { color: var(--muted); font-size: 0.78rem; }
.kpi .v { margin-top: 4px; font-size: 1.14rem; font-weight: 700; }
.kpi .sub { margin-top: 2px; font-size: 0.7rem; color: var(--muted); font-weight: 400; }
.kpi.is-negative {
  background: rgba(220,72,72,0.16);
  border-color: rgba(255,125,125,0.75);
  color: #ffd8d8;
}
.kpi.is-negative .k { color: rgba(255,216,216,0.7); }
.kpi.is-positive {
  background: rgba(49,208,170,0.15);
  border-color: rgba(49,208,170,0.4);
  color: #31d0aa;
}
.kpi.is-positive .k { color: rgba(49,208,170,0.7); }

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.chart { width: 100%; height: 200px; }
.chart-short { height: 160px; }

.stat-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.stat-list.triple {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.stat {
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 5px 7px;
}
.stat .label { color: var(--muted); font-size: 0.7rem; }
.stat .value { font-weight: 700; margin-top: 1px; font-size: 0.92rem; }

textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(4,7,15,0.74);
  color: var(--text);
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.hint { color: var(--muted); margin-top: 0; }
.row-actions { display: flex; gap: 6px; margin-top: 8px; }
.inline-fields {
  display: grid;
  gap: 8px;
  margin: 8px 0 2px;
}
.inline-fields-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.inline-fields label {
  color: var(--muted);
  font-size: 0.8rem;
  display: grid;
  gap: 4px;
}
.codebox {
  margin: 10px 0 0;
  border-radius: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  background: rgba(4,7,15,0.74);
  color: #d4defe;
  overflow: auto;
  max-height: 220px;
}
.advice-list {
  display: grid;
  gap: 8px;
}
.advice-item {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px;
  font-size: 0.9rem;
  line-height: 1.35;
}
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.pill.ok {
  background: rgba(8, 216, 255, 0.16);
  border: 1px solid rgba(8, 216, 255, 0.5);
  color: #d4f7ff;
}
.pill.warn {
  background: rgba(255, 186, 73, 0.2);
  border: 1px solid rgba(255, 186, 73, 0.62);
  color: #ffe2ac;
}
.pill.bad {
  background: rgba(255, 95, 122, 0.2);
  border: 1px solid rgba(255, 95, 122, 0.62);
  color: #ffd3db;
}

.table-wrap { overflow: auto; }
#tradesScrollSentinel { height: 1px; display: none; }
.trades-table-wrap {
  height: 420px;
  overflow-y: scroll;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.trades-table-wrap::-webkit-scrollbar { width: 5px; }
.trades-table-wrap::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.trades-scroll-sentinel { height: 1px; display: none; }
.small-table { max-height: 200px; }
table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
th, td {
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 4px 4px;
  text-align: left;
}
th { color: var(--muted); font-weight: 600; }

#tradesTable { font-size: 0.72rem; }
#tradesTable thead th {
  position: sticky;
  top: 0;
  background: var(--bg-panel);
  z-index: 1;
}
#tradesTable tr.trades-row-tip { position: relative; }
#tradesTable tr.is-trade-selected {
  background: #2a2f5a !important;
  box-shadow: 1px 0 0 0 rgba(99,102,241,0.7),
              -1px 0 0 0 rgba(99,102,241,0.7),
              0 1px 0 0 rgba(99,102,241,0.7);
}
#tradesTable tr.is-trade-selected::after {
  content: "Symbol: " attr(data-symbol);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 100%;
  background: #2a2f5a;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid rgba(99,102,241,0.7);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 5px 16px 0;
  white-space: nowrap;
  pointer-events: none;
  opacity: 1;
  transition: none;
  z-index: 10;
}
#tradesTable th, #tradesTable td { padding: 4px 6px; }

#tradesTable td.pnl-pos,
#tradesTable tr.pnl-pos td:nth-child(5) {
  color: #2cd7ff;
  font-weight: 700;
}

#tradesTable td.pnl-neg,
#tradesTable tr.pnl-neg td:nth-child(5) {
  color: #ff5b6e;
  font-weight: 700;
}

#tradesTable td.pnl-flat,
#tradesTable tr.pnl-flat td:nth-child(5) {
  color: #dbe6ff;
}

.recent-trades-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.recent-trades-head .hint {
  margin: 0;
}
.recent-trades-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.recent-trades-actions button {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
}
/* ── Side panel stack container ────────────────────────────────── */
.side-panel-stack {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
}

/* ── Calendar side panel ──────────────────────────────────────── */
.cal-panel {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  filter: drop-shadow(-4px 0 18px rgba(0,0,0,0.45));
}
.cal-panel:not(.side-panel-stack .cal-panel) {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 400;
}
.cal-panel.is-stowed { align-items: center; }
.cal-panel[data-views] { /* handled by setView toggling is-hidden */ }

.cal-panel-tab {
  flex-shrink: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 10px 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--accent);
  padding: 0;
  width: 30px;
  transition: background 0.15s, width 0.2s, padding 0.2s;
}
.cal-panel-tab:hover { background: rgba(8,216,255,0.12); }

/* Stowed: compact pill with label */
.cal-panel.is-stowed .cal-panel-tab {
  width: auto;
  padding: 10px 8px;
  gap: 6px;
  flex-direction: column;
  background: rgba(8,216,255,0.08);
  border-color: rgba(8,216,255,0.25);
}
.cal-panel.is-stowed .cal-panel-tab:hover {
  background: rgba(8,216,255,0.18);
}

.cal-panel-body {
  width: 308px;
  overflow: hidden;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 0 0 0 0;
  padding: 10px 10px 10px 10px;
  transition: width 0.28s cubic-bezier(.4,0,.2,1),
              opacity 0.22s ease,
              padding 0.28s cubic-bezier(.4,0,.2,1);
}
.cal-panel.is-stowed .cal-panel-body {
  width: 0;
  height: 0;
  opacity: 0;
  padding: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Compact calendar cells inside the panel */
.cal-panel .trade-day-card { min-height: 48px; padding: 3px 3px; border-radius: 6px; }
.cal-panel .trade-calendar-grid,
.cal-panel .trade-calendar-head { gap: 3px; }
.cal-panel .trade-day-date { font-size: 0.6rem; white-space: nowrap; overflow: hidden; }
.cal-panel .trade-day-count { font-size: 0.65rem; }
/* ────────────────────────────────────────────────────────────── */

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.cal-header .section-label { margin: 0; }
.cal-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cal-filter-badge {
  font-size: 0.78rem;
  color: var(--accent);
  background: rgba(99,102,241,0.12);
  border: 1px solid rgba(99,102,241,0.3);
  border-radius: 6px;
  padding: 2px 8px;
  white-space: nowrap;
}
.cal-clear-btn {
  font-size: 0.75rem;
  color: var(--muted);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.cal-clear-btn:hover { color: var(--text); background: rgba(255,255,255,0.1); }
.cal-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
.cal-hint {
  font-size: 0.76rem;
  color: var(--muted);
  margin: 0 0 10px;
}
.trade-calendar {
  display: grid;
  gap: 8px;
}
.trade-calendar-head {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.trade-calendar-head > div {
  text-align: center;
  color: #9eb0df;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.trade-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.trade-day-pad {
  min-height: 74px;
}
.trade-day-card {
  min-height: 74px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.03);
  color: #dbe6ff;
  cursor: pointer;
  text-align: left;
}
.trade-day-top {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.trade-day-count {
  border: 1px solid rgba(8, 216, 255, 0.5);
  background: rgba(8, 216, 255, 0.16);
  color: #e6efff;
  border-radius: 999px;
  min-width: 24px;
  text-align: center;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 2px 6px;
}
.trade-day-date {
  color: #95b9d3;
  font-size: 0.72rem;
  margin-top: 6px;
}
.trade-day-card.is-profit {
  background: rgba(8, 216, 255, 0.2);
  border-color: rgba(8, 216, 255, 0.58);
}
.trade-day-card.is-profit .trade-day-count {
  border-color: rgba(8, 216, 255, 0.82);
  background: rgba(8, 216, 255, 0.32);
  color: #dcf9ff;
}
.trade-day-card.is-loss {
  background: rgba(255, 102, 102, 0.22);
  border-color: rgba(255, 102, 102, 0.62);
  color: #ff6b6b;
}
.trade-day-card.is-loss .trade-day-count {
  border-color: rgba(255, 102, 102, 0.82);
  background: rgba(255, 102, 102, 0.34);
  color: #ff5252;
}
.trade-day-card.is-loss .trade-day-date {
  color: #ff8c8c;
}
.trade-day-card.is-flat {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.28);
}
/* Today — dashed white outline, visually distinct from selected */
.trade-day-card.is-today {
  outline: 2px dashed rgba(255, 255, 255, 0.5);
  outline-offset: -1px;
}

/* Selected (single day) — solid cyan outline */
.trade-day-card.is-selected {
  outline: 2px solid #08d8ff;
  outline-offset: -1px;
  box-shadow: 0 0 8px rgba(8, 216, 255, 0.25);
}
.trade-day-card.is-selected .trade-day-count {
  border-color: rgba(8, 216, 255, 0.7);
}

/* Today when selected — cyan outline + inner white glow */
.trade-day-card.is-today.is-selected {
  outline: 2px solid #08d8ff;
  box-shadow: 0 0 10px rgba(8, 216, 255, 0.3), inset 0 0 0 1.5px rgba(255, 255, 255, 0.5);
}

/* Range: start — round left, square right, cyan bracket */
.trade-day-card.is-range-start {
  border-radius: 10px 0 0 10px;
  border-right-color: transparent !important;
  outline: none;
  box-shadow: -4px 0 0 0 #08d8ff, 4px 0 0 0 rgba(8, 216, 255, 0.35), 0 0 10px rgba(8, 216, 255, 0.1);
}

/* Range: middle — square all corners, cyan bridges on both sides */
.trade-day-card.is-range-mid {
  border-radius: 0;
  border-right-color: transparent !important;
  border-left-color: transparent !important;
  outline: none;
  box-shadow: -4px 0 0 0 rgba(8, 216, 255, 0.35), 4px 0 0 0 rgba(8, 216, 255, 0.35);
}

/* Range: end — square left, round right, cyan bracket */
.trade-day-card.is-range-end {
  border-radius: 0 10px 10px 0;
  border-left-color: transparent !important;
  outline: none;
  box-shadow: 4px 0 0 0 #08d8ff, -4px 0 0 0 rgba(8, 216, 255, 0.35), 0 0 10px rgba(8, 216, 255, 0.1);
}

/* Today inside a range — dashed white outline preserved */
.trade-day-card.is-today.is-range-start,
.trade-day-card.is-today.is-range-mid,
.trade-day-card.is-today.is-range-end {
  outline: 2px dashed rgba(255, 255, 255, 0.5);
  outline-offset: -1px;
}
.trade-day-card.is-empty .trade-day-count {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #a6b0d1;
}
.trade-day-card.is-empty {
  opacity: 0.52;
  cursor: not-allowed;
}
.trade-day-card:disabled {
  pointer-events: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 14, 0.74);
  display: grid;
  place-items: center;
  z-index: 80;
  padding: 16px;
}
.modal-card {
  width: min(760px, 96vw);
  max-height: 88vh;
  overflow: auto;
  background: rgba(10, 14, 26, 0.96);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px;
}

@media (max-width: 1100px) {
  .layout { grid-template-columns: repeat(2, 1fr); }
  .widget.w-half { grid-column: span 1; }
  .widget.w-third { grid-column: span 1; }
}
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  .widget.w-half,
  .widget.w-third { grid-column: 1 / -1; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .stat-list.triple { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .auth-gate {
    padding: 14px;
  }
  .auth-gate-card {
    grid-template-columns: 1fr;
  }
  .auth-gate-left {
    min-height: 0;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .topbar { flex-direction: column; align-items: start; }
  .topbar-controls,
  .auth-controls {
    width: 100%;
  }
  .view-toolbar { padding: 0; }
  .view-menu { width: 100%; }
  .view-hint { padding: 0 14px 8px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-list,
  .stat-list.triple { grid-template-columns: 1fr; }
  .trade-calendar-head,
  .trade-calendar-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .trade-calendar-head { display: none; }
  .recent-trades-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ── Trading Platform cards ────────────────────────────────────── */
.platform-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 12px;
  transition: border-color 0.2s, background 0.2s;
}
.platform-card.is-connected {
  border-left-color: rgba(49,208,170,0.5);
  background: rgba(49,208,170,0.03);
}
.platform-card.is-active-platform {
  border-left-color: rgba(140,100,255,0.6);
  background: rgba(140,100,255,0.03);
}
.platform-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.platform-card-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}
.platform-card-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.platform-card-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  flex-shrink: 0;
}
.platform-badges {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.platform-status {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--muted);
  background: rgba(255,255,255,0.03);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.platform-status.is-connected {
  color: #31d0aa;
  background: rgba(49,208,170,0.1);
  border-color: rgba(49,208,170,0.3);
}
.platform-status.is-active {
  color: #d8c6ff;
  background: rgba(140,100,255,0.12);
  border-color: rgba(168,130,255,0.4);
}
.platform-meta {
  font-size: 0.78rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.platform-meta span { display: inline; }
.platform-meta .meta-sep { color: rgba(255,255,255,0.15); }
.platform-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.platform-actions button {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 7px;
  padding: 6px 13px;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.platform-actions button:hover { background: rgba(255,255,255,0.1); }
.platform-actions button.primary {
  border-color: rgba(8,216,255,0.4);
  color: #d5f6ff;
}
.platform-actions button.primary:hover { background: rgba(8,216,255,0.1); }
.platform-actions button.danger { border-color: rgba(255,95,122,0.35); color: #ff8fa3; }
.platform-actions button.danger:hover { background: rgba(255,95,122,0.08); }
.platform-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.platform-form.is-hidden { display: none; }
.howto-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid rgba(8,216,255,0.3);
  background: rgba(8,216,255,0.07);
  color: #8ecbff;
  cursor: pointer;
  margin-left: 7px;
  vertical-align: middle;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.howto-btn:hover {
  background: rgba(8,216,255,0.16);
  border-color: rgba(8,216,255,0.6);
}
.howto-card {
  width: min(560px, 94vw);
  max-height: 80vh;
  overflow-y: auto;
}
.howto-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.howto-title { margin: 0; font-size: 1rem; }
.howto-close-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: color 0.15s;
}
.howto-close-btn:hover { color: var(--text); }
.howto-body { font-size: 0.88rem; line-height: 1.6; color: var(--text); }
.howto-body ol { margin: 0 0 12px; padding-left: 20px; }
.howto-body li { margin-bottom: 6px; }
.howto-body p { margin: 0 0 10px; }
.howto-body strong { color: #d5f6ff; }
.howto-body .howto-note {
  margin-top: 14px;
  padding: 10px 13px;
  background: rgba(8,216,255,0.07);
  border-left: 3px solid rgba(8,216,255,0.4);
  border-radius: 0 6px 6px 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.platform-form-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.platform-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
@media (max-width: 700px) { .platform-fields { grid-template-columns: 1fr; } }
.platform-field label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 5px;
}
.platform-field input,
.platform-field select {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.88rem;
}
.platform-field input:focus,
.platform-field select:focus {
  outline: none;
  border-color: rgba(8,216,255,0.5);
}
.platform-field-helper {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
}
.platform-field-helper a { color: #8ecbff; }
.platform-form-actions { display: flex; gap: 8px; }
.platform-feedback {
  margin-top: 10px;
  font-size: 0.82rem;
  min-height: 1.2em;
}
.platform-feedback.ok { color: #31d0aa; }
.platform-feedback.err { color: #ff8fa3; }

/* ── Today's PnL badge ─────────────────────────────────────────── */
.today-pnl-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.today-pnl-header h2 { margin: 0; }
.today-pnl-badge {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--muted);
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}
.today-pnl-badge.is-positive {
  background: rgba(49,208,170,0.15);
  border-color: rgba(49,208,170,0.4);
  color: #31d0aa;
}
.today-pnl-badge.is-negative {
  background: rgba(255,95,122,0.15);
  border-color: rgba(255,95,122,0.4);
  color: #ff5f7a;
}

/* ── Profile menu ──────────────────────────────────────────────── */
.profile-menu-wrap {
  position: relative;
}
.profile-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}
.profile-btn:hover,
.profile-btn[aria-expanded="true"] {
  background: rgba(8,216,255,0.12);
  border-color: rgba(8,216,255,0.5);
  color: #d5f6ff;
}
.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 160px;
  background: rgba(10,14,28,0.98);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  padding: 6px;
  z-index: 9000;
  backdrop-filter: blur(12px);
}
.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.88rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.profile-dropdown-item:hover {
  background: rgba(255,255,255,0.08);
}
.profile-dropdown-item--danger { color: #ff8fa3; }
.profile-dropdown-item--danger:hover { background: rgba(255,95,122,0.12); }
.profile-dropdown-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 4px 0;
}

/* ── Settings page ─────────────────────────────────────────────── */
.settings-page {
  position: fixed;
  inset: 0;
  z-index: 8000;
  background: var(--bg, #080c17);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.settings-page.is-hidden { display: none; }
.settings-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: 100%;
}
.settings-sidebar {
  width: 220px;
  min-width: 180px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0 24px;
  background: rgba(255,255,255,0.02);
  flex-shrink: 0;
}
.settings-sidebar-header {
  padding: 0 16px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.settings-sidebar-title {
  margin: 12px 0 0;
  font-size: 1.1rem;
  font-family: "Sora", sans-serif;
}
.settings-close-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 4px 0;
  border-radius: 6px;
  transition: color 0.15s;
}
.settings-close-btn:hover { color: var(--text); }
.settings-nav {
  display: flex;
  flex-direction: column;
  padding: 0 8px;
  gap: 2px;
}
.settings-nav-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.settings-nav-btn:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}
.settings-nav-btn.is-active {
  background: rgba(8,216,255,0.1);
  color: #d5f6ff;
  font-weight: 600;
}
.settings-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 36px 40px;
}
.settings-section { display: none; }
.settings-section.is-active { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.settings-section > h2 {
  margin: 0 0 20px;
  font-size: 1.3rem;
  font-family: "Sora", sans-serif;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.settings-field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.settings-field-label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.9rem;
  color: var(--text);
}
.settings-field-hint {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 400;
}
.settings-select {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 6px 10px;
  font-size: 0.85rem;
  min-width: 130px;
  cursor: pointer;
}

@media (max-width: 600px) {
  .settings-sidebar { width: 140px; min-width: 120px; }
  .settings-content { padding: 20px 16px; }
}

/* ── Account Settings ───────────────────────────────────────────── */

/* ── Account section: label stacked above input ── */
[data-section="account"] .settings-field-row {
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 6px;
  padding: 12px 0;
  max-width: 420px;
}
[data-section="account"] .settings-field-label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
[data-section="account"] .settings-input,
[data-section="account"] .acct-password-group {
  width: 100%;
}
[data-section="account"] .settings-input {
  min-width: unset;
  width: 100%;
  box-sizing: border-box;
}

/* ── General section: label+hint left, dropdown right ── */
[data-section="general"] .settings-field-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 0;
}
[data-section="general"] .settings-field-label {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
}
[data-section="general"] .settings-field-label .settings-field-hint {
  margin-top: 2px;
}
[data-section="general"] .settings-select {
  flex-shrink: 0;
  width: 200px;
  min-width: unset;
  box-sizing: border-box;
}
[data-section="account"] .acct-save-row { padding-top: 16px; }

.settings-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0 4px;
}

.settings-input {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 0.9rem;
  min-width: 240px;
  outline: none;
  transition: border-color 0.18s;
}
.settings-input:focus { border-color: var(--accent); }
.settings-input[readonly] { opacity: 0.55; cursor: default; }

.acct-avatar-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 0 20px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  margin-bottom: 4px;
}
.acct-avatar-wrap {
  position: relative;
  width: 160px !important;
  height: 160px !important;
  flex-shrink: 0;
}
.acct-avatar-preview {
  display: block;
  width: 160px !important;
  height: 160px !important;
  border-radius: 16px;
  object-fit: cover;
  border: 2px solid var(--border);
}
.acct-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 160px !important;
  height: 160px !important;
  border-radius: 16px;
  border: 2px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--muted);
}
.acct-avatar-overlay-btn {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #020914;
  color: #020914;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.18s;
}
.acct-avatar-overlay-btn:hover { background: var(--accent-2); }
.acct-avatar-meta { flex: 1; }
.acct-avatar-hint { margin: 0; font-size: 0.8rem; color: var(--muted); }

.acct-email-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.acct-email-value { font-size: 0.9rem; color: var(--text); }
.acct-email-badge {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.acct-email-verified   { background: rgba(0,200,100,0.15); color: #4deba0; border: 1px solid rgba(0,200,100,0.3); }
.acct-email-unverified { background: rgba(255,180,0,0.12); color: #f5c542; border: 1px solid rgba(255,180,0,0.3); }

.acct-password-row { align-items: center; }

.acct-2fa-row { align-items: center; }
.acct-2fa-status-wrap { display: flex; align-items: center; gap: 10px; }
.acct-2fa-badge {
  font-size: 0.72rem;
  padding: 2px 10px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.acct-2fa-enabled  { background: rgba(0,200,100,0.15); color: #4deba0; border: 1px solid rgba(0,200,100,0.3); }
.acct-2fa-disabled { background: rgba(255,180,0,0.12); color: #f5c542; border: 1px solid rgba(255,180,0,0.3); }
.acct-2fa-unknown  { background: rgba(255,255,255,0.05); color: var(--muted); border: 1px solid var(--border); }
.acct-2fa-confirm-hint { margin: 0 0 14px; font-size: 0.84rem; color: var(--muted); }
.acct-2fa-qr-wrap {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 14px;
}
.acct-2fa-qr-img {
  width: 180px;
  height: 180px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 6px;
}
.acct-2fa-qr-loading {
  color: var(--muted);
  font-size: 0.84rem;
  padding: 60px 0;
}
.acct-2fa-step {
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
  align-items: flex-start;
}
.acct-2fa-step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}
.acct-2fa-step-body {
  flex: 1;
}
.acct-2fa-step-label {
  margin: 0 0 10px;
  font-size: 0.88rem;
  color: var(--text);
}
.acct-2fa-secret-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}
.acct-2fa-secret-label {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}
.acct-2fa-secret-row { align-items: center; }
.acct-2fa-secret-code {
  font-family: monospace;
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  color: var(--accent);
  background: rgba(8,216,255,0.06);
  border: 1px solid rgba(8,216,255,0.2);
  border-radius: 6px;
  padding: 4px 10px;
  word-break: break-all;
}
.acct-2fa-code-input { max-width: 140px; letter-spacing: 0.15em; font-size: 1.1rem; }
.acct-password-group {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.acct-password-group .settings-input { flex: 1; min-width: unset; }
.acct-password-display { letter-spacing: 0.12em; min-width: 160px; }

.acct-change-pw-form {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin: 8px 0 4px;
}
.acct-change-pw-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.acct-save-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 20px;
}
.acct-msg {
  font-size: 0.85rem;
  margin: 0;
}
.acct-msg.ok  { color: #4deba0; }
.acct-msg.err { color: var(--danger); }

.btn-primary {
  background: var(--accent);
  color: #020914;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s, opacity 0.18s;
}
.btn-primary:hover { background: var(--accent-2); }
.btn-primary:disabled { opacity: 0.45; cursor: default; }
.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.18s;
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); }
.btn-secondary:disabled { opacity: 0.35; cursor: default; pointer-events: none; }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.18s;
}
.btn-ghost:hover { color: var(--text); }

/* profile avatar img in topbar */
.profile-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* ── Toggle Switch ──────────────────────────────────────────────── */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle-switch input { display: none; }
.toggle-track {
  width: 42px;
  height: 24px;
  border-radius: 12px;
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--border);
  position: relative;
  transition: background 0.2s, border-color 0.2s;
}
.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s, background 0.2s;
}
.toggle-switch input:checked + .toggle-track {
  background: rgba(8,216,255,0.25);
  border-color: var(--accent);
}
.toggle-switch input:checked + .toggle-track .toggle-thumb {
  transform: translateX(18px);
  background: var(--accent);
}

/* ── Notification Checkboxes ────────────────────────────────────── */
.notif-checks {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.notif-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
}
.notif-check-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Legal Tabs (Privacy & Terms) ──────────────────────────────── */
.legal-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.legal-tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 16px;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.18s, border-color 0.18s;
}
.legal-tab-btn:hover { color: var(--text); }
.legal-tab-btn.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.legal-tab-content { display: none; }
.legal-tab-content.is-active { display: block; }

.legal-doc {
  max-width: 720px;
  line-height: 1.7;
  font-size: 0.88rem;
  color: var(--text);
}
.legal-doc h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  margin: 28px 0 8px;
  letter-spacing: 0.02em;
}
.legal-doc h3:first-of-type { margin-top: 8px; }
.legal-doc p { margin: 0 0 10px; color: rgba(238,248,255,0.85); }
.legal-doc ul {
  margin: 0 0 12px 0;
  padding-left: 20px;
}
.legal-doc li {
  margin-bottom: 6px;
  color: rgba(238,248,255,0.85);
}
.legal-meta {
  font-size: 0.78rem !important;
  color: var(--muted) !important;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
  margin-bottom: 4px !important;
}
.legal-link {
  color: var(--accent);
  text-decoration: none;
}
.legal-link:hover { text-decoration: underline; }
.legal-address {
  font-style: normal;
  line-height: 1.8;
  color: rgba(238,248,255,0.85);
  margin-top: 4px;
}

/* ── Activity Feed ─────────────────────────────────────────────── */
.bot-events-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.bot-events-header h2 { margin: 0; }
/* ── Session Notes widget ───────────────────────────────────────── */
.sn-edit-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 3px 5px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
}
.sn-edit-btn:hover { color: var(--accent); background: rgba(99,102,241,0.10); }
.sn-edit-btn.sn-unlocked { color: var(--accent); }

.sn-prompt {
  font-size: 0.82rem;
  color: var(--muted);
  padding: 16px;
  margin: 0;
  text-align: center;
}
.sn-content { padding: 14px 16px; }
.sn-date {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 10px;
}
.sn-text {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.6;
  min-height: 40px;
}
.sn-text p { margin: 0 0 6px; }
.sn-text p:last-child { margin-bottom: 0; }
.sn-empty-note { color: var(--muted); font-style: italic; }

.sn-edit-area { margin-top: 12px; }
.sn-textarea {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.6;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}
.sn-textarea:focus { border-color: var(--accent); }
.sn-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: flex-end;
}
.sn-save-btn {
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 16px;
  transition: opacity 0.15s;
}
.sn-save-btn:hover { opacity: 0.85; }
.sn-save-btn:disabled { opacity: 0.5; cursor: default; }
.sn-cancel-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  padding: 6px 14px;
  transition: color 0.15s, background 0.15s;
}
.sn-cancel-btn:hover { color: var(--text); background: rgba(255,255,255,0.10); }

/* Activity Feed config button */
.be-config-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px 5px;
  margin-right: 2px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.be-config-btn:hover,
.be-config-btn.active {
  color: var(--accent);
  border-color: var(--border);
  background: rgba(255,255,255,0.05);
}

/* Activity Feed config panel */
.be-config-panel {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px 12px;
}
.be-config-header {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.be-config-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
}
.be-config-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--fg);
  cursor: pointer;
  white-space: nowrap;
}
.be-config-item input[type=checkbox] {
  accent-color: var(--accent);
  cursor: pointer;
  width: 13px;
  height: 13px;
}

.bot-events-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
}
.be-feed-scroll {
  height: 420px;
  overflow-y: scroll;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.be-feed-scroll::-webkit-scrollbar { width: 5px; }
.be-feed-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.bot-events-feed {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
}

.be-card {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  overflow: hidden;
  transition: box-shadow 0.15s;
}
.be-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.3); }

.be-card.be-trade-win  { border-color: rgba(52,211,120,0.45); background: rgba(52,211,120,0.06); }
.be-card.be-trade-loss { border-color: rgba(255,95,122,0.45); background: rgba(255,95,122,0.06); }
.be-card.be-trade-entry { border-color: rgba(8,216,255,0.35); background: rgba(8,216,255,0.05); }
.be-card.be-session-start { border-color: rgba(95,230,255,0.35); background: rgba(95,230,255,0.05); }
.be-card.be-session-end { border-color: rgba(95,230,255,0.35); background: rgba(95,230,255,0.05); }
.be-card.be-circuit { border-color: rgba(251,146,60,0.45); background: rgba(251,146,60,0.06); }
.be-card.be-guardrail { border-color: rgba(251,191,36,0.45); background: rgba(251,191,36,0.06); }
.be-card.be-kill,
.be-card.be-error { border-color: rgba(255,95,122,0.55); background: rgba(255,95,122,0.07); }
.be-card.be-canary { border-color: rgba(167,139,250,0.45); background: rgba(167,139,250,0.06); }
.be-card.be-observation { border-color: rgba(56,189,248,0.45); background: rgba(56,189,248,0.06); }

.be-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  user-select: none;
}
.be-summary::-webkit-details-marker { display: none; }

.be-type-badge {
  flex-shrink: 0;
  width: 120px;
  text-align: center;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.be-trade-win  .be-type-badge { background: rgba(52,211,120,0.2);  color: #4ade80; }
.be-trade-loss .be-type-badge { background: rgba(255,95,122,0.2);  color: #ff5f7a; }
.be-trade-entry .be-type-badge { background: rgba(8,216,255,0.18); color: var(--accent); }
.be-session-start .be-type-badge,
.be-session-end .be-type-badge { background: rgba(95,230,255,0.15); color: var(--accent-2); }
.be-circuit .be-type-badge { background: rgba(251,146,60,0.2); color: #fb923c; }
.be-guardrail .be-type-badge { background: rgba(251,191,36,0.2); color: #fbbf24; }
.be-kill .be-type-badge,
.be-error .be-type-badge { background: rgba(255,95,122,0.22); color: #ff5f7a; }
.be-canary .be-type-badge { background: rgba(167,139,250,0.2); color: #a78bfa; }
.be-observation .be-type-badge { background: rgba(56,189,248,0.2); color: #38bdf8; }
.be-system .be-type-badge { background: rgba(147,169,187,0.15); color: var(--muted); }

.be-title {
  flex: 1;
  min-width: 0;
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.be-subtitle {
  flex-shrink: 0;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}
.be-time {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-family: "JetBrains Mono", "Fira Code", "Consolas", monospace;
  color: var(--accent);
  opacity: 0.8;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.be-chevron {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.7rem;
  transition: transform 0.18s;
}
details.be-card[open] .be-chevron { transform: rotate(90deg); }

.be-detail {
  padding: 10px 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.06);
  word-break: break-word;
}
.be-detail-blurb {
  font-size: 0.82rem;
  color: var(--fg);
  line-height: 1.6;
  margin: 0 0 12px;
  opacity: 0.88;
}
.be-detail-blurb strong {
  color: var(--fg);
  font-weight: 600;
}
.be-df {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  margin: 0;
  padding: 10px 12px;
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.05);
}
.be-df-row {
  display: contents;
}
.be-df dt {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  padding: 2px 0;
}
.be-df dd {
  font-size: 0.8rem;
  color: var(--fg);
  font-family: "JetBrains Mono", "Fira Code", monospace;
  margin: 0;
  padding: 2px 0;
  opacity: 0.9;
}

.be-empty {
  text-align: center;
  color: var(--muted);
  font-size: 0.84rem;
  padding: 28px 0;
  font-style: italic;
}

/* ── Widget drag-and-drop system ───────────────────────────────── */
/* Onboarding checklist widget */
.onboarding-widget {
  background: var(--bg-panel);
  border: 1px solid rgba(8, 216, 255, 0.25);
  border-radius: 10px;
  padding: 16px 20px;
  grid-column: 1 / -1;
  box-shadow: 0 0 20px rgba(8, 216, 255, 0.06);
}
.onboarding-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.onboarding-title {
  font-family: "Sora", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: #e7fbff;
}
.onboarding-dismiss {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
}
.onboarding-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.onboarding-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
  transition: border-color 0.2s, color 0.2s;
  flex: 1 1 220px;
  min-width: 200px;
}
.onboarding-step.completed {
  border-color: rgba(34, 197, 94, 0.35);
  color: #86efac;
}
.onboarding-step.locked {
  opacity: 0.5;
}
.onboarding-step-icon {
  font-size: 1rem;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}
.onboarding-step.completed .onboarding-step-icon { color: #22c55e; }
.onboarding-step.locked .onboarding-step-icon { color: var(--muted); }
.onboarding-step-progress {
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: auto;
}
.onboarding-go-live-btn {
  margin-left: auto;
  padding: 4px 16px;
  background: linear-gradient(120deg, rgba(34, 197, 94, 0.3), rgba(34, 197, 94, 0.1));
  border: 1px solid rgba(34, 197, 94, 0.5);
  border-radius: 6px;
  color: #86efac;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}
.onboarding-go-live-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.onboarding-go-live-btn:not(:disabled):hover {
  background: linear-gradient(120deg, rgba(34, 197, 94, 0.5), rgba(34, 197, 94, 0.2));
}
/* LIVE badge in header */
.live-badge {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: 4px;
  color: #fca5a5;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-left: 8px;
  animation: live-pulse 2s infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
/* Onboarding progress bar */
.onboarding-progress {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}
.onboarding-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #22d3ee, #818cf8);
  border-radius: 2px;
  transition: width 0.3s ease;
}
.onboarding-progress-text {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
}

.widget {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  overflow: hidden;
  position: relative;
  transition: box-shadow 0.12s, opacity 0.12s;
  /* Default: full width across all columns */
  grid-column: 1 / -1;
}
.widget.w-half { grid-column: span 3; }
.widget.w-third { grid-column: span 2; }
.widget.is-dragging { opacity: 0.4; }

@keyframes widget-glow {
  0%   { box-shadow: 0 0 8px rgba(8, 216, 255, 0.6), 0 0 24px rgba(8, 216, 255, 0.3); border-color: rgba(8, 216, 255, 0.6); }
  100% { box-shadow: var(--shadow); border-color: var(--border); }
}
.widget.widget-glow {
  animation: widget-glow 1.5s ease-out forwards;
}
@keyframes activity-glow {
  0%   { box-shadow: 0 0 8px rgba(8, 216, 255, 0.6), 0 0 24px rgba(8, 216, 255, 0.3); border-color: rgba(8, 216, 255, 0.6); }
  100% { box-shadow: none; border-color: var(--border); }
}
.be-card.be-glow {
  animation: activity-glow 3s ease-out forwards;
}
[data-widget-hidden="true"] { display: none !important; }

/* Drop-zone indicators — colored inset edge + centred action label */
.widget[data-drop-zone]::after {
  content: attr(data-drop-label);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: var(--accent);
  color: #001820;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 12px;
  border-radius: 20px;
  pointer-events: none;
  z-index: 20;
  white-space: nowrap;
}
.widget[data-drop-zone="above"] {
  box-shadow: inset 0 5px 0 var(--accent), 0 0 18px rgba(8,216,255,0.2);
  border-top-color: var(--accent);
}
.widget[data-drop-zone="below"] {
  box-shadow: inset 0 -5px 0 var(--accent), 0 0 18px rgba(8,216,255,0.2);
  border-bottom-color: var(--accent);
}
.widget[data-drop-zone="left"] {
  box-shadow: inset 5px 0 0 var(--accent), 0 0 18px rgba(8,216,255,0.2);
  border-left-color: var(--accent);
}
.widget[data-drop-zone="right"] {
  box-shadow: inset -5px 0 0 var(--accent), 0 0 18px rgba(8,216,255,0.2);
  border-right-color: var(--accent);
}

.widget-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px 4px 6px;
  background: linear-gradient(90deg, rgba(8,216,255,0.07) 0%, rgba(95,230,255,0.02) 100%);
  border-bottom: 1px solid rgba(95,230,255,0.13);
  cursor: grab;
  user-select: none;
}
.widget-bar:active { cursor: grabbing; }

.widget-grip {
  color: var(--muted);
  opacity: 0.55;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.widget-bar:hover .widget-grip { opacity: 0.9; }

.widget-title {
  flex: 1;
  font-family: "Sora", sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}

.kpi-period-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  padding: 2px 8px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

.widget-close-btn {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color 0.15s, background 0.15s;
}
.widget-close-btn:hover {
  color: var(--danger);
  background: rgba(255,95,122,0.13);
}

.widget-body {
  padding: 8px;
}

/* Customize tray */
.widget-customize-wrap {
  display: none;
}
.widget-tray-anchor {
  position: relative;
}
.widget-customize-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 13px;
  background: rgba(8,216,255,0.08);
  border: 1px solid rgba(8,216,255,0.28);
  border-radius: 20px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: inherit;
}
.widget-customize-btn:hover {
  background: rgba(8,216,255,0.17);
  border-color: rgba(8,216,255,0.5);
}
.widget-tray {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 260px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.46);
  backdrop-filter: blur(16px);
  padding: 14px;
  z-index: 200;
}
.widget-tray-title {
  margin: 0 0 10px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.widget-tray-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}
.widget-tray-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 14px;
  background: rgba(8,216,255,0.07);
  border: 1px solid rgba(8,216,255,0.22);
  border-radius: 10px;
  font-size: 0.8rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: inherit;
  text-align: left;
}
.widget-tray-chip:hover {
  background: rgba(8,216,255,0.18);
  border-color: rgba(8,216,255,0.45);
}
.widget-tray-chip:hover .widget-tray-chip-title { color: var(--accent); }
.widget-tray-chip-title {
  font-weight: 600;
  color: var(--text);
  transition: color 0.15s;
}
.widget-tray-chip-desc {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.3;
}
.widget-tray-empty {
  color: var(--muted);
  font-size: 0.84rem;
  font-style: italic;
  margin: 0;
}

/* today-pnl-badge lives in widget-bar now */
.widget-bar .today-pnl-badge { margin-left: auto; }
/* bot-events-badge lives in widget-bar now */
.widget-bar .bot-events-badge { margin-left: 0; }

/* ── Tuner Parameters ───────────────────────────────────────────── */
.tuner-row { gap: 12px; }
.tuner-row.is-overridden .settings-field-label { color: var(--accent); }
.tuner-row.is-deviated { border-left: 3px solid #ff5f7a; padding-left: 20px; margin-left: -13px; }
.tuner-row.is-deviated .settings-field-label { color: #ff5f7a; }
.tuner-input-wrap { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.tuner-input-wrap .settings-input { min-width: unset; }
.tuner-input-wrap .settings-input:disabled,
.tuner-toggle input[type="checkbox"]:disabled { opacity: 0.65; cursor: default; }
.tuner-override-tag {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
  background: rgba(99,102,241,0.15); color: var(--accent);
  padding: 1px 6px; border-radius: 999px; margin-left: 8px;
  vertical-align: middle; letter-spacing: 0.04em;
}
.tuner-deviate-tag {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
  background: rgba(255,95,122,0.15); color: #ff5f7a;
  padding: 1px 6px; border-radius: 999px;
  vertical-align: middle; letter-spacing: 0.04em; white-space: nowrap;
}
.tuner-ai-value {
  font-size: 0.72rem; color: var(--muted);
  font-style: italic; white-space: nowrap;
}
.tuner-reset-btn,
.tuner-rollback-btn {
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  color: var(--muted); border-radius: 6px; padding: 4px 8px;
  font-size: 0.78rem; cursor: pointer; white-space: nowrap;
}
.tuner-reset-btn:hover { background: rgba(255,95,122,0.15); color: #ff5f7a; border-color: rgba(255,95,122,0.3); }
.tuner-rollback-btn { border-color: rgba(255,95,122,0.25); color: #ff5f7a; }
.tuner-rollback-btn:hover { background: rgba(255,95,122,0.15); border-color: rgba(255,95,122,0.4); }
.tuner-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.tuner-toggle input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.tuner-toggle-label { font-size: 0.85rem; color: var(--text); }
.tuner-footer { margin-top: 16px; display: flex; align-items: center; gap: 10px; }
.tuner-cancel-btn {
  background: rgba(255,255,255,0.06); border: 1px solid var(--border);
  color: var(--muted); border-radius: 8px; padding: 8px 18px;
  font-size: 0.85rem; cursor: pointer;
}
.tuner-cancel-btn:hover { background: rgba(255,255,255,0.1); color: var(--text); }
.tuner-save-status { margin-left: 12px; font-size: 0.82rem; color: var(--accent); }
.tuner-save-status.is-error { color: #ff5f7a; }
.tuner-confirm-list {
  margin: 0; padding: 0 0 0 18px; font-size: 0.85rem; color: var(--text);
  line-height: 1.7; list-style: disc;
}
[data-section="trading-params"] .settings-field-row { padding: 8px 0; }
[data-section="trading-params"] h3.section-label {
  font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--accent); border-bottom: 1px solid var(--border); padding-bottom: 6px;
}

/* ═══ Admin Panel ═══ */
.admin-accent { color: #f59e0b !important; }
.admin-accent.menu-btn.is-active { background: rgba(245, 158, 11, 0.15); border-color: rgba(245, 158, 11, 0.4); color: #fbbf24; }
.admin-accent.menu-btn:hover:not(.is-active) { background: rgba(245, 158, 11, 0.08); }
.admin-widget .widget-bar { border-bottom-color: rgba(245, 158, 11, 0.2); }
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  padding: 8px 0;
}
.admin-stat-card {
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.15);
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.admin-stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.45);
}
.admin-stat-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fbbf24;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.admin-table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.5);
  border-bottom: 1px solid var(--border);
  padding: 6px 8px;
}
.admin-table td {
  padding: 8px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  white-space: nowrap;
}
.admin-table tr:hover td {
  background: rgba(245, 158, 11, 0.04);
}
.admin-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.5);
}
.admin-badge-ok { background: rgba(34, 197, 94, 0.15); color: #86efac; }
.admin-badge-warn { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.admin-badge-danger { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.admin-badge-amber { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.admin-action-btn {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  transition: background 0.15s;
}
.admin-action-btn:hover { background: rgba(255,255,255,0.1); }
.admin-action-sm { padding: 2px 8px; font-size: 0.7rem; }
.admin-action-start { border-color: rgba(34, 197, 94, 0.3); color: #86efac; }
.admin-action-start:hover { background: rgba(34, 197, 94, 0.15); }
.admin-action-stop { border-color: rgba(245, 158, 11, 0.3); color: #fbbf24; }
.admin-action-stop:hover { background: rgba(245, 158, 11, 0.15); }
.admin-action-danger { border-color: rgba(239, 68, 68, 0.3); color: #fca5a5; }
.admin-action-danger:hover { background: rgba(239, 68, 68, 0.15); }

/* Observation Warm-Up Panel */
.observation-panel {
  background: linear-gradient(135deg, rgba(56,189,248,0.08), rgba(14,165,233,0.04));
  border: 1px solid rgba(56,189,248,0.3);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
}
.obs-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.obs-icon { font-size: 1.2rem; }
.obs-title {
  font-weight: 600;
  color: #38bdf8;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.obs-timer {
  margin-left: auto;
  font-size: 0.8rem;
  color: #7dd3fc;
  font-variant-numeric: tabular-nums;
}
.obs-progress-bar {
  height: 4px;
  background: rgba(56,189,248,0.15);
  border-radius: 2px;
  margin-bottom: 10px;
  overflow: hidden;
}
.obs-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  border-radius: 2px;
  transition: width 1s linear;
}
.obs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
}
.obs-stat {
  text-align: center;
}
.obs-label {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.obs-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
