/* Valtron "Frosted Glass" layer (2026-11-16)
   Loaded AFTER style.css on the admin panel (base.html, login.html) and the
   affiliates panel (aff_base.html, aff_auth_base.html). It only re-skins:
   no element moves. Remove the <link> to glass.css to roll back.
   Depth: backdrop (fixed glow scene) -> layer 1 frosted panels (blur) ->
   layer 2 frosted cards inside panels (translucent, parent does the blur). */

/* ------------------------------------------------------------ tokens: dark */
html[data-theme="dark"] {
  --bg: #07070f;
  --shell: rgba(18, 17, 34, .72);
  --surface: rgba(20, 19, 38, .58);
  --surface-2: rgba(255, 255, 255, .06);
  --surface-3: rgba(255, 255, 255, .10);
  --border: rgba(255, 255, 255, .12);
  --border-soft: rgba(255, 255, 255, .085);
  --title: #f6f5ff;
  --ink: rgba(240, 238, 255, .90);
  --muted: rgba(236, 234, 255, .68);
  --faint: rgba(236, 234, 255, .48);
  --brand: #8b7cff; --brand-2: #b4a9ff; --brand-ink: #c4bbff;
  --green: #3ee08f; --red: #ff6b7f; --gold: #ffc561; --blue: #6cb6ff;
  --dark: rgba(0, 0, 0, .24);
  --dark-2: rgba(255, 255, 255, .06);
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .10), 0 20px 50px -22px rgba(0, 0, 0, .65);
  --shadow-lg: inset 0 1px 0 rgba(255, 255, 255, .12), 0 30px 80px -24px rgba(0, 0, 0, .75);
  --glow: inset 0 1px 0 rgba(255, 255, 255, .30), 0 10px 28px -8px rgba(123, 108, 246, .75);
  --grad: linear-gradient(135deg, #9a8cff, #6b5cf0);
  --grad-blue: linear-gradient(135deg, #9a8cff, #6b5cf0);
  --grad-panel: linear-gradient(150deg, rgba(139, 124, 255, .30), rgba(91, 140, 255, .12) 55%, rgba(255, 255, 255, .04));
  --g-orb1: rgba(109, 77, 255, .30);
  --g-orb2: rgba(44, 140, 255, .22);
  --g-orb3: rgba(192, 77, 255, .14);
  --g-orb4: rgba(24, 198, 160, .12);
  --g-grid: rgba(255, 255, 255, .035);
  --g-solid: rgba(20, 19, 38, .92);   /* menus / dropdown options: must stay readable */
  --g-hi: rgba(255, 255, 255, .14);   /* top edge highlight */
}

/* ----------------------------------------------------------- tokens: light */
html:not([data-theme="dark"]) {
  --bg: #ecebf7;
  --shell: rgba(255, 255, 255, .62);
  --surface: rgba(255, 255, 255, .50);
  --surface-2: rgba(255, 255, 255, .62);
  --surface-3: rgba(255, 255, 255, .80);
  --border: rgba(30, 24, 90, .12);
  --border-soft: rgba(30, 24, 90, .08);
  --dark: rgba(22, 20, 46, .82);
  --dark-2: rgba(255, 255, 255, .10);
  --shadow: inset 0 1px 0 rgba(255, 255, 255, .85), 0 18px 44px -22px rgba(40, 30, 120, .30);
  --shadow-lg: inset 0 1px 0 rgba(255, 255, 255, .9), 0 28px 70px -26px rgba(40, 30, 120, .35);
  --grad-panel: linear-gradient(150deg, rgba(111, 97, 242, .92), rgba(77, 62, 201, .86));
  --g-orb1: rgba(140, 115, 255, .40);
  --g-orb2: rgba(80, 170, 255, .30);
  --g-orb3: rgba(220, 120, 255, .24);
  --g-orb4: rgba(40, 210, 170, .18);
  --g-grid: rgba(30, 24, 90, .04);
  --g-solid: rgba(255, 255, 255, .96);
  --g-hi: rgba(255, 255, 255, .9);
}

/* ---------------------------------------------------------------- backdrop */
body, .login-body {
  background: var(--bg) !important;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(520px 520px at 4% 22%, var(--g-orb1), transparent 70%),
    radial-gradient(640px 640px at 100% 0%, var(--g-orb2), transparent 70%),
    radial-gradient(600px 560px at 48% 78%, var(--g-orb3), transparent 70%),
    radial-gradient(520px 520px at 96% 92%, var(--g-orb4), transparent 70%),
    linear-gradient(var(--g-grid) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(90deg, var(--g-grid) 1px, transparent 1px) 0 0 / 64px 64px;
}
body { position: relative; z-index: 0; }

/* the old big white/dark shell card goes: panels float on the backdrop */
.app {
  background: transparent !important;
  box-shadow: none !important;
}

/* ------------------------------------------- layer 1: frosted glass panels */
.topnav,
.panel, .stat-card, .agent-card, .kpi,
.dark-panel, .violet-panel,
.agent-strip, .acct-row, .login-card,
.au-tile, .sig-tile, .flash,
details.g-acc {
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02));
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  backdrop-filter: blur(24px) saturate(160%);
}
.panel, .stat-card, .agent-card, .kpi, .acct-row, .login-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.panel, .kpi, .stat-card, .agent-card { border-radius: 22px; }

