/* AUR Management — dark ops console */

:root {
  --ink: #e8edf5;
  --muted: #8b97a8;
  --line: #2a3341;
  --surface: #151a22;
  --bg: #0c0f14;
  --bg-soft: #10151c;
  --accent: #3d8bfd;
  --accent-hover: #5aa0ff;
  --accent-soft: rgba(61, 139, 253, 0.14);
  --ok: #3ecf8e;
  --ok-soft: rgba(62, 207, 142, 0.12);
  --danger: #e35d6a;
  --danger-soft: rgba(227, 93, 106, 0.12);
  --warn: #e6b84d;
  --warn-soft: rgba(230, 184, 77, 0.12);
  --radius: 12px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "Consolas", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  height: 56px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand span {
  font-weight: 500;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav { display: flex; gap: 4px; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}
.nav a:hover { color: var(--ink); background: rgba(255,255,255,0.04); text-decoration: none; }
.nav a.active { color: var(--ink); background: rgba(255,255,255,0.06); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}
.main--wide {
  width: min(1680px, calc(100% - 24px));
}

/* Ladders desk: left status · center setup · right coach */
.ladders-desk {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr) minmax(260px, 320px);
  gap: 16px;
  align-items: start;
  margin-top: 4px;
}
.ladders-rail {
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(100vh - 88px);
  overflow-y: auto;
  padding-right: 2px;
}
.ladders-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.rail-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.rail-stats .stat {
  padding: 10px 12px;
}
.rail-stats .stat .value {
  font-size: 1.05rem;
}
.engine-rail h2,
.templates-rail h2 {
  font-size: 1.05rem;
}

/* Setup coach — right column; full height (page scrolls, not the panel alone) */
.coach-float {
  position: sticky;
  top: 72px;
  z-index: 2;
  width: auto;
  max-height: none;
  overflow: visible;
  padding: 14px 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(14, 16, 20, 0.96);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.coach-float-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.coach-float h2 {
  margin: 0;
  font-size: 1.05rem;
}
.coach-live-hint {
  margin: 2px 0 0;
  font-size: 0.75rem;
}
.coach-fit-badge {
  flex-shrink: 0;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255,255,255,0.04);
}
.coach-float.coach-fit-fit {
  border-color: rgba(62,207,142,.55);
  box-shadow: 0 0 0 1px rgba(62,207,142,.18);
}
.coach-float.coach-fit-fit .coach-fit-badge {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: rgba(62,207,142,.45);
}
.coach-float.coach-fit-warn {
  border-color: rgba(230,184,77,.5);
}
.coach-float.coach-fit-warn .coach-fit-badge {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: rgba(230,184,77,.4);
}
.coach-float.coach-fit-bad {
  border-color: rgba(227,93,106,.55);
}
.coach-float.coach-fit-bad .coach-fit-badge {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(227,93,106,.4);
}
.coach-float.coach-busy .coach-live-hint::after {
  content: " · checking…";
}
.coach-float .hint {
  margin: 0;
}
.coach-float .lead {
  margin: 0;
  font-size: 0.88rem;
}
.coach-suggest {
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.coach-suggest .label {
  margin-top: 6px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.coach-suggest .label:first-child { margin-top: 0; }
.coach-suggest .mono {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--text);
}
.coach-import-btn {
  margin-top: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(62,207,142,.45);
  background: var(--ok-soft);
  color: var(--ok);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}
.coach-import-btn:hover {
  filter: brightness(1.08);
}
.coach-import-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
#coachImportHint {
  margin-top: 6px;
}
.coach-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.coach-item {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 0.78rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.coach-item strong { font-weight: 600; }
.coach-item.coach-bad {
  background: var(--danger-soft);
  border-color: rgba(227,93,106,.35);
  color: var(--danger);
}
.coach-item.coach-warn {
  background: var(--warn-soft);
  border-color: rgba(230,184,77,.35);
  color: var(--warn);
}
.coach-item.coach-tip,
.coach-item.coach-ok {
  background: rgba(255,255,255,0.02);
  color: var(--text);
}
.coach-item.coach-ok { border-color: rgba(62,207,142,.35); }
@media (max-width: 1320px) {
  .ladders-desk {
    grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  }
  .coach-float {
    grid-column: 1 / -1;
    position: static;
    order: 3;
  }
}
.templates-rail .row {
  grid-template-columns: 1fr;
}
.templates-rail .tpl-actions-inline button {
  width: 100%;
}
.templates-rail .tpl-row {
  flex-direction: column;
  align-items: stretch;
}
.templates-rail .tpl-btns {
  width: 100%;
  justify-content: flex-start;
}
.templates-rail .switch {
  max-width: none;
}
/* Compact templates footer */
.tpl-bar {
  margin-top: 22px;
  padding: 16px 18px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.015);
}
.tpl-bar-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.tpl-bar-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}
.tpl-bar-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.tpl-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.tpl-tool {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.tpl-tool input[type="text"],
.tpl-tool input[type="file"] {
  width: auto;
  min-width: 140px;
  max-width: 220px;
  padding: 8px 10px;
  font-size: 13px;
}
.tpl-tool input[type="file"] {
  max-width: 260px;
  padding: 6px 8px;
}
.tpl-table {
  margin-top: 14px;
  width: 100%;
  font-size: 0.88rem;
}
.tpl-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tpl-table td {
  vertical-align: middle;
}
.tpl-table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}
.tpl-table-actions form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.tpl-empty { margin: 10px 0 0; }
.capital-rail h2 {
  font-size: 1.05rem;
}
.ladders-rail .arm-panel {
  padding: 16px;
}
.ladders-rail .arm-row {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}
.ladders-rail .arm-copy h2 {
  font-size: 1.1rem;
}
.ladders-rail .arm-copy .lead {
  font-size: 0.85rem;
}
.ladders-rail .switch--hero {
  width: 100%;
  justify-content: space-between;
}
@media (max-width: 1100px) {
  .ladders-desk {
    grid-template-columns: 1fr;
  }
  .ladders-rail {
    position: static;
    max-height: none;
    overflow: visible;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
  .ladders-rail .arm-panel {
    grid-column: 1 / -1;
  }
  .ladders-rail .capital-rail {
    grid-column: 1 / -1;
  }
  .coach-float {
    grid-column: 1 / -1;
    position: static;
  }
}
@media (max-width: 720px) {
  .ladders-rail {
    grid-template-columns: 1fr;
  }
  .tpl-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .tpl-tool input[type="text"],
  .tpl-tool input[type="file"] {
    max-width: none;
    width: 100%;
  }
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.page-head h1 {
  margin: 0 0 4px;
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.page-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 56ch;
}

/* Price strip */
.tickers {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
@media (max-width: 900px) {
  .tickers { grid-template-columns: repeat(2, 1fr); }
}
.ticker {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.ticker .sym {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.ticker .px {
  margin-top: 6px;
  font-size: 1.15rem;
  font-weight: 600;
  font-family: var(--mono);
}
.ticker .chg { margin-top: 4px; font-size: 12px; font-family: var(--mono); }
.ticker .chg.up { color: var(--ok); }
.ticker .chg.down { color: var(--danger); }
.ticker .chg.flat { color: var(--muted); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 14px;
}
.panel h2 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 600;
}
.panel .lead {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.85rem;
}

.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 14px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat .label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.stat .value {
  font-size: 1.25rem;
  font-weight: 650;
  font-family: var(--mono);
}
.stat .meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.ok { color: var(--ok); }
.bad { color: var(--danger); }

.dash-split {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
@media (max-width: 900px) {
  .dash-split { grid-template-columns: 1fr; }
}

.chart-wrap {
  position: relative;
  height: 220px;
}
.chart-wrap canvas { width: 100% !important; height: 100% !important; }

label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin: 12px 0 6px;
}
label:first-child { margin-top: 0; }

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0e131a;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* One-box searchable dropdown (combobox) */
.combo {
  position: relative;
  width: 100%;
}
.combo-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.combo-face {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 0 10px 0 0;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0e131a;
}
.combo.is-open .combo-face,
.combo-face:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.combo-input {
  flex: 1;
  min-width: 0;
  margin: 0 !important;
  padding: 10px 4px 10px 12px !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-family: var(--mono), "IBM Plex Mono", ui-monospace, monospace;
}
.combo-input:focus {
  outline: none !important;
  box-shadow: none !important;
}
.combo-caret {
  flex-shrink: 0;
  width: 0;
  height: 0;
  margin-right: 4px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--muted);
  pointer-events: none;
}
.combo.is-open .combo-caret {
  transform: rotate(180deg);
}
.combo-menu {
  position: absolute;
  z-index: 50;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  margin: 0;
  padding: 4px;
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0e131a;
  box-shadow: 0 12px 28px rgba(0,0,0,0.45);
}
.combo-menu[hidden] {
  display: none !important;
}
.combo-option {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  font-family: var(--mono), "IBM Plex Mono", ui-monospace, monospace;
  text-align: left;
  cursor: pointer;
}
.combo-option:hover,
.combo-option.is-active {
  background: rgba(255,255,255,0.06);
}
.combo-option.is-selected {
  color: var(--ok);
}
.combo-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 0.82rem;
}
.follow-slot .combo {
  width: 100%;
}

/* Checkbox inputs inside switches must not look like text fields */
label.switch {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 520px;
  margin: 10px 0 6px !important;
  padding: 12px 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.015));
  border: 1px solid rgba(255,255,255,0.06);
  cursor: pointer;
  user-select: none;
  color: var(--ink);
  font-size: inherit;
  font-weight: inherit;
  transition: background 0.28s ease, border-color 0.28s ease;
}
label.switch:hover {
  background: linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.03));
  border-color: rgba(255,255,255,0.1);
}
label.switch .switch-copy { flex: 1; min-width: 0; text-align: left; }
label.switch .switch-title {
  display: block;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink);
}
label.switch .switch-hint {
  display: block;
  margin-top: 3px;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.35;
}
label.switch .switch-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
label.switch input[type="checkbox"] {
  position: absolute !important;
  opacity: 0 !important;
  width: 46px !important;
  height: 28px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  cursor: pointer;
  z-index: 2;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}
