:root {
    --primary:        #1565C0;
    --primary-light:  #1E88E5;
    --primary-dark:   #0D47A1;
    --accent:         #FFC107;
    --accent-dark:    #FFA000;
    --bg:             #F5F5F5;
    --surface:        #FFFFFF;
    --danger:         #D32F2F;
    --danger-light:   #FFEBEE;
    --success:        #2E7D32;
    --success-light:  #E8F5E9;
    --warning:        #F57C00;
    --warning-light:  #FFF8E1;
    --text:           #212121;
    --text-secondary: #757575;
    --border:         #E0E0E0;
    --shadow:         0 2px 8px rgba(0,0,0,0.1);
    --radius:         10px;
    --nav-height:     56px;
    --topbar-height:  48px;
    --safe-top:       env(safe-area-inset-top, 0px);
    --safe-bottom:    env(safe-area-inset-bottom, 0px);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

::-webkit-scrollbar { display: none; }
* { scrollbar-width: none; }

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

#app {
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom));
}

/* Topbar */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(var(--topbar-height) + var(--safe-top));
    padding-top: var(--safe-top);
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    padding-left: 16px;
    padding-right: 16px;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.topbar-title {
    font-size: 1.1rem;
    font-weight: 700;
    flex: 1;
}

.topbar-action {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    border-radius: 50%;
}

.topbar-action:active {
    background: rgba(255,255,255,0.15);
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: space-around;
    border-top: 1px solid var(--border);
    z-index: 100;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 0;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s;
    min-height: 48px;
}

.nav-item svg {
    width: 24px;
    height: 24px;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item:active {
    opacity: 0.7;
}

/* Page content area */
.page {
    padding: calc(var(--topbar-height) + var(--safe-top) + 8px) 12px 16px;
    min-height: 100vh;
}

/* Full-page slide-in */
.fullpage {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: calc(var(--nav-height) + var(--safe-bottom));
    background: var(--bg);
    z-index: 105;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
}

.fullpage.active {
    transform: translateX(0);
}

.fullpage-header {
    height: calc(var(--topbar-height) + var(--safe-top));
    padding-top: var(--safe-top);
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    padding-left: 4px;
    padding-right: 16px;
    flex-shrink: 0;
}

.fullpage-back {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
}

.fullpage-title {
    font-size: 1.05rem;
    font-weight: 700;
    flex: 1;
}

.fullpage-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    -webkit-overflow-scrolling: touch;
}

.fullpage-footer {
    padding: 12px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

/* Auth pages */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: 16px;
    padding: 28px 20px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.auth-logo {
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo h1 {
    font-size: 1.8rem;
    color: var(--primary);
    font-weight: 800;
}

.auth-logo p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.auth-version {
    font-size: 0.7rem;
    color: var(--text-secondary);
    display: inline-block;
    margin-top: 4px;
}

/* Utility classes */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--primary); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.w-full { width: 100%; }
