/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700&family=Inter:wght@400;500&display=swap');

:root {
    --primary: #009900;
    --primary-dark: #026b02;
    --loader-speed: 1100ms;
    --accent: #d70000;
    --error: #d70000;
    --error-dark: #9f1239;
    --bg-white: #ffffff;
    --bg-off-white: #f7f9fb;
    --bg: #ffffff;
    --bg-surface-2: #f3f6fa;
    --bg-surface-3: #edf1f7;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-inverse: #ffffff;
    --border-light: #e2e8f0;
    --border: #cbd5e1;
    --gray-light: #cbd5e1;
    --primary-strong: #015c01;
    --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 12px 28px rgba(15, 23, 42, 0.10);
    --radius: 8px;
    --radius-lg: 8px;
    --transition-fast: 150ms ease;
    --transition-base: 220ms ease;
    --transition-slow: 320ms ease;
    --surface: #ffffff;
    --surface-2: #f3f6fa;
    --surface-3: #edf1f7;
}

html {
    overflow-x: hidden;
    
}

body {
    font-family: 'Inter', 'Manrope', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(180deg, #f8fafc 0%, #eef4ef 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    overscroll-behavior-x: none;
    
}

#app {
    min-height: 100vh;
}
.profile-form-card{
    max-width: 600px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 28px;
    border: 1px solid var(--border-light);
    transition: all var(--transition-base);
     margin: auto;
}
/* Screen Management */
.screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 40px 16px;
}

.auth-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 28px;
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border-light);
   
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.group-auth{
    display: flex;
    align-items: center;
    flex-direction: row;
}
.auth-logo {
    width: 51px;
    height: 51px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--primary-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    align-items: center;
}
.auth-logo img{
    width: 51px;
    height: 51px;
    border-radius: 50%;
}

.card h1 {
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 12px;
    font-size: 2em;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.card h1::before {
    content: "●";
    color: var(--primary);
    font-size: 0.6em;
    margin-right: 10px;
    display: inline-block;
    vertical-align: middle;
}

.card h3 {
    color: var(--text-secondary);
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-light);
    padding-bottom: 12px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 28px;
}

/* Form Styles */
.form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.form .full {
    grid-column: span 2;
}

label {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9em;
}

label .required {
    color: var(--error);
    margin-left: 4px;
}

input, select, textarea {
    padding: 12px 14px;
    border: 2px solid var(--border-light);
    background: var(--bg-white);
    color: var(--text-primary);
    border-radius: 12px;
    font-size: 14px;
    transition: all var(--transition-fast);
}

input:hover, select:hover, textarea:hover {
    border-color: var(--gray-light);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(44, 142, 34, 0.1);
    background: var(--bg-white);
}

/* Button Styles */
.btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
    display: inline-block;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-inverse);
    box-shadow: 0 4px 12px rgba(44, 142, 34, 0.25);
}

.btn.primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 142, 34, 0.35);
}

.btn.secondary {
    background: var(--surface-2);
    color: var(--text-secondary);
    border: 1.5px solid var(--border-light);
}

.btn.secondary:hover:not(:disabled) {
    background: var(--surface-3);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,153,0,0.1);
}

.btn.danger {
    background: linear-gradient(135deg, var(--error), #c41c1c);
    color: var(--text-inverse);
    box-shadow: 0 4px 12px rgba(230, 0, 0, 0.25);
}

.btn.danger:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(230, 0, 0, 0.35);
}

.btn.success {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-inverse);
    box-shadow: 0 4px 12px rgba(44, 142, 34, 0.25);
}

.btn.success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(44, 142, 34, 0.35);
}

.btn.full {
    width: 100%;
}

.chart-export-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 12px;
    padding: 8px 12px;
    border: 1px solid rgba(0, 153, 0, 0.2);
    background: rgba(0, 153, 0, 0.08);
    color: var(--primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
}

.chart-export-btn:hover {
    background: rgba(0, 153, 0, 0.16);
}

/* Navigation Bar */
.navbar {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    color: var(--text-primary);
}

.navbar-brand {
    font-size: 1.1em;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--primary);
    margin:0 0 0 20px ;
}


.navbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-nav-toggle {
    display: none;
    border: 0;
    background: var(--surface-2);
    color: var(--primary);
    font-size: 1.2rem;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    cursor: pointer;
}

