/* ==========================================================================
   PESO RESORT MANAGEMENT SYSTEM
   Reference-Based Design System: Soft Sky-Blue + Warm Cream + Forest Green
   Municipality of Peñaranda, Nueva Ecija • P.E.S.O. & Municipal Tourism Office
   ========================================================================== */

:root {
    /* 1. Primary Reference Design Tokens (Section 3) */
    --color-bg:            #D7ECF8;
    --color-bg-soft:       #E4F2FA;
    --color-sidebar:       #F4EEDF;
    --color-surface:       #F5EFDF;
    --color-surface-alt:   #FFF9EC;
    --color-surface-hover: #EBE4D2;

    --color-primary:       #1F6F58;
    --color-primary-hover: #185943;
    --color-primary-soft:  #DCEDE5;

    --color-text:          #17211E;
    --color-text-secondary:#2F3E39;
    --color-text-muted:    #596860;
    --color-text-light:    #7D8C84;

    --color-border:        #DEDCCD;
    --color-border-strong: #C9C6B5;

    --color-chart-blue:    #409DAB;
    --color-chart-green:   #1F6F58;
    --color-chart-plot:    #D7ECF8;
    --color-chart-grid:    #C2DCEB;

    --color-success:       #237B53;
    --color-warning:       #B7791F;
    --color-danger:        #B83C3C;
    --color-info:          #2675A6;

    --radius-card:         16px;
    --radius-control:      9px;

    --shadow-card:         0 3px 8px rgba(28, 54, 46, 0.10);
    --sidebar-width:       252px;
    --sidebar-collapsed-width: 76px;
    --topbar-height:       76px;

    /* 2. System-Wide Token Aliases (Maps all legacy/gov tokens to Reference Palette) */
    --gov-bg:              var(--color-bg);
    --gov-surface:         var(--color-surface);
    --gov-surface-alt:     var(--color-surface-alt);
    --gov-surface-hover:   var(--color-surface-hover);
    --gov-border:          var(--color-border);
    --gov-border-strong:   var(--color-border-strong);

    --gov-text-primary:    var(--color-text);
    --gov-text-secondary:  var(--color-text-secondary);
    --gov-text-muted:      var(--color-text-muted);
    --gov-text-light:      var(--color-text-light);

    --gov-navy-950:        #17211E;
    --gov-navy-900:        #17211E;
    --gov-navy-800:        #253530;
    --gov-navy-700:        #1F6F58;
    --gov-navy-600:        #185943;
    --gov-navy-500:        #237B53;
    --gov-navy-100:        #C8E4D8;
    --gov-navy-50:         #DCEDE5;

    --gov-teal-900:        #134637;
    --gov-teal-700:        #185943;
    --gov-teal-600:        #1F6F58;
    --gov-teal-500:        #409DAB;
    --gov-teal-100:        #D2E9EC;
    --gov-teal-50:         #DCEDE5;

    --gov-crimson-700:     #962D2D;
    --gov-crimson-600:     #B83C3C;
    --gov-crimson-500:     #C94A4A;
    --gov-crimson-100:     #F5D8D5;
    --gov-crimson-50:      #FBECE9;

    --gov-gold-600:        #9C6516;
    --gov-gold-500:        #B7791F;
    --gov-gold-400:        #D1922E;
    --gov-gold-100:        #F4E3C1;
    --gov-gold-50:         #FAF1DC;

    /* Sidebar Surface Tokens (Warm Cream Reference Sidebar) */
    --sidebar-bg:          var(--color-sidebar);
    --sidebar-surface:     var(--color-surface-alt);
    --sidebar-border:      var(--color-border);
    --sidebar-text:        var(--color-text);
    --sidebar-text-muted:  var(--color-text-muted);
    --sidebar-active-bg:   var(--color-primary);
    --sidebar-active-text: #FFFFFF;
    --sidebar-hover-bg:    #E8E2D1;

    /* 3. Semantic Status Colors */
    --gov-success:         #237B53;
    --gov-success-bg:      #DCEDE5;
    --gov-success-border:  #B5D8C8;

    --gov-warning:         #B7791F;
    --gov-warning-bg:      #FAF0DA;
    --gov-warning-border:  #E9D09B;

    --gov-danger:          #B83C3C;
    --gov-danger-bg:       #FBECE9;
    --gov-danger-border:   #EBBAB3;

    --gov-info:            #2675A6;
    --gov-info-bg:         #DFEFF8;
    --gov-info-border:     #B7D8EC;

    /* 4. Legacy Alias Compatibility */
    --color-primary-navy:  #17211E;
    --color-primary-blue:  #1F6F58;
    --color-tourism-teal:  #409DAB;
    --color-neutral-900:   #17211E;
    --color-neutral-800:   #2F3E39;
    --color-neutral-700:   #45544E;
    --color-neutral-600:   #596860;
    --sp-xs: 0.25rem;
    --sp-sm: 0.5rem;
    --sp-md: 1rem;
    --sp-lg: 1.5rem;
    --font-xs: 0.75rem;
    --font-sm: 0.875rem;

    /* 5. Typography Scale */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

    --text-xs:   0.78125rem; /* 12.5px */
    --text-sm:   0.875rem;   /* 14px   */
    --text-base: 0.9375rem;  /* 15px   */
    --text-md:   1.02rem;    /* 16.3px */
    --text-lg:   1.1875rem;  /* 19px   */
    --text-xl:   1.375rem;   /* 22px   */
    --text-2xl:  1.75rem;    /* 28px   */
    --text-3xl:  2.05rem;    /* 32.8px */

    /* 6. Spacing Scale */
    --space-1: 0.25rem;  /* 4px */
    --space-2: 0.5rem;   /* 8px */
    --space-3: 0.75rem;  /* 12px */
    --space-4: 1rem;     /* 16px */
    --space-5: 1.25rem;  /* 20px */
    --space-6: 1.5rem;   /* 24px */
    --space-8: 2rem;     /* 32px */
    --space-10: 2.5rem;  /* 40px */

    /* 7. Radii & Shadows (Matched to Reference Screenshot) */
    --radius-xs: 6px;
    --radius-sm: var(--radius-control); /* 9px */
    --radius-md: var(--radius-card);    /* 16px */
    --radius-lg: 18px;

    --shadow-xs: 0 2px 5px rgba(28, 54, 46, 0.07);
    --shadow-sm: var(--shadow-card);
    --shadow-md: 0 6px 16px rgba(28, 54, 46, 0.12);
    --shadow-lg: 0 14px 28px rgba(28, 54, 46, 0.16);

    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 220ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Chart Tokens */
    --chart-primary:    #1F6F58;
    --chart-secondary:  #409DAB;
    --chart-tertiary:   #2D8670;
    --chart-quaternary: #84BAC4;
    --chart-grid:       #C2DCEB;
}

