/* ========================================================================== */
/* MtaaTrack — NCC Green Army report automation                               */
/* ========================================================================== */

:root {
    /* Brand (shared across themes) */
    --brand-green: #2E7D32;
    --brand-green-dark: #1B5E20;
    --brand-green-light: #4caf50;
    --brand-emerald: #00c853;
    --brand-yellow: #FFD60A;
    --brand-yellow-dark: #F5B400;
    --brand-red: #ef5350;
    --brand-amber: #FF9800;
    --brand-blue: #2962FF;
    --brand-blue-soft: #64B5F6;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --transition-fast: 0.15s ease;
    --transition: 0.25s ease;
}

/* --- Light theme (default) ----------------------------------------------- */
:root,
[data-theme="light"] {
    --bg-void: #F5F7F4;
    --bg-surface: #FFFFFF;
    --bg-elevated: #FFFFFF;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-glass: rgba(255, 255, 255, 0.7);
    --bg-subtle: #F1F5ED;
    --bg-input: #FFFFFF;

    --border-subtle: rgba(46, 125, 50, 0.12);
    --border-accent: rgba(46, 125, 50, 0.35);
    --border-glass: rgba(46, 125, 50, 0.15);
    --border-input: #D9DEE0;

    --text-primary: #0F1F14;
    --text-secondary: #374A3A;
    --text-muted: #73847A;
    --text-inverse: #FFFFFF;

    --accent-green: #2E7D32;
    --accent-light: #388E3C;
    --accent-dark: #1B5E20;
    --accent-emerald: #00A348;
    --accent-gold: #F5A000;
    --accent-red: #E53935;
    --accent-blue: #1E88E5;
    --accent-amber: #EF6C00;

    --navbar-bg: rgba(255, 255, 255, 0.92);
    --navbar-border: rgba(46, 125, 50, 0.15);

    --gradient-bg: linear-gradient(180deg, #F5F7F4 0%, #EAF3E6 100%);
    --gradient-glow: radial-gradient(ellipse at 50% -10%, rgba(46, 125, 50, 0.12) 0%, transparent 55%);
    --gradient-brand: linear-gradient(135deg, #2E7D32 0%, #1B5E20 100%);
    --gradient-hero: linear-gradient(135deg, #2E7D32 0%, #1B5E20 55%, #0F3B14 100%);

    --glass-blur: blur(16px);
    --shadow-card: 0 4px 20px rgba(15, 31, 20, 0.06);
    --shadow-card-hover: 0 8px 28px rgba(15, 31, 20, 0.1);
    --shadow-glow: 0 0 30px rgba(46, 125, 50, 0.08);
    --shadow-btn: 0 2px 8px rgba(46, 125, 50, 0.2);

    --amber-row-bg: rgba(255, 152, 0, 0.08);
    --amber-row-border: #FF9800;
}

/* --- Dark theme ---------------------------------------------------------- */
[data-theme="dark"] {
    --bg-void: #0a1a0f;
    --bg-surface: #0f2416;
    --bg-elevated: #142d1b;
    --bg-card: rgba(20, 45, 27, 0.6);
    --bg-glass: rgba(20, 45, 27, 0.4);
    --bg-subtle: #142d1b;
    --bg-input: rgba(10, 26, 15, 0.6);

    --border-subtle: rgba(46, 125, 50, 0.15);
    --border-accent: rgba(46, 125, 50, 0.4);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-input: rgba(46, 125, 50, 0.15);

    --text-primary: #e8f5e9;
    --text-secondary: rgba(232, 245, 233, 0.7);
    --text-muted: rgba(232, 245, 233, 0.4);
    --text-inverse: #0F1F14;

    --accent-green: #4caf50;
    --accent-light: #81c784;
    --accent-dark: #2e7d32;
    --accent-emerald: #00c853;
    --accent-gold: #ffd54f;
    --accent-red: #ef5350;
    --accent-blue: #64B5F6;
    --accent-amber: #FFB74D;

    --navbar-bg: rgba(10, 26, 15, 0.85);
    --navbar-border: rgba(46, 125, 50, 0.15);

    --gradient-bg: var(--bg-void);
    --gradient-glow: radial-gradient(ellipse at 50% 0%, rgba(46, 125, 50, 0.2) 0%, transparent 60%);
    --gradient-brand: linear-gradient(135deg, #4caf50 0%, #2e7d32 100%);
    --gradient-hero: linear-gradient(135deg, #1B5E20 0%, #0F3B14 55%, #061B08 100%);

    --glass-blur: blur(20px);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-card-hover: 0 12px 40px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(46, 125, 50, 0.15);
    --shadow-btn: 0 4px 20px rgba(46, 125, 50, 0.3);

    --amber-row-bg: rgba(255, 152, 0, 0.12);
    --amber-row-border: #FFB74D;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-family);
    background: var(--gradient-bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    transition: background var(--transition), color var(--transition);
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: var(--gradient-glow);
    pointer-events: none;
    z-index: 0;
}

/* --- Brand mark ---------------------------------------------------------- */
.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand-green) 0%, var(--brand-green-dark) 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(46, 125, 50, 0.3);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.brand-mark svg {
    width: 22px;
    height: 22px;
    color: var(--brand-yellow);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

.brand-mark-lg {
    width: 56px;
    height: 56px;
    border-radius: 16px;
}

.brand-mark-lg svg {
    width: 34px;
    height: 34px;
}

/* --- Navigation --------------------------------------------------------- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 2rem;
    background: var(--navbar-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--navbar-border);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.navbar-brand .brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.navbar-brand .brand-text .t {
    font-size: 1.15rem;
    font-weight: 700;
}

.navbar-brand .brand-text .s {
    font-size: 0.64rem;
    color: var(--text-muted);
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: 0.1rem;
}

.navbar-links {
    display: flex;
    gap: 0.35rem;
    align-items: center;
    flex-wrap: wrap;
}

.navbar-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.45rem 0.85rem;
    border-radius: 8px;
    transition: all var(--transition-fast);
    font-weight: 500;
}

.navbar-links a:hover {
    color: var(--accent-green);
    background: rgba(46, 125, 50, 0.08);
}

.navbar-links a.active {
    color: var(--accent-green);
    background: rgba(46, 125, 50, 0.12);
    font-weight: 600;
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.navbar-user .name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.navbar-user .role-chip {
    font-size: 0.65rem;
    color: var(--accent-green);
    background: rgba(46, 125, 50, 0.12);
    padding: 0.18rem 0.45rem;
    border-radius: 50px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.navbar-user .logout {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.navbar-user .logout:hover {
    color: var(--accent-red);
    border-color: var(--accent-red);
}

/* --- Theme toggle --- */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    padding: 0;
}

.theme-toggle:hover {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.theme-toggle svg { width: 18px; height: 18px; }
[data-theme="light"] .theme-toggle .i-dark { display: inline; }
[data-theme="light"] .theme-toggle .i-light { display: none; }
[data-theme="dark"] .theme-toggle .i-dark { display: none; }
[data-theme="dark"] .theme-toggle .i-light { display: inline; }

/* --- Notification bell --- */
.notif-bell {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    text-decoration: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.notif-bell:hover {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.notif-bell svg { width: 18px; height: 18px; }

.notif-bell .dot {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--brand-red);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    border: 2px solid var(--navbar-bg);
}

/* --- Container ---------------------------------------------------------- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.container-narrow { max-width: 640px; }
.container-wide { max-width: 1440px; }

/* --- Glass Card --------------------------------------------------------- */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
    margin-bottom: 1.5rem;
    transition: all var(--transition);
}

.glass-card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-card-hover);
}

.glass-card h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

.glass-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.card-amber-highlight {
    border: 2px solid var(--amber-row-border) !important;
    background: var(--amber-row-bg) !important;
    box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.12);
}

/* --- Stats Grid --------------------------------------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
    transition: all var(--transition);
    box-shadow: var(--shadow-card);
}

.stat-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--accent-green);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 0.4rem;
    font-weight: 600;
}

/* --- Buttons ------------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    line-height: 1.3;
}

.btn-primary {
    background: var(--gradient-brand);
    color: #fff;
    box-shadow: var(--shadow-btn);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(46, 125, 50, 0.35);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-accent);
}

.btn-secondary:hover {
    background: rgba(46, 125, 50, 0.08);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.btn-yellow {
    background: var(--brand-yellow);
    color: #2E2B00;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(255, 214, 10, 0.4);
}

.btn-yellow:hover {
    background: var(--brand-yellow-dark);
    transform: translateY(-1px);
}

.btn-danger {
    background: rgba(229, 57, 53, 0.12);
    color: var(--accent-red);
    border: 1px solid rgba(229, 57, 53, 0.35);
}

.btn-danger:hover { background: rgba(229, 57, 53, 0.22); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.45rem 0.8rem;
}

.btn-ghost:hover {
    background: rgba(46, 125, 50, 0.08);
    color: var(--accent-green);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
}

.btn-xs {
    padding: 0.22rem 0.55rem;
    font-size: 0.72rem;
}

.btn-lg {
    padding: 0.9rem 1.8rem;
    font-size: 0.95rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* --- Forms -------------------------------------------------------------- */
.form-group { margin-bottom: 1rem; }

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-control {
    width: 100%;
    padding: 0.65rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.12);
}

.form-control::placeholder { color: var(--text-muted); }

textarea.form-control { resize: vertical; min-height: 80px; }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%232E7D32'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 200px; }

/* --- Tables ------------------------------------------------------------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.87rem;
}

.data-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    vertical-align: middle;
}

.data-table tr:hover td { background: rgba(46, 125, 50, 0.04); }

.data-table tr.amber-row td {
    background: var(--amber-row-bg) !important;
    border-left: 3px solid var(--amber-row-border);
}

.data-table tr.amber-row:hover td { background: rgba(255, 152, 0, 0.14) !important; }

/* --- Badges ------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.22rem 0.65rem;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.4;
}

.badge-complete {
    background: rgba(0, 163, 72, 0.15);
    color: var(--accent-emerald);
    border: 1px solid rgba(0, 163, 72, 0.3);
}

.badge-incomplete {
    background: rgba(245, 160, 0, 0.15);
    color: var(--accent-gold);
    border: 1px solid rgba(245, 160, 0, 0.3);
}

.badge-anomaly {
    background: rgba(229, 57, 53, 0.12);
    color: var(--accent-red);
    border: 1px solid rgba(229, 57, 53, 0.3);
}

.badge-info {
    background: rgba(30, 136, 229, 0.12);
    color: var(--accent-blue);
    border: 1px solid rgba(30, 136, 229, 0.3);
}

.badge-warning {
    background: rgba(245, 160, 0, 0.15);
    color: var(--accent-gold);
    border: 1px solid rgba(245, 160, 0, 0.3);
}

.badge-error {
    background: rgba(229, 57, 53, 0.12);
    color: var(--accent-red);
    border: 1px solid rgba(229, 57, 53, 0.3);
}

.badge-new {
    background: var(--brand-yellow);
    color: #2E2B00;
    border: 1px solid var(--brand-yellow-dark);
    animation: badge-pulse 2s infinite;
}

@keyframes badge-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 214, 10, 0.5); }
    50% { box-shadow: 0 0 0 6px rgba(255, 214, 10, 0); }
}

.badge-amber {
    background: rgba(239, 108, 0, 0.15);
    color: var(--accent-amber);
    border: 1px solid rgba(239, 108, 0, 0.35);
}

/* --- Dropzone ----------------------------------------------------------- */
.dropzone {
    border: 2px dashed var(--border-accent);
    border-radius: var(--radius-md);
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    margin-bottom: 1rem;
    background: var(--bg-subtle);
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--accent-green);
    background: rgba(46, 125, 50, 0.06);
}

.dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.dropzone .icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.dropzone .text { font-size: 0.95rem; color: var(--text-secondary); font-weight: 500; }
.dropzone .subtext { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.3rem; }

/* --- File list ---------------------------------------------------------- */
.file-list { list-style: none; margin-bottom: 1rem; }

.file-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
}