.navbar-nav {
    background-color:  var(--bg-surface-2);
    display: flex;
    list-style: none;
    padding: 8px 20px ;
    margin: 0;
    gap: 8px;
    overflow-x: auto;
    white-space: nowrap;
    
}

.navbar-nav li {
    margin: 0;
}

.navbar-nav a {
    display: inline-block;
    padding: 10px 18px;
    text-decoration: none;
    color: rgb(0, 0, 0);
    font-weight: 700;
    transition: all var(--transition-fast);
    border-radius: var(--radius);
    cursor: pointer;
    position: relative;
}

.navbar-nav a:hover {
    color: #ffffff;
    background: linear-gradient(135deg, #d70000, #a30000);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(215, 0, 0, 0.3);
}

.navbar-nav a.active {
    color: #ffffff;
    background: linear-gradient(135deg, #009900, #026b02);
    box-shadow: 0 4px 12px rgba(0, 153, 0, 0.3);
    font-weight: 700;
}

/* Main Content */
.content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 0;
}

/* Consistent card styling for all sections */
.card {
    background: var(--surface);
    border-radius: 0;
    box-shadow: var(--shadow-md);
    padding: 28px;
    border: 1px solid var(--border-light);
    transition: all var(--transition-base);
    
}

.card:hover {
    box-shadow: 0 12px 40px rgba(0,0,0,0.1);
}

.card h2 {
    margin-bottom: 24px;
    font-size: 1.5em;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.card h3 {
    margin-bottom: 20px;
    font-size: 1.2em;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.card.form-card {
    border-top: none;
    margin-bottom: 10px;
}

.tab-content {
    display: none;
    animation: fadeIn var(--transition-slow);
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card Grid for Stats */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

/* Section loader overlay for charts */
.tab-content { position: relative; }
.section-loader {
    position: absolute;
    inset: 12px 12px 12px 12px;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(255,255,255,0.7);
    border-radius: 12px;
    z-index: 40;
    pointer-events: none;
}
.section-loader .progress-bar {
    width: 160px;
    height: 10px;
    background: rgba(0,0,0,0.06);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}
.section-loader .progress-fill {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 36%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 999px;
    transform: translateX(-120%);
    animation: slide var(--loader-speed) linear infinite;
}
.section-loader .loader-text {
    color: var(--text-secondary);
    font-weight: 600;
}
@keyframes slide { to { transform: translateX(120%); } }

.stat-card {
    background: linear-gradient(135deg, var(--surface), var(--surface-2));
    color: var(--text-primary);
    padding: 28px;
    border-radius: var(--radius-lg);
    text-align: center;
    border: 1px solid var(--border-light);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

/* stat-card styles removed */

/* Table Styles */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

/* Profile guidelines */
.profile-guidelines {
    margin-top: 18px;
}
.profile-guidelines h3 {
    margin-bottom: 12px;
}
.guideline-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 12px 14px;
    border-radius: var(--radius);
    margin-bottom: 10px;
}
.guideline-card h4 {
    margin: 0 0 8px 0;
}
.guideline-card ul {
    margin: 0;
    padding-left: 18px;
}

/* Program details table: allow long program text to wrap */
.program-details-container table {
    width: 100%;
    table-layout: fixed;
}
.program-details-container table th,
.program-details-container table td {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    max-width: 260px;
    vertical-align: top;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
}

table th, table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

table th {
    background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
}

table tr:hover {
    background: rgba(44, 142, 34, 0.02);
    transition: background var(--transition-fast);
}

table tbody tr:last-child td {
    border-bottom: none;
}

.status-active {
    color: var(--primary);
    font-weight: 700;
}

.status-inactive {
    color: var(--error);
    font-weight: 700;
}

.text-center {
    text-align: center;
    padding: 48px;
    color: var(--text-muted);
}

/* Controls */
.controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.controls select {
    background: var(--bg-white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 0.65rem 1rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.controls select:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,153,0,0.1);
}

.controls select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,153,0,0.15);
}

.controls button {
    padding: 0.65rem 1.2rem;
}

/* Activities List */
.activities-list {
    margin-top: 20px;
    max-height: 500px;
    overflow-y: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    padding: 0;
}

.activity-item {
    background: var(--bg-surface-2);
    padding: 16px;
    margin-bottom: 0;
    border-radius: 0;
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--primary);
    transition: all var(--transition-fast);
    border-bottom: 1px solid var(--border-light);
}

.activity-item:last-child {
    margin-bottom: 0;
    border-bottom: none;
    border-radius: 0 0 var(--radius) var(--radius);
}

.activity-item:first-child {
    border-radius: var(--radius) var(--radius) 0 0;
}

.activity-item:hover {
    background: var(--bg-surface-3);
    transform: translateX(4px);
    box-shadow: inset 1px 0 0 var(--primary);
}

.activity-item strong {
    color: var(--text-primary);
    font-weight: 700;
}

/* Activities legend */
.activities-legend {
    display: grid;
    grid-template-columns: 1.2fr 1.5fr 1.5fr 1.4fr 0.7fr;
    gap: 8px;
    font-weight: 700;
    margin: 16px 0 0 0;
    padding: 12px;
    background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
    border-radius: var(--radius) var(--radius) 0 0;
    border: 1px solid var(--border-light);
    border-bottom: none;
    font-size: 0.9em;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.profile-info p {
    margin: 12px 0;
    color: var(--text-primary);
}

.profile-info strong {
    color: var(--text-secondary);
    display: inline-block;
    width: 130px;
}

.note {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-top: 16px;
    font-style: italic;
}

/* Message Containers */
.message-container {
    margin-top: 16px;
    padding: 16px;
    border-radius: var(--radius);
}

.error-message {
    background: rgba(230, 0, 0, 0.08);
    color: var(--error-dark);
    border: 1px solid rgba(230, 0, 0, 0.2);
    border-left: 4px solid var(--error);
}

.success-message {
    background: rgba(44, 142, 34, 0.08);
    color: var(--primary-dark);
    border: 1px solid rgba(44, 142, 34, 0.2);
    border-left: 4px solid var(--primary);
}

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9999;
}

.modal.hidden {
    display: none;
}

.modal-panel {
    width: min(520px, calc(100% - 32px));
    background: var(--bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.16);
    position: relative;
}

.modal-panel h3 {
    margin-top: 0;
    margin-bottom: 12px;
}

.modal-panel select {
    width: 100%;
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.modal-panel select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 153, 0, 0.08);
    outline: none;
}