/* ==========================================================================
   DARK THEME OVERRIDES (Section 10 — Theme System)
   ========================================================================== */
[data-theme="dark"] {
    --color-bg:            #0F1917;
    --color-bg-soft:       #14221F;
    --color-sidebar:       #152320;
    --color-surface:       #192A26;
    --color-surface-alt:   #203530;
    --color-surface-hover: #28413B;

    --color-primary:       #28896D;
    --color-primary-hover: #1F6F58;
    --color-primary-soft:  rgba(40, 137, 109, 0.22);

    --color-text:          #EFF5F2;
    --color-text-secondary:#C9D8D1;
    --color-text-muted:    #92A89E;
    --color-text-light:    #677D74;

    --color-border:        #2B433D;
    --color-border-strong: #39574F;

    --color-chart-blue:    #56B4C2;
    --color-chart-green:   #34A885;
    --color-chart-plot:    #13211E;
    --color-chart-grid:    #263D37;

    --gov-bg:              var(--color-bg);
    --gov-surface:         var(--color-surface);
    --gov-surface-alt:     var(--color-surface-alt);
    --gov-surface-hover:   var(--color-surface-hover);
    --gov-border:          var(--color-border);
    --gov-border-strong:   var(--color-border-strong);

    --gov-text-primary:    var(--color-text);
    --gov-text-secondary:  var(--color-text-secondary);
    --gov-text-muted:      var(--color-text-muted);
    --gov-text-light:      var(--color-text-light);

    --gov-navy-950:        #EFF5F2;
    --gov-navy-900:        #E2ECE7;
    --gov-navy-800:        #C9D8D1;
    --gov-navy-700:        #34A885;
    --gov-navy-600:        #28896D;
    --gov-navy-500:        #34A885;
    --gov-navy-100:        rgba(52, 168, 133, 0.22);
    --gov-navy-50:         rgba(52, 168, 133, 0.14);

    --gov-teal-900:        #D2F4EA;
    --gov-teal-700:        #34A885;
    --gov-teal-600:        #28896D;
    --gov-teal-500:        #56B4C2;
    --gov-teal-100:        rgba(86, 180, 194, 0.22);
    --gov-teal-50:         rgba(40, 137, 109, 0.16);

    --gov-crimson-700:     #FCA5A5;
    --gov-crimson-600:     #F87171;
    --gov-crimson-500:     #EF4444;
    --gov-crimson-100:     rgba(239, 68, 68, 0.22);
    --gov-crimson-50:      rgba(239, 68, 68, 0.12);

    --gov-gold-600:        #FBBF24;
    --gov-gold-500:        #F59E0B;
    --gov-gold-400:        #FBBF24;
    --gov-gold-100:        rgba(245, 158, 11, 0.22);
    --gov-gold-50:         rgba(245, 158, 11, 0.12);

    --sidebar-bg:          var(--color-sidebar);
    --sidebar-surface:     var(--color-surface-alt);
    --sidebar-border:      var(--color-border);
    --sidebar-text:        var(--color-text);
    --sidebar-text-muted:  var(--color-text-muted);
    --sidebar-active-bg:   #1F6F58;
    --sidebar-active-text: #FFFFFF;
    --sidebar-hover-bg:    #203530;

    --gov-success:         #4ADE80;
    --gov-success-bg:      rgba(35, 123, 83, 0.25);
    --gov-success-border:  rgba(74, 222, 128, 0.35);

    --gov-warning:         #FBBF24;
    --gov-warning-bg:      rgba(183, 121, 31, 0.22);
    --gov-warning-border:  rgba(251, 191, 36, 0.35);

    --gov-danger:          #F87171;
    --gov-danger-bg:       rgba(184, 60, 60, 0.22);
    --gov-danger-border:   rgba(248, 113, 113, 0.35);

    --gov-info:            #60A5FA;
    --gov-info-bg:         rgba(38, 117, 166, 0.22);
    --gov-info-border:     rgba(96, 165, 250, 0.35);

    --color-primary-navy:  #EFF5F2;
    --color-neutral-900:   #EFF5F2;
    --color-neutral-800:   #C9D8D1;
    --color-neutral-700:   #92A89E;
    --color-neutral-600:   #677D74;

    --shadow-xs: 0 2px 6px rgba(0, 0, 0, 0.30);
    --shadow-sm: 0 4px 10px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.55);

    --chart-primary:   #34A885;
    --chart-secondary: #56B4C2;
    --chart-tertiary:  #28896D;
    --chart-quaternary:#84BAC4;
    --chart-grid:      #263D37;
    color-scheme: dark;
}

