:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface2: #f9fafb;
  --border: #e5e7eb;
  --border2: #d1d5db;
  --text: #111827;
  --text2: #6b7280;
  --text3: #9ca3af;
  --accent: #1d4ed8;
  --accent-light: #eff6ff;
  --accent-hover: #1e40af;
  --green: #15803d;
  --green-bg: #dcfce7;
  --teal: #0f766e;
  --teal-bg: #ccfbf1;
  --orange: #c2410c;
  --orange-bg: #ffedd5;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --gray-bg: #f3f4f6;
  --amber: #92400e;
  --amber-bg: #fef3c7;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,.06), 0 2px 4px rgba(0,0,0,.04);
  --radius: 8px;
  --radius-lg: 12px;
  font-size: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── LAYOUT ── */
#app { display: none; min-height: 100vh; }
.topbar {
  height: 56px; background: #0f172a; display: flex; align-items: center;
  padding: 0 20px; gap: 16px; position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,.06);
}
.topbar-logo { height: 28px; }
.topbar-title { color: white; font-weight: 700; font-size: 15px; letter-spacing: -.2px; flex: 1; }
.topbar-user { font-size: 12px; color: rgba(255,255,255,.5); }
.topbar-role { font-size: 11px; background: rgba(255,255,255,.1); color: rgba(255,255,255,.7); padding: 2px 8px; border-radius: 20px; margin-left: 6px; }
.btn-logout { padding: 6px 14px; background: rgba(255,255,255,.08); color: rgba(255,255,255,.7); border: 1px solid rgba(255,255,255,.12); border-radius: 6px; font-size: 12px; cursor: pointer; font-family: inherit; transition: all .15s; }
.btn-logout:hover { background: rgba(255,255,255,.14); color: white; }

.nav { display: flex; gap: 2px; padding: 0 20px; background: #1e293b; overflow-x: auto; }
.nav-item { padding: 10px 16px; color: rgba(255,255,255,.5); font-size: 13px; font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; transition: all .15s; }
.nav-item:hover { color: rgba(255,255,255,.8); }
.nav-item.active { color: white; border-bottom-color: #3b82f6; }

.main { padding: 24px 20px; max-width: 1400px; margin: 0 auto; }

/* ── MISC ── */
.page { display: none; }
.page.active { display: block; }
.section-title { font-size: 18px; font-weight: 700; margin-bottom: 20px; color: var(--text); }
.divider { height: 1px; background: var(--border); margin: 20px 0; }
.info-row { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text2); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text3); }
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }
.loading { text-align: center; padding: 40px; color: var(--text2); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; bottom: 24px; right: 24px; background: #1e293b; color: white;
  padding: 12px 18px; border-radius: var(--radius); font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-md); z-index: 500; transform: translateY(80px); opacity: 0;
  transition: all .3s; pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: #15803d; }
.toast.error { background: #b91c1c; }

/* ── MOBILE RESPONSIVE ── */
@media (max-width: 768px) {
  :root { font-size: 13px; }

  /* Topbar */
  .topbar { padding: 0 12px; height: 48px; gap: 8px; }
  .topbar-logo { height: 22px; }
  .topbar-title { font-size: 13px; }
  .topbar-user { display: none; }
  .topbar-role { font-size: 10px; padding: 1px 6px; margin-left: 4px; }
  .btn-logout { font-size: 11px; padding: 5px 10px; }

  /* Nav — fixed bottom tab bar */
  .nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 150;
    padding: 0; gap: 0;
    overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    box-shadow: 0 -1px 0 rgba(255,255,255,.08);
    background: #1e293b;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item {
    flex: 0 0 auto;
    padding: 10px 14px 8px;
    font-size: 10px;
    white-space: nowrap;
    border-bottom: none;
    border-top: 2px solid transparent;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    min-width: 60px;
  }
  .nav-item.active { border-bottom: none; border-top-color: #3b82f6; }

  /* Main — account for fixed bottom nav + topbar */
  .main { padding: 12px 10px 76px; }
  .section-title { font-size: 15px; margin-bottom: 12px; }

  /* Toast — full-width above bottom nav */
  .toast {
    bottom: 68px; left: 12px; right: 12px;
    text-align: center; transform: translateY(80px);
  }
  .toast.show { transform: translateY(0); }
}