.file-list .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); }
.file-list .remove { color: var(--accent-red); cursor: pointer; font-size: 1.1rem; margin-left: 0.75rem; opacity: 0.75; transition: opacity var(--transition-fast); }
.file-list .remove:hover { opacity: 1; }

/* --- Result items ------------------------------------------------------- */
.result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    border: 1px solid;
}

.result-item.success {
    background: rgba(0, 163, 72, 0.08);
    border-color: rgba(0, 163, 72, 0.25);
}

.result-item.error {
    background: rgba(229, 57, 53, 0.08);
    border-color: rgba(229, 57, 53, 0.25);
}

.result-item .info { flex: 1; }
.result-item .fname { font-weight: 600; color: var(--text-primary); }
.result-item .detail { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; }

/* --- Anomaly list ------------------------------------------------------- */
.anomaly-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.4rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border-subtle);
    font-size: 0.83rem;
}

.anomaly-item .description {
    color: var(--text-secondary);
    flex: 1;
}

.anomaly-item.resolved {
    opacity: 0.55;
    background: rgba(0, 163, 72, 0.05);
    border-color: rgba(0, 163, 72, 0.2);
}

.anomaly-item.resolved .description { text-decoration: line-through; }

/* --- Suggestion row ----------------------------------------------------- */
.suggestion-row { transition: all var(--transition); }
.suggestion-row .suggestion-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }
.suggestion-row.resolved { opacity: 0.65; }

