/* ============================================================
   iEnergy — Unified Energy Management & Billing
   Design: Hussain Zagzoug Style (hzagzoug.com)
   Palette: Jade & Teal Green Spectrum (#159d90, #0c7a70, #7fe0d4)
   Clean Mint White & Deep Obsidian Teal Void (#071719)
   Zero Gold, Zero Pink, Zero Red, Zero Blue, Zero Purple
   Thmanyah Typeface Default + Center-Aligned Inputs + FontAwesome Icons
   ============================================================ */

/* ------------------------------------------------------------
   1. FONTS IMPORT (Cairo & Tajawal for user settings toggle)
   ------------------------------------------------------------ */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&family=Tajawal:wght@400;500;700;800;900&display=swap');

/* ------------------------------------------------------------
   2. THMANYAH TYPEFACE FONTS (@font-face - Local WOFF2 & OTF)
   ------------------------------------------------------------ */

/* === 2.1 Thmanyah Sans (Modern Geometric Sans) === */
@font-face {
    font-family: 'Thmanyah';
    src: url('/fonts/thmanyahsans-Light.woff2') format('woff2'),
         url('/fonts/thmanyahsans-Light.otf') format('opentype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Thmanyah';
    src: url('/fonts/thmanyahsans-Regular.woff2') format('woff2'),
         url('/fonts/thmanyahsans-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Thmanyah';
    src: url('/fonts/thmanyahsans-Medium.woff2') format('woff2'),
         url('/fonts/thmanyahsans-Medium.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Thmanyah';
    src: url('/fonts/thmanyahsans-Bold.woff2') format('woff2'),
         url('/fonts/thmanyahsans-Bold.otf') format('opentype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Thmanyah';
    src: url('/fonts/thmanyahsans-Bold.woff2') format('woff2'),
         url('/fonts/thmanyahsans-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Thmanyah';
    src: url('/fonts/thmanyahsans-Black.woff2') format('woff2'),
         url('/fonts/thmanyahsans-Black.otf') format('opentype');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Thmanyah';
    src: url('/fonts/thmanyahsans-Black.woff2') format('woff2'),
         url('/fonts/thmanyahsans-Black.otf') format('opentype');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

/* Alias ThmanyahSans */
@font-face {
    font-family: 'ThmanyahSans';
    src: url('/fonts/thmanyahsans-Light.woff2') format('woff2'),
         url('/fonts/thmanyahsans-Light.otf') format('opentype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'ThmanyahSans';
    src: url('/fonts/thmanyahsans-Regular.woff2') format('woff2'),
         url('/fonts/thmanyahsans-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'ThmanyahSans';
    src: url('/fonts/thmanyahsans-Medium.woff2') format('woff2'),
         url('/fonts/thmanyahsans-Medium.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'ThmanyahSans';
    src: url('/fonts/thmanyahsans-Bold.woff2') format('woff2'),
         url('/fonts/thmanyahsans-Bold.otf') format('opentype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'ThmanyahSans';
    src: url('/fonts/thmanyahsans-Bold.woff2') format('woff2'),
         url('/fonts/thmanyahsans-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'ThmanyahSans';
    src: url('/fonts/thmanyahsans-Black.woff2') format('woff2'),
         url('/fonts/thmanyahsans-Black.otf') format('opentype');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'ThmanyahSans';
    src: url('/fonts/thmanyahsans-Black.woff2') format('woff2'),
         url('/fonts/thmanyahsans-Black.otf') format('opentype');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

/* === 2.2 Thmanyah Serif Display (The Iconic Signature Thmanyah Headline Font) === */
@font-face {
    font-family: 'ThmanyahDisplay';
    src: url('/fonts/thmanyahserifdisplay-Light.woff2') format('woff2'),
         url('/fonts/thmanyahserifdisplay-Light.otf') format('opentype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'ThmanyahDisplay';
    src: url('/fonts/thmanyahserifdisplay-Regular.woff2') format('woff2'),
         url('/fonts/thmanyahserifdisplay-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'ThmanyahDisplay';
    src: url('/fonts/thmanyahserifdisplay-Medium.woff2') format('woff2'),
         url('/fonts/thmanyahserifdisplay-Medium.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'ThmanyahDisplay';
    src: url('/fonts/thmanyahserifdisplay-Bold.woff2') format('woff2'),
         url('/fonts/thmanyahserifdisplay-Bold.otf') format('opentype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'ThmanyahDisplay';
    src: url('/fonts/thmanyahserifdisplay-Bold.woff2') format('woff2'),
         url('/fonts/thmanyahserifdisplay-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'ThmanyahDisplay';
    src: url('/fonts/thmanyahserifdisplay-Black.woff2') format('woff2'),
         url('/fonts/thmanyahserifdisplay-Black.otf') format('opentype');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'ThmanyahDisplay';
    src: url('/fonts/thmanyahserifdisplay-Black.woff2') format('woff2'),
         url('/fonts/thmanyahserifdisplay-Black.otf') format('opentype');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

/* === 2.3 Thmanyah Serif Text (Elegant Editorial Reading Font) === */
@font-face {
    font-family: 'ThmanyahSerif';
    src: url('/fonts/thmanyahseriftext-Light.woff2') format('woff2'),
         url('/fonts/thmanyahseriftext-Light.otf') format('opentype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'ThmanyahSerif';
    src: url('/fonts/thmanyahseriftext-Regular.woff2') format('woff2'),
         url('/fonts/thmanyahseriftext-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'ThmanyahSerif';
    src: url('/fonts/thmanyahseriftext-Medium.woff2') format('woff2'),
         url('/fonts/thmanyahseriftext-Medium.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'ThmanyahSerif';
    src: url('/fonts/thmanyahseriftext-Bold.woff2') format('woff2'),
         url('/fonts/thmanyahseriftext-Bold.otf') format('opentype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'ThmanyahSerif';
    src: url('/fonts/thmanyahseriftext-Bold.woff2') format('woff2'),
         url('/fonts/thmanyahseriftext-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'ThmanyahSerif';
    src: url('/fonts/thmanyahseriftext-Black.woff2') format('woff2'),
         url('/fonts/thmanyahseriftext-Black.otf') format('opentype');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'ThmanyahSerif';
    src: url('/fonts/thmanyahseriftext-Black.woff2') format('woff2'),
         url('/fonts/thmanyahseriftext-Black.otf') format('opentype');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

/* ------------------------------------------------------------
   3. FONT SELECTION THEME PREFERENCES
   ------------------------------------------------------------ */
:root {
    --font-sans: 'Thmanyah', 'ThmanyahSans', system-ui, -apple-system, sans-serif;
    --font-display: 'ThmanyahDisplay', 'Thmanyah', sans-serif;
    --font-serif: 'ThmanyahSerif', serif;
    
    /* Pure Teal / Jade Green Spectrum (from hzagzoug.com) */
    --teal-primary: #159d90;
    --teal-secondary: #0c7a70;
    --teal-bright: #7fe0d4;
    --teal-dark: #073b37;
    --teal-deep: #052623;
    
    --primary: #159d90;
    --primary-color: #159d90;
    --secondary: #0c7a70;
    --secondary-color: #0c7a70;
    --accent: #7fe0d4;
    --accent-glow: rgba(127, 224, 212, 0.35);
    
    /* Legacy aliases mapped cleanly to teal */
    --emerald: #159d90;
    --emerald-light: #7fe0d4;
    --emerald-base: #159d90;
    --emerald-dark: #0c7a70;
    --gold-base: #7fe0d4;
    --gold-light: #bbf7f0;
    --amber: #7fe0d4;
    --rose: #159d90;
    
    --transition-speed: 0.3s;
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-pill: 999px;
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
    --bg-surface-elevated: rgba(21, 157, 144, 0.08);
}

/* Dynamic Font Attribute */
[data-font="thmanyah"] {
    --font-sans: 'Thmanyah', 'ThmanyahSans', system-ui, sans-serif !important;
    --font-display: 'ThmanyahDisplay', 'Thmanyah', sans-serif !important;
}
[data-font="thmanyah-display"] {
    --font-sans: 'ThmanyahDisplay', 'Thmanyah', system-ui, sans-serif !important;
    --font-display: 'ThmanyahDisplay', sans-serif !important;
}
[data-font="thmanyah-serif"] {
    --font-sans: 'ThmanyahSerif', 'ThmanyahDisplay', serif !important;
    --font-display: 'ThmanyahDisplay', serif !important;
}
[data-font="cairo"] {
    --font-sans: 'Cairo', system-ui, sans-serif !important;
    --font-display: 'Cairo', sans-serif !important;
}
[data-font="tajawal"] {
    --font-sans: 'Tajawal', system-ui, sans-serif !important;
    --font-display: 'Tajawal', sans-serif !important;
}

/* Dynamic Scale */
[data-scale="sm"] { font-size: 85% !important; }
[data-scale="md"] { font-size: 90% !important; }
[data-scale="lg"] { font-size: 97% !important; }

/* ---------- DARK THEME: Deep Obsidian Teal Void (#071719) ---------- */
[data-theme="dark"] {
    color-scheme: dark;
    --space-void: #071719;
    --bg-base: #071719;
    --bg-dark: #071719;
    --bg-card: rgba(13, 38, 39, 0.85);
    --bg-card-hover: rgba(18, 51, 52, 0.95);
    --bg-surface: #0a2123;
    --bg-input: #0a2123;
    
    /* Text: STRICTLY WHITE on dark void & card surfaces */
    --text-primary: #ffffff !important;
    --text-secondary: #ffffff !important;
    --text-muted: #f1f5f9 !important;
    
    --border-color: rgba(127, 224, 212, 0.18);
    --border-highlight: rgba(127, 224, 212, 0.4);
    --shadow-color: rgba(0, 0, 0, 0.6);
    --bg-footer: rgba(7, 23, 25, 0.95);
    
    /* Glass Elements */
    --hd-glass: rgba(13, 34, 37, 0.85);
    --hd-glass-2: rgba(10, 28, 31, 0.95);
    --hd-border: rgba(127, 224, 212, 0.18);
    --hd-teal: #7fe0d4;
    --hd-text: #ffffff !important;
    --hd-dim: #ffffff !important;
    --hd-active-text: #000000 !important;
    --hd-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    
    --primary-glow: rgba(21, 157, 144, 0.4);
}

/* ---------- LIGHT THEME: Clean Modern Neutral Slate (#f8fafc) ---------- */
[data-theme="light"] {
    color-scheme: light;
    --space-void: #f8fafc;
    --bg-base: #f8fafc;
    --bg-dark: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-input: #ffffff;
    
    /* Text: STRICTLY BLACK on light surfaces */
    --text-primary: #0f172a !important;
    --text-secondary: #334155 !important;
    --text-muted: #64748b !important;
    
    --border-color: rgba(0, 0, 0, 0.08);
    --border-highlight: rgba(15, 143, 131, 0.45);
    --shadow-color: rgba(0, 0, 0, 0.05);
    --bg-footer: rgba(255, 255, 255, 0.95);
    
    /* Glass Elements */
    --hd-glass: rgba(255, 255, 255, 0.92);
    --hd-glass-2: rgba(255, 255, 255, 0.98);
    --hd-border: rgba(0, 0, 0, 0.08);
    --hd-teal: #0f8f83;
    --hd-text: #0f172a !important;
    --hd-dim: #475569 !important;
    --hd-active-text: #ffffff !important;
    --hd-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
    
    --primary: #0f8f83;
    --teal-bright: #0c7a70;
    --primary-glow: rgba(15, 143, 131, 0.2);
}

[data-theme="light"] .sync-pulse-pill {
    background: rgba(15, 143, 131, 0.08);
    border-color: rgba(15, 143, 131, 0.25);
    color: #0c7a70;
}

[data-theme="light"] .sync-pulse-pill .pulse-dot {
    background-color: #0c7a70;
    box-shadow: 0 0 6px #0c7a70;
}

[data-theme="light"] .btn-theme-toggle {
    background: #f1f5f9;
    color: #0c7a70;
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .header-username i {
    color: #0c7a70;
}

[data-theme="light"] .btn-secondary:hover {
    border-color: #0c7a70 !important;
    color: #0c7a70 !important;
}

[data-theme="light"] .app-sidebar .nav-link:hover {
    color: #0c7a70;
    background: rgba(15, 143, 131, 0.08);
}


/* ------------------------------------------------------------
   4. GLOBAL RESET & BASE STYLES
   ------------------------------------------------------------ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    height: 100%;
    direction: rtl;
    font-size: 90%;
}

body {
    font-family: var(--font-sans) !important;
    background-color: var(--space-void) !important;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

input, button, select, textarea, optgroup, option, label, p, a, span, table, th, td {
    font-family: var(--font-sans);
}

h1, h2, h3, h4, h5, h6,
.brand-info h2,
.metric-value,
.card-title,
.page-header h1,
.login-card h1,
.stat-title {
    font-family: var(--font-display) !important;
}

/* Ensure FontAwesome never gets overwritten by typography font rules */
.fa, .fas, .far, .fal, .fad, .fat, .fa-solid, .fa-regular, .fa-brands, [class*="fa-"] {
    font-family: "Font Awesome 6 Free" !important;
}

/* ------------------------------------------------------------
   5. DRIFTING TEAL NEBULA BACKGROUND (hzagzoug.com style)
   ------------------------------------------------------------ */
.bg-fixed {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -3 !important;
    background-color: var(--space-void) !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: cover !important;
    pointer-events: none;
}

[data-theme="dark"] .bg-fixed {
    background-image:
        radial-gradient(1200px 700px at 72% 18%, rgba(24, 66, 68, 0.42), transparent 60%),
        radial-gradient(1000px 640px at 18% 82%, rgba(18, 52, 56, 0.45), transparent 60%),
        radial-gradient(760px 520px at 45% 55%, rgba(20, 58, 60, 0.28), transparent 62%) !important;
}

[data-theme="light"] .bg-fixed {
    background-image:
        radial-gradient(1200px 700px at 72% 18%, rgba(21, 157, 144, 0.05), transparent 60%),
        radial-gradient(1000px 640px at 18% 82%, rgba(12, 122, 112, 0.04), transparent 60%) !important;
}

#site-stars {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
    display: block;
}

/* ------------------------------------------------------------
   6. ALL INPUTS & FIELDS CENTER-ALIGNED (STRICT REQUIREMENT)
   ------------------------------------------------------------ */
input,
select,
textarea,
.form-control,
.form-control-modern,
.login-input,
.search-input,
input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="email"],
input[type="search"] {
    text-align: center !important;
    font-family: var(--font-sans) !important;
}

input::placeholder,
textarea::placeholder {
    text-align: center !important;
    color: var(--text-muted) !important;
}

/* ------------------------------------------------------------
   7. FORMS & INPUT CONTROLS
   ------------------------------------------------------------ */
.form-group {
    margin-bottom: 1.25rem;
    position: relative;
}

.form-label,
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.92rem;
    text-align: center;
    transition: color var(--transition-speed);
}

.form-control,
.form-control-modern,
.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--bg-input) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
    color: var(--text-primary) !important;
    font-size: 1rem;
    transition: all var(--transition-speed) ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.12);
}

.form-control-modern:focus,
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none !important;
    border-color: var(--teal-bright) !important;
    background-color: var(--bg-input) !important;
    box-shadow: 0 0 0 3px rgba(127, 224, 212, 0.25), 0 0 20px rgba(21, 157, 144, 0.3) !important;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ------------------------------------------------------------
   8. BUTTONS (Teal / Jade Green Spectrum)
   ------------------------------------------------------------ */
.btn-modern,
.btn-primary,
.submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 11px 26px;
    background: linear-gradient(135deg, #0c7a70, #159d90) !important;
    color: #ffffff !important;
    border: 1px solid rgba(127, 224, 212, 0.4) !important;
    border-radius: var(--radius-pill) !important;
    font-family: var(--font-sans) !important;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all var(--transition-speed) ease !important;
    box-shadow: 0 8px 24px rgba(12, 122, 112, 0.35) !important;
}

.btn-modern:hover,
.btn-primary:hover,
.submit-btn:hover {
    transform: none !important;
    background: linear-gradient(135deg, #159d90, #0c7a70) !important;
    border-color: var(--teal-bright) !important;
    color: #ffffff !important;
}

.btn-gold,
.btn-claim-action {
    background: linear-gradient(135deg, #159d90, #7fe0d4) !important;
    color: #06322c !important;
    font-weight: 800 !important;
    border: 1px solid #bbf7f0 !important;
    box-shadow: 0 8px 24px rgba(127, 224, 212, 0.3) !important;
}

.btn-gold:hover,
.btn-claim-action:hover {
    background: linear-gradient(135deg, #7fe0d4, #159d90) !important;
    color: #06322c !important;
    box-shadow: 0 12px 30px rgba(127, 224, 212, 0.5) !important;
}

.btn-secondary {
    background: var(--hd-glass) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    box-shadow: var(--hd-shadow) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.btn-secondary:hover {
    border-color: var(--teal-bright) !important;
    color: var(--teal-bright) !important;
    transform: none !important;
}

.btn-cyan {
    background: linear-gradient(135deg, #073b37, #159d90) !important;
    color: #ffffff !important;
    border: 1px solid rgba(127, 224, 212, 0.3) !important;
}

.btn-emerald {
    background: linear-gradient(135deg, #0c7a70, #159d90) !important;
    color: #ffffff !important;
    border: 1px solid rgba(127, 224, 212, 0.3) !important;
}

.btn-sm {
    padding: 6px 14px !important;
    font-size: 0.85rem !important;
    border-radius: var(--radius-pill) !important;
}

/* ------------------------------------------------------------
   9. CARDS & GLASS PANELS
   ------------------------------------------------------------ */
.metric-card,
.card-modern,
.telemetry-card,
.invoice-card,
.stat-card,
.info-card,
.glass-panel,
.login-card {
    background-color: var(--bg-card) !important;
    border-radius: 16px !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 10px 30px var(--shadow-color) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: all var(--transition-speed) ease !important;
    overflow: hidden;
    position: relative;
}

.metric-card:hover,
.card-modern:hover,
.telemetry-card:hover,
.invoice-card:hover,
.stat-card:hover,
.glass-panel:hover {
    transform: none !important;
    border-color: var(--teal-bright) !important;
    box-shadow: 0 10px 30px var(--shadow-color) !important;
}

/* Teal / Jade Top Border Accent */
.metric-card::before,
.card-modern::before,
.login-card::before,
.claim-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 3.5px;
    background: linear-gradient(90deg, #0c7a70, #159d90, #7fe0d4, #0c7a70) !important;
}

.glass-panel {
    padding: 24px !important;
    margin-bottom: 24px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.panel-title i {
    color: var(--teal-bright);
    font-size: 1.25rem;
}

.dual-panels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 24px;
    margin-bottom: 28px;
}

/* ------------------------------------------------------------
   10. SIDEBAR & BRAND IDENTITY
   ------------------------------------------------------------ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 10;
}

.app-sidebar {
    width: 280px;
    background: var(--hd-glass) !important;
    border-left: 1px solid var(--hd-border) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--hd-shadow);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: transform var(--transition-speed) ease;
    z-index: 200;
}

.brand-chip,
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--hd-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    padding: 8px 16px;
    box-shadow: var(--hd-shadow);
    text-decoration: none;
    color: inherit;
    transition: all var(--transition-speed) ease;
}

.brand-chip:hover,
.sidebar-brand:hover {
    border-color: var(--teal-bright);
    transform: none !important;
}

.brand-icon,
.brand-avatar,
.brand-logo-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0c7a70, #159d90) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(21, 157, 144, 0.4);
    border: 1px solid rgba(127, 224, 212, 0.35);
    flex-shrink: 0;
}

.brand-info h2 {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.brand-badge {
    background: linear-gradient(135deg, #159d90, #7fe0d4);
    color: #06322c;
    font-size: 0.65rem;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 4px;
}

.brand-subtitle {
    font-size: 0.72rem;
    color: var(--teal-bright);
    display: block;
}

.btn-sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    margin-right: auto;
}

/* Sidebar Menu */
.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.menu-category {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--teal-bright);
    letter-spacing: 0.5px;
    padding: 12px 14px 4px 14px;
    opacity: 0.95;
}

.app-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 600;
    border-radius: var(--radius-pill);
    transition: all 0.25s ease;
    border: 1px solid transparent;
}

.app-sidebar .nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    color: var(--teal-primary);
    transition: color 0.2s ease;
}

.app-sidebar .nav-link:hover {
    color: #ffffff;
    background: rgba(21, 157, 144, 0.15);
    border-color: rgba(127, 224, 212, 0.3);
    transform: none !important;
}

.app-sidebar .nav-link:hover i {
    color: var(--teal-bright);
}

.app-sidebar .nav-link.active {
    color: #06322c !important;
    background: linear-gradient(135deg, #159d90, #7fe0d4) !important;
    box-shadow: 0 4px 20px rgba(127, 224, 212, 0.4);
    font-weight: 800;
    border: 1px solid #bbf7f0;
}

.app-sidebar .nav-link.active i {
    color: #06322c !important;
}

/* ------------------------------------------------------------
   11. TOP HEADER
   ------------------------------------------------------------ */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 14px 28px;
    background: var(--hd-glass) !important;
    border-bottom: 1px solid var(--border-color) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--hd-shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-title-block h1 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}

.header-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sync-pulse-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(21, 157, 144, 0.12);
    border: 1px solid rgba(127, 224, 212, 0.3);
    border-radius: var(--radius-pill);
    font-size: 0.82rem;
    color: var(--teal-bright);
    text-decoration: none;
    transition: all 0.2s ease;
}

.sync-pulse-pill:hover {
    background: rgba(21, 157, 144, 0.22);
    border-color: var(--teal-bright);
    color: #ffffff;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--teal-bright);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--teal-bright);
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(127, 224, 212, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(127, 224, 212, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(127, 224, 212, 0); }
}

.btn-theme-toggle {
    background: rgba(21, 157, 144, 0.12);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    color: var(--teal-bright);
    font-size: 1.05rem;
}

.btn-theme-toggle:hover {
    border-color: var(--teal-bright);
    background: rgba(127, 224, 212, 0.2);
    transform: none !important;
}

.header-user-block {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-inline-start: 12px;
    border-inline-start: 1px solid var(--border-color);
}

.header-username {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-username i {
    color: var(--teal-bright);
}

.btn-header-logout {
    padding: 6px 14px !important;
    font-size: 0.82rem !important;
}

.btn-mobile-nav {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    background: var(--hd-glass);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
}

.btn-mobile-nav span {
    width: 20px;
    height: 2px;
    background-color: var(--teal-bright);
    border-radius: 2px;
}

/* ------------------------------------------------------------
   12. METRICS & STATS GRIDS
   ------------------------------------------------------------ */
.page-container {
    padding: 28px;
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.metric-card {
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.metric-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.metric-title {
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.metric-icon-box {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(21, 157, 144, 0.15);
    color: var(--teal-bright);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    border: 1px solid rgba(127, 224, 212, 0.25);
}

.metric-value {
    font-size: 2.1rem;
    font-weight: 800;
    color: #ffffff;
    font-family: var(--font-display);
    line-height: 1.2;
    text-align: center;
}

[data-theme="light"] .metric-value {
    color: #0c3833;
}

.metric-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: center;
}

/* ------------------------------------------------------------
   13. TABLES & RESPONSIVE CARDS
   ------------------------------------------------------------ */
.table-responsive,
.modern-table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    box-shadow: 0 10px 30px var(--shadow-color);
}

.table-modern,
.modern-table {
    width: 100%;
    border-collapse: collapse;
    text-align: center;
}

.table-modern th,
.modern-table th {
    background: rgba(7, 23, 25, 0.75);
    color: #ffffff !important;
    padding: 14px 18px;
    font-size: 0.88rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

[data-theme="light"] .table-modern th,
[data-theme="light"] .modern-table th {
    background: #f1f5f9;
    color: #000000 !important;
}

.table-modern td,
.modern-table td {
    padding: 14px 18px;
    font-size: 0.92rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    transition: background var(--transition-speed);
}

.table-modern tbody tr:hover td,
.modern-table tbody tr:hover td {
    background: rgba(21, 157, 144, 0.08);
}

/* Status Badges */
.badge-modern,
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
}

.status-badge.water {
    background: rgba(21, 157, 144, 0.2);
    color: #ffffff !important;
    border: 1px solid rgba(127, 224, 212, 0.35);
}

.status-badge.power {
    background: rgba(12, 122, 112, 0.25);
    color: #ffffff !important;
    border: 1px solid rgba(127, 224, 212, 0.3);
}

.status-badge.success,
.badge-success {
    background: rgba(21, 157, 144, 0.2);
    color: #ffffff !important;
    border: 1px solid rgba(127, 224, 212, 0.35);
}

.status-badge.warning,
.badge-warning {
    background: rgba(12, 122, 112, 0.25);
    color: #ffffff !important;
    border: 1px solid rgba(127, 224, 212, 0.3);
}

.status-badge.error,
.badge-error {
    background: rgba(7, 59, 55, 0.5);
    color: #ffffff !important;
    border: 1px solid rgba(127, 224, 212, 0.35);
}

[data-theme="light"] .status-badge.water,
[data-theme="light"] .status-badge.power,
[data-theme="light"] .status-badge.success,
[data-theme="light"] .status-badge.warning,
[data-theme="light"] .status-badge.error {
    color: #000000 !important;
}

/* ------------------------------------------------------------
   14. CLAIMS CARDS (Grid View)
   ------------------------------------------------------------ */
.claims-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}

.claim-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 24px var(--shadow-color);
    transition: all var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.claim-card:hover {
    transform: none !important;
    border-color: var(--teal-bright);
}

.claim-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 8px;
}

.claim-card-id {
    display: flex;
    align-items: center;
    gap: 10px;
}

.claim-icon {
    font-size: 1.3rem;
    color: var(--teal-bright);
}

.claim-no {
    display: block;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary) !important;
    font-family: var(--font-display);
}

.claim-date {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.claim-period-badge {
    font-size: 0.75rem;
    background: rgba(21, 157, 144, 0.15);
    border: 1px solid rgba(127, 224, 212, 0.25);
    border-radius: var(--radius-pill);
    padding: 4px 10px;
    color: var(--text-primary) !important;
    white-space: nowrap;
}

.claim-card-company {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(21, 157, 144, 0.05);
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid rgba(127, 224, 212, 0.12);
}

.company-icon {
    font-size: 1.25rem;
    color: var(--teal-bright);
    flex-shrink: 0;
}

.company-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 2px 0;
}

.company-code {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.claim-card-finance {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
    padding: 10px 0;
    border-top: 1px dashed var(--border-color);
    border-bottom: 1px dashed var(--border-color);
}

.finance-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.finance-label {
    color: var(--text-secondary);
}

.finance-val {
    font-weight: 700;
    color: var(--text-primary) !important;
    font-family: var(--font-display);
}

.finance-val.vat {
    color: var(--text-primary) !important;
}

.finance-item.highlight {
    padding-top: 6px;
    border-top: 1px solid var(--border-color);
}

.finance-val.net {
    font-size: 1.15rem;
    color: var(--text-primary) !important;
    font-weight: 900;
}

.claim-card-footer {
    display: flex;
    justify-content: stretch;
}

.btn-view-toggle {
    padding: 6px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-pill);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-sans);
}

.btn-view-toggle:hover {
    color: var(--text-primary);
}

.btn-view-toggle.active {
    background: linear-gradient(135deg, #0c7a70, #159d90) !important;
    color: #ffffff !important;
    font-weight: 800;
    box-shadow: 0 2px 10px rgba(21, 157, 144, 0.35);
}

.upload-dropzone {
    border: 2px dashed rgba(127, 224, 212, 0.4);
    border-radius: 16px;
    padding: 36px 20px;
    text-align: center;
    background: rgba(21, 157, 144, 0.04);
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--teal-bright);
    background: rgba(21, 157, 144, 0.09);
    box-shadow: 0 0 25px rgba(127, 224, 212, 0.2);
    transform: none !important;
}

.upload-dropzone i {
    font-size: 2.8rem;
    color: var(--teal-bright);
    margin-bottom: 12px;
}

/* ------------------------------------------------------------
   15. TOAST NOTIFICATIONS (hzagzoug.com style)
   ------------------------------------------------------------ */
.toast-container {
    position: fixed;
    top: 14px;
    left: 0;
    right: 0;
    margin: 0 auto;
    max-width: 680px;
    padding: 0 16px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    width: auto;
    min-width: 280px;
    max-width: min(520px, 92vw);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--hd-glass-2);
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--toast-accent, #159d90);
    border-radius: var(--radius-pill);
    padding: 10px 22px;
    color: var(--text-primary);
    box-shadow: 0 12px 35px var(--shadow-color), 0 0 16px rgba(21, 157, 144, 0.2);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    font-size: .92rem;
    font-weight: 600;
    line-height: 1.45;
    animation: toastSlideDown .36s cubic-bezier(.16, 1, .3, 1) forwards;
}

.toast.hide {
    animation: toastSlideUp .28s cubic-bezier(.4, 0, .2, 1) forwards;
}

.toast-icon {
    font-size: 1.15rem;
    color: var(--toast-accent, #159d90);
    flex: 0 0 auto;
}

.toast-msg {
    flex: 1;
    word-break: break-word;
    text-align: center;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 4px;
    flex: 0 0 auto;
    transition: color .2s ease;
}

.toast-close:hover {
    color: var(--text-primary);
}

.toast.toast-success { --toast-accent: #159d90; }
.toast.toast-warning { --toast-accent: #7fe0d4; }
.toast.toast-info    { --toast-accent: #159d90; }
.toast.toast-error   { --toast-accent: #ef4444; }

@keyframes toastSlideDown {
    from {
        opacity: 0;
        transform: translateY(-45px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastSlideUp {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-45px) scale(0.95);
    }
}

/* ------------------------------------------------------------
   16. SETTINGS MODAL & PREFERENCES
   ------------------------------------------------------------ */
.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

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

.settings-card {
    width: 100%;
    max-width: 480px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    position: relative;
    animation: settingsIn 0.28s ease;
}

.settings-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, #0c7a70, #159d90, #7fe0d4, #0c7a70);
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.settings-header h3 {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-header h3 i {
    color: var(--teal-bright);
}

.settings-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.settings-close-btn:hover {
    color: var(--teal-bright);
}

.settings-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-section-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--teal-bright);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-pills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
}

.setting-pill-btn {
    padding: 8px 12px;
    background: rgba(21, 157, 144, 0.08);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    font-family: inherit;
}

.setting-pill-btn:hover {
    border-color: var(--teal-bright);
    background: rgba(21, 157, 144, 0.16);
}

.setting-pill-btn.active {
    background: linear-gradient(135deg, #0c7a70, #159d90) !important;
    color: #ffffff !important;
    border-color: var(--teal-bright) !important;
    box-shadow: 0 4px 14px rgba(21, 157, 144, 0.35);
}

@keyframes settingsIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* ------------------------------------------------------------
   17. MOBILE & RESPONSIVE BEHAVIOR
   ------------------------------------------------------------ */
@media (max-width: 1024px) {
    .app-sidebar {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        transform: translateX(100%);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.7);
    }
    
    .app-sidebar.open {
        transform: translateX(0);
    }
    
    .btn-sidebar-close {
        display: block;
    }
    
    .btn-mobile-nav {
        display: flex;
    }
    
    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.65);
        backdrop-filter: blur(6px);
        z-index: 150;
    }
    
    .sidebar-backdrop.open {
        display: block;
    }
    
    .page-container {
        padding: 16px;
    }
    
    .header-username {
        display: none;
    }
}

@media (max-width: 600px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .top-header {
        padding: 12px 16px;
    }
    
    .page-title {
        font-size: 1.3rem;
    }
}