/* Two-column shell: sidebar + content. Mobile: off-canvas drawer. */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100%;
}
.is-booting .app, .is-guest .app { filter: blur(6px) saturate(0.7); opacity: 0.55; }
.app { transition: filter 0.35s var(--ease), opacity 0.35s var(--ease); }

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky; top: 0;
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px 14px 14px;
  overflow-y: auto;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 20px;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand__mark { width: 30px; height: 30px; color: var(--accent); filter: drop-shadow(0 0 8px rgba(47, 240, 163, 0.35)); }
.brand__name { font-weight: 700; font-size: 19px; letter-spacing: -0.02em; }
.brand__accent { color: var(--accent); }
.brand__tag { margin-left: auto; font-size: 10.5px; color: var(--faint); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav__label {
  font: 600 11px/1 var(--mono);
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--faint);
  padding: 18px 12px 8px;
}
.nav__item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 10px 12px;
  border: 0; border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font-size: 14.5px; text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav__item svg { width: 20px; height: 20px; }
.nav__item:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav__item.is-active { background: var(--panel-3); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav__item.is-active > svg:first-child { color: var(--accent); }
.nav__item.is-locked { color: var(--faint); }
.nav__item.is-locked:hover { color: var(--muted); }
.nav__lock { margin-left: auto; width: 15px !important; height: 15px !important; opacity: 0.8; }

/* Possess mode: admin viewing as a customer */
.depossess {
  display: flex; align-items: center; gap: 10px;
  width: 100%; margin-top: auto; padding: 9px 12px;
  border: 1px solid var(--warn); border-radius: var(--r);
  background: var(--warn-soft); color: var(--warn);
  font: 600 12px/1.2 var(--mono); text-align: left; cursor: pointer;
}
.depossess:hover { background: rgba(255, 181, 71, 0.18); }
.depossess__glyph { font-weight: 700; }
.depossess__text { display: grid; gap: 2px; min-width: 0; }
.depossess__who { color: var(--text-2); font-weight: 400; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.depossess + .account { margin-top: 8px; }
body.is-possessed { box-shadow: inset 0 3px 0 var(--warn); }

.account {
  display: flex; align-items: center; gap: 10px;
  margin-top: 16px; padding: 10px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--panel);
}
.account__avatar {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  font-weight: 700; text-transform: uppercase;
}
.account__meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.account__email { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Main column ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 16px;
  min-height: var(--topbar-h);
  padding: 12px 32px;
  background: rgba(5, 7, 11, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .topbar__menu { display: none; }
.stats { display: flex; gap: 40px; flex: 1; min-width: 0; }
.stat dt.stat__dt--text { display: block; }
.stat dt { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.stat dd { font-size: 16px; font-weight: 600; margin-top: 2px; white-space: nowrap; }
.live { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); letter-spacing: 0.08em; }
.live__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); animation: pulse 2.4s ease-in-out infinite; }
.live.is-stale .live__dot { background: var(--warn); box-shadow: 0 0 10px var(--warn); }
@keyframes pulse { 50% { opacity: 0.35; transform: scale(0.8); } }

.content {
  flex: 1;
  padding: 36px 32px 64px;
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: -1px -1px;
}
.view { max-width: 1180px; margin: 0 auto; }
.view__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; flex-wrap: wrap; }
.view__head h1 { font-size: 28px; letter-spacing: -0.025em; font-weight: 700; }
.lede { color: var(--muted); margin-top: 6px; max-width: 560px; }

.grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 20px;
  align-items: start;
}
.grid--single { grid-template-columns: minmax(0, 1fr); } /* unfunded: no wallet card yet */

.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 19; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .stats { gap: 28px; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 20; left: 0; top: 0;
    width: min(var(--sidebar-w), 86vw);
    transform: translateX(-102%);
    transition: transform 0.25s var(--ease);
  }
  .is-menu-open .sidebar { transform: none; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .topbar .topbar__menu { display: inline-grid; }
  .stats { gap: 18px; overflow-x: auto; scrollbar-width: none; }
  .stats::-webkit-scrollbar { display: none; }
  .stat dd { font-size: 14px; }
  .stat--status, .stat--price, .live span.mono { display: none; } /* phones: balance, value, total */
  .content { padding: 24px 16px 48px; }
  .view__head h1 { font-size: 23px; }
}
@media (max-width: 480px) {
  .stats { gap: 14px; }
  .stat dt { font-size: 11.5px; white-space: nowrap; }
  .stat__long { display: none; } /* "Est. Total (USD)" fits on one line */
}