/* ==========================================================================
   BASE RESET & ACCESSIBILITY
   ========================================================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.55;
    color: var(--color-text);
    background-color: var(--color-bg);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-hover);
}

img, svg {
    max-width: 100%;
    height: auto;
}

/* Visible Keyboard Focus Ring (WCAG 2.2 AA) */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: var(--space-4);
    background: var(--color-primary);
    color: #ffffff;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-control);
    z-index: 9999;
    font-weight: 600;
    box-shadow: var(--shadow-md);
}

.skip-link:focus {
    top: var(--space-3);
    color: #ffffff;
}

.tabular-nums {
    font-variant-numeric: tabular-nums;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   GLOBAL APPLICATION SHELL (Section 4 — Warm Cream Sidebar + Sky-Blue Workspace)
   ========================================================================== */
.app-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
    position: relative;
}

/* --- Left Sidebar (Matches Reference Screenshot #F4EEDF) --- */
.app-sidebar {
    width: var(--sidebar-width);
    background: var(--color-sidebar);
    color: var(--color-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    border-right: 1px solid var(--color-border);
    transition: width var(--transition-base), transform var(--transition-base);
    user-select: none;
}

/* Collapsed Desktop Sidebar State */
body.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .app-main {
    margin-left: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar-brand-text,
body.sidebar-collapsed .sidebar-nav-section,
body.sidebar-collapsed .sidebar-link span,
body.sidebar-collapsed .sidebar-link .nav-badge,
body.sidebar-collapsed .sidebar-user-info,
body.sidebar-collapsed .sidebar-logout-btn span {
    display: none;
}

body.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    padding: var(--space-4) var(--space-2);
}

body.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding: 0.75rem;
}

body.sidebar-collapsed .sidebar-link i {
    font-size: 1.2rem;
    margin: 0;
}

body.sidebar-collapsed .sidebar-user {
    justify-content: center;
    padding: var(--space-2);
}

body.sidebar-collapsed .sidebar-logout-btn {
    padding: var(--space-2);
}

/* Sidebar Brand Header */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 1.35rem var(--space-5) 1rem;
    min-height: var(--topbar-height);
}

.sidebar-brand-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-control);
    background: var(--color-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(31, 111, 88, 0.25);
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-brand-title {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--color-text);
    line-height: 1.2;
    white-space: nowrap;
}

.sidebar-brand-subtitle {
    font-size: 0.6875rem;
    color: var(--color-primary);
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3) 1.15rem;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-strong) transparent;
}

.sidebar-nav-section {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    padding: var(--space-3) var(--space-3) var(--space-1);
}

.sidebar-nav-section:first-child {
    padding-top: 0;
}

.sidebar-nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.72rem 1rem;
    border-radius: var(--radius-control);
    color: var(--color-text);
    font-size: 0.9375rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
}

.sidebar-link i {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
    color: var(--color-text);
    transition: color var(--transition-fast);
    flex-shrink: 0;
}

.sidebar-link:hover {
    background-color: var(--sidebar-hover-bg);
    color: var(--color-text);
}

.sidebar-link:hover i {
    color: var(--color-primary);
}

/* Active Sidebar Item (Exact Forest-Green Pill #1F6F58 from Reference Screenshot) */
.sidebar-link.active {
    background-color: var(--color-primary);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 3px 8px rgba(31, 111, 88, 0.28);
}

.sidebar-link.active i {
    color: #ffffff;
}