/* top nav = one floating glass pill */
.topnav {
  background-color: var(--shell);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 12px 10px 20px;
  box-shadow: var(--shadow);
}
.pillnav { background: var(--dark); border: 1px solid var(--border-soft); }
.pillnav a.active {
  background: linear-gradient(180deg, rgba(255, 255, 255, .20), rgba(255, 255, 255, .08));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 4px 14px -4px rgba(139, 124, 255, .7);
}
.icon-btn { border-radius: 50%; background: var(--surface); border-color: var(--border-soft); }
.side-avatar { box-shadow: 0 0 0 3px rgba(139, 124, 255, .28); }
.user-pop {
  background: var(--g-solid) !important;
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  border: 1px solid var(--border);
}

/* page header */
.topbar h1 { letter-spacing: -.02em; }

/* --------------------------------------------- dashboard specific panels */
.dark-panel {
  background-color: rgba(0, 0, 0, .22);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
html:not([data-theme="dark"]) .dark-panel { background-color: rgba(22, 20, 46, .80); }
.violet-panel {
  background: var(--grad-panel);
  border: 1px solid rgba(180, 169, 255, .28);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  backdrop-filter: blur(24px) saturate(160%);
}
.list-row.sel {
  background: linear-gradient(90deg, rgba(139, 124, 255, .32), rgba(139, 124, 255, .08));
  box-shadow: inset 0 0 0 1px rgba(180, 169, 255, .32);
}
.mini-card { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .14); }
.agent-strip {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 10px;
  box-shadow: var(--shadow);
}
.agent-chip { background: var(--surface-2); border: 1px solid var(--border-soft); }
.feed-card { background: var(--surface-2); border: 1px solid var(--border-soft); }
.feed-card.hot {
  background: linear-gradient(160deg, rgba(139, 124, 255, .45), rgba(139, 124, 255, .14));
  border-color: rgba(180, 169, 255, .40);
}
.btn-dark { background: var(--surface-3); border: 1px solid var(--border); color: var(--title); }
.sig-tile, .au-tile { background-color: var(--surface-2); border: 1px solid var(--border-soft); }
.bars .bar { background: rgba(255, 255, 255, .12); }
html:not([data-theme="dark"]) .bars .bar { background: rgba(30, 24, 90, .10); }
.bars .bar.hot { background: linear-gradient(180deg, #b4a9ff, #8b7cff); }

/* --------------------------------------------- layer 2: cards in panels */
.panel .panel, .panel .stat-card, .panel .kpi, .panel .acct-row, .panel .au-tile, .panel .sig-tile {
  -webkit-backdrop-filter: none; backdrop-filter: none;
  background-color: var(--surface-2);
  box-shadow: inset 0 1px 0 var(--g-hi);
}

/* ------------------------------------------------------------------ tables */
.table-wrap {
  border-radius: 16px;
  background: rgba(0, 0, 0, .12);
  border: 1px solid var(--border-soft);
}
html:not([data-theme="dark"]) .table-wrap { background: rgba(255, 255, 255, .35); }
th { border-bottom-color: var(--border-soft); padding-top: 12px; padding-bottom: 12px; color: var(--faint); }
td { border-bottom-color: var(--border-soft); }
tbody tr:hover { background: rgba(139, 124, 255, .08); }
.mono { font-family: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace; }

/* ---------------------------------------------------- tags / chips / pills */
.tag { border-radius: 999px; }
.tabs { background: var(--dark); border: 1px solid var(--border-soft); }
html:not([data-theme="dark"]) .tabs { background: rgba(255, 255, 255, .45); }
.tab.active, .seg button.active {
  background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .08));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
  color: var(--title);
}
html:not([data-theme="dark"]) .tab.active { background: var(--grad); color: #fff; }

/* ------------------------------------------------------------- forms/btns */
input, select, textarea {
  background: rgba(0, 0, 0, .18);
  border-color: var(--border);
}
html:not([data-theme="dark"]) input,
html:not([data-theme="dark"]) select,
html:not([data-theme="dark"]) textarea { background: rgba(255, 255, 255, .7); }
select option { background: var(--g-solid); color: var(--ink); }
.btn { border-radius: 999px; background: var(--surface-2); border-color: var(--border); }
.btn:hover { background: var(--surface-3); }
.btn-primary { background: var(--grad); border: none; box-shadow: var(--glow); }
.btn-white { box-shadow: 0 10px 30px -10px rgba(255, 255, 255, .5); }

/* ---------------------------------------------------------- accordions */
details.g-acc {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 22px;
  overflow: hidden;
}
details.g-acc > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 18px 24px;
  font-weight: 700;
  font-size: 15px;
  color: var(--title);
  -webkit-tap-highlight-color: transparent;
}
details.g-acc > summary::-webkit-details-marker { display: none; }
details.g-acc > summary::after {
  content: "";
  margin-left: auto;
  width: 28px; height: 28px; flex: 0 0 28px;
  border-radius: 50%;
  background: var(--surface-3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a9a3d6' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / 14px no-repeat;
  transition: transform .2s ease;
}
details.g-acc[open] > summary::after { transform: rotate(180deg); }
details.g-acc > summary:hover { background: rgba(255, 255, 255, .03); }
details.g-acc .g-sub { font-weight: 500; font-size: 12.5px; color: var(--faint); }
details.g-acc .g-peek { display: flex; gap: 20px; flex-wrap: wrap; font-weight: 500; font-size: 12.5px; color: var(--faint); }
details.g-acc .g-peek b { color: var(--title); margin-left: 4px; }
details.g-acc > .g-body { padding: 0 24px 22px; }
/* a panel moved inside an accordion loses its own frame */
details.g-acc > .g-body > .panel,
details.g-acc > .panel {
  background: transparent; border: 0; box-shadow: none;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  padding: 0 24px 22px; margin: 0;
}
details.g-acc.g-inner {
  border-radius: 16px; margin: 14px 0 0; box-shadow: inset 0 1px 0 var(--g-hi);
  -webkit-backdrop-filter: none; backdrop-filter: none; background-color: var(--surface-2);
}
details.g-acc.g-inner > summary { padding: 13px 16px; font-size: 13.5px; }
details.g-acc.g-inner > .g-body { padding: 0 16px 16px; }
/* existing <details> blocks on the old pages (manual publish / client trades) */
.main-inner > details:not(.g-acc) > summary { padding: 16px 20px !important; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); }

