*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --blue:        #0057a8;
    --blue-dark:   #003d7a;
    --blue-light:  #e6f1fb;
    --blue-mid:    #378add;
    --green:       #059669;
    --green-light: #d1fae5;
    --red:         #dc2626;
    --red-light:   #fee2e2;
    --amber:       #d97706;
    --amber-light: #fef3c7;
    --gray-50:     #f8fafc;
    --gray-100:    #f1f5f9;
    --gray-200:    #e2e8f0;
    --gray-400:    #94a3b8;
    --gray-600:    #475569;
    --gray-800:    #1e293b;
    --gray-900:    #0f172a;
    --white:       #ffffff;
    --shadow-sm:   0 1px 3px rgba(0,0,0,0.08);
    --shadow-md:   0 4px 12px rgba(0,0,0,0.10);
    --radius-sm:   6px;
    --radius-md:   10px;
    --radius-lg:   14px;
    --font:        -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--gray-50); color: var(--gray-900); line-height: 1.5; min-height: 100vh; }

/* ── Typography ─────────────────────────────────────────── */
h1 { font-size: 1.5rem; font-weight: 600; color: var(--gray-900); }
h2 { font-size: 1.25rem; font-weight: 600; color: var(--gray-900); }
h3 { font-size: 1rem; font-weight: 600; color: var(--gray-900); }
p  { color: var(--gray-600); }

/* ── Layout ─────────────────────────────────────────────── */
.app         { display: flex; flex-direction: column; min-height: 100vh; }
.page        { display: none; }
.page.active { display: flex; flex-direction: column; min-height: 100vh; }

/* ── Top nav ────────────────────────────────────────────── */
.topnav {
    background: var(--blue);
    padding: 0 1rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.topnav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.topnav-logo {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.2);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}
.topnav-logo svg { width: 18px; height: 18px; fill: white; }
.topnav-name { color: white; font-weight: 600; font-size: 1.1rem; }
.topnav-right { display: flex; align-items: center; gap: 8px; }
.topnav-user { color: rgba(255,255,255,0.85); font-size: 0.875rem; }
.topnav-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    cursor: pointer;
}
.topnav-btn:hover { background: rgba(255,255,255,0.25); }

/* ── Bottom nav (mobile) ────────────────────────────────── */
.bottomnav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    display: flex;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px;
    text-decoration: none;
    color: var(--gray-400);
    font-size: 0.7rem;
    gap: 3px;
    border: none;
    background: none;
    cursor: pointer;
}
.bottomnav-item.active { color: var(--blue); }
.bottomnav-item svg { width: 22px; height: 22px; }

/* ── Main content ───────────────────────────────────────── */
.main { flex: 1; padding: 1rem; padding-bottom: 80px; max-width: 900px; width: 100%; margin: 0 auto; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}
.card-title { font-size: 0.875rem; font-weight: 600; color: var(--gray-600); margin-bottom: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Stat grid ──────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 1rem; }
.stat-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 1rem;
}
.stat-label { font-size: 0.75rem; color: var(--gray-600); font-weight: 500; margin-bottom: 4px; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--gray-900); }
.stat-value.blue   { color: var(--blue); }
.stat-value.green  { color: var(--green); }
.stat-value.red    { color: var(--red); }
.stat-value.amber  { color: var(--amber); }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: opacity 0.15s;
    text-decoration: none;
}
.btn:hover { opacity: 0.88; }
.btn:active { opacity: 0.75; }
.btn-primary   { background: var(--blue); color: white; }
.btn-success   { background: var(--green); color: white; }
.btn-danger    { background: var(--red); color: white; }
.btn-secondary { background: var(--gray-100); color: var(--gray-800); border: 1px solid var(--gray-200); }
.btn-sm        { padding: 6px 12px; font-size: 0.8rem; }
.btn-full      { width: 100%; }

/* ── Forms ──────────────────────────────────────────────── */
.form-group   { margin-bottom: 1rem; }
.form-label   { display: block; font-size: 0.875rem; font-weight: 500; color: var(--gray-800); margin-bottom: 5px; }
.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    color: var(--gray-900);
    background: var(--white);
    transition: border-color 0.15s;
}
.form-input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,87,168,0.1); }
.form-error { font-size: 0.8rem; color: var(--red); margin-top: 4px; }

/* ── Badges ─────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 99px; font-size: 0.75rem; font-weight: 500; }
.badge-green  { background: var(--green-light); color: #065f46; }
.badge-red    { background: var(--red-light); color: #991b1b; }
.badge-blue   { background: var(--blue-light); color: #1e40af; }
.badge-amber  { background: var(--amber-light); color: #92400e; }
.badge-gray   { background: var(--gray-100); color: var(--gray-600); }

/* ── List rows ──────────────────────────────────────────── */
.list-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
}
.list-row:last-child { border-bottom: none; }
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--blue-light);
    color: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}
.list-name  { font-size: 0.9rem; font-weight: 500; color: var(--gray-900); }
.list-sub   { font-size: 0.78rem; color: var(--gray-400); }
.list-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }

/* ── Alerts ─────────────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: var(--radius-md); font-size: 0.875rem; margin-bottom: 1rem; }
.alert-error   { background: var(--red-light); color: #991b1b; }
.alert-success { background: var(--green-light); color: #065f46; }
.alert-info    { background: var(--blue-light); color: #1e40af; }

/* ── Login page ─────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    background: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-md);
}
.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 1.75rem;
}
.login-logo-mark {
    width: 44px;
    height: 44px;
    background: var(--blue);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-logo-mark svg { width: 24px; height: 24px; fill: white; }
.login-title { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); }
.login-subtitle { font-size: 0.875rem; color: var(--gray-400); text-align: center; margin-top: 2px; }

/* ── Section header ─────────────────────────────────────── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.section-title  { font-size: 1.1rem; font-weight: 600; color: var(--gray-900); }

/* ── Loading ────────────────────────────────────────────── */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--blue);
}
.loading-logo { color: white; font-size: 1.5rem; font-weight: 700; display: flex; align-items: center; gap