.nav-badge {
    margin-left: auto;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

.sidebar-link.active .nav-badge {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: var(--space-3) 1.15rem var(--space-4);
    border-top: 1px solid var(--color-border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0.55rem 0.65rem;
    margin-bottom: var(--space-2);
    border-radius: var(--radius-control);
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--text-sm);
    flex-shrink: 0;
}

.sidebar-user-info {
    overflow: hidden;
    flex: 1;
}

.sidebar-user-name {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.6875rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-logout-form {
    width: 100%;
}

.sidebar-logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0.55rem var(--space-3);
    border-radius: var(--radius-control);
    border: 1px solid var(--gov-danger-border);
    background: var(--color-surface-alt);
    color: var(--color-danger);
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sidebar-logout-btn:hover {
    background: var(--color-danger);
    border-color: var(--color-danger);
    color: #ffffff;
}

/* --- Main Content Column (Sky-Blue Workspace #D7ECF8) --- */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    background: var(--color-bg);
    transition: margin-left var(--transition-base);
}

/* --- Top Header (Matches Reference Screenshot: Title on Left, Search + Bell + Profile on Right) --- */
.app-topbar {
    min-height: var(--topbar-height);
    background: var(--color-bg);
    padding: 1.15rem var(--space-6) 0.65rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.topbar-heading-group {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar-page-title {
    font-size: clamp(1.45rem, 2.2vw, 1.85rem);
    font-weight: 800;
    color: var(--color-text);
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin: 0;
}

.topbar-page-subtitle {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-menu-toggle,
.desktop-sidebar-toggle {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-control);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: var(--shadow-xs);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.mobile-menu-toggle {
    display: none;
}

.mobile-menu-toggle:hover,
.desktop-sidebar-toggle:hover {
    background: var(--color-surface-alt);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-shrink: 0;
}

/* Topbar Search Input (Matches Reference Screenshot Search Box) */
.topbar-search-wrapper {
    position: relative;
    width: 240px;
}

.topbar-search-wrapper i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

.topbar-search-wrapper input.topbar-search-input {
    width: 100%;
    padding: 0.55rem 0.85rem 0.55rem 2.25rem;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid #B7D4E6;
    border-radius: var(--radius-control);
    transition: all var(--transition-fast);
}

[data-theme="dark"] .topbar-search-wrapper input.topbar-search-input {
    background: var(--color-surface);
    border-color: var(--color-border);
}

.topbar-search-wrapper input.topbar-search-input:focus {
    outline: none;
    background: var(--color-surface-alt);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(31, 111, 88, 0.16);
}

/* Topbar Icon Controls (Notification / Portal / Theme Toggle) */
.topbar-icon-btn,
.theme-toggle-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-control);
    border: 1px solid transparent;
    background: transparent;
    color: var(--color-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.15rem;
    position: relative;
    transition: all var(--transition-fast);
}

.topbar-icon-btn:hover,
.theme-toggle-btn:hover {
    background: var(--color-surface);
    border-color: var(--color-border);
    color: var(--color-primary);
    box-shadow: var(--shadow-xs);
}

.topbar-status-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #D94F3D;
    border: 1.5px solid var(--color-bg);
}

/* Topbar User Profile Control & Dropdown (Matches Reference Screenshot "John Warid / @rofilerousser") */
.topbar-profile-dropdown {
    position: relative;
}

.topbar-profile-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.3rem 0.55rem 0.3rem 0.35rem;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--color-text);
    font-family: var(--font-sans);
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-fast);
}

.topbar-profile-trigger:hover,
.topbar-profile-trigger[aria-expanded="true"] {
    background: var(--color-surface);
    border-color: var(--color-border);
    box-shadow: var(--shadow-xs);
}

.topbar-profile-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.95rem;
    border: 2px solid var(--color-surface);
    box-shadow: 0 2px 5px rgba(28, 54, 46, 0.14);
    flex-shrink: 0;
}

.topbar-profile-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.topbar-profile-name {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--color-text);
}

.topbar-profile-handle {
    font-size: 0.72rem;
    color: var(--color-text-muted);
}

.topbar-profile-chevron {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-left: 2px;
}

.topbar-profile-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 235px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-md);
    padding: var(--space-2);
    display: none;
    z-index: 1100;
}

.topbar-profile-menu.is-open {
    display: block;
}

.profile-menu-header {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 4px;
}

.profile-menu-header strong {
    display: block;
    font-size: var(--text-xs);
    color: var(--color-text);
}

.profile-menu-header span {
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-control);
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text);
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background var(--transition-fast);
}

.profile-menu-item i {
    color: var(--color-primary);
    font-size: 0.95rem;
}

.profile-menu-item:hover {
    background: var(--color-surface-alt);
    color: var(--color-primary);
}

.profile-menu-item.danger {
    color: var(--color-danger);
}

.profile-menu-item.danger i {
    color: var(--color-danger);
}

.profile-menu-item.danger:hover {
    background: var(--gov-danger-bg);
}

