/* WINDELS AI WORKFORCE — professional dashboard design system.
   Self-hosted, no CDN. One brand accent, one type scale, one spacing
   rhythm, consistent icon sizes. Existing class names are preserved. */
:root {
  --bg: #0a0e17;
  --surface: #0f1623;
  --panel: #0f1623;
  --panel2: #131c2c;
  --elevated: #16203200;
  --line: #1e2738;
  --line2: #2a3548;
  --line-strong: #3a475e;
  --text: #e7ecf4;
  --muted: #9aa7bd;
  --dim: #5e6b82;
  --brand: #2f6bff;
  --brand-2: #6366f1;
  --brand-soft: #2f6bff22;
  --sky: #3b82f6;
  --green: #22c55e;
  --red: #fb5d6b;
  --amber: #f5a623;
  --violet: #8b5cf6;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px #00000040, 0 8px 24px #00000033;
  --sidebar-w: 256px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --icon-sidebar: 20px;
  --icon-header: 20px;
  --icon-button: 18px;
  --icon-stat: 24px;
  --icon-feature: 32px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { overflow-x: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { color: #fff; font-weight: 700; letter-spacing: -0.015em; }
h1 { font-size: 22px; line-height: 1.25; }
h2 { font-size: 20px; line-height: 1.3; }
h3 { font-size: 15px; line-height: 1.35; }
h4 { font-size: 13px; line-height: 1.4; letter-spacing: 0; }
p { margin: 0 0 10px; }
p:last-child { margin-bottom: 0; }
img {
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  object-position: center;
}
::selection { background: var(--brand); color: #fff; }

/* ---------- App shell ---------- */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.app-main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  background: #070b13;
  border-right: 1px solid var(--line);
  padding: 0 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #1e2738; border-radius: 6px; }
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 10px 16px;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}
.sidebar-brand img { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; flex: none; }
.sidebar-brand small {
  display: block;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--dim);
  margin-top: 2px;
}
.sidebar-label {
  margin: 16px 10px 6px;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 700;
}
.sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  border-left: 2px solid transparent;
  transition: background .15s, color .15s;
  line-height: 1.2;
}
.sidebar a svg { width: 20px; height: 20px; flex: none; opacity: .85; }
.sidebar a:hover { background: #121a29; color: #e7ecf4; text-decoration: none; }
.sidebar a.active { background: var(--brand-soft); color: #fff; border-left-color: var(--brand); }
.sidebar a.active svg { opacity: 1; color: var(--brand); }
.sidebar a .badge { margin-left: auto; }
.sidebar-badge { margin-left: auto; display:inline-flex; align-items:center; justify-content:center; min-width:20px; height:20px; padding:0 6px; border-radius:999px; background:#dc2626; color:#fff; font-size:11px; font-weight:700; line-height:1; }
.sidebar a.active .sidebar-badge { background:#fff; color:#dc2626; }
.sidebar a.sidebar-sub {
  margin-left: 12px;
  padding-left: 26px;
  font-size: 13px;
  opacity: .9;
  border-left: 1px solid var(--line);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.sidebar a.sidebar-sub.active { border-left-color: var(--brand); }
.sidebar-logout { margin-top: auto; padding: 16px 6px 4px; border-top: 1px solid var(--line); }
.sidebar-logout .btn { width: 100%; }
/* Mobile navigation trigger — lives in the topbar, not a floating pill. */
.sidebar-toggle {
  display: none;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  flex: none;
  border: 1px solid var(--line2);
  border-radius: 9px;
  background: var(--panel2);
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: color .15s, border-color .15s;
}
.sidebar-toggle:hover { color: #fff; border-color: var(--brand); }
.sidebar-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sidebar-toggle svg { width: 20px; height: 20px; }

/* ---------- Topbar / header ---------- */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: #0a0f1ae6;
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 12;
}
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; flex: 1; }
.nav-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--line2);
  background: var(--panel2);
}
.nav-controls .btn { padding: 6px 10px; font-size: 12px; min-height: 32px; }
.nav-controls .btn svg { width: 18px; height: 18px; }
.nav-controls .btn[disabled] { opacity: .35; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand .mark {
  width: 34px;
  height: 34px;
  display: none; /* sidebar carries the brand on desktop */
  place-items: center;
  border-radius: 9px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  flex: none;
}
.brand .mark img { width: 100%; height: 100%; object-fit: cover; }
.brand h1 {
  font-size: 16px;
  margin: 0;
  color: #fff;
  letter-spacing: -0.01em;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand .sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.crumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--dim); }
.crumb a { color: var(--muted); }
.crumb .sep { color: var(--dim); }
.crumb .cur { color: var(--text); font-weight: 600; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid var(--line2);
  background: var(--panel2);
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { color: #fff; border-color: var(--brand); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); border: 2px solid var(--panel2); }
.profile {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--line2);
  background: var(--panel2);
  cursor: pointer;
  color: var(--text);
}
.profile:hover { border-color: var(--brand); }
.profile .avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); flex: none; }
.profile .who { display: flex; flex-direction: column; line-height: 1.2; }
.profile .who b { font-size: 13px; color: #fff; font-weight: 700; }
.profile .who span { font-size: 11px; color: var(--dim); }
.profile-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  background: var(--panel);
  border: 1px solid var(--line2);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 30;
  display: none;
}
.profile-wrap { position: relative; }
.profile-menu.open { display: block; }
.profile-menu a, .profile-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  background: none;
  border: 0;
  cursor: pointer;
}
.profile-menu a svg, .profile-menu button svg { width: 18px; height: 18px; flex: none; }
.profile-menu a:hover, .profile-menu button:hover { background: #131c2c; text-decoration: none; }
.profile-menu .sep { height: 1px; background: var(--line); margin: 5px 4px; }
.profile-menu form { margin: 0; }

/* ---------- Status badges (top-right) ---------- */
.statuspill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--line2);
  background: var(--panel2);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.statuspill .pill-dot { width: 6px; height: 6px; border-radius: 50%; background: #22c55e; flex: none; }
.statuspill.warn { color: #ffb4a2; border-color: #7f2d2d; background: #2a1518; }
.statuspill.warn .pill-dot { background: var(--red); }

/* ---------- Content ---------- */
.wrap { max-width: 1280px; margin: 0 auto; padding: 24px 28px 72px; width: 100%; }
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.page-head h2 { margin: 0; font-size: 22px; color: #fff; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; }
.page-head p { margin: 6px 0 0; font-size: 14px; color: var(--muted); max-width: 64ch; line-height: 1.55; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.center { text-align: center; }

/* ---------- Dashboard hero / status ---------- */
.dash-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(720px 260px at 10% -30%, #2f6bff1f, transparent 60%),
    var(--panel);
}
.dash-hero-copy { min-width: 0; }
.dash-hero-copy h2 { margin: 0; font-size: 24px; }
.dash-hero-copy p { margin: 8px 0 0; max-width: 64ch; color: var(--muted); font-size: 14px; }
.dash-status { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.dash-hero-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.section-title { font-size: 13px; margin: 4px 0 14px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
@media (max-width: 640px) {
  .dash-hero { flex-direction: column; padding: 20px; }
  .dash-hero-actions { width: 100%; }
}

/* ---------- Layout grids ---------- */
.grid { display: grid; gap: 16px; }
.grid + .grid { margin-top: 16px; }
.cols-main { grid-template-columns: minmax(0, 1fr) 340px; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 1100px) { .cols-main { grid-template-columns: 1fr; } }
.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .three, .four { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .three, .four { grid-template-columns: 1fr; } }

/* ---------- Panels / cards ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px #00000026;
}
.panel > h3 {
  margin: 0;
  padding: 16px 20px 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel > h3 svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.panel > h3 svg:first-child { color: var(--brand); }
.panel .body { padding: 14px 20px 20px; }
.panel > .body:first-child { padding-top: 20px; }
.panel .foot { padding: 12px 20px; border-top: 1px solid var(--line); }
.kp-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color .15s;
  color: inherit;
  min-width: 0;
}
.kp-card:hover { border-color: var(--line-strong); text-decoration: none; }

/* ---------- Activity feed ---------- */
.feed { display: flex; flex-direction: column; }
.feed .row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.feed .row:last-child { border-bottom: 0; }
.feed .t { color: #fff; font-weight: 600; font-size: 13.5px; }
.feed .d { color: var(--dim); font-size: 12px; white-space: nowrap; }
.panel-foot-link {
  display: block;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
}
.kp-card .kp-top { display: flex; align-items: center; justify-content: space-between; }
.kp-card .kp-ic {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--brand);
  background: var(--brand-soft);
  flex: none;
}
.kp-card .kp-ic svg { width: 24px; height: 24px; }
.kp-card .k { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); font-weight: 700; }
.kp-card .v { font-size: 26px; font-weight: 800; color: #fff; line-height: 1; font-variant-numeric: tabular-nums; }
.kp-card .trend { font-size: 12.5px; color: var(--muted); }

/* ---------- Feature start cards (AI modules) ---------- */
.feature-start {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  margin-bottom: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.feature-start h3 { margin: 0 0 4px; font-size: 15px; }
.feature-start p { margin: 0; color: var(--muted); font-size: 13.5px; max-width: 62ch; }
.feature-start-aside { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
@media (max-width: 760px) { .feature-start-aside { width: 100%; } }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; border: 1px solid transparent; }
.b-green { background: #22c55e1f; color: var(--green); border-color: #22c55e44; }
.b-red { background: #fb5d6b1f; color: var(--red); border-color: #fb5d6b44; }
.b-amber { background: #f5a6231f; color: var(--amber); border-color: #f5a62344; }
.b-blue  { background: #2563eb1f; color: #2563eb; border-color: #2563eb44; }
.b-sky { background: #3b82f61f; color: var(--sky); border-color: #3b82f644; }
.b-violet { background: #8b5cf61f; color: var(--violet); border-color: #8b5cf644; }
.b-gray { background: #64748b1f; color: var(--muted); border-color: #64748b44; }
.badge.big { font-size: 16px; padding: 6px 12px; border-radius: 8px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line2);
  background: var(--panel2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  min-height: 36px;
}
.btn:hover { border-color: var(--brand); color: #fff; text-decoration: none; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #1f5ae0; border-color: #1f5ae0; }
.btn.danger { background: #fb5d6b18; border-color: #fb5d6b55; color: var(--red); }
.btn.danger:hover { background: #fb5d6b26; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 12px; min-height: 30px; }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; }

button svg, a.btn svg, .notice svg { max-width: 18px; max-height: 18px; flex: none; }

/* ---------- Watchlist consensus buttons (AI Workforce) ---------- */
.wl-list { display: flex; flex-wrap: wrap; gap: 8px; }
.wl-list form { margin: 0; }
.wl-btn { display: flex; flex-direction: column; align-items: stretch; gap: 6px; width: 172px; height: auto; padding: 10px 12px; text-align: left; }
.wl-btn .wl-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wl-btn .wl-row .mono { color: #fff; font-size: 12.5px; }
.wl-btn .wl-meta { font-size: 11px; color: var(--dim); line-height: 1.35; }

/* ---------- Tables ---------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left;
  color: var(--dim);
  font-weight: 700;
  padding: 10px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: #0b1119;
}
.tbl td { padding: 10px; border-bottom: 1px solid #161e2c; vertical-align: middle; }
.tbl tbody tr:hover { background: #0e1622; }
.tbl tr:last-child td { border-bottom: none; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.up { color: var(--green); } .down { color: var(--red); } .warn { color: var(--amber); } .dim { color: var(--dim); }

/* ---------- Forms ---------- */
form.inline { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
label.fld { display: flex; flex-direction: column; gap: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); font-weight: 700; }
input.sel, select.sel, textarea.sel {
  background: #0b1119;
  color: var(--text);
  border: 1px solid var(--line2);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 13.5px;
  font-family: inherit;
}
input.sel:focus, select.sel:focus, textarea.sel:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
input.sel { min-width: 90px; }
textarea.sel { min-height: 96px; resize: vertical; width: 100%; }

/* Unclassed form controls inside panels (execution, risk, brokers). */
.panel input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=range]):not(.sel),
.panel select:not(.sel),
.panel textarea:not(.sel) {
  background: #0b1119;
  color: var(--text);
  border: 1px solid var(--line2);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 13.5px;
  font-family: inherit;
}
.panel input:not([type=checkbox]):not([type=radio]):not([type=hidden]):not([type=range]):focus,
.panel select:focus,
.panel textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.choice,
label.choice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  margin: 6px 0;
}
.choice:hover { border-color: var(--line-strong); }

/* ---------- Meters / providers ---------- */
.meter { margin: 8px 0; }
.meter .row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.meter .bar { height: 6px; border-radius: 4px; background: #141c2a; overflow: hidden; }
.meter .bar > div { height: 100%; border-radius: 4px; }
.prov { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.up { background: var(--green); } .dot.down { background: var(--red); } .dot.synth { background: var(--amber); }

/* ---------- Stat grid ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.stat .k { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--dim); font-weight: 700; }
.stat .v { font-size: 18px; font-weight: 800; margin-top: 4px; color: #fff; font-variant-numeric: tabular-nums; }

/* ---------- Notices / states ---------- */
.notice {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13.5px;
  margin-bottom: 14px;
  border: 1px solid;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}
.notice.err { background: #fb5d6b14; border-color: #fb5d6b44; color: #ffb3b9; }
.notice.ok { background: #22c55e14; border-color: #22c55e44; color: #9fe9b6; }
.notice.warnbox { background: #f5a62314; border-color: #f5a62344; color: #fcd28a; }
.empty-state { text-align: center; padding: 36px 16px; color: var(--dim); }
.empty-state svg { width: 32px; height: 32px; opacity: .4; margin: 0 auto 10px; }
.empty-state p { margin: 0; }
.skeleton {
  background: linear-gradient(90deg, #131c2c 25%, #1a2640 37%, #131c2c 63%);
  background-size: 400% 100%;
  animation: sk 1.3s ease infinite;
  border-radius: 6px;
}
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

footer.page {
  margin-top: auto;
  text-align: center;
  font-size: 12px;
  color: var(--dim);
  line-height: 1.7;
  padding: 20px 24px 16px;
}
.scroll, .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
details.raw > summary { cursor: pointer; color: var(--brand); font-size: 12px; }
pre.raw {
  background: #05070b;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font-size: 11px;
  overflow: auto;
  max-height: 320px;
  color: #94a3b8;
}

.stages { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.stages li { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.stages .n { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; font-weight: 800; background: #141926; color: var(--dim); }
.stages .n.done { background: #0ea5e933; color: var(--sky); }
.stages li.cur { color: #fff; font-weight: 700; }
.stages li.pend { color: var(--dim); }

/* ---------- Authentication pages — clean centered card ---------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1200px 520px at 50% -12%, #2f6bff2b, transparent 60%),
    radial-gradient(900px 460px at 85% 108%, #6366f11e, transparent 55%),
    var(--bg);
}
.auth-shell { flex: 1; display: grid; place-items: center; padding: 48px 20px; }
.auth-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px 32px 28px;
  box-shadow: 0 18px 60px #0000004d;
}
.auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-brand-mark { width: 46px; height: 46px; border-radius: 12px; object-fit: cover; box-shadow: 0 0 0 1px var(--line2), 0 10px 24px #00000040; }
.auth-brand-text { font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.auth-card h1 { margin: 0; text-align: center; color: #fff; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.auth-sub { margin: 8px 0 0; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.5; }
.auth-notice { margin: 18px 0 0; }
.auth-form { display: grid; gap: 16px; margin-top: 24px; }
.auth-field { display: grid; gap: 6px; }
.auth-field > span { font-size: 13px; font-weight: 600; color: var(--text); }
.auth-control { position: relative; display: flex; align-items: center; }
.auth-control input {
  width: 100%;
  border: 1px solid var(--line2);
  border-radius: var(--radius-sm);
  background: #0b1119;
  color: #fff;
  padding: 11px 12px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
}
.auth-control input::placeholder { color: var(--dim); }
.auth-control input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.auth-control textarea {
  width: 100%;
  border: 1px solid var(--line2);
  border-radius: var(--radius-sm);
  background: #0b1119;
  color: #fff;
  padding: 11px 12px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  resize: vertical;
  min-height: 72px;
  line-height: 1.45;
}
.auth-control textarea::placeholder { color: var(--dim); }
.auth-control textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.auth-control.has-toggle input { padding-right: 44px; }
.pw-toggle {
  position: absolute;
  right: 5px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.pw-toggle:hover { color: #fff; }
.pw-toggle svg { width: 18px; height: 18px; }
.auth-hint { font-size: 12px; color: var(--dim); }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; }
.auth-check { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); cursor: pointer; user-select: none; }
.auth-check input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; margin: 0; }
.auth-submit { width: 100%; padding: 12px 14px; font-size: 14px; min-height: 44px; }
.auth-submit.is-loading { pointer-events: none; opacity: .75; }
.auth-spinner { display: inline-block; width: 13px; height: 13px; border: 2px solid #ffffff59; border-top-color: #fff; border-radius: 50%; animation: authspin .7s linear infinite; }
@keyframes authspin { to { transform: rotate(360deg); } }
.auth-foot { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); text-align: center; font-size: 13.5px; color: var(--muted); }
.auth-back { display: block; margin-top: 16px; text-align: center; font-size: 13px; }
@media (max-width: 480px) {
  .auth-card { padding: 28px 20px 24px; }
  .auth-shell { padding: 24px 14px 88px; }
}

/* ---------- Admin / account accents ---------- */
.eyebrow { color: var(--brand); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .14em; margin: 0 0 6px; }
.admin-form label { display: grid; gap: 6px; color: var(--text); font-size: 13px; font-weight: 600; }
.admin-form input, .admin-form select {
  width: 100%;
  border: 1px solid var(--line2);
  border-radius: var(--radius-sm);
  background: #0b1119;
  color: #fff;
  padding: 10px 11px;
  outline: none;
  font-family: inherit;
  font-size: 14px;
}
.admin-form input:focus, .admin-form select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.account-hero { display: flex; align-items: center; gap: 14px; padding: 4px 0 8px; }
.account-hero h3 { margin: 0; color: #fff; font-size: 16px; }
.account-hero p { margin: 2px 0 0; }
.account-mark { width: 48px; height: 48px; object-fit: cover; border-radius: 12px; }
.permission-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.policy-list { display: grid; gap: 10px; }
.policy-list div { padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel2); }
.policy-list b { display: block; color: #fff; font-size: 13px; }
.policy-list span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.admin-badge { display: flex; align-items: center; gap: 8px; color: var(--amber); font-size: 12px; font-weight: 700; }
.admin-badge img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; border: 1px solid #f5a62355; }
.admin-form { display: grid; gap: 12px; margin-top: 12px; }

/* ---------- Media frames (never stretch / overlap) ---------- */
.media {
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel2);
}
.media img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; position: fixed; z-index: 40; width: min(280px, 86vw); box-shadow: var(--shadow); }
  .sidebar-open .sidebar { display: flex; }
  .sidebar-toggle { display: inline-flex; }
  .brand .mark { display: grid; }
  .brand .sub { display: none; }
  .profile .who { display: none; }
  .crumb { display: none; }
  .app-main { padding-bottom: 88px; }
}
@media (max-width: 560px) {
  .wrap { padding: 16px 14px 96px; }
  .topbar { padding: 10px 14px; }
  .page-head h2 { font-size: 20px; }
  .page-head p { font-size: 13.5px; }
  .kp-card .v { font-size: 22px; }
  .tbl th, .tbl td { padding: 8px; }
}

/* ---------- Admin portal ---------- */
.app-shell > .impersonation-banner { grid-column: 1 / -1; }
.impersonation-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  background: #3b2a0a;
  color: #fcd28a;
  border-bottom: 1px solid #f5a62355;
  font-size: 13.5px;
  font-weight: 700;
}
.impersonation-banner form { margin: 0; }
.impersonation-banner .banner-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.impersonation-banner a.btn { text-decoration: none; }
.admin-search { display: flex; align-items: center; gap: 6px; }
.admin-search input {
  width: 240px;
  max-width: 42vw;
  background: #0b1119;
  color: var(--text);
  border: 1px solid var(--line2);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font: inherit;
}
.admin-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.admin-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 16px;
}
.admin-filters label { display: grid; gap: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); font-weight: 700; }
.admin-filters input, .admin-filters select {
  background: #0b1119;
  color: var(--text);
  border: 1px solid var(--line2);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font: inherit;
  min-width: 180px;
}
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.admin-actions form { margin: 0; }
.admin-inline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
.admin-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
}
.admin-shell .sidebar-brand small { color: var(--amber); }
@media (max-width: 820px) {
  .admin-search input { width: 140px; }
}

/* ---------- Save toasts + language picker + voice buttons ---------- */
.save-toasts {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: min(420px, calc(100vw - 32px));
}
.save-toast {
  pointer-events: auto;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 700;
  border: 1px solid;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
  box-shadow: 0 10px 28px #00000066;
}
.save-toast.is-in { opacity: 1; transform: translateY(0); }
.save-toast--ok { background: #12301f; border-color: #22c55e66; color: #9fe9b6; }
.save-toast--err { background: #3b121d; border-color: #fb5d6b66; color: #ffb3b9; }

.lang-picker { position: relative; width: 100%; }
.lang-picker-display {
  width: 100%;
  text-align: left;
  background: #0b1119;
  color: var(--text);
  border: 1px solid var(--line2);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.lang-picker-display:hover, .lang-picker-display:focus { border-color: var(--brand); }
.lang-picker-panel {
  position: absolute;
  z-index: 20;
  left: 0; right: 0;
  top: calc(100% + 4px);
  background: var(--panel);
  border: 1px solid var(--line2);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 8px;
}
.lang-picker-search { width: 100%; margin-bottom: 6px; }
.lang-picker-list { max-height: 240px; overflow: auto; display: grid; gap: 2px; }
.lang-picker-item {
  display: grid; gap: 2px;
  width: 100%; text-align: left;
  background: transparent; border: 0; color: var(--text);
  padding: 8px 10px; border-radius: 8px; cursor: pointer; font: inherit;
}
.lang-picker-item:hover, .lang-picker-item.is-selected { background: var(--brand-soft); }
.lang-picker-name { font-weight: 700; font-size: 13px; }
.lang-picker-meta { font-size: 11px; color: var(--dim); }
.lang-picker-empty, .lang-picker-note { font-size: 11px; color: var(--dim); margin: 6px 4px 2px; }

.btn.is-recording { background: #fb5d6b22; border-color: var(--red); color: #ffb3b9; }
.voice-unavailable { font-size: 12px; color: var(--amber); margin-top: 8px; }

/* The floating AI assistant (WINDELS Assistant) styles live in
   assets/css/chat-widget.css, loaded by the chat_widget partial itself so
   the widget floats correctly on every page shell — including the public
   site, which never loads this stylesheet. */

/* =========================================================
   Account & authentication enhancements (WINDELS AI WORKFORCE)
   Two-column auth, profile avatar, account page sections.
   ========================================================= */

/* ---- Profile avatar (dashboard header + user menu) ---- */
.profile .avatar--img { overflow: hidden; background: transparent; }
.profile .avatar--img img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }

/* ---- Two-column auth pages (login / register) ---- */
.auth-split { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; place-items: center; max-width: 980px; margin: 0 auto; width: 100%; }
.auth-visual { display: flex; flex-direction: column; gap: 18px; width: 100%; max-width: 460px; }
.auth-visual-frame { position: relative; border-radius: 18px; overflow: hidden; border: 1px solid var(--line2); box-shadow: 0 20px 60px #00000055; background: var(--panel2); aspect-ratio: 4 / 3; }
.auth-visual-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.auth-visual-fallback { display: none; width: 100%; height: 100%; place-items: center; color: var(--muted); font-size: 60px; }
.auth-visual-copy .eyebrow { margin: 0 0 8px; }
.auth-visual-copy h2 { margin: 0; color: #fff; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.auth-visual-copy p { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; max-width: 44ch; }

/* ---- Logout / goodbye page ---- */
.auth-shell--goodbye { display: grid; place-items: center; padding: 48px 20px; }
.auth-card--goodbye { max-width: 460px; }
.goodbye-visual { margin: 0 auto 18px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line2); background: var(--panel2); max-width: 340px; aspect-ratio: 3 / 2; }
.goodbye-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.goodbye-fallback { display: none; width: 100%; height: 100%; place-items: center; color: var(--muted); font-size: 46px; }

/* ---- Account page ---- */
.avatar-lg-wrap { flex: none; width: 84px; height: 84px; }
.avatar-lg { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 2px solid var(--line2); box-shadow: 0 8px 24px #00000044; }
.avatar-lg--initial { display: grid; place-items: center; font-weight: 800; font-size: 32px; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.avatar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.avatar-actions .avatar-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.avatar-actions label.btn { position: relative; cursor: pointer; }
.account-edit { margin-top: 18px; padding: 16px 18px; border: 1px solid var(--line2); border-radius: 12px; background: var(--panel2); }
.account-edit h4 { margin: 0 0 4px; color: #fff; font-size: 14px; }
.account-edit .auth-form { margin-top: 10px; gap: 12px; }

/* ---- Responsive: stack the visual above the form on mobile ---- */
@media (max-width: 860px) {
  .auth-split { grid-template-columns: 1fr; gap: 22px; padding-top: 24px; }
  .auth-visual { max-width: 520px; }
  .auth-visual-frame { aspect-ratio: 16 / 9; }
  .auth-visual-copy { display: none; }
}
@media (max-width: 480px) {
  .auth-split { gap: 18px; }
  .auth-visual-frame { aspect-ratio: 16 / 9; }
}

/* ---------- Shared auth chrome: site menu + footer on every auth page ---------- */
.auth-page { display: flex; flex-direction: column; min-height: 100vh; }
.auth-nav {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 5vw;
  background: #0a0e17f2;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.auth-nav-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.auth-nav-brand:hover { text-decoration: none; }
.auth-nav-brand img { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; }
.auth-nav-links { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-left: 10px; font-size: 13.5px; }
.auth-nav-links a { color: var(--muted); padding: 6px 0; }
.auth-nav-links a:hover, .auth-nav-links a.is-active { color: #fff; text-decoration: none; }
.auth-nav-actions { margin-left: auto; display: flex; gap: 8px; }
.auth-nav-actions .btn { min-height: 38px; padding: 0 16px; border-radius: 10px; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; }
.auth-nav-actions .btn.primary { background: var(--brand); color: #fff; border: 1px solid var(--brand); }
.auth-nav-actions .btn.primary:hover { background: #1f5ae0; text-decoration: none; }
.auth-nav-actions .btn.ghost { background: transparent; color: #fff; border: 1px solid var(--line2); }
.auth-nav-actions .btn.ghost:hover { border-color: var(--line-strong); text-decoration: none; }
.auth-nav-toggle { display: none; margin-left: auto; border: 1px solid var(--line2); background: transparent; color: #fff; border-radius: 8px; padding: 8px 12px; font-weight: 700; cursor: pointer; }

.auth-foot-site { margin-top: auto; background: #070b12; border-top: 1px solid var(--line); padding: 40px 5vw 22px; color: var(--muted); font-size: 13.5px; }
.auth-foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 28px; max-width: 1180px; margin: 0 auto; }
.auth-foot-grid strong { display: block; color: #fff; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 10px; }
.auth-foot-grid span { display: block; color: #fff; font-weight: 700; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 10px; }
.auth-foot-grid p { margin: 0 0 10px; line-height: 1.6; max-width: 46ch; }
.auth-foot-grid a { display: block; color: var(--muted); padding: 3px 0; }
.auth-foot-grid a:hover { color: #fff; text-decoration: none; }
.auth-foot-legal { max-width: 1180px; margin: 26px auto 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--dim); }

/* ---------- Register page — organised multi-section layout ---------- */
.auth-shell--register { display: block; padding: 40px 5vw 56px; }
.auth-reg { max-width: 1180px; margin: 0 auto; width: 100%; }
.auth-reg-head { max-width: 720px; margin: 0 0 26px; }
.auth-reg-head h1 { margin: 0; font-size: 30px; line-height: 1.2; }
.auth-reg-lead { margin: 10px 0 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
.auth-reg-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.auth-card--form { max-width: none; padding: 28px 28px 24px; }

.auth-form--sections { display: grid; gap: 22px; margin-top: 4px; }
.auth-section { border: 1px solid var(--line); border-radius: 12px; background: var(--panel2); padding: 18px 18px 20px; margin: 0; min-width: 0; }
.auth-section legend { display: flex; align-items: center; gap: 10px; padding: 0 8px; margin-left: -4px; color: #fff; font-size: 14px; font-weight: 700; }
.auth-step { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; font-weight: 800; }
.auth-section-note { margin: 2px 0 14px; color: var(--dim); font-size: 12.5px; }
.auth-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.auth-field--full { grid-column: 1 / -1; margin-top: 14px; }
.auth-control select {
  width: 100%; border: 1px solid var(--line2); border-radius: var(--radius-sm);
  background: #0b1119; color: #fff; padding: 11px 12px; font-family: inherit; font-size: 14px; outline: none;
}
.auth-control select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.auth-hint.is-ok { color: var(--green); }
.auth-hint.is-warn { color: var(--amber); }
.auth-section--submit { display: grid; gap: 14px; }
.auth-section--submit .auth-check { align-items: flex-start; }
.auth-submit-note { margin: 0; color: var(--dim); font-size: 12px; text-align: center; }

.auth-aside { display: grid; gap: 18px; position: sticky; top: 84px; }
.auth-aside .auth-visual-frame { aspect-ratio: 16 / 10; }
.auth-aside-card { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); padding: 18px 20px; }
.auth-aside-card--muted { background: var(--panel2); }
.auth-aside-card h2 { margin: 0 0 10px; font-size: 15px; }
.auth-aside-card p { color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.auth-benefits { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.auth-benefits li { padding-left: 20px; position: relative; }
.auth-benefits li::before { content: ""; position: absolute; left: 0; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.auth-benefits strong { color: #fff; }

@media (max-width: 1024px) {
  .auth-reg-grid { grid-template-columns: 1fr; }
  .auth-aside { position: static; }
}
@media (max-width: 860px) {
  .auth-nav { flex-wrap: wrap; gap: 10px; }
  .auth-nav-toggle { display: inline-block; }
  .auth-nav-links { display: none; width: 100%; flex-direction: column; gap: 0; margin-left: 0; }
  .auth-nav.is-open .auth-nav-links { display: flex; }
  .auth-nav-links a { padding: 10px 0; border-top: 1px solid var(--line); }
  .auth-nav-actions { width: 100%; margin-left: 0; }
  .auth-nav-actions .btn { flex: 1; }
  .auth-foot-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .auth-cols { grid-template-columns: 1fr; }
  .auth-shell--register { padding: 26px 16px 40px; }
  .auth-card--form { padding: 20px 16px 18px; }
  .auth-reg-head h1 { font-size: 24px; }
  .auth-foot-grid { grid-template-columns: 1fr; gap: 20px; }
}

/* ------------------------------------------------------------------ *
 * Live market-data chart (assets/js/market-chart.js)
 * Streams real bars from /api/market-data/live. Synthetic data is never
 * animated as live — it keeps the SIMULATION badge and auto-refresh off.
 * ------------------------------------------------------------------ */
.livechart { margin-top: 12px; }
.livechart-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 10px; margin-bottom: 8px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.livechart-price { font-size: 15px; font-weight: 700; color: var(--text); }
.livechart-price.up { color: var(--green); }
.livechart-price.down { color: var(--red); }
.livechart-source { font-size: 11px; }
.livechart-updated { font-size: 10px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.livechart-controls { margin-left: auto; display: flex; gap: 8px; }
.livechart-canvas { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.livechart-svg { min-width: 760px; width: 100%; display: block; }
.livechart-notice {
  font-size: 11px; margin-top: 8px; padding: 8px 10px;
  border-left: 2px solid var(--line-strong); background: #131c2c66; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.livechart-notice.livechart-error { border-left-color: var(--red); color: #ffc9ce; background: #fb5d6b12; }
@media (prefers-reduced-motion: no-preference) {
  .livechart-price { transition: color .25s ease; }
}
@media (max-width: 860px) {
  .livechart-controls { margin-left: 0; width: 100%; }
  .livechart-controls .btn { flex: 1; }
}

/* Symbol / timeframe switcher for the standalone live chart */
.livechart-controls-row {
  display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line);
}
/* .livechart-fld is a label.fld, so it already gets the standard stacked,
   uppercase field styling — only the width needs constraining. */
.livechart-fld { min-width: 132px; }
.livechart-fld .sel { text-transform: none; letter-spacing: 0; font-weight: 600; }
.livechart-streamnote { font-size: 10.5px; margin-left: auto; max-width: 340px; }

/* Market-data connection strip (welcome/partials/live_market_panel.php) */
.livemarket-state {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px; padding: 10px 12px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.livemarket-chip { display: inline-flex; align-items: center; gap: 8px; }
.livemarket-label { font-size: 12px; font-weight: 600; color: var(--text); }
.livemarket-hint { font-size: 10.5px; margin-left: auto; max-width: 420px; }
.livemarket-hint a { color: var(--brand); }
@media (max-width: 860px) {
  .livechart-streamnote, .livemarket-hint { margin-left: 0; max-width: none; width: 100%; }
}

/* Broker connect form */
.form-grid { display: grid; gap: 14px; }
.form-grid .field { display: flex; flex-direction: column; gap: 6px; }
.form-grid .field label { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.form-grid .field.checkbox label { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--text); display:flex; align-items:center; gap:8px; }
.form-grid .field input[type=text], .form-grid .field input[type=url], .form-grid .field input[type=password], .form-grid .field input:not([type]) {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); background: var(--bg);
  color: var(--text); border-radius: var(--radius-sm); font: inherit;
}
.form-grid .field input:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.form-grid .help { font-size: 11.5px; color: var(--muted); }
.card-link:hover { border-color: var(--brand) !important; background: var(--panel2); }

/* ---------- Direct member ⇄ admin messages ---------- */
.dm-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 520px;
  overflow-y: auto;
  padding: 4px 2px 14px;
  scroll-behavior: smooth;
}
.dm-msg {
  max-width: 78%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--panel2);
}
.dm-msg .dm-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 11px;
  color: var(--dim);
  margin-bottom: 4px;
}
.dm-msg .dm-who { font-weight: 800; color: var(--muted); letter-spacing: .02em; }
.dm-msg .dm-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
}
.dm-msg.dm-incoming { align-self: flex-start; border-top-left-radius: 4px; }
.dm-msg.dm-outgoing { align-self: flex-end; border-top-right-radius: 4px; border-color: #3b82f644; background: #3b82f610; }
.dm-send { display: flex; gap: 10px; align-items: flex-end; margin-top: 12px; }
.dm-send textarea { flex: 1; resize: vertical; }
@media (max-width: 640px) {
  .dm-msg { max-width: 92%; }
  .dm-send { flex-direction: column; align-items: stretch; }
}