label.switch .switch-track {
  display: block;
  width: 46px;
  height: 28px;
  border-radius: 999px;
  position: relative;
  flex-shrink: 0;
  background: #3a4454;
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.35);
  transition: background 0.28s ease;
  pointer-events: none;
}
label.switch .switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f3f6fb;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
label.switch input[type="checkbox"]:checked + .switch-track {
  background: #3ecf8e;
}
label.switch input[type="checkbox"]:checked + .switch-track .switch-knob {
  transform: translateX(18px);
}
label.switch .switch-state {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  min-width: 2rem;
  color: var(--muted);
  pointer-events: none;
}
label.switch .switch-state::before { content: "Off"; }
label.switch input[type="checkbox"]:checked ~ .switch-state { color: var(--ok); }
label.switch input[type="checkbox"]:checked ~ .switch-state::before { content: "On"; }

label.switch.switch--compact {
  max-width: none;
  width: auto;
  margin: 0 !important;
  padding: 6px 10px;
  gap: 10px;
  background: transparent;
  border-color: transparent;
}
label.switch.switch--compact .switch-title { font-size: 0.85rem; color: var(--muted); }
label.switch.switch--compact .switch-track { width: 40px; height: 24px; }
label.switch.switch--compact .switch-knob { width: 18px; height: 18px; }
label.switch.switch--compact input[type="checkbox"] {
  width: 40px !important;
  height: 24px !important;
}
label.switch.switch--compact input[type="checkbox"]:checked + .switch-track .switch-knob {
  transform: translateX(16px);
}
label.switch.switch--compact .switch-state { display: none; }