/* section group labels */
.g-grp {
  display: flex; align-items: center; gap: 12px;
  margin: 6px 6px 12px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--faint);
}
.g-grp::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border), transparent); }
.g-grp span { letter-spacing: .02em; text-transform: none; font-weight: 500; }

/* -------------------------------------------------------- mobile shell */
@media (max-width: 900px) {
  .topnav { border-radius: 0 0 22px 22px; border-top: 0; padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px; }
  .tabbar, .sheet-panel {
    background: var(--shell) !important;
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    backdrop-filter: blur(24px) saturate(160%);
  }
  .tabbar { border-top: 1px solid var(--border); }
  .sheet-panel { background: var(--g-solid) !important; }
  details.g-acc > summary { padding: 16px 18px; }
  details.g-acc > .g-body { padding: 0 16px 16px; }
}

/* old browsers without backdrop-filter: keep text readable */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html[data-theme="dark"] { --surface: rgba(28, 27, 48, .92); --surface-2: rgba(36, 35, 60, .92); --shell: rgba(22, 21, 40, .96); }
}

/* ---- fixes after first live check (2026-11-17) ---- */
/* keep the top bar on ONE row: the pill nav shrinks + scrolls instead of wrapping */
@media (min-width: 901px) {
  .topnav { flex-wrap: nowrap; }
  .pillnav { flex: 0 1 auto; min-width: 0; }
  .pillnav a { padding: 9px 14px; }
  .topnav-icons { gap: 6px; }
  .icon-btn { width: 38px; height: 38px; }
}
/* text that sat on white chips used the (now see-through) dark token */
.btn-white, .btn-white:hover { color: #3b2fb8; }
.list-row.sel .lr-pill { color: #14122a; }
.list-row.sel .lr-pill.live { color: #0f8a52; }

/* ---- light-mode contrast fixes + calmer dark backdrop (2026-11-17) ---- */
html:not([data-theme="dark"]) .bars .bar { background: rgba(30, 24, 90, .14); }
html:not([data-theme="dark"]) .bars .bar.hot { background: linear-gradient(180deg, #8b7cff, #5b4ce0); }
html:not([data-theme="dark"]) .feed-card.hot { background: var(--grad); border-color: transparent; }
/* accordions sitting on the purple trader panel stay purple-glass in both modes */
.violet-panel details.g-acc.g-inner { background-color: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .22); }
.violet-panel details.g-acc.g-inner > summary { color: #fff; }
.violet-panel details.g-acc .g-sub { color: rgba(255, 255, 255, .72); }
