/* The admin shell (docs/UI_STANDARD.md): one labelled sidebar (every main section on screen, More folded below,
 * narrows to its icons and remembers it) and one header row. */

.admin-body {
  --fx-sticky-top: 64px;
  --sb-wide: 224px;
  --sb-narrow: 60px;
}

.admin-body .admin-frame {
  grid-template-columns: var(--sb-wide) minmax(0, 1fr);
  transition: grid-template-columns 0.16s ease;
}

.admin-body .admin-frame.sb-collapsed {
  grid-template-columns: var(--sb-narrow) minmax(0, 1fr);
}

.admin-body .admin-sidebar.sb {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  height: 100dvh;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  background: var(--sidebar);
  border-right: 1px solid var(--sidebar-line);
  box-shadow: none;
}

/* Head: the brand (links to Today) and the narrow/wide switch. */
.sb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 52px;
  padding: 0 10px 0 14px;
  border-bottom: 1px solid var(--sidebar-line);
}

.admin-body .sb-brand.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  text-decoration: none;
}

.admin-body .sb-brand .brand-mark {
  width: 26px;
  height: 26px;
  font-size: 12px;
}

.sb-brand-text {
  min-width: 0;
  white-space: nowrap;
}

.admin-body .sb-brand strong {
  font-size: 13.5px;
}

.admin-body .sb-brand small {
  margin-top: 1px;
  color: var(--faint);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.sb-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.sb-icon-button:hover {
  color: var(--ink);
  background: rgba(148, 163, 184, 0.08);
}

.sb-icon-button:focus-visible,
.admin-body .sb a:focus-visible,
.sb-more > summary:focus-visible {
  outline: 2px solid rgba(124, 180, 245, 0.6);
  outline-offset: -2px;
}

.sb-icon-button .nav-icon,
.sb-icon-button .button-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

.admin-body .sb .mobile-nav-toggle {
  display: none;
}

/* The list: section labels, then one row per page (icon, name, count). */
.admin-body .sb-nav.side-nav {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 14px;
  min-height: 0;
  padding: 12px 8px 16px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.18) transparent;
}