.switch-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 560px;
}

label.switch.switch--hero {
  max-width: none;
  width: auto;
  margin: 0 !important;
  padding: 14px 18px;
  gap: 16px;
  border-radius: 18px;
  background: rgba(0,0,0,0.22);
}
label.switch.switch--hero .switch-track {
  width: 64px;
  height: 36px;
}
label.switch.switch--hero .switch-knob {
  width: 28px;
  height: 28px;
  top: 4px;
  left: 4px;
}
label.switch.switch--hero input[type="checkbox"] {
  width: 64px !important;
  height: 36px !important;
}
label.switch.switch--hero input[type="checkbox"]:checked + .switch-track .switch-knob {
  transform: translateX(28px);
}
label.switch.switch--hero .switch-state {
  font-size: 1.05rem;
  min-width: 2.4rem;
}

/* Follow path enable — same clear pill as Armed */
label.switch.switch--path {
  max-width: 560px;
  margin-top: 14px !important;
}
.path-exchange {
  max-width: 560px;
  margin: 4px 0 8px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
}
.path-exchange label {
  margin-top: 0;
  font-size: 0.95rem;
  color: var(--ink);
  font-weight: 500;
}
.path-exchange select {
  margin-top: 6px;
  font-size: 1rem;
  font-weight: 500;
}