/* --- Contextual Page Action Bar (When $masthead_actions is present) --- */
.page-actions-bar {
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding: 0.25rem var(--space-6) 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.masthead-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* Legacy .page-masthead fallback if referenced directly */
.page-masthead {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-4);
    box-shadow: var(--shadow-card);
}

.masthead-title {
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--color-text);
}

.masthead-subtitle {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.app-content {
    flex: 1;
    padding: var(--space-4) var(--space-6) var(--space-6);
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

.app-footer {
    padding: var(--space-4) var(--space-6);
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: auto;
}

/* ==========================================================================
   EXECUTIVE & OPERATIONAL KPI CARDS (Matches Reference Screenshot KPI Cards)
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    padding: 1.35rem 1.45rem;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    margin-bottom: 0.45rem;
}

.stat-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: -0.01em;
}

/* Reference Screenshot Top-Right Forest-Green Pill Badge */
.kpi-badge-pill,
.stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.24rem 0.7rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--color-primary);
    color: #ffffff;
    white-space: nowrap;
}

.stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: var(--color-primary);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.stat-card.primary .stat-icon,
.stat-card.success .stat-icon,
.stat-card.info .stat-icon {
    background: var(--color-primary);
    color: #ffffff;
}

.stat-card.warning .stat-icon {
    background: var(--color-warning);
    color: #ffffff;
}

.stat-number {
    font-size: clamp(1.75rem, 2.5vw, 2.2rem);
    font-weight: 800;
    color: var(--color-text);
    line-height: 1.12;
    letter-spacing: -0.025em;
    font-variant-numeric: tabular-nums;
    margin: 2px 0;
}

.stat-card.highlight-green .stat-number {
    color: var(--color-primary);
}

.stat-meta {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: 0.35rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
}

/* ==========================================================================
   CARDS, CONTAINERS & SECTION HEADERS (Warm Cream #F5EFDF + 16px Radius)
   ========================================================================== */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    margin-bottom: var(--space-5);
    overflow: hidden;
}

.card-header {
    padding: 1.15rem 1.4rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
    background: var(--color-surface);
}

.card-header-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.card-title {
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin: 0;
}

.card-title i {
    color: var(--color-primary);
}

.card-subtitle {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin: 0;
}

.card-body {
    padding: 1.35rem 1.4rem;
}

.card-footer {
    padding: 0.9rem 1.4rem;
    background: var(--color-surface-alt);
    border-top: 1px solid var(--color-border);
}

/* ==========================================================================
   DATA VISUALIZATION & CHARTS (Matches Reference Screenshot Chart Styling)
   ========================================================================== */
.analytics-charts-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.chart-card-col-8 {
    grid-column: span 8;
}

.chart-card-col-6 {
    grid-column: span 6;
}

.chart-card-col-4 {
    grid-column: span 4;
}

@media (max-width: 1100px) {
    .chart-card-col-8,
    .chart-card-col-6,
    .chart-card-col-4 {
        grid-column: span 12;
    }
}

.chart-legend {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-secondary);
}

.chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.chart-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* Donut Chart Layout */
.donut-chart-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-6);
    flex-wrap: wrap;
    padding: var(--space-2) 0;
}

.donut-svg-wrap {
    position: relative;
    width: 164px;
    height: 164px;
    flex-shrink: 0;
}

.donut-center-label {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    pointer-events: none;
}

.donut-center-value {
    font-size: var(--text-lg);
    font-weight: 800;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.donut-center-caption {
    font-size: 0.6875rem;
    color: var(--color-text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.donut-legend-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    flex: 1;
    min-width: 180px;
}

.donut-legend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    font-size: var(--text-xs);
    padding: 6px 10px;
    border-radius: var(--radius-xs);
    background: var(--color-surface-alt);
}

/* Horizontal Bar Comparison List */
.bar-comparison-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.bar-comparison-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.bar-comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: var(--text-xs);
    gap: var(--space-2);
}

.bar-comparison-name {
    font-weight: 600;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-comparison-val {
    font-weight: 700;
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.bar-comparison-track {
    width: 100%;
    height: 8px;
    background: var(--color-surface-alt);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--color-border);
}

.bar-comparison-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-chart-blue) 100%);
    border-radius: 999px;
    transition: width var(--transition-base);
}

/* Visitor Analytics Panel (Shared Component) */
.visitor-analytics-panel .visitor-analytics-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: var(--color-surface-alt);
    border-bottom: 1px solid var(--color-border);
}

.visitor-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 150px;
}

.visitor-filter-group label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-text-secondary);
}

.visitor-analytics-status {
    padding: var(--space-5);
    text-align: center;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.visitor-analytics-status.is-error {
    color: var(--color-danger);
    background: var(--gov-danger-bg);
}

.visitor-analytics-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    padding: var(--space-5);
}

.visitor-analytics-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: var(--space-5);
    padding: 0 var(--space-5) var(--space-5);
}

@media (max-width: 992px) {
    .visitor-analytics-grid {
        grid-template-columns: 1fr;
    }
}