.modal-actions {
    margin-top: 18px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.error {
    color: var(--error);
    font-size: 0.9em;
    margin-top: 12px;
    text-align: center;
    font-weight: 600;
}

.success {
    color: var(--primary);
    font-size: 0.9em;
    margin-top: 12px;
    text-align: center;
    font-weight: 600;
}

/* Program Details Modal */
.program-details-container {
    max-height: 60vh;
    overflow-y: auto;
}

.program-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-item label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9em;
}

.info-item span {
    color: var(--text);
    font-size: 0.95em;
}

.program-details-container h4 {
    margin: 20px 0 12px;
    font-size: 1em;
}

/* Forecast Section */
.forecast {
    margin-top: 20px;
    padding: 16px;
    background: var(--bg-surface-2);
    border-radius: 12px;
    font-weight: 600;
    border-left: 4px solid var(--accent);
}

/* Responsive Design */
@media (max-width: 768px) {
    .form.two-col {
        grid-template-columns: 1fr;
    }
    
    .form .full {
        grid-column: span 1;
    }
    
    .card-grid {
        grid-template-columns: 1fr;
    }
    
    .content {
        padding: 20px;
    }
    
    .card {
        padding: 20px;
    }
    
    .card h2 {
        font-size: 1.3em;
        margin-bottom: 20px;
    }
    
    .card h3 {
        font-size: 1.1em;
        margin-bottom: 16px;
    }
    
    .navbar-nav a {
        padding: 8px 14px;
        font-size: 0.9em;
    }
    
    .flex-between {
        padding: 12px 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    
    .filter-bar {
        flex-direction: column;
        gap: 12px;
        padding: 1rem;
    }
    
    .filter-item {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
    }
    
    .filter-item select,
    .filter-item input {
        width: 100%;
    }
    
    .filter-item button {
        width: 100%;
    }
    
    table th, table td {
        padding: 10px;
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    .stat-value {
        font-size: 2em;
    }
    
    .card h1 {
        font-size: 1.6em;
    }
    
    .navbar-brand {
        font-size: 1em;
    }
}

/* Extra small-screen refinements */
@media (max-width: 480px) {
    .activities-legend {
        display: flex;
        flex-direction: column;
        gap: 8px;
        font-size: 0.85em;
    }

    .card { padding: 12px; }
    .card.form-card { padding: 12px; }
    .profile-form-card { padding: 12px; }

    .modal-panel { width: calc(100% - 20px); padding: 12px; }

    canvas { max-height: 220px !important; }

    .navbar-nav { gap: 6px; padding: 6px; }
    .navbar-nav a { padding: 8px 10px; font-size: 0.9em; }

    .controls { gap: 6px; }
    .controls select { padding: 0.45rem 0.6rem; }

    /* Make tables more compact on narrow screens */
    table th, table td { padding: 8px 6px; font-size: 0.85em; }
}

.filter-item label {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-item select {
    background: var(--bg-white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 0.65rem 1rem;
    min-width: 160px;
    font-weight: 600;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.filter-item select:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,153,0,0.1);
}

.filter-item select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,153,0,0.15);
}

.filter-badge {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #ffffff;
    border-radius: 40px;
    padding: 0.55rem 1.2rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(0,153,0,0.15);
    white-space: nowrap;
}

/* Program grid */
.activities-legend {
    display: grid;
    grid-template-columns: 1.2fr 1.5fr 1.5fr 1.4fr 0.7fr;
    gap: 8px;
    font-weight: 700;
    margin: 8px 0;
}

.activities-list .grid-row {
    display: grid;
    grid-template-columns: 1.2fr 1.5fr 1.5fr 1.4fr 0.7fr;
    gap: 8px;
    align-items: center;
    padding: 12px 8px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-white);
    transition: all var(--transition-fast);
}