/* --- Ward section ------------------------------------------------------- */
.ward-section { margin-bottom: 1rem; }

.ward-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1rem;
    background: rgba(46, 125, 50, 0.1);
    border: 1px solid rgba(46, 125, 50, 0.22);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.ward-header:hover { background: rgba(46, 125, 50, 0.15); }

.ward-header h3 {
    margin: 0;
    font-size: 0.92rem;
    color: var(--accent-green);
    font-weight: 700;
    letter-spacing: 0.02em;
}

.ward-content { padding: 0.75rem; display: none; }
.ward-content.open { display: block; }

/* --- Spinner ------------------------------------------------------------ */
.spinner { display: none; text-align: center; padding: 1.5rem; color: var(--text-secondary); }
.spinner.active { display: flex; align-items: center; justify-content: center; gap: 0.75rem; }

.spinner-dot {
    width: 8px; height: 8px;
    background: var(--accent-green);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}

.spinner-dot:nth-child(2) { animation-delay: 0.16s; }
.spinner-dot:nth-child(3) { animation-delay: 0.32s; }

.btn-spin {
    display: inline-block;
    width: 12px; height: 12px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: btn-spin 0.7s linear infinite;
    vertical-align: -2px;
    margin-right: 0.35rem;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
    40% { transform: scale(1); opacity: 1; }
}

/* --- Modal -------------------------------------------------------------- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 31, 20, 0.5);
    backdrop-filter: blur(6px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 560px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(15, 31, 20, 0.25);
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.modal-lg { max-width: 960px; }
.modal-xl { max-width: 1200px; }

.modal h3 {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 700;
}

.modal p { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 1.25rem; }

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* --- Login Page --------------------------------------------------------- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-hero);
    position: relative;
    padding: 2rem;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(255, 214, 10, 0.1) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 80%, rgba(76, 175, 80, 0.15) 0%, transparent 55%);
}

.login-card {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.25);
}

.login-card h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
    color: #0F1F14;
    letter-spacing: -0.02em;
}

.login-card .subtitle {
    color: #73847A;
    font-size: 0.85rem;
    margin-bottom: 1.75rem;
}

.login-card .logo-area {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-card .brand-mark-lg { margin-bottom: 0.75rem; }

.login-card .form-control { background: #F5F7F4; color: #0F1F14; border-color: #D9DEE0; }
.login-card .form-group label { color: #374A3A; }

.error-msg {
    background: rgba(229, 57, 53, 0.12);
    border: 1px solid rgba(229, 57, 53, 0.3);
    color: #E53935;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.83rem;
    margin-bottom: 1rem;
}

.success-msg {
    background: rgba(0, 163, 72, 0.1);
    border: 1px solid rgba(0, 163, 72, 0.3);
    color: var(--accent-emerald);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.83rem;
    margin-bottom: 1rem;
}

/* --- Expandable row ----------------------------------------------------- */
.expand-trigger { cursor: pointer; user-select: none; }

.expand-trigger::before {
    content: '›';
    display: inline-block;
    margin-right: 0.5rem;
    transition: transform var(--transition-fast);
    font-weight: bold;
    color: var(--accent-green);
    font-size: 1.2rem;
    line-height: 1;
}

.expand-trigger.open::before { transform: rotate(90deg); }
.expand-content { display: none; padding: 0.5rem 1rem 0.75rem 2rem; }
.expand-content.open { display: block; }

/* --- Lightbox ----------------------------------------------------------- */
.zoomable { cursor: zoom-in; transition: transform var(--transition-fast); }
.zoomable:hover { transform: scale(1.02); }

.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.lightbox-overlay.active { display: flex; }

.lightbox-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
}

.lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.4rem;
    transition: all var(--transition-fast);
}

.lightbox-close:hover { background: rgba(255, 255, 255, 0.22); }

.lightbox-caption {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    max-width: 80vw;
    text-align: center;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    padding: 0;
    line-height: 1;
    user-select: none;
}
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.25); transform: translateY(-50%) scale(1.08); }
.lightbox-prev { left: 2rem; }
.lightbox-next { right: 2rem; }

.lightbox-counter {
    position: absolute;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    padding: 0.3rem 0.9rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* --- Notifications dropdown -------------------------------------------- */
.notif-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 360px;
    max-height: 480px;
    overflow-y: auto;
    background: var(--bg-elevated);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-md);
    box-shadow: 0 16px 48px rgba(15, 31, 20, 0.2);
    z-index: 150;
}

.notif-dropdown.active { display: block; }

.notif-item {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    display: block;
    text-decoration: none;
    color: var(--text-primary);
    transition: background var(--transition-fast);
}

.notif-item:hover { background: rgba(46, 125, 50, 0.06); }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: rgba(255, 214, 10, 0.06); border-left: 3px solid var(--brand-yellow-dark); }
.notif-item .title { font-size: 0.88rem; font-weight: 600; margin-bottom: 0.2rem; }
.notif-item .msg { font-size: 0.8rem; color: var(--text-muted); }
.notif-item .ts { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.3rem; }

.notif-header {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.notif-empty { padding: 2rem 1rem; text-align: center; color: var(--text-muted); font-size: 0.85rem; }

/* --- Hero section for public portal ------------------------------------ */
.hero {
    background: var(--gradient-hero);
    color: #fff;
    padding: 4rem 2rem;
    border-radius: var(--radius-xl);
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
}

.hero::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 214, 10, 0.18) 0%, transparent 70%);
    pointer-events: none;
}

.hero h1 { font-size: 3rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.03em; margin-bottom: 1rem; }
.hero .highlight { color: var(--brand-yellow); }
.hero p { font-size: 1.1rem; opacity: 0.9; max-width: 640px; }

/* --- Utilities ---------------------------------------------------------- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 0.5rem; } .gap-2 { gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.muted { color: var(--text-muted); }
.small { font-size: 0.8rem; }

.pos-relative { position: relative; }

/* --- Photo grid (portal + review) -------------------------------------- */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.photo-tile {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-subtle);
    cursor: zoom-in;
    transition: all var(--transition-fast);
    border: 1px solid var(--border-subtle);
}

.photo-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-card-hover); }

.photo-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-tile .phase-label {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: rgba(15, 31, 20, 0.7);
    color: #fff;
    font-size: 0.68rem;
    padding: 0.2rem 0.55rem;
    border-radius: 50px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Photo group (Before / During / After row) ------------------------ */
.photo-group-row {
    padding: 0.9rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-subtle);
    margin-bottom: 0.9rem;
}

.phase-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.phase-cell { display: flex; flex-direction: column; gap: 0.3rem; }

.phase-title {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-green);
    padding-left: 0.2rem;
}

.photo-tile-empty {
    aspect-ratio: 4/3;
    background: var(--bg-subtle);
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

@media (max-width: 640px) {
    .phase-row { grid-template-columns: 1fr; }
}

/* --- Resize preview ---------------------------------------------------- */
.resize-preview-wrapper {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.resize-preview-wrapper > .form-side { flex: 1; min-width: 260px; }
.resize-preview-wrapper > .preview-side { flex: 1; min-width: 300px; text-align: center; }

.preview-frame {
    display: inline-block;
    border: 2px solid var(--accent-green);
    background: var(--bg-subtle);
    border-radius: 4px;
    overflow: hidden;
    transition: all var(--transition);
    box-shadow: var(--shadow-card);
    position: relative;
}

.preview-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }

.preview-frame-caption {
    margin-top: 0.75rem;
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* --- Compare panes ---------------------------------------------------- */
.compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.compare-pane {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1rem;
    background: var(--bg-subtle);
    max-height: 520px;
    overflow-y: auto;
}

.compare-pane h4 {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 700;
}

.compare-pane.chosen {
    border-color: var(--accent-green);
    background: rgba(46, 125, 50, 0.06);
}

/* --- Public portal specifics ------------------------------------------- */
.portal-nav {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.9rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ward-card {
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
    transition: all var(--transition);
}

.ward-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-card-hover); }

.ward-card-hero {
    height: 180px;
    background: var(--gradient-brand);
    position: relative;
    overflow: hidden;
}

.ward-card-hero img { width: 100%; height: 100%; object-fit: cover; }

.ward-card-body { padding: 1.25rem; }
.ward-card h3 { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); margin-bottom: 0.3rem; }
.ward-card p { font-size: 0.85rem; color: var(--text-muted); }

/* --- Responsive ------------------------------------------------------- */
@media (max-width: 768px) {
    .navbar { padding: 0.75rem 1rem; flex-wrap: wrap; gap: 0.5rem; }
    .navbar-links { display: none; }
    .navbar-links.open { display: flex; width: 100%; }
    .navbar-user { flex-wrap: wrap; gap: 0.5rem; justify-content: flex-end; }
    .navbar-user > div:not(.pos-relative) { display: none; }  /* hide name block on mobile */
    .theme-toggle, .notif-bell { position: relative; z-index: 2; }
    .container { padding: 1rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { flex-direction: column; }
    .hero h1 { font-size: 2rem; }
    .compare-grid { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
}
