/* AUREA Tools — dashboard shell (ui-dashboard-spec.md implementation).
   Shared override layer, loaded LAST on every Tools page. Adds the
   Lutherium-density layout translated to the AUREA brand: fixed left
   sidebar (expanded / icon rail / off-canvas drawer), glass cards,
   denser rows and the ambient violet-gold ground. The sidebar markup
   is static in every page; tools-shell.js drives the drawer, the
   active nav state and the watchlist. Pages loaded inside a hub
   iframe carry .embed-mode on <html> and hide the shell entirely. */

:root {
  --glass: rgba(18, 22, 38, 0.72);
  --glass-strong: rgba(10, 15, 30, 0.88);
  --glass-border: rgba(255, 255, 255, 0.08);
  --divider: rgba(255, 255, 255, 0.05);
  --sidebar-w: 232px;
  --sidebar-rail-w: 76px;
}

/* --- ambient ground ------------------------------------------------------ */
body {
  background:
    radial-gradient(900px 480px at 50% -120px, rgba(255, 190, 0, 0.10), rgba(255, 190, 0, 0) 60%),
    radial-gradient(820px 620px at 100% 0, rgba(138, 43, 226, 0.12), rgba(138, 43, 226, 0) 55%),
    radial-gradient(720px 720px at 0 100%, rgba(138, 43, 226, 0.07), rgba(138, 43, 226, 0) 55%),
    var(--bg);
  background-attachment: fixed;
}

/* --- sidebar ------------------------------------------------------------- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w); z-index: 60;
  display: none; flex-direction: column;
  background: linear-gradient(180deg, rgba(138, 43, 226, 0.07), rgba(255, 215, 0, 0.03) 55%, rgba(255, 215, 0, 0)), var(--glass-strong);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--glass-border);
  box-shadow: 18px 0 44px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin;
}
.sb-brand { padding: 16px 16px 10px; display: block; }
.sb-brand .sb-logo-full { height: 40px; width: auto; max-width: 100%; display: block; }
.sb-brand .sb-logo-mark { display: none; width: 36px; height: 36px; border-radius: 50%; }

.sb-nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.sb-sec {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted-2);
  padding: 12px 8px 6px;
}
.sb-link {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  min-height: 38px; padding: 8px 10px; border-radius: 10px;
  color: var(--muted); text-decoration: none;
  font-size: 14px; font-weight: 700; white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.sb-link svg { width: 18px; height: 18px; flex: none; }
.sb-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.sb-link.active { background: var(--gold-soft); color: var(--gold); }
.sb-link.active::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 3px; background: var(--gold);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.55);
}
.sb-link.sb-cta { color: var(--gold); }
.sb-link.sb-cta:hover { background: var(--gold-soft); color: var(--gold-light); }
.sb-link .sb-ext { margin-left: auto; font-size: 11px; color: var(--muted-2); }
.sb-link:focus-visible, .sb-watch-row:focus-visible, .sb-toggle:focus-visible {
  outline: 2px solid rgba(255, 215, 0, 0.55); outline-offset: 1px;
}

.sb-watch { padding: 4px 10px 10px; }
.sb-watch-row {
  display: flex; align-items: baseline; gap: 8px; width: 100%;
  padding: 7px 10px; border-radius: 10px; border: none; background: none;
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
}
.sb-watch-row:hover { background: rgba(255, 255, 255, 0.05); }
.sb-watch-sym { font-weight: 800; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-watch-nums { margin-left: auto; text-align: right; flex: none; }
.sb-watch-price { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sb-watch-chg { font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sb-watch-note { font-size: 12px; color: var(--muted-2); padding: 4px 10px; line-height: 1.5; }
.sb-watch-chg.chg-up { color: var(--green); }
.sb-watch-chg.chg-down { color: var(--red); }

.sb-foot {
  margin-top: auto; padding: 14px 18px 18px;
  border-top: 1px solid var(--divider);
  display: flex; flex-direction: column; gap: 8px;
}
.sb-foot a { color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 700; }
.sb-foot a:hover { color: var(--gold); }

.sb-scrim {
  position: fixed; inset: 0; z-index: 55;
  background: rgba(2, 6, 22, 0.62); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.sb-toggle {
  display: none; flex: none;
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--glass); border: 1px solid var(--glass-border);
  color: var(--text); cursor: pointer;
  align-items: center; justify-content: center;
}
.sb-toggle svg { width: 20px; height: 20px; }

/* expanded sidebar ≥1280px */
@media (min-width: 1280px) {
  .sidebar { display: flex; width: var(--sidebar-w); }
  body { padding-left: var(--sidebar-w); }
  main { max-width: 1180px; }
}
/* icon rail 1024–1279px */
@media (min-width: 1024px) and (max-width: 1279.98px) {
  .sidebar { display: flex; width: var(--sidebar-rail-w); align-items: stretch; }
  body { padding-left: var(--sidebar-rail-w); }
  .sb-brand { padding: 14px 0 8px; display: flex; justify-content: center; }
  .sb-brand .sb-logo-full { display: none; }
  .sb-brand .sb-logo-mark { display: block; }
  .sb-sec, .sb-watch, .sb-foot { display: none; }
  .sb-nav { padding: 6px 8px; align-items: center; }
  .sb-link { justify-content: center; padding: 10px; }
  .sb-link .sb-label, .sb-link .sb-ext { display: none; }
  .sb-link.active::before { left: -8px; }
}
/* off-canvas drawer <1024px */
@media (max-width: 1023.98px) {
  .sidebar {
    display: flex; width: 264px;
    transform: translateX(-105%);
    transition: transform 0.24s ease;
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.5);
  }
  .sidebar.open { transform: translateX(0); }
  .sb-scrim.on { opacity: 1; pointer-events: auto; }
  .sb-toggle { display: inline-flex; }
}
/* desktop: the sidebar replaces the top menu strip and the bottom nav */
@media (min-width: 1024px) {
  .topnav { display: none; }
  .bottom-nav { display: none; }
  body { padding-bottom: 32px; }
  .topbar .brand-logo { display: none; }
}

/* --- glass cards, dashboard density --------------------------------------- */
.card, .tool-card, .intel-card, .token-card {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.014) 55%), var(--glass);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.38), 0 0 24px rgba(138, 43, 226, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
@media (min-width: 1024px) {
  .row { padding-top: 6px; padding-bottom: 6px; }
  .list-item { padding-top: 9px; padding-bottom: 9px; }
  .card table td, .card table th { padding-top: 9px; padding-bottom: 9px; }
}
@media (hover: hover) {
  .card, .tool-card, .intel-card, .token-card { transition: box-shadow 0.2s ease, transform 0.2s ease; }
}

/* --- hub embed mode: the shell never shows inside a tab iframe ------------ */
.embed-mode .sidebar, .embed-mode .sb-scrim, .embed-mode .sb-toggle { display: none !important; }
.embed-mode body { padding-left: 0 !important; }

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
  .sb-scrim { transition: none; }
  .card, .tool-card, .intel-card, .token-card { transition: none; }
}