.activities-list .grid-row:hover {
    background: var(--surface-2);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.admin-legend {
    grid-template-columns: 1.2fr 2fr 0.8fr;
    padding: 12px;
    background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
    border-radius: var(--radius) var(--radius) 0 0;
    border: 1px solid var(--border-light);
    border-bottom: none;
}

.admin-grid .grid-row {
    grid-template-columns: 1.2fr 2fr 0.8fr;
}

.activities-list input[disabled], .activities-list input[readonly] {
    background: #f2f4f5;
    color: #666;
    cursor: not-allowed;
}

.pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eef7ee;
    color: #0d6b0d;
    font-weight: 700;
    font-size: 0.85rem;
}

.badge.subtle {
    display: inline-block;
    margin-top: 4px;
    padding: 3px 8px;
    border-radius: 10px;
    background: #f0f0f0;
    color: #333;
    font-size: 0.8rem;
}

/* Users table styling */
.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-cell .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #009900;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}
.user-cell .u-name { font-weight: 700; }
.user-cell .u-email { font-size: 0.85rem; color: #666; }
.badge.status { padding: 4px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; }
.badge.success { background: #e8f5e9; color: #1b5e20; }
.badge.muted { background: #f0f0f0; color: #555; }
.actions .btn.sm { padding: 6px 10px; font-size: 0.85rem; margin: 2px 0; }
.btn.danger { background: #b91c1c; color: #fff; }

/* Hide comparison charts globally */
.dashboard-charts {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 48px;
    color: var(--text-muted);
}

.loading::after {
    content: "...";
    animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {
    0%, 20% { content: "."; }
    40% { content: ".."; }
    60%, 100% { content: "..."; }
}

/* Scrollbar Styling - Light theme */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-surface-2);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-strong);
}

/* Print Styles */
@media print {
    .navbar, .btn, .controls, .forecast {
        display: none;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--border-light);
        break-inside: avoid;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .stat-value {
        color: var(--primary-dark);
    }
}

/* Utility Classes */
.text-success {
    color: var(--primary);
}

.text-danger {
    color: var(--error);
}

.text-primary {
    color: var(--primary);
}

.bg-success {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-inverse);
}

.bg-danger {
    background: linear-gradient(135deg, var(--error), var(--error-dark));
    color: var(--text-inverse);
}

/* Alert Boxes */
.alert {
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-weight: 500;
}

.alert-success {
    background: rgba(44, 142, 34, 0.08);
    border-left: 4px solid var(--primary);
    color: var(--primary-dark);
}

.alert-danger {
    background: rgba(230, 0, 0, 0.08);
    border-left: 4px solid var(--error);
    color: var(--error-dark);
}

/* Badge Styles */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-success {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-inverse);
}

.badge-danger {
    background: linear-gradient(135deg, var(--error), var(--error-dark));
    color: var(--text-inverse);
}

/* Progress bars */
.progress-bar {
    background: var(--bg-surface-3);
    border-radius: 10px;
    overflow: hidden;
    height: 8px;
}

