/* AUREA Terminal — dashboard shell (ui-dashboard-spec.md implementation).
   Terminal-native override layer, loaded LAST on every page. Adds the
   Lutherium-density layout translated to the AUREA brand: fixed left
   sidebar (expanded / icon rail / off-canvas drawer), glass cards,
   metric strip with sparklines, dense rows and a sticky right rail.
   Not part of the aurea-tools copy — see README.md. */

: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);
  --glow-violet: rgba(138, 43, 226, 0.14);
  --sidebar-w: 232px;
  --sidebar-rail-w: 76px;
  --topbar-h: 60px;
}

/* --- shell ------------------------------------------------------------- */
.shell { display: block; }
.shell-main { min-width: 0; }

.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%, transparent), 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; }
.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-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); }
  .shell-main { margin-left: var(--sidebar-w); }
}
/* icon rail 1024–1279px */
@media (min-width: 1024px) and (max-width: 1279.98px) {
  .sidebar { display: flex; width: var(--sidebar-rail-w); align-items: stretch; }
  .shell-main { margin-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: sidebar replaces the floating bottom nav */
@media (min-width: 1024px) {
  .bottom-nav { display: none; }
  body { padding-bottom: 32px; }
  .topbar .brand-logo { display: none; }
}

/* --- topbar inside the shell ------------------------------------------- */
.shell-main .topbar { min-height: var(--topbar-h); }
.shell-main .alert { margin-left: 24px; margin-right: 24px; }
@media (max-width: 640px) {
  .shell-main .alert { margin-left: 12px; margin-right: 12px; }
}

/* --- content frame ------------------------------------------------------- */
.shell-main main {
  max-width: 1560px; margin: 0 auto;
  padding: 20px 24px 8px; width: 100%;
}
body[data-page="wallet"] .shell-main main,
body[data-page="alerts"] .shell-main main { max-width: 1120px; }
@media (max-width: 640px) {
  .shell-main main { padding: 16px 12px 8px; }
}
.shell-main .site-footer { max-width: 1560px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }

/* --- glass cards, dashboard density -------------------------------------- */
.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);
  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) {
  .card { padding: 18px; }
  .pool-row { padding-top: 9px; padding-bottom: 9px; border-bottom-color: var(--divider); }
}

/* --- metric strip ---------------------------------------------------------- */
.metric-strip {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px; margin-bottom: 16px;
}
@media (max-width: 1279.98px) { .metric-strip { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 479.98px) { .metric-strip { grid-template-columns: 1fr; } }
.metric-card {
  background: linear-gradient(160deg, rgba(138, 43, 226, 0.10), rgba(255, 255, 255, 0.02) 52%), var(--glass);
  backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border); border-radius: 20px;
  padding: 14px 16px 10px; min-width: 0;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.metric-top { display: flex; align-items: center; gap: 8px; }
.metric-label {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.metric-chg { margin-left: auto; font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.metric-value {
  font-size: 24px; font-weight: 800; margin-top: 5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.metric-sub { font-size: 12px; color: var(--muted-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-spark { width: 100%; height: 36px; display: block; margin-top: 6px; }
.metric-chg.chg-up { color: var(--green); }
.metric-chg.chg-down { color: var(--red); }

/* --- dashboard two-column layout ------------------------------------------- */
.dash-layout { display: block; }
.dash-main { min-width: 0; }
.dash-rail { min-width: 0; }
@media (min-width: 1280px) {
  .dash-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
  .dash-rail { position: sticky; top: calc(var(--topbar-h) + 16px); }
}
@media (max-width: 1279.98px) {
  .dash-layout { display: flex; flex-direction: column; }
  .dash-rail { order: -1; }
}
.quick-actions { display: flex; flex-direction: column; gap: 9px; margin-top: 12px; }
.quick-actions .btn { width: 100%; }

/* --- row sparklines --------------------------------------------------------- */
.pool-spark { flex: none; width: 84px; display: none; }
.pool-spark canvas { width: 84px; height: 28px; display: block; }
@media (min-width: 720px) { .pool-spark { display: block; } }

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
  .sb-scrim { transition: none; }
}