.visitor-analytics-block {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    padding: var(--space-4);
}

.visitor-block-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.visitor-block-header h3 {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--color-text);
}

.visitor-block-header span {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

.visitor-month-chart {
    display: grid;
    grid-template-columns: repeat(12, minmax(28px, 1fr));
    gap: 8px;
    height: 190px;
    align-items: end;
    padding-top: var(--space-3);
}

.visitor-month-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    gap: 6px;
}

.visitor-month-value {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--color-text-secondary);
    font-variant-numeric: tabular-nums;
}

.visitor-month-track {
    flex: 1;
    width: 100%;
    max-width: 28px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xs);
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

.visitor-month-bar {
    width: 100%;
    background: linear-gradient(180deg, var(--color-chart-blue) 0%, var(--color-primary) 100%);
    border-radius: var(--radius-xs) var(--radius-xs) 0 0;
    transition: height var(--transition-base);
}

.visitor-month-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.visitor-ranking-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.visitor-ranking-item {
    display: grid;
    grid-template-columns: minmax(110px, 1.2fr) 2fr auto;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-xs);
}

.visitor-ranking-name {
    font-weight: 600;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.visitor-ranking-track {
    height: 8px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    overflow: hidden;
}

.visitor-ranking-bar {
    display: block;
    height: 100%;
    background: var(--color-primary);
    border-radius: 999px;
}

.visitor-ranking-count {
    font-variant-numeric: tabular-nums;
    color: var(--color-text);
}

/* ==========================================================================
   DATA TABLES & LEDGERS (Warm Cream Surfaces & Clean Borders)
   ========================================================================== */
.data-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: var(--text-sm);
}

.data-table thead th {
    background: var(--color-surface);
    color: var(--color-text);
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.85rem var(--space-4);
    border-bottom: 1px solid var(--color-border-strong);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 0.85rem var(--space-4);
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background-color: var(--color-surface-alt);
}

.data-table tfoot td,
.data-table tfoot th {
    padding: 0.85rem var(--space-4);
    background: var(--color-surface-alt);
    border-top: 2px solid var(--color-border-strong);
    font-weight: 700;
}

