:root {
    --brand-orange: #ff4d00;
    --brand-yellow: #ffe23c;
    --brand-white: #ffffff;
    --brand-dark: #1e1917;
    --bg-light: #fffbf7;
    --text-muted: #6b635f;
    --border-light: #ffe6d5;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --font-display: 'Fredoka', sans-serif;
    --font-base: 'Outfit', sans-serif;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --max-width-pc: 1200px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body, html { width: 100%; height: 100%; height: -webkit-fill-available; font-family: var(--font-base); overflow: hidden; font-size: 15px; }
html { background: var(--brand-orange); }
body { background: var(--bg-light); }

.app-viewport { position: absolute; top: 0; left: 0; right: 0; bottom: 0; overflow: hidden; background: var(--bg-light); }

.view-container {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column;
    z-index: 1; background: var(--bg-light);
}
.view-container.active { z-index: 10; }

/* ============ SPLASH ============ */
.splash-bg {
    background: radial-gradient(circle at top right, #ff6b2b, #ff4d00),
                radial-gradient(circle at bottom left, #ffe23c, #ff4d00);
    background-blend-mode: overlay;
    justify-content: center; align-items: center;
}
.splash-screen { opacity: 1; transition: opacity 0.8s ease; text-align: center; }
.splash-screen.hide { opacity: 0; }
.logo-splash {
    max-width: 250px; width: 80%; height: auto;
    opacity: 0; animation: logoIntro 2s ease forwards;
}

/* ============ WELCOME / LOGIN ============ */
.login-welcome {
    background: radial-gradient(circle at top right, #ff6b2b, #ff4d00),
                radial-gradient(circle at bottom left, #ffe23c, #ff4d00);
    background-blend-mode: overlay;
    justify-content: center; align-items: center; padding: 0;
}
.sphere {
    position: absolute; border-radius: 50%;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(40px);
    z-index: 0; pointer-events: none;
}
.welcome-main {
    position: relative; z-index: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    flex: 1; width: 100%; padding: 40px 32px;
}
.welcome-text { text-align: center; color: white; }
.welcome-text h1 {
    font-family: var(--font-base); font-size: 3.75rem; font-weight: 800;
    margin-bottom: 24px; letter-spacing: -0.05em;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}
.welcome-text p {
    font-family: var(--font-base); font-size: 1.25rem; font-weight: 300; opacity: 0.8;
    max-width: 280px; line-height: 1.625; margin: 0 auto;
}
.fade-in-up { animation: fadeInUp 0.8s ease-out forwards; }
.welcome-buttons {
    width: 100%; height: 96px; display: flex; align-items: stretch;
    background: transparent; flex-shrink: 0; z-index: 2;
}
.welcome-buttons button {
    flex: 1; border: none; cursor: pointer; font-family: var(--font-base);
    transition: all 0.2s; font-size: 1.125rem;
}
.btn-welcome-login {
    background: transparent; color: rgba(255,255,255,0.9); font-weight: 600;
}
.btn-welcome-login:active { color: white; }
.btn-welcome-register {
    background: white; color: #ff4d00; font-weight: 700;
    border-radius: 30px 0 0 0; box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
}
.btn-welcome-register:active { transform: scale(0.98); }

/* Close button */
#closeContainer {
    position: fixed; top: 40px; left: 24px; z-index: 60;
    opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
#closeContainer.visible { opacity: 1; pointer-events: auto; }
#btnClose {
    display: flex; align-items: center; gap: 4px;
    background: none; border: none; color: white;
    font-family: var(--font-base); font-weight: 600; font-size: 0.95rem;
    cursor: pointer; padding: 8px 0;
}
#btnClose svg { width: 24px; height: 24px; }
#btnClose:active { opacity: 0.7; }

/* Auth modals (slide-up) */
#registerModal, #loginModal {
    position: fixed; bottom: -80px; left: 0; width: 100%; height: 100dvh;
    background: white; z-index: 55;
    visibility: hidden; transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.5s;
    overflow-y: auto;
    border-radius: 40px 40px 0 0;
    padding: 32px 32px calc(32px + env(safe-area-inset-bottom, 20px));
    box-shadow: 0 -20px 80px rgba(54,53,53,0.15);
}
#registerModal.active, #loginModal.active {
    visibility: visible; transform: translateY(0);
}
.auth-modal-title {
    font-family: var(--font-base); font-size: 1.875rem; font-weight: 700;
    color: #ff4d00; text-align: center; margin-top: 16px; margin-bottom: 16px;
}
.auth-modal-desc {
    font-family: var(--font-base); font-size: 13px; color: #6b7280; text-align: center;
    max-width: 320px; margin: 0 auto 32px; line-height: 1.625;
}
.auth-field {
    position: relative; margin-bottom: 16px;
}
.auth-field input {
    width: 100%; height: 56px; padding: 0 24px;
    background: white; border: 2px solid #e5e7eb; border-radius: 16px;
    outline: none; font-family: var(--font-base); font-size: 16px;
    transition: border-color 0.2s;
}
.auth-field input:focus { border-color: #ff4d00; }
.auth-field input::placeholder { color: #d1d5db; }
.auth-field label {
    position: absolute; left: 12px; top: -10px;
    padding: 0 8px; background: white;
    font-size: 13px; color: #9ca3af; font-weight: 500;
    transition: color 0.2s; pointer-events: none;
}
.auth-field input:focus + label { color: #ff4d00; }
.auth-error-text {
    height: 16px; font-size: 11px; color: #ef4444; font-weight: 500;
    padding: 0 8px; margin-top: 4px;
}
.auth-eye-btn {
    position: absolute; right: 20px; top: 16px;
    background: none; border: none; color: #9ca3af; cursor: pointer; padding: 0;
}
.auth-eye-btn svg { width: 24px; height: 24px; }
.auth-btn {
    width: 100%; height: 56px; background: #ff4d00; color: white;
    font-family: var(--font-base); font-weight: 700; font-size: 1rem;
    border: none; border-radius: 16px; cursor: pointer;
    transition: all 0.2s; margin-top: 8px;
}
.auth-btn:active { transform: scale(0.98); }
.auth-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.auth-switch {
    margin-top: 32px; text-align: center; font-size: 12px; color: #6b7280;
}
.auth-switch button {
    background: none; border: none; color: #ff4d00; font-weight: 700;
    cursor: pointer; font-family: var(--font-base); font-size: 12px;
}
.auth-switch button:active { text-decoration: underline; }

/* Top gradient overlay (behind modals) */
#topGradient {
    position: fixed; top: 0; left: 0; width: 100%; height: 100dvh;
    z-index: 49; pointer-events: none; display: none;
    background: radial-gradient(circle at top right, #ff6b2b, #ff4d00),
                radial-gradient(circle at bottom left, #ffe23c, #ff4d00);
    background-blend-mode: overlay;
}
.tg-overlay {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    pointer-events: none; user-select: none;
}
.tg-text {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: white; padding: 0 28px; text-align: center;
}
.tg-text h1 {
    font-family: var(--font-base); font-size: 3.75rem; font-weight: 800;
    margin-bottom: 24px; letter-spacing: -0.05em;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}
.tg-text p {
    font-family: var(--font-base); font-size: 1.25rem; font-weight: 300;
    opacity: 0.8; max-width: 280px; line-height: 1.625;
}
.tg-spacer { height: 96px; flex-shrink: 0; }

/* Shake */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    50% { transform: translateX(8px); }
    75% { transform: translateX(-4px); }
}
.shake-animation { animation: shake 0.4s ease-in-out; }

.login-view-bg { background: var(--brand-white); justify-content: center; align-items: center; padding: 30px; }

.form-group { width: 100%; }
.form-group label { display: block; font-size: 0.8rem; color: var(--brand-dark); font-weight: 700; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.5px; }
.input-field, .select-field {
    width: 100%; padding: 14px 16px; border: 2px solid var(--border-light); border-radius: var(--radius-sm);
    font-family: var(--font-base); font-size: 16px; color: var(--brand-dark); outline: none;
    transition: border-color 0.3s; background: #fffcf9;
}
.input-field:focus, .select-field:focus { border-color: var(--brand-orange); }
.input-field::placeholder { color: #9ca3af; }

.btn-primary {
    width: 100%; padding: 15px; background: linear-gradient(135deg, var(--brand-orange), #ff7300);
    border: none; border-radius: var(--radius-sm); color: var(--brand-white);
    font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; cursor: pointer;
    box-shadow: 0 4px 15px rgba(255,77,0,0.25); transition: transform 0.2s;
    display: flex; justify-content: center; align-items: center; gap: 10px;
}
.btn-primary:active { transform: scale(0.97); }
.btn-secondary {
    width: 100%; padding: 14px; background: var(--bg-light); border: 2px solid var(--border-light);
    border-radius: var(--radius-sm); color: var(--text-muted); font-family: var(--font-base);
    font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-secondary:active { background: var(--border-light); }
.btn-danger { background: var(--danger); box-shadow: 0 4px 15px rgba(239,68,68,0.25); }
.btn-success { background: var(--success); box-shadow: 0 4px 15px rgba(16,185,129,0.25); }
.btn-sm { padding: 10px 18px; font-size: 0.85rem; width: auto; display: inline-flex; }
.btn-xs { padding: 6px 12px; font-size: 0.75rem; width: auto; display: inline-flex; border-radius: var(--radius-sm); }

.auth-error { color: var(--danger); font-size: 0.85rem; text-align: center; display: none; }

.lobby-header { background: var(--brand-white); border-bottom: 2px solid var(--border-light); padding: 16px 20px; padding-top: calc(16px + env(safe-area-inset-top, 0px)); display: flex; justify-content: center; min-height: 64px; }
.header-inner { width: 100%; max-width: var(--max-width-pc); display: flex; justify-content: space-between; align-items: center; }
.header-brand { display: flex; align-items: center; gap: 10px; }
.header-brand img { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--brand-orange); object-fit: contain; }
.header-brand h1 { font-family: var(--font-display); font-size: 1.1rem; color: var(--brand-orange); font-weight: 700; }
.user-badge { display: flex; align-items: center; gap: 8px; background: var(--bg-light); padding: 6px 14px 6px 10px; border-radius: 50px; border: 2px solid var(--border-light); cursor: pointer; transition: all 0.2s; }
.user-badge:active { border-color: var(--brand-orange); }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-orange); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; flex-shrink: 0; }
.user-name { font-size: 0.85rem; font-weight: 600; color: var(--brand-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.notif-bell { position: relative; cursor: pointer; color: var(--text-muted); transition: color 0.2s; display: flex; align-items: center; padding: 6px; margin-right: 4px; }
.notif-bell:hover { color: var(--brand-orange); }
.notif-count { position: absolute; top: -2px; right: -2px; background: var(--danger); color: white; font-size: 0.6rem; font-weight: 700; min-width: 16px; height: 16px; border-radius: 50px; display: flex; align-items: center; justify-content: center; padding: 0 4px; line-height: 1; }
.desktop-nav { display: none; gap: 20px; }
.desktop-nav a { text-decoration: none; color: var(--text-muted); font-weight: 600; font-size: 0.95rem; transition: color 0.2s; display: flex; align-items: center; gap: 6px; padding: 6px 0; cursor: pointer; }
.desktop-nav a.active, .desktop-nav a:hover { color: var(--brand-orange); }

.view-content { flex: 1; overflow-y: auto; padding: 20px; padding-bottom: 65px; display: flex; flex-direction: column; align-items: center; }
.content-inner { width: 100%; max-width: var(--max-width-pc); }

.section-title { font-family: var(--font-display); font-size: 1.2rem; color: var(--brand-dark); margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.section-title svg { color: var(--brand-orange); width: 22px; height: 22px; }

.card { background: var(--brand-white); border: 2px solid var(--border-light); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 20px; box-shadow: 0 4px 16px rgba(255,77,0,0.03); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-header h3 { font-family: var(--font-display); font-size: 1.1rem; color: var(--brand-dark); }

.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 24px; }
.stat-card { background: var(--brand-white); border: 2px solid var(--border-light); border-radius: var(--radius-md); padding: 18px; text-align: center; }
.stat-card .num { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--brand-orange); }
.stat-card .label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.stat-card.green .num { color: var(--success); }
.stat-card.red .num { color: var(--danger); }
.stat-card.blue .num { color: var(--info); }

.quick-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 24px; }
.quick-action { display: flex; flex-direction: column; align-items: center; gap: 8px; background: var(--brand-white); border: 2px solid var(--border-light); border-radius: var(--radius-md); padding: 18px 12px; cursor: pointer; transition: all 0.2s; }
.quick-action:active { transform: scale(0.96); border-color: var(--brand-orange); }
.quick-action svg { width: 28px; height: 28px; color: var(--brand-orange); }
.quick-action span { font-size: 0.85rem; font-weight: 600; color: var(--brand-dark); text-align: center; }

.chart-container { width: 100%; margin-bottom: 20px; }
.chart-container canvas { width: 100% !important; max-height: 180px; }

.selector-row { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.selector-row .select-field { padding: 12px 14px; }

.student-list { display: flex; flex-direction: column; gap: 10px; }
.student-item { display: flex; justify-content: space-between; align-items: center; background: var(--bg-light); border: 2px solid var(--border-light); padding: 14px 16px; border-radius: var(--radius-md); flex-wrap: wrap; gap: 10px; }
.student-info h4 { font-family: var(--font-display); font-size: 1rem; color: var(--brand-dark); }
.student-info p { font-size: 0.8rem; color: var(--text-muted); }
.student-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.student-rating { display: flex; gap: 6px; flex-wrap: wrap; }
.student-rating .btn-rating { padding: 6px 10px; border: 2px solid var(--border-light); background: var(--brand-white); border-radius: var(--radius-sm); font-family: var(--font-base); font-weight: 600; font-size: 0.7rem; cursor: pointer; transition: all 0.2s; }

.btn-status { padding: 8px 14px; border: 2px solid var(--border-light); background: var(--brand-white); border-radius: var(--radius-sm); font-family: var(--font-base); font-weight: 700; font-size: 0.8rem; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 5px; }
.btn-status.present { border-color: var(--success); color: var(--success); }
.btn-status.present.active { background: var(--success); color: white; }
.btn-status.absent { border-color: var(--danger); color: var(--danger); }
.btn-status.absent.active { background: var(--danger); color: white; }
.btn-status.excused { border-color: var(--warning); color: var(--warning); }
.btn-status.excused.active { background: var(--warning); color: white; }

.btn-rating.excellent { border-color: var(--success); color: var(--success); }
.btn-rating.excellent.active { background: var(--success); color: white; }
.btn-rating.good { border-color: var(--info); color: var(--info); }
.btn-rating.good.active { background: var(--info); color: white; }
.btn-rating.average { border-color: var(--warning); color: var(--warning); }
.btn-rating.average.active { background: var(--warning); color: white; }
.btn-rating.bad { border-color: var(--danger); color: var(--danger); }
.btn-rating.bad.active { background: var(--danger); color: white; }

.children-list { display: flex; flex-direction: column; gap: 10px; }
.child-card { display: flex; justify-content: space-between; align-items: center; background: var(--brand-white); border: 2px solid var(--border-light); border-radius: var(--radius-md); padding: 14px 16px; gap: 10px; }
.child-card .info { flex: 1; }
.child-card .info h4 { font-family: var(--font-display); font-size: 1rem; color: var(--brand-dark); }
.child-card .info p { font-size: 0.8rem; color: var(--text-muted); }
.child-card .badge { padding: 3px 10px; border-radius: 50px; font-size: 0.7rem; font-weight: 700; background: var(--bg-light); color: var(--brand-orange); border: 1px solid var(--border-light); white-space: nowrap; }

.user-list { display: flex; flex-direction: column; gap: 10px; }
.user-card { display: flex; justify-content: space-between; align-items: center; background: var(--brand-white); border: 2px solid var(--border-light); border-radius: var(--radius-md); padding: 14px 16px; gap: 10px; }
.user-card .info { flex: 1; }
.user-card .info h4 { font-family: var(--font-display); font-size: 1rem; color: var(--brand-dark); }
.user-card .info p { font-size: 0.8rem; color: var(--text-muted); }
.user-card .actions { display: flex; gap: 8px; }
.role-badge { padding: 3px 10px; border-radius: 50px; font-size: 0.7rem; font-weight: 700; white-space: nowrap; }
.role-badge.super_admin { background: #fef3c7; color: #92400e; }
.role-badge.admin { background: #dbeafe; color: #1e40af; }
.role-badge.maestro { background: #d1fae5; color: #065f46; }
.status-badge { padding: 3px 10px; border-radius: 50px; font-size: 0.7rem; font-weight: 700; white-space: nowrap; }
.status-badge.pending { background: #fef3c7; color: #92400e; }
.status-badge.active { background: #d1fae5; color: #065f46; }
.status-badge.rejected { background: #fee2e2; color: #991b1b; }

.campus-list { display: flex; flex-direction: column; gap: 14px; }
.campus-card { background: var(--brand-white); border: 2px solid var(--border-light); border-radius: var(--radius-lg); padding: 20px; }
.campus-card h3 { font-family: var(--font-display); font-size: 1.1rem; color: var(--brand-dark); margin-bottom: 4px; }
.campus-card .campus-meta { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 12px; }
.service-tag { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-light); border: 1px solid var(--border-light); padding: 4px 12px; border-radius: 50px; font-size: 0.8rem; font-weight: 600; color: var(--brand-dark); margin: 3px; }
.add-row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.add-row input { flex: 1; min-width: 120px; padding: 10px 14px; border: 2px solid var(--border-light); border-radius: var(--radius-sm); font-family: var(--font-base); font-size: 0.9rem; outline: none; }
.add-row input:focus { border-color: var(--brand-orange); }

.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--brand-white); backdrop-filter: none !important; border-top: 2px solid var(--border-light); padding: 0; padding-bottom: env(safe-area-inset-bottom, 0px); margin: 0; display: flex; justify-content: center; z-index: 50; min-height: 50px; }
.nav-inner { width: 100%; max-width: 600px; display: flex; justify-content: center; align-items: center; padding: 4px 8px; }
.nav-item { text-decoration: none; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 0.75rem; font-weight: 400; transition: color 0.2s; cursor: pointer; padding: 6px 10px 0; flex: 1; }
.nav-item svg { width: 24px; height: 24px; stroke-width: 1.5 !important; }
.nav-item.active { color: var(--brand-orange); font-weight: 700; }
.nav-item.active svg { stroke-width: 2.5 !important; }

.toast { position: fixed; top: -80px; left: 50%; transform: translateX(-50%); background: var(--brand-dark); color: var(--brand-white); padding: 14px 22px; border-radius: var(--radius-md); box-shadow: 0 10px 30px rgba(0,0,0,0.2); z-index: 2000; font-family: var(--font-base); font-weight: 600; display: flex; align-items: center; gap: 10px; transition: top 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); max-width: 90%; width: 400px; font-size: 0.9rem; }
.toast.show { top: calc(20px + env(safe-area-inset-top, 0px)); }
.toast-icon { color: var(--brand-yellow); display: flex; align-items: center; }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(30,25,23,0.6); backdrop-filter: blur(5px); z-index: 1500; display: flex; justify-content: center; align-items: center; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal-card { background: var(--brand-white); border-radius: var(--radius-lg); width: 90%; max-width: 420px; padding: 30px 24px; text-align: center; box-shadow: 0 20px 40px rgba(0,0,0,0.25); transform: scale(0.9); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); position: relative; }
.modal-overlay.show .modal-card { transform: scale(1); }
.modal-close { position: absolute; top: 12px; right: 12px; background: none; border: none; color: #9ca3af; cursor: pointer; padding: 6px; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: background 0.2s; }
.modal-close:hover { background: var(--bg-light); }
.modal-icon { color: var(--brand-orange); margin-bottom: 16px; display: inline-flex; }
.modal-card h3 { font-family: var(--font-display); color: var(--brand-dark); font-size: 1.2rem; margin-bottom: 10px; }
#modal-desc { color: var(--text-muted); font-size: 0.9rem; line-height: 1.4; margin-bottom: 24px; text-align: left; }
.modal-buttons { display: flex; gap: 12px; }
.modal-buttons.vertical { flex-direction: column; }
.btn-modal { flex: 1; padding: 13px; border: none; border-radius: var(--radius-md); font-family: var(--font-base); font-weight: 700; cursor: pointer; transition: transform 0.1s; font-size: 0.9rem; }
.btn-modal:active { transform: scale(0.97); }
.btn-modal.confirm { background: var(--brand-orange); color: white; }
.btn-modal.cancel { background: var(--bg-light); color: var(--text-muted); border: 2px solid var(--border-light); }
.btn-modal.danger { background: var(--danger); color: white; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state svg { margin-bottom: 12px; color: var(--brand-orange); }
.empty-state p { font-weight: 600; margin-bottom: 4px; }
.empty-state small { font-size: 0.85rem; }

.tag { display: inline-block; padding: 3px 10px; border-radius: 50px; font-size: 0.7rem; font-weight: 700; white-space: nowrap; }

.welcome-card { background: linear-gradient(135deg, var(--brand-orange), #ff7300); border-radius: var(--radius-lg); padding: 28px 24px; margin-bottom: 20px; color: white; }
.welcome-card h2 { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; }
.welcome-card h2 span { color: var(--brand-yellow); }

.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-nav-btn { background: none; border: 2px solid var(--border-light); border-radius: var(--radius-sm); padding: 6px 10px; cursor: pointer; color: var(--text-muted); display: flex; align-items: center; }
.cal-nav-btn:active { border-color: var(--brand-orange); color: var(--brand-orange); }
.cal-title { font-family: var(--font-display); font-size: 1rem; color: var(--brand-dark); font-weight: 600; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-day-header { text-align: center; font-size: 0.65rem; font-weight: 700; color: var(--text-muted); padding: 6px 0; text-transform: uppercase; }
.cal-cell { text-align: center; padding: 4px 2px; border-radius: var(--radius-sm); cursor: pointer; position: relative; min-height: 32px; }
.cal-cell.empty { cursor: default; }
.cal-num { font-size: 0.8rem; font-weight: 500; color: var(--brand-dark); line-height: 26px; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; }
.cal-cell.today .cal-num { background: var(--brand-orange); color: white; font-weight: 700; }
.cal-cell.selected .cal-num { background: #ff8a3d; color: white; font-weight: 700; }
.cal-dots { display: flex; justify-content: center; gap: 2px; margin-top: 1px; flex-wrap: wrap; min-height: 6px; }
.cal-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--brand-orange); }
.cal-detail { margin-top: 12px; border-top: 2px solid var(--border-light); padding-top: 12px; }
.cal-detail-title { font-family: var(--font-display); font-size: 0.85rem; color: var(--brand-dark); margin-bottom: 8px; font-weight: 600; }
.cal-event-item { padding: 8px 0; border-bottom: 1px solid var(--border-light); }
.cal-event-item:last-child { border-bottom: none; }
.cal-event-item strong { font-size: 0.85rem; color: var(--brand-dark); }
.cal-event-item small { color: var(--text-muted); font-size: 0.75rem; }

@media (min-width: 768px) {
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    .quick-actions { grid-template-columns: repeat(4, 1fr); }
    .selector-row { flex-direction: row; align-items: flex-end; }
    .selector-row .select-field { flex: 1; }
    .mini-cards { grid-template-columns: repeat(4, 1fr); }
    .slide-up-card { max-width: 480px; border-radius: var(--radius-lg); margin-bottom: 40px; }
}
@media (min-width: 1024px) {
    .bottom-nav { display: none; }
    .desktop-nav { display: flex; }
    .lobby-header { padding: 16px 40px; }
    .view-content { padding: 32px 40px; }
}
@media (max-width: 1023px) {
    .user-badge { display: none; }
    .header-inner { justify-content: center; }
    .header-brand { position: absolute; left: 50%; transform: translateX(-50%); }
    .notif-bell { margin-left: auto; }
}

.nav-plus { margin-top: -8px; }
.nav-plus svg { width: 28px; height: 28px; padding: 4px; background: var(--brand-orange); color: white; border-radius: 50%; stroke-width: 3 !important; box-shadow: 0 2px 8px rgba(255,77,0,0.3); }
.nav-item.active.nav-plus svg { stroke-width: 3 !important; }

.mini-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.mini-card { display: flex; flex-direction: column; align-items: center; gap: 6px; background: var(--brand-white); border: 2px solid var(--border-light); border-radius: var(--radius-md); padding: 16px 12px; cursor: pointer; transition: all 0.2s; }
.mini-card:active { transform: scale(0.96); border-color: var(--brand-orange); }
.mini-card svg { width: 24px; height: 24px; color: var(--brand-orange); }
.mini-card span { font-size: 0.8rem; font-weight: 600; color: var(--brand-dark); text-align: center; }

.tabs { display: flex; gap: 0; margin-bottom: 16px; border-bottom: 2px solid var(--border-light); }
.tab { flex: 1; padding: 10px; background: none; border: none; border-bottom: 3px solid transparent; font-family: var(--font-base); font-size: 0.85rem; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: all 0.2s; }
.tab.active { color: var(--brand-orange); border-bottom-color: var(--brand-orange); }
.tab:active { opacity: 0.7; }

.slide-up-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 1800; background: rgba(30,25,23,0.4); opacity: 0; pointer-events: none; transition: opacity 0.3s; display: flex; align-items: flex-end; justify-content: center; }
.slide-up-overlay.show { opacity: 1; pointer-events: auto; }
.slide-up-card { background: var(--brand-white); border-radius: var(--radius-lg) var(--radius-lg) 0 0; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; transform: translateY(100%); transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275); padding: 20px 24px; padding-bottom: calc(20px + env(safe-area-inset-bottom, 20px)); }
.slide-up-overlay.show .slide-up-card { transform: translateY(0); }
.slide-up-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.slide-up-header h3 { font-family: var(--font-display); font-size: 1.1rem; color: var(--brand-dark); display: flex; align-items: center; gap: 8px; }
.slide-up-close { background: var(--bg-light); border: none; border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-muted); }
.slide-up-body { overflow-x: hidden; }
.slide-up-body .form-group { margin-bottom: 12px; }

.profile-panel { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 2000; background: var(--bg-light); transform: translateX(100%); transition: transform 0.3s ease; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom, 0px); }
.profile-panel.show { transform: translateX(0); }
.profile-topbar { display: flex; align-items: center; justify-content: center; padding: 16px 20px; padding-top: calc(16px + env(safe-area-inset-top, 0px)); background: var(--brand-white); border-bottom: 2px solid var(--border-light); position: relative; min-height: 64px; }
.profile-topbar h2 { font-family: var(--font-display); font-size: 1.15rem; color: var(--brand-dark); }
.profile-back { position: absolute; left: 16px; background: none; border: none; padding: 10px; cursor: pointer; color: var(--brand-orange); display: flex; align-items: center; border-radius: 50%; }
.profile-back:active { background: var(--bg-light); }
.profile-back svg { width: 26px; height: 26px; }
.profile-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 24px 20px; background: var(--bg-light); display: flex; flex-direction: column; }
.profile-nav-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.profile-nav-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: var(--brand-white); border: 2px solid var(--border-light); border-radius: var(--radius-md); padding: 16px 12px; cursor: pointer; transition: all 0.2s; }
.profile-nav-card:active { transform: scale(0.96); border-color: var(--brand-orange); }
.profile-nav-card svg { width: 24px; height: 24px; color: var(--brand-orange); }
.profile-nav-card span { font-size: 0.8rem; font-weight: 600; color: var(--brand-dark); text-align: center; }
.profile-list { padding: 0; }
.profile-list-item { display: flex; align-items: center; gap: 12px; padding: 16px 16px; cursor: pointer; font-weight: 500; color: var(--brand-dark); font-size: 0.9rem; border-bottom: 1px solid var(--border-light); }
.profile-list-item:last-child { border-bottom: none; }
.profile-list-item:active { opacity: 0.6; }
.profile-list-item svg { width: 20px; height: 20px; color: var(--brand-orange); flex-shrink: 0; }
.profile-list-item.danger { color: var(--danger); }
.profile-list-item.danger svg { color: var(--danger); }
.profile-list-item .chevron { margin-left: auto; display: flex; align-items: center; color: var(--text-muted); opacity: 0.5; }

/* Profile avatar & info section */
.profile-avatar-section { display: flex; flex-direction: column; align-items: center; padding: 0 0 20px; }
.profile-avatar-large { width: 72px; height: 72px; border-radius: 50%; background: var(--brand-orange); color: white; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; margin-bottom: 10px; border: 3px solid var(--border-light); }
.profile-name { font-family: var(--font-display); font-size: 1.15rem; color: var(--brand-dark); font-weight: 600; margin-bottom: 6px; }
.profile-role-badge { display: inline-block; padding: 3px 14px; border-radius: 50px; font-size: 0.75rem; font-weight: 700; }
.profile-info-section { background: var(--brand-white); border: 2px solid var(--border-light); border-radius: var(--radius-md); margin-bottom: 20px; overflow: hidden; }
.profile-info-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--border-light); }
.profile-info-row:last-child { border-bottom: none; }
.profile-info-row .info-icon { display: flex; align-items: center; flex-shrink: 0; }
.profile-info-row .info-icon svg { width: 18px; height: 18px; color: var(--brand-orange); }
.profile-info-row .info-content { flex: 1; min-width: 0; }
.profile-info-row .info-label { font-size: 0.7rem; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 2px; }
.profile-info-row .info-value { font-size: 0.9rem; color: var(--brand-dark); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Flat profile edit form */
.profile-edit-flat { padding: 0; }
.profile-edit-flat .pedit-section-label { font-family: var(--font-display); font-size: 1rem; color: var(--brand-dark); margin-bottom: 10px; font-weight: 600; }
.profile-edit-flat .pedit-name-row { display: flex; gap: 12px; margin-bottom: 16px; }
.profile-edit-flat .pedit-name-row .form-group { margin-bottom: 0; flex: 1; }
.profile-edit-flat .form-group { margin-bottom: 16px; }
.profile-edit-flat .input-readonly { background: var(--bg-light) !important; color: var(--text-muted) !important; cursor: not-allowed; border-style: dashed; }
.date-input-wrapper { position: relative; width: 100%; }
.date-input-wrapper .input-field { cursor: pointer; }

/* Toggle Switch */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: var(--border-light); border-radius: 24px; transition: .3s; }
.slider:before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .3s; }
.switch input:checked + .slider { background: var(--brand); }
.switch input:checked + .slider:before { transform: translateX(20px); }
.notif-toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border-light); gap: 12px; }
.notif-toggle-info { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.notif-toggle-label { font-size: 0.9rem; font-weight: 500; color: var(--text-dark); }
.notif-toggle-desc { font-size: 0.78rem; color: var(--text-muted); }

@keyframes logoIntro {
    0% { opacity: 0; transform: scale(0.9); }
    20% { opacity: 1; transform: scale(1); }
    35% { transform: scale(1.06); }
    50% { transform: scale(1); }
    65% { transform: scale(1.04); }
    80% { transform: scale(1); }
    100% { opacity: 1; transform: scale(1); }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.3s ease; }