/* ---------- App shell: sidebar (desktop) / bottom nav (mobile) ---------- */
.shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-w) 1fr; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--space-5);
  padding: var(--space-5) var(--space-4); border-right: 1px solid var(--border); background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 var(--space-2); font-weight: 700; letter-spacing: -.02em; text-decoration: none; }
.brand img { width: 30px; height: 30px; }
.nav { display: grid; gap: 2px; }
.nav-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding: var(--space-3) var(--space-3) var(--space-1); }
.nav a {
  display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 var(--space-3);
  border-radius: var(--radius-sm); color: var(--text-2); text-decoration: none; font-weight: 500; font-size: 14px;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] .icon { color: var(--yellow); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10; height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-6);
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 18px; font-weight: 650; }
.content { padding: var(--space-6); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-5); align-content: start; width: 100%; max-width: 1440px; }
.content > * { min-width: 0; }

.account-chip {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px;
  border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--surface); font-size: 14px; font-weight: 550;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.demo { background: var(--up); }
.dot.live { background: var(--down); box-shadow: 0 0 0 3px var(--down-soft); }
.dot.paper { background: var(--purple); }
.account-chip { cursor: pointer; color: var(--text); max-width: 360px; }
.account-chip:hover { background: var(--surface-2); }
.account-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.kind-tag {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 8px; border-radius: var(--radius-pill); background: var(--surface-3); color: var(--text-2);
}
.kind-tag.demo { background: var(--up-soft); color: var(--up); }
.kind-tag.live { background: var(--down-soft); color: var(--down); }
.kind-tag.paper { background: color-mix(in srgb, var(--purple) 16%, transparent); color: var(--purple); }
.menu button[aria-checked="true"] { background: var(--surface-2); }
@media (max-width: 860px) { .account-label { max-width: 90px; } }

.user-menu { position: relative; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--yellow), var(--purple)); color: #111; font-weight: 700; cursor: pointer;
}
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; z-index: 20;
  padding: 6px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.menu[hidden] { display: none; }
.menu .menu-head { padding: 10px 12px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu button, .menu a {
  display: flex; width: 100%; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px;
  border: 0; border-radius: var(--radius-sm); background: transparent; text-decoration: none; cursor: pointer; font-size: 14px;
}
.menu button:hover, .menu a:hover { background: var(--surface-2); }

.bottom-nav { display: none; }

.grid-cards { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.stat-value { font-size: 32px; font-weight: 600; letter-spacing: -.03em; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 0 var(--space-4); }
  .content { padding: var(--space-4); padding-bottom: calc(var(--bottomnav-h) + var(--space-5) + env(safe-area-inset-bottom)); }
  .bottom-nav {
    position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--border);
  }
  .bottom-nav a {
    display: grid; place-items: center; align-content: center; gap: 2px; text-decoration: none;
    color: var(--muted); font-size: 11px; font-weight: 550;
  }
  .bottom-nav a[aria-current="page"] { color: var(--text); }
  .bottom-nav a[aria-current="page"] .icon { color: var(--yellow); }
  .hide-mobile { display: none !important; }
  .grid-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
  .grid-cards .card { padding: var(--space-4); }
  .stat-value { font-size: 26px; }
}

/* ---------- Auth pages (image-7 style: big title, centered column) ---------- */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: var(--space-5) var(--space-4);
}
.auth-panel { width: min(440px, 100%); display: grid; gap: var(--space-6); }
.auth-title { font-size: clamp(36px, 9vw, 52px); font-weight: 800; letter-spacing: -.035em; line-height: 1.02; text-align: center; }
.auth-sub { text-align: center; color: var(--muted); margin-top: calc(-1 * var(--space-4)); }
.auth-logo { display: grid; place-items: center; }
.auth-logo img { width: 52px; height: 52px; }
.auth-actions { display: grid; grid-template-columns: auto 1fr; gap: var(--space-3); }
.auth-actions.single { grid-template-columns: 1fr; }
.auth-links { text-align: center; font-size: 14px; color: var(--muted); }
.auth-links a { font-weight: 600; color: var(--text); }
.resend {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%;
  border: 0; background: none; color: var(--muted); font-size: 14px; cursor: pointer;
}
.resend[disabled] { cursor: default; }
.resend:not([disabled]) { color: var(--text); font-weight: 600; }
.steps { display: flex; justify-content: center; gap: 6px; }
.steps span { width: 24px; height: 4px; border-radius: 4px; background: var(--surface-3); }
.steps span.on { background: var(--text); }