.col-num,
.col-money {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.col-actions {
    text-align: right;
    white-space: nowrap;
}

/* Table Search & Filter Controls */
.table-search-box {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.table-search-box i {
    position: absolute;
    left: 11px;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.table-search-box input.table-search-input {
    padding: 0.48rem 0.8rem 0.48rem 2.2rem;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-control);
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    color: var(--color-text);
    background: var(--color-surface-alt);
    min-width: 220px;
    transition: all var(--transition-fast);
}

.table-search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(31, 111, 88, 0.14);
}

/* ==========================================================================
   BUTTON SYSTEM (Matches Reference Image 2: #1F6F58 Primary & #FFF9EC Secondary)
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.58rem 1.1rem;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1.3;
    border-radius: var(--radius-control);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Primary Action Buttons (Forest Green #1F6F58) */
.btn-primary,
.btn-navy,
.btn-teal,
.btn-success {
    background-color: var(--color-primary);
    color: #ffffff;
    border-color: var(--color-primary);
    box-shadow: 0 2px 5px rgba(31, 111, 88, 0.22);
}

.btn-primary:hover:not(:disabled),
.btn-navy:hover:not(:disabled),
.btn-teal:hover:not(:disabled),
.btn-success:hover:not(:disabled) {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    color: #ffffff;
}

/* Secondary / Cancel Buttons (Warm Off-White #FFF9EC with #DEDCCD Border) */
.btn-secondary,
.btn-outline {
    background-color: var(--color-surface-alt);
    color: var(--color-text);
    border-color: var(--color-border-strong);
}

.btn-secondary:hover:not(:disabled),
.btn-outline:hover:not(:disabled) {
    background-color: var(--color-surface-hover);
    color: var(--color-text);
    border-color: var(--color-primary);
}

/* Destructive Buttons */
.btn-danger {
    background-color: var(--color-danger);
    color: #ffffff;
    border-color: var(--color-danger);
}

.btn-danger:hover:not(:disabled) {
    background-color: #962D2D;
    border-color: #962D2D;
    color: #ffffff;
}

.btn-outline-danger {
    background-color: var(--color-surface-alt);
    color: var(--color-danger);
    border-color: var(--gov-danger-border);
}

.btn-outline-danger:hover:not(:disabled) {
    background-color: var(--gov-danger-bg);
    color: var(--color-danger);
}

.btn-sm {
    padding: 0.38rem 0.78rem;
    font-size: var(--text-xs);
}

.btn-lg {
    padding: 0.72rem 1.35rem;
    font-size: var(--text-base);
}

/* ==========================================================================
   BADGES & STATUS INDICATORS
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.24rem 0.65rem;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 999px;
    line-height: 1.2;
    white-space: nowrap;
}

.badge-success {
    background: var(--gov-success-bg);
    color: var(--gov-success);
    border: 1px solid var(--gov-success-border);
}

.badge-warning {
    background: var(--gov-warning-bg);
    color: var(--gov-warning);
    border: 1px solid var(--gov-warning-border);
}

.badge-error,
.badge-danger,
.badge-crimson {
    background: var(--gov-danger-bg);
    color: var(--gov-danger);
    border: 1px solid var(--gov-danger-border);
}

.badge-info {
    background: var(--gov-info-bg);
    color: var(--gov-info);
    border: 1px solid var(--gov-info-border);
}

.badge-neutral {
    background: var(--color-surface-alt);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}

/* ==========================================================================
   FORMS & INPUT CONTROLS (Warm Off-White #FFF9EC Inputs + Forest-Green Focus)
   ========================================================================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.form-group {
    margin-bottom: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

label,
.form-label {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--color-text-secondary);
}

label.required::after {
    content: " *";
    color: var(--color-danger);
}

.form-control,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
input[type="tel"],
input[type="search"]:not(.topbar-search-input):not(.table-search-input),
select,
textarea {
    width: 100%;
    padding: 0.58rem 0.85rem;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    color: var(--color-text);
    background-color: var(--color-surface-alt);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-control);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(31, 111, 88, 0.16);
}

.form-hint {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    line-height: 1.4;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
}

/* Currency Input Wrapper */
.input-currency-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.currency-prefix {
    position: absolute;
    left: 12px;
    font-weight: 700;
    color: var(--color-text-muted);
    pointer-events: none;
}

.currency-input {
    padding-left: 2rem !important;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

/* ==========================================================================
   ALERTS & FEEDBACK BANNERS
   ========================================================================== */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    border-radius: var(--radius-control);
    margin-bottom: var(--space-5);
    font-size: var(--text-sm);
    border: 1px solid transparent;
}

.alert i {
    font-size: 1.1rem;
    margin-top: 1px;
    flex-shrink: 0;
}

.alert-success {
    background: var(--gov-success-bg);
    color: var(--gov-success);
    border-color: var(--gov-success-border);
}

.alert-warning {
    background: var(--gov-warning-bg);
    color: var(--gov-warning);
    border-color: var(--gov-warning-border);
}

.alert-error,
.alert-danger {
    background: var(--gov-danger-bg);
    color: var(--gov-danger);
    border-color: var(--gov-danger-border);
}

.alert-info {
    background: var(--gov-info-bg);
    color: var(--gov-info);
    border-color: var(--gov-info-border);
}

/* ==========================================================================
   SPECIALIZED WORKSPACE GRIDS & MODULES
   ========================================================================== */

/* Receipt Generator & Voucher Layout */
.receipt-generator-grid,
.report-submission-grid {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: var(--space-5);
    align-items: start;
}

@media (max-width: 992px) {
    .receipt-generator-grid,
    .report-submission-grid {
        grid-template-columns: 1fr;
    }
}

.voucher-breakdown {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    padding: var(--space-4);
}

.voucher-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: var(--text-sm);
}

.voucher-label {
    color: var(--color-text-secondary);
}

.voucher-value {
    font-weight: 700;
    color: var(--color-text);
}

.voucher-total-block {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 2px dashed var(--color-border-strong);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.voucher-total-label {
    font-size: var(--text-sm);
    font-weight: 800;
    color: var(--color-text);
    text-transform: uppercase;
}

.voucher-total-value {
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--color-primary);
}

.voucher-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

/* Compliance Notice & Protocol Cards */
.compliance-notice-card {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius-control);
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.compliance-icon {
    font-size: 1.2rem;
    color: var(--color-primary);
    flex-shrink: 0;
}

.protocol-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.protocol-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-control);
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
}

.protocol-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-xs);
    background: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    border: 1px solid var(--color-border);
}

.protocol-content strong {
    display: block;
    font-size: var(--text-xs);
    color: var(--color-text);
    margin-bottom: 2px;
}

.protocol-content p {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin: 0;
}

/* File Dropzone */
.file-dropzone {
    position: relative;
    border: 2px dashed var(--color-border-strong);
    border-radius: var(--radius-card);
    background: var(--color-surface-alt);
    padding: var(--space-8) var(--space-4);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: var(--space-4);
}

.file-dropzone:hover,
.file-dropzone.dragover {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
}

.file-dropzone-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-dropzone-icon {
    font-size: 2.25rem;
    color: var(--color-primary);
    margin-bottom: var(--space-2);
}

.file-dropzone-text {
    font-size: var(--text-sm);
    color: var(--color-text);
    margin-bottom: 4px;
}

.file-dropzone-hint {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    display: block;
}

.file-dropzone-selected {
    display: none;
    align-items: center;
    gap: 6px;
    margin-top: var(--space-3);
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--gov-success-bg);
    color: var(--gov-success);
    border: 1px solid var(--gov-success-border);
    font-size: var(--text-xs);
    font-weight: 600;
}

/* Empty States */
.empty-state,
.empty-state-mini {
    text-align: center;
    padding: var(--space-8) var(--space-4);
    color: var(--color-text-muted);
}