.progress-fill {
    background: var(--primary);
    height: 100%;
    transition: width var(--transition-base);
}

.progress-fill.danger {
    background: var(--error);
}

/* Toggle switches */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-light);
    transition: var(--transition-fast);
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition-fast);
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--primary);
}

/* Additional utility for light backgrounds */
.bg-dark {
    background: var(--bg-surface-2);
}

.bg-darker {
    background: var(--bg-surface-3);
}

/* Card variants */
.card-success {
    border-top: 4px solid var(--primary);
}

.card-danger {
    border-top: 4px solid var(--error);
}

/* Divider */
.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-light), transparent);
    margin: 20px 0;
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    background-color: var(--bg-surface-3);
    color: var(--text-primary);
    text-align: center;
    padding: 5px 10px;
    border-radius: 6px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity var(--transition-fast);
    white-space: nowrap;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Accordion Styles */
.accordion-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.accordion-item {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-sm);
}

.accordion-item:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    border-color: var(--primary);
}

.accordion-header {
    width: 100%;
    background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
    border: none;
    padding: 16px 20px;
    text-align: left;
    cursor: pointer;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    transition: all var(--transition-fast);
}

.accordion-header:hover {
    background: linear-gradient(135deg, rgba(0,153,0,0.06), rgba(2,107,2,0.06));
    color: var(--primary);
}

.accordion-header:focus {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.accordion-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    transition: transform var(--transition-base);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.accordion-header[aria-expanded="true"] .accordion-icon {
    transform: rotate(90deg);
}

.accordion-title {
    flex-grow: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.accordion-content {
    padding: 20px;
    background: var(--surface);
    border-top: 1px solid var(--border-light);
    animation: slideDown var(--transition-base);
}

.accordion-content.hidden {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 2000px;
    }
}

@media (max-width: 768px) {
    .accordion-header {
        padding: 12px 16px;
        font-size: 0.95rem;
    }
    
    .accordion-content {
        padding: 16px;
    }
}

/* Modern responsive polish */
img,
svg,
canvas {
    max-width: 100%;
}

button,
input,
select,
textarea {
    font: inherit;
}

.auth-card,
.card,
.profile-form-card,
.accordion-item,
.modal-panel {
    box-shadow: var(--shadow-md);
}

.auth-card {
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 5px;
    background: linear-gradient(90deg, var(--accent), var(--primary));
}

.auth-brand h1 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    line-height: 1.1;
    text-align: center;
}

.navbar {
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08);
}

.navbar .flex-between {
    max-width: 1440px;
    margin: 0 auto;
    gap: 16px;
}

.group-auth {
    min-width: 0;
    gap: 12px;
}

.navbar-brand {
    margin: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#logout-btn {
    background: #b91c1c !important;
    color: #ffffff !important;
    border-color: #991b1b;
    flex-shrink: 0;
}

.navbar-nav {
    max-width: 1440px;
    margin: 0 auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.navbar-nav a {
    border-radius: 999px;
}

.nav-logout-item a {
    color: var(--accent);
    font-weight: 700;
}

.content {
    width: min(100%, 1560px);
}

    .card,
    .chart-container {
    overflow: hidden;
}

    .card:hover,
    .chart-container:hover,
    .accordion-item:hover {
    transform: none;
}

.card-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

.dashboard-charts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.chart-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.chart-container canvas {
    width: 100% !important;
    min-height: 260px;
}

.filter-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    align-items: center;
    padding: 8px 0;
}

.filter-item {
    min-width: 0;
    display: grid;
    gap: 0.25rem;
}

.filter-item label {
    font-size: 0.82rem;
    margin-bottom: 0;
    opacity: 0.85;
}

.filter-item input,
.filter-item select,
.filter-item textarea,
.filter-bar > .btn,
.filter-item .btn {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    font-size: 0.9rem;
}

.filter-badge {
    justify-self: start;
    align-self: center;
    padding: 0.45rem 0.9rem;
    font-size: 0.85rem;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    min-width: 720px;
}

.activities-legend,
.activities-list .grid-row {
    min-width: 720px;
}

.activities-list {
    overflow: auto;
}

.activities-list input,
.activities-list select {
    width: 100%;
    min-width: 0;
}

.modal-panel {
    max-height: calc(100vh - 32px);
    overflow: auto;
}

.modal-actions {
    flex-wrap: wrap;
}

.modal-actions .btn {
    flex: 1 1 160px;
}

