:root {
    --primary: #0c4a6e;
    --primary-light: #0369a1;
    --accent: #0ea5e9;
    --sidebar-width: 280px;
    --sidebar-width-mini: 72px;
    --sidebar-offset: 280px;
    --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --danger: #dc2626;
    --success: #059669;
    --bg: #f0f9ff;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.required::after { content: " *"; color: var(--danger); font-weight: bold; }

/* Welcome */
.welcome-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0c4a6e 0%, #0ea5e9 50%, #7dd3fc 100%);
    overflow: hidden;
}

.welcome-content {
    text-align: center;
    color: white;
    animation: fadeUp 1s ease-out;
}

.welcome-content h1 {
    font-size: clamp(1.8rem, 5vw, 3rem);
    margin-bottom: 1rem;
    text-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.welcome-logo {
    width: 120px;
    height: 120px;
    margin: 0 auto 2rem;
    animation: pulse 2s ease-in-out infinite;
}

.water-drop {
    width: 80px;
    height: 80px;
    background: rgba(255,255,255,0.3);
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    margin: 2rem auto;
    animation: drop 1.5s ease-in-out infinite;
}

.progress-bar {
    width: 200px;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    margin: 2rem auto;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: white;
    animation: progress 5s linear forwards;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes drop {
    0%, 100% { transform: rotate(-45deg) translateY(0); }
    50% { transform: rotate(-45deg) translateY(-15px); }
}

@keyframes progress {
    from { width: 0; }
    to { width: 100%; }
}

/* Auth split layout */
.auth-split {
    display: flex;
    min-height: 100vh;
}

.auth-left {
    flex: 1;
    background: linear-gradient(160deg, #e0f2fe, #f0f9ff);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-left img, .auth-left .logo-svg {
    max-width: 420px;
    width: 90%;
    margin-bottom: 1.5rem;
}

.auth-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--card);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(12, 74, 110, 0.1);
    border: 1px solid var(--border);
}

.auth-card h2 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.form-group { margin-bottom: 1.25rem; }

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.btn {
    padding: 0.7rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
}

.btn-primary:hover { background: var(--primary-light); }

.btn-secondary {
    background: #e2e8f0;
    color: var(--text);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
}

.btn-danger { background: var(--danger); color: white; }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }

.auth-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    text-align: center;
}

.auth-links a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 500;
}

.password-rules {
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.password-rules li { list-style: none; padding: 0.15rem 0; }
.password-rules li.valid { color: var(--success); }
.password-rules li.invalid { color: var(--muted); }

.captcha-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.captcha-question {
    background: #e0f2fe;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 700;
    color: var(--primary);
}

/* Dashboard layout */
.app-shell {
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    width: var(--sidebar-width);
    max-width: 100vw;
    background: var(--card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    z-index: 200;
    overflow: hidden;
    transition: transform var(--transition), width var(--transition);
    box-sizing: border-box;
}

.sidebar.collapsed {
    transform: translateX(-100%);
    pointer-events: none;
}

.sidebar.mini {
    width: var(--sidebar-width-mini);
}

.sidebar-header {
    padding: 1.25rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.sidebar-header img, .sidebar-header .logo-svg {
    max-width: 100%;
    width: 100%;
    height: auto;
}

.sidebar-user {
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.35rem;
    border-radius: 10px;
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    width: 100%;
    background: none;
    font-size: 0.95rem;
    text-align: left;
}

.nav-item:hover, .nav-item.active {
    background: linear-gradient(90deg, #eef2ff, #ecfeff);
    border-color: transparent;
    color: #4f46e5;
}

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 0.75rem;
    color: var(--muted);
}

.main-content {
    margin-left: var(--sidebar-offset);
    width: calc(100% - var(--sidebar-offset));
    max-width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    min-width: 0;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition), width var(--transition);
    box-sizing: border-box;
}

.top-bar {
    padding: 0.75rem 1.5rem;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.toggle-sidebar {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
}

.content-area {
    flex: 1;
    padding: 1.5rem;
    overflow-x: auto;
    overflow-y: auto;
    width: 100%;
    min-width: 0;
}

#panelContent {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.home-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.home-logo img, .home-logo .logo-svg {
    max-width: 320px;
    opacity: 0.95;
}

/* Cards & tables */
.card {
    background: var(--card);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-bottom: 1.5rem;
    overflow: hidden;
    border: 1px solid var(--border);
}

.card-header {
    padding: 0.85rem 1.25rem;
    font-weight: 700;
    color: white;
}

.card-header.blue { background: #175690; border-left: 5px solid #ffc286; }
.card-header.orange { background: #c2410c; border-left: 5px solid #fdba74; }
.card-header.teal { background: #0f766e; border-left: 5px solid #5eead4; }
.card-header.cyan { background: #155e75; border-left: 5px solid #67e8f9; }

.card-body { padding: 1.25rem; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    padding: 0.5rem;
    border: 1px solid var(--border);
    font-size: 0.9rem;
}
.table th { background: #f1f5f9; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

@media (max-width: 992px) {
    .grid-2, .grid-4 { grid-template-columns: 1fr; }
    .auth-split { flex-direction: column; }
    .sidebar {
        width: min(var(--sidebar-width), 85vw);
        transform: translateX(-100%);
    }
    .sidebar.sidebar-open {
        transform: translateX(0);
        pointer-events: auto;
    }
    .sidebar.mini {
        width: min(var(--sidebar-width), 85vw);
    }
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    body.sidebar-overlay::before {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 150;
    }
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info { background: #e0f2fe; color: #075985; }

.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }

.page-title {
    font-size: 1.75rem;
    color: var(--primary);
    margin-bottom: 1.25rem;
    text-align: center;
    font-weight: 700;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.register-promo {
    background: linear-gradient(160deg, var(--primary), var(--accent));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
}

.register-promo h2 { font-size: 2rem; margin-bottom: 1rem; }

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
    align-items: flex-end;
}

.settings-group {
    margin-bottom: 2rem;
}

.settings-group h3 {
    color: var(--primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent);
}