.empty-state-icon {
    font-size: 2.25rem;
    color: var(--color-primary);
    margin-bottom: var(--space-2);
}

.empty-state-title {
    display: block;
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 4px;
}

.empty-state-desc,
.empty-state-text {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    max-width: 420px;
    margin: 0 auto var(--space-4);
}

/* Resort Slot Selector Grid */
.slot-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: var(--space-2);
}

.slot-tile {
    padding: var(--space-3);
    border-radius: var(--radius-control);
    border: 1px solid var(--color-border);
    background: var(--color-surface-alt);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.slot-tile.available:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
}

.slot-tile.selected {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
    box-shadow: 0 0 0 2px rgba(31, 111, 88, 0.25);
}

.slot-tile.occupied {
    background: var(--color-surface);
    opacity: 0.7;
    cursor: not-allowed;
}

/* QR Code Plaque & Grid */
.qr-layout-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: var(--space-5);
    align-items: start;
}

@media (max-width: 960px) {
    .qr-layout-grid {
        grid-template-columns: 1fr;
    }
}

.qr-plaque {
    background: var(--color-surface);
    border: 2px solid var(--color-border-strong);
    border-radius: var(--radius-card);
    padding: var(--space-6);
    text-align: center;
    box-shadow: var(--shadow-card);
}

.qr-image-frame {
    display: inline-flex;
    padding: var(--space-4);
    background: #ffffff;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-control);
    margin: var(--space-3) 0;
    box-shadow: var(--shadow-xs);
}

.qr-directory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-4);
}

.qr-directory-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    padding: var(--space-5);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow-card);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.qr-directory-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Facility Info Grid (Resort Dashboard) */
.facility-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
}

.facility-info-item {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-control);
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
}

.facility-info-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    font-weight: 700;
    margin-bottom: 4px;
}

.facility-info-value {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Quick Action Tiles */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: var(--space-3);
}

.quick-action-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    padding: var(--space-4);
    border-radius: var(--radius-control);
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    transition: all var(--transition-fast);
}

.quick-action-tile:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.quick-action-tile i {
    font-size: 1.35rem;
    color: var(--color-primary);
}

.quick-action-tile strong {
    font-size: var(--text-sm);
    color: var(--color-text);
}

.quick-action-tile span {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

/* ==========================================================================
   CONFIRMATION DIALOG / MODAL SYSTEM (Warm Cream Surface #F5EFDF)
   ========================================================================== */
.peso-confirm-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(23, 33, 30, 0.55);
    backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    z-index: 2000;
}

.peso-confirm-backdrop.is-open {
    display: flex;
}

.peso-confirm-dialog {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    max-width: 440px;
    width: 100%;
    padding: var(--space-6);
    box-shadow: var(--shadow-lg);
}

.peso-confirm-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: var(--space-3);
    background: var(--gov-warning-bg);
    color: var(--gov-warning);
}

.peso-confirm-dialog[data-variant="danger"] .peso-confirm-icon {
    background: var(--gov-danger-bg);
    color: var(--gov-danger);
}

.peso-confirm-title {
    font-size: var(--text-lg);
    font-weight: 800;
    color: var(--color-text);
    margin-bottom: var(--space-2);
}

.peso-confirm-message {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-bottom: var(--space-5);
    line-height: 1.5;
}

.peso-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
}

/* ==========================================================================
   MOBILE & RESPONSIVE BREAKPOINTS (Sections 4 & 12)
   ========================================================================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(23, 33, 30, 0.45);
    z-index: 995;
}

@media (max-width: 1024px) {
    .app-sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width) !important;
    }

    body.sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-overlay {
        display: block;
    }

    .app-main,
    body.sidebar-collapsed .app-main {
        margin-left: 0;
    }

    .mobile-menu-toggle {
        display: inline-flex;
    }

    .desktop-sidebar-toggle {
        display: none;
    }

    .topbar-search-wrapper {
        width: 185px;
    }
}

@media (max-width: 640px) {
    .app-topbar {
        padding: var(--space-3) var(--space-4);
    }

    .topbar-search-wrapper,
    .topbar-profile-meta {
        display: none;
    }

    .page-actions-bar {
        padding: 0 var(--space-4) var(--space-3);
    }

    .app-content {
        padding: var(--space-3) var(--space-4) var(--space-5);
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
        gap: var(--space-3);
    }

    .stat-card {
        padding: var(--space-4);
    }

    .card-header,
    .card-body {
        padding: var(--space-4);
    }
}

/* Print Stylesheet Protection */
@media print {
    .app-sidebar,
    .app-topbar,
    .page-actions-bar,
    .masthead-actions,
    .app-footer,
    .no-print {
        display: none !important;
    }

    .app-main {
        margin-left: 0 !important;
        background: #ffffff !important;
    }

    body {
        background: #ffffff !important;
        color: #000000 !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #cbd5e1 !important;
        background: #ffffff !important;
    }
}