@media (min-width: 1100px) {
    .chart-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .chart-row .compare-card {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .dashboard-charts {
        grid-template-columns: 1fr;
    }

    .content {
        padding: 24px 0;
    }
}

@media (max-width: 768px) {
    .mobile-nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .navbar-nav {
        display: none;
        flex-direction: column;
        gap: 6px;
        padding: 10px 12px 12px;
        overflow: visible;
        white-space: normal;
    }

    .navbar-nav.open {
        display: flex;
    }

    .navbar-nav li {
        width: 100%;
    }

    .navbar-nav a {
        display: block;
        width: 100%;
    }

    .screen {
        align-items: flex-start;
        padding: 28px 14px;
    }

    .auth-card {
        padding: 24px 18px;
    }

    .navbar .flex-between {
        flex-direction: row;
        align-items: center;
        padding: 12px 14px;
    }

    .navbar-brand {
        font-size: 0.95rem;
    }

    .auth-logo,
    .auth-logo img {
        width: 42px;
        height: 42px;
    }

    #logout-btn {
        padding: 9px 12px;
    }

    .navbar-nav {
        padding: 8px 12px 10px;
        gap: 6px;
    }

    .navbar-nav a {
        padding: 9px 13px;
        font-size: 0.88rem;
    }

    .filter-bar {
        grid-template-columns: 1fr;
        padding: 14px;
    }

    .card,
    .chart-container,
    .profile-form-card {
        padding: 10px;
    }

    .stat-card {
        padding: 20px 16px;
    }

    .stat-value {
        font-size: 2.15rem;
    }

    .chart-container canvas {
        min-height: 220px;
    }

    .accordion-content {
        overflow-x: auto;
    }
}

@media (max-width: 520px) {
    .navbar .flex-between {
        align-items: flex-start;
        gap: 10px;
    }

    .group-auth {
        width: 100%;
    }

    .navbar-brand {
        white-space: normal;
        line-height: 1.2;
    }

    #logout-btn {
        width: 100%;
    }

    .content {
        padding: 16px 0;
    }

    .card,
    .chart-container,
    .profile-form-card,
    .accordion-content {
        padding: 10px;
        border: none;
        box-shadow: none;
    }

    .card h2,
    .card h3 {
        line-height: 1.25;
    }

    .flex-between {
        padding: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .flex-between select,
    .flex-between .btn {
        width: 100%;
    }

    input,
    select,
    textarea,
    .btn {
        min-height: 44px;
    }

    .text-center,
    .loading {
        padding: 28px 12px;
    }

    table {
        min-width: 640px;
    }

    .activities-legend,
    .activities-list .grid-row {
        min-width: 640px;
    }
}

/* Full-width chart experience */
.dashboard-charts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.chart-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.chart-row > *,
.dashboard-charts > * {
    width: 100%;
    min-width: 0;
}

.chart-row .compare-card {
    grid-column: auto;
}

.chart-container {
    width: 100%;
    padding: 18px 20px 16px;
    background: var(--surface);
    border-radius: 0;
    border: 1px solid var(--border-light);
    box-shadow: none;
    transition: all var(--transition-base);
    overflow: hidden;
}

.chart-container .flex-between {
    gap: 14px;
    flex-wrap: wrap;
}

.chart-container .flex-between h3 {
    margin-bottom: 0;
    border-bottom: 0;
}

.chart-container canvas {
    display: block;
    width: 100% !important;
    height: clamp(240px, 30vh, 360px);
    min-height: 220px;
    max-height: 420px;
    margin-top: 12px;
    background: #ffffff;
    border: none;
    border-radius: 12px;
}

@media (max-width: 900px) {
    .dashboard-charts {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .dashboard-charts,
    .chart-row {
        gap: 20px;
    }

    .chart-container {
        padding: 14px 14px 12px;
    }

    .chart-container .filter-bar {
        gap: 12px;
        margin-bottom: 12px;
        padding: 12px;
    }

    .chart-container .filter-badge {
        width: 100%;
        text-align: center;
        border-radius: var(--radius);
    }

    .chart-container canvas {
        min-height: 280px;
        margin-top: 14px;
    }
}

@media (max-width: 520px) {
    .chart-container {
        padding: 8px 8px 8px;
    }

    .chart-container .flex-between {
        align-items: stretch;
    }

    .chart-container .flex-between h3 {
        font-size: 1rem;
    }

    .chart-container canvas {
        height: 340px !important;
    }
}