/* Reference basket: one row per slot — symbol + weight% aligned */
.follow-slots {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255,255,255,0.02);
}
.follow-slots-head,
.follow-slot {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 110px;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
}
.follow-slot {
  align-items: start;
}
.follow-slot .search-select {
  width: 100%;
}
.follow-slot .weight-field {
  margin-top: 0;
  align-self: center;
}
.follow-slots-head {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  background: rgba(0,0,0,0.18);
}
.follow-slot + .follow-slot {
  border-top: 1px solid rgba(255,255,255,0.04);
}
.follow-slot-idx {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
}
.follow-slot select {
  margin: 0;
  width: 100%;
  font-family: var(--mono);
  font-size: 0.9rem;
}
.weight-field {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
.weight-field input {
  margin: 0;
  border: 0;
  border-radius: 0;
  width: 100%;
  min-width: 0;
  text-align: right;
  font-family: var(--mono);
  font-size: 0.9rem;
  padding: 8px 6px 8px 10px;
  background: transparent;
}
.weight-field input:focus {
  outline: none;
  box-shadow: none;
}
.weight-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.weight-suffix {
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(255,255,255,0.03);
  border-left: 1px solid var(--line);
  user-select: none;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 640px) {
  .follow-slots-head { display: none; }
  .follow-slots-head,
  .follow-slot {
    grid-template-columns: 32px minmax(0, 1fr) 96px;
    gap: 8px;
    padding: 10px 12px;
  }
}

.fee-default {
  margin-top: 14px;
}
.fee-default-ex {
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}
.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.row.is-hidden,
[hidden].row {
  display: none !important;
}
.vol-fee-est {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.02);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 100%;
  box-sizing: border-box;
}
.vol-fee-est .label {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.vol-fee-est .value {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
}
.vol-fee-est .meta {
  font-size: 0.78rem;
  color: var(--muted);
}
.vol-fee-est .hint {
  margin: 4px 0 0;
}
@media (max-width: 700px) {
  .row { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .brand span { display: none; }
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 14px;
}
.check input { width: auto; }

/* Trading Armed panel */
.arm-panel {
  padding: 22px 24px;
  border-width: 1px;
  background:
    radial-gradient(600px 180px at 90% 20%, rgba(62, 207, 142, 0.06), transparent 60%),
    var(--surface);
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
}
.arm-panel.arm-off {
  border-color: rgba(139, 151, 168, 0.28);
  background:
    radial-gradient(600px 180px at 90% 20%, rgba(139, 151, 168, 0.06), transparent 60%),
    var(--surface);
}
.arm-panel.arm-on {
  border-color: rgba(72, 180, 140, 0.35);
  box-shadow: 0 0 0 1px rgba(62, 207, 142, 0.08);
}
.arm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.arm-copy { flex: 1; min-width: 220px; }
.arm-copy h2 {
  margin: 0 0 6px;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}
.arm-copy .lead { margin: 0; font-size: 0.95rem; }
.arm-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid rgba(139, 151, 168, 0.2);
  font-size: 0.9rem;
  line-height: 1.45;
  cursor: pointer;
}
.arm-opt input {
  width: auto;
  margin-top: 3px;
  flex-shrink: 0;
}
.arm-opt .hint {
  display: block;
  margin-top: 4px;
  opacity: 0.75;
  font-size: 0.82rem;
}
.engine-strip { margin-top: 0; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  align-items: center;
}

.desk-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 92%, #000 8%);
  backdrop-filter: blur(8px);
}
.desk-bar-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.desk-bar-copy strong { font-size: 0.95rem; }
.desk-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.desk-form.desk-locked .desk-fields {
  opacity: 0.92;
}
.desk-form:not(.desk-locked) .desk-fields {
  outline: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 6px;
  border-radius: 8px;
}
.panel--tight {
  padding-top: 12px;
  padding-bottom: 12px;
}

button, .btn {
  appearance: none;
  border: 0;
  border-radius: 8px;
  padding: 9px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}
button:hover, .btn:hover { background: var(--accent-hover); }
button.ghost, .btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
button.ghost:hover, .btn.ghost:hover { background: rgba(255,255,255,0.04); }
button.secondary, .btn.secondary {
  background: var(--accent-soft);
  color: #9ec5ff;
}
button.danger, .btn.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(227, 93, 106, 0.35);
}
button.block { width: 100%; padding: 12px; }