.admin-body .sb .nav-section {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.admin-body .sb .nav-section > .nav-section-label {
  display: block;
  padding: 0 10px 5px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav-entry {
  display: flex;
  flex-direction: column;
}

.admin-body .sb .nav-entry > a,
.admin-body .sb .sb-more > summary,
.admin-body .sb .sb-account {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.admin-body .sb .nav-entry > a::before {
  content: none;
  display: none;
}

.admin-body .sb .nav-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  color: var(--faint);
  transition: color 0.12s ease;
}

.admin-body .sb .nav-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-body .sb .nav-entry > a:hover,
.admin-body .sb .sb-more > summary:hover,
.admin-body .sb .sb-account:hover {
  color: var(--ink);
  background: rgba(148, 163, 184, 0.07);
}

.admin-body .sb .nav-entry > a:hover .nav-icon,
.admin-body .sb .sb-more > summary:hover .nav-icon,
.admin-body .sb .sb-account:hover .nav-icon {
  color: var(--muted);
}

.admin-body .sb .nav-entry > a.active,
.admin-body .sb .sb-account.active {
  color: var(--ink);
  background: rgba(124, 180, 245, 0.1);
  font-weight: 500;
}

.admin-body .sb .nav-entry > a.active .nav-icon,
.admin-body .sb .sb-account.active .nav-icon {
  color: var(--nav);
}

.admin-body .sb .nav-entry > a.active::after {
  content: "";
  position: absolute;
  left: -8px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--nav);
}

.admin-body .sb .nav-badge {
  flex: 0 0 auto;
  margin-left: auto;
}

/* The page shown keeps its own list under it: watchlists, running automations, strategy groups, market sets. */
.subnav-children {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 2px 0 6px 17px;
  padding: 2px 0 2px 10px;
  border-left: 1px solid var(--sidebar-line);
}

.subnav-subgroup {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.subnav-subgroup + .subnav-subgroup {
  margin-top: 4px;
}

.subnav-subgroup-label {
  padding: 5px 8px 2px;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-body .sb a.subnav-child,
.admin-body .sb button.subnav-action {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  min-height: 26px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.3;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.admin-body .sb a.subnav-child::before,
.admin-body .sb a.subnav-child::after {
  content: none;
  display: none;
}

.subnav-child-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-body .sb a.subnav-child:hover,
.admin-body .sb button.subnav-action:hover {
  color: var(--ink);
  background: rgba(148, 163, 184, 0.07);
}

.admin-body .sb a.subnav-child.active {
  color: var(--ink);
  background: rgba(124, 180, 245, 0.1);
  font-weight: 500;
}

.admin-body .sb a.subnav-child-off {
  opacity: 0.62;
}

.subnav-count {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 11px;
}

.admin-body .sb a.subnav-child.active .subnav-count {
  color: var(--muted);
}

.subnav-tag {
  flex: 0 0 auto;
  padding: 0 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 16px;
  white-space: nowrap;
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted);
}

.subnav-tag-warn {
  background: rgba(251, 191, 36, 0.18);
  color: #fcd34d;
}

.subnav-tag-pos {
  background: rgba(52, 211, 153, 0.16);
  color: #6ee7b7;
}

.subnav-tag-info {
  background: rgba(124, 180, 245, 0.16);
  color: #93c5fd;
}

.admin-body .sb button.subnav-action {
  justify-content: flex-start;
  margin-top: 2px;
  color: var(--nav);
  font-weight: 500;
}

.admin-body .sb button.subnav-action::before {
  content: "+";
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1;
}

/* More: Control, Research, Data and System, folded until opened or until one of their pages is shown. */
.sb-more {
  display: block;
  padding-top: 10px;
  border-top: 1px solid var(--sidebar-line);
}

/* A <details> does not lay its content out as flex children, so the sections are spaced by margins. */
.admin-body .sb .sb-more > .nav-section {
  margin-top: 14px;
}

.admin-body .sb .sb-more > summary + .nav-section {
  margin-top: 10px;
}

.admin-body .sb .sb-more > summary {
  list-style: none;
}

.sb-more > summary::-webkit-details-marker {
  display: none;
}

.sb-more-mark {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin: 0 3px 0 auto;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  color: var(--faint);
  transform: rotate(-45deg);
  transition: transform 0.12s ease;
}

.sb-more[open] .sb-more-mark {
  transform: rotate(45deg) translate(-2px, -1px);
}

/* Foot: who is signed in (the account page) and sign out. */
.sb-foot {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  padding: 8px;
  border-top: 1px solid var(--sidebar-line);
}

.admin-body .sb .sb-account {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12.5px;
}

.sb-foot form {
  margin: 0;
}

/* Narrow: icons only, sections split by a hairline, names in the hover text, each page's own list hidden. */
.admin-body .sb-collapsed .sb-head {
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 12px 0 10px;
}

.admin-body .sb-collapsed .sb-brand-text,
.admin-body .sb-collapsed .sb .nav-section > .nav-section-label,
.admin-body .sb-collapsed .sb-more-mark,
.admin-body .sb-collapsed .subnav-children {
  display: none;
}

.admin-body .sb-collapsed .sb .nav-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.admin-body .sb-collapsed .sb-nav.side-nav {
  gap: 0;
  padding: 8px 10px 16px;
}

.admin-body .sb-collapsed .sb .nav-section + .nav-section,
.admin-body .sb-collapsed .sb-more {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--sidebar-line);
}

.admin-body .sb-collapsed .sb .sb-more > .nav-section {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--sidebar-line);
}

.admin-body .sb-collapsed .sb .nav-entry > a,
.admin-body .sb-collapsed .sb .sb-more > summary,
.admin-body .sb-collapsed .sb .sb-account {
  justify-content: center;
  width: 40px;
  min-height: 34px;
  padding: 0;
}

.admin-body .sb-collapsed .sb .nav-icon {
  width: 18px;
  height: 18px;
  flex-basis: 18px;
}

.admin-body .sb-collapsed .sb .nav-entry > a.active::after {
  left: -10px;
}

.admin-body .sb-collapsed .sb .nav-badge {
  position: absolute;
  top: 1px;
  right: 0;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  font-size: 9.5px;
  line-height: 15px;
  pointer-events: none;
}

.admin-body .sb-collapsed .sb-foot {
  flex-direction: column;
  padding: 8px 0 10px;
}

.admin-body .sb-collapsed .sb .sb-account {
  flex: 0 0 auto;
}

/* One-row header: page title and optional one-line subtitle on the left, symbol search and trading status on the right. */
.admin-body .admin-topbar {
  min-height: 58px;
  padding: 9px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: var(--surface, #0b1120);
  border-bottom: 1px solid var(--line);
}

.admin-topbar-main {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-topbar-eyebrow {
  margin: 0;
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-topbar-eyebrow a {
  color: var(--muted);
  text-decoration: none;
}

.admin-topbar-eyebrow a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.admin-topbar-title {
  margin: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.admin-topbar-title small {
  margin-left: 2px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 400;
  letter-spacing: 0;
}

.admin-topbar-sub {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 82ch;
}

.admin-topbar-sub a {
  color: var(--ink);
}

.admin-topbar-sub .ws-quote {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.admin-topbar-sub .ws-price {
  font-size: 13.5px;
  font-weight: 600;
}

.admin-body .admin-shell-fixed {
  height: calc(100dvh - 58px);
}

/* Page toolbars after page headings moved into the topbar. */
.admin-page-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  margin: 0 0 14px;
}

.trading-viewport-page > .admin-page-bar {
  flex: 0 0 auto;
}

.admin-page-bar-end {
  justify-content: flex-end;
}

.admin-page-bar > .fx-nav,
.admin-page-bar > .dk-tabs,
.admin-page-bar > .wl-meta,
.admin-page-bar > .fd-form,
.admin-page-bar > .symbol-links,
.admin-page-bar > .oi-way {
  margin: 0;
}

.admin-page-bar > .fx-nav {
  position: static;
  flex: 0 1 auto;
  min-width: 0;
}

.admin-page-bar > .dk-tabs {
  flex: 1 1 auto;
  min-width: 0;
}

.admin-page-bar > .wl-meta,
.admin-page-bar > .oi-way {
  flex: 1 1 320px;
  min-width: 0;
}

.admin-page-bar > .fd-form {
  flex: 1 1 auto;
  min-width: 0;
}

.admin-page-bar .fx-header-side {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.admin-page-bar > .sl-actions,
.admin-page-bar > .ws-side,
.admin-page-bar > .br-card-actions,
.admin-page-bar > .dk-filter,
.admin-page-bar > .page-actions {
  margin-left: auto;
}

.admin-page-bar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.admin-page-bar-left p {
  margin: 0;
  font-size: 12.5px;
}

.sl-set-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.sl-set-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}

.sl-set-select select {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel, #111827);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13px;
}

/* Phone width: the sidebar is a bar with the brand and a menu button; the list opens under it, always wide. */
@media (max-width: 900px) {
  .admin-body .admin-frame,
  .admin-body .admin-frame.sb-collapsed {
    display: block;
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-body .admin-sidebar.sb {
    z-index: 40;
    height: auto;
    max-height: 100dvh;
    border-right: 0;
    border-bottom: 1px solid var(--sidebar-line);
  }

  .admin-body .sb-collapsed .sb-head,
  .sb-head {
    flex-direction: row;
    justify-content: space-between;
    min-height: 48px;
    padding: 0 10px 0 14px;
    border-bottom: 0;
  }

  .admin-body .sb-collapsed .sb-brand-text {
    display: block;
  }

  .admin-body .sb .sb-collapse {
    display: none;
  }

  .admin-body .sb .mobile-nav-toggle {
    display: inline-flex;
    margin-left: auto;
  }

  .admin-body .sb:not(.nav-open) .sb-nav.side-nav,
  .admin-body .sb:not(.nav-open) .sb-foot {
    display: none;
  }

  .admin-body .sb.nav-open .sb-nav.side-nav {
    display: flex;
    max-height: calc(100dvh - 48px - 50px);
    border-top: 1px solid var(--sidebar-line);
  }

  /* On a phone the narrow setting is ignored: names are always shown. */
  .admin-body .sb-collapsed .sb .nav-label {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
  }

  .admin-body .sb-collapsed .sb .nav-section > .nav-section-label {
    display: block;
  }

  .admin-body .sb-collapsed .sb-more-mark {
    display: block;
  }

  .admin-body .sb-collapsed .subnav-children {
    display: flex;
  }

  .admin-body .sb-collapsed .sb-nav.side-nav {
    gap: 14px;
    padding: 12px 8px 16px;
  }

  .admin-body .sb-collapsed .sb .nav-section + .nav-section,
  .admin-body .sb-collapsed .sb .sb-more > .nav-section {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .admin-body .sb-collapsed .sb .sb-more > .nav-section {
    margin-top: 14px;
  }

  .admin-body .sb-collapsed .sb .nav-entry > a,
  .admin-body .sb-collapsed .sb .sb-more > summary,
  .admin-body .sb-collapsed .sb .sb-account {
    justify-content: flex-start;
    width: auto;
    min-height: 34px;
    padding: 0 10px;
  }

  .admin-body .sb-collapsed .sb .nav-badge {
    position: static;
  }

  .admin-body .sb-collapsed .sb-foot {
    flex-direction: row;
    padding: 8px;
  }

  .admin-body .sb-collapsed .sb .sb-account {
    flex: 1 1 auto;
  }

  .admin-body .admin-topbar {
    flex-wrap: wrap;
    min-height: 0;
    padding: 10px 14px;
    gap: 10px;
  }

  .admin-topbar-main {
    flex: 1 1 100%;
  }

  .admin-topbar-sub {
    white-space: normal;
  }
}

/* The filter over a page's own list in the sidebar, once the list is long (admin_shell.js). */
.admin-body .subnav-filter { width: 100%; height: 24px; min-height: 0; margin: 0 0 3px; padding: 0 7px; border: 1px solid var(--sidebar-line); border-radius: 5px; background: transparent; color: var(--ink); font: 400 12px/1 var(--font-ui); }
.admin-body .subnav-filter::placeholder { color: var(--faint); }
.admin-body .subnav-filter:focus { outline: none; border-color: var(--active-border); }
.admin-body .sb .subnav-children [hidden] { display: none !important; }

/* ---- The header, fourth pass (13 Nov 2026): one quiet 48px row -------------------------------
   No slab of its own: the page's background shows through, with a hairline under it. The title and its one line sit
   on one baseline; the symbol box is a small field with its key shown; the trading status is a dot and two words; Stop
   stays in reach but only turns red when pointed at. */
.admin-body .admin-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 48px;
  padding: 0 24px;
  gap: 16px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft, var(--line));
}
.admin-body .admin-topbar-main { flex-direction: row; flex-wrap: nowrap; align-items: baseline; gap: 12px; }
.admin-body .admin-topbar-eyebrow { flex: 0 0 auto; font-size: 10px; }
.admin-body .admin-topbar-title { flex: 0 0 auto; flex-wrap: nowrap; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.admin-body .admin-topbar-sub { flex: 1 1 0; min-width: 0; max-width: none; color: var(--faint); font-size: 12.5px; }
.admin-body .admin-topbar-actions { flex: 0 0 auto; gap: 14px; }

.admin-body .admin-topbar-search { position: relative; align-items: center; }
.admin-body .admin-topbar-search-icon { position: absolute; left: 9px; color: var(--faint); pointer-events: none; }
.admin-body .admin-topbar-search input {
  width: 200px;
  height: 30px;
  min-height: 0;
  padding: 0 30px 0 28px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.07);
  color: var(--ink);
  font: 400 12.5px/1 var(--font-ui);
  transition: width 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.admin-body .admin-topbar-search input::placeholder { color: var(--faint); }
.admin-body .admin-topbar-search input:hover { background: rgba(148, 163, 184, 0.1); }
.admin-body .admin-topbar-search input:focus { width: 300px; border-color: var(--active-border); background: var(--input-bg); box-shadow: none; outline: none; }
.admin-body .admin-topbar-key { position: absolute; right: 7px; display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; padding: 0 4px; border: 1px solid var(--line); border-radius: 4px; color: var(--faint); font: 500 10px/1 var(--font-mono); pointer-events: none; }
.admin-body .admin-topbar-search input:focus ~ .admin-topbar-key { display: none; }

.admin-body .admin-topbar-status { gap: 12px; }
.admin-body .admin-topbar .admin-topbar-chip { min-height: 0; padding: 0; border: 0; background: none; color: var(--muted); font: 400 12px/1 var(--font-ui); letter-spacing: 0; text-transform: none; text-decoration: none; }
.admin-body .admin-topbar a.admin-topbar-chip:hover { color: var(--ink); }
.admin-body .admin-topbar .admin-topbar-chip-warn { color: #fcd34d; }
.admin-body .admin-topbar .admin-topbar-chip-neg { color: #fca5a5; }
.admin-body .admin-topbar .admin-topbar-stop button { height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); font: 500 12px/1 var(--font-ui); transition: color 0.12s ease, border-color 0.12s ease, background-color 0.12s ease; }
.admin-body .admin-topbar .admin-topbar-stop button:hover,
.admin-body .admin-topbar .admin-topbar-stop button:focus-visible { border-color: rgba(248, 113, 113, 0.6); background: rgba(248, 113, 113, 0.14); color: #fca5a5; }
.admin-body .admin-shell-fixed { height: calc(100dvh - 48px); }
@media (max-width: 1100px) { .admin-body .admin-topbar-sub { display: none; } }
@media (max-width: 720px) {
  .admin-body .admin-topbar { padding: 8px 14px; }
  .admin-body .admin-topbar-search input, .admin-body .admin-topbar-search input:focus { width: 100%; }
}