.flash {
  padding: 11px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 0.9rem;
}
.flash.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid rgba(62,207,142,.35); }
.flash.err { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(227,93,106,.35); }

.hint { color: var(--muted); font-size: 0.82rem; }
.warn {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.82rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255,255,255,0.03);
}
.badge.on { color: var(--ok); background: var(--ok-soft); border-color: rgba(62,207,142,.4); }
.badge.off { color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td {
  text-align: left;
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
code, .mono {
  font-family: var(--mono);
  font-size: 0.85em;
  background: rgba(255,255,255,0.04);
  padding: 2px 6px;
  border-radius: 4px;
}
.num { font-family: var(--mono); text-align: right; }

details { margin-top: 10px; }
summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}
summary:hover { color: var(--ink); }

/* Compact ? help — hover / focus popover keeps the desk clean */
.help-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: 4px;
}
.help-tip .help-q {
  display: inline-grid;
  place-items: center;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  user-select: none;
}
.help-tip:hover .help-q,
.help-tip:focus-within .help-q {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}
.help-tip .help-pop {
  position: absolute;
  z-index: 40;
  left: 0;
  bottom: calc(100% + 8px);
  width: min(280px, 72vw);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.45;
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
}
.help-tip .help-pop strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.8rem;
}
.help-tip:hover .help-pop,
.help-tip:focus-within .help-pop {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.help-block {
  margin: 0 0 12px;
  padding: 0;
  border: none;
}
.help-block > summary {
  list-style: none;
  color: var(--accent);
  font-size: 0.82rem;
}
.help-block > summary::-webkit-details-marker { display: none; }
.help-block[open] > summary { margin-bottom: 8px; }
.help-block .help-body {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}
.help-block .help-body p { margin: 0 0 8px; }
.help-block .help-body p:last-child { margin-bottom: 0; }
.subhead .help-tip { margin-left: 6px; }
label .help-tip { margin-left: 6px; }
.switch-title .help-tip { margin-left: 6px; }

.bal { margin-top: 12px; }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.callout {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}
.callout strong { color: var(--ink); font-weight: 600; }

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 10% -10%, #1a2740 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #1c1828 0%, transparent 50%),
    var(--bg);
}
.login-card {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 26px 22px;
  box-shadow: var(--shadow);
}
.login-card .brand-block { margin-bottom: 22px; }
.login-card h1 {
  margin: 0 0 4px;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}
.login-card .sub { margin: 0; color: var(--muted); font-size: 0.9rem; }
.login-card .ver {
  margin-top: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

.subhead {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 600;
}
.tpl-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tpl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.02);
}
.tpl-meta { flex: 1; min-width: 180px; }
.tpl-btns {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tpl-btns form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.tpl-actions-inline button { width: 100%; }
a.btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

/* One-sided ladder book — sticky strip + confirm modal */
.book-warn-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 16px;
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 90, 90, 0.45);
  background: rgba(180, 40, 40, 0.22);
  color: #ffb4b4;
  font-size: 0.95rem;
}
.book-warn-strip[hidden] { display: none !important; }
.book-warn-strip strong { color: #fff; font-weight: 600; }
.book-warn-strip .mono { opacity: 0.9; font-size: 0.85rem; }

.book-warn-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
}
.book-warn-modal[hidden] { display: none !important; }
.book-warn-modal__card {
  width: min(480px, 100%);
  padding: 22px 22px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 90, 90, 0.5);
  background: #1a1214;
  color: #f2e9ea;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}
.book-warn-modal__eyebrow {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
  color: #ff8a8a;
  font-weight: 600;
}
.book-warn-modal__card h2 {
  margin: 0 0 12px;
  font-size: 1.25rem;
  line-height: 1.3;
  color: #fff;
}
.book-warn-modal__detail {
  margin: 0 0 12px;
  line-height: 1.45;
  color: #e8d6d8;
}
.book-warn-modal__nums {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.88rem;
  color: #ffc9c9;
}
.book-warn-modal__hint {
  margin: 0 0 16px;
  font-size: 0.88rem;
  color: #b9a8aa;
  line-height: 1.4;
}
.book-warn-modal__btn {
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-radius: 8px;
  background: #e85d5d;
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}
.book-warn-modal__btn:hover { background: #f06a6a; }
.book-warn-modal__btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

