/* ============================================
   SPNB DIGITAL — Corporate Sapphire Blue Theme
   Palette Inspired by @The_Pensiler Design Tokens:
   #091F5C | #334DAF | #7096D1 | #D0E4FE | #E8F2FE | #F9FBFF
   ============================================ */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ============================================
   DESIGN TOKENS & VARIABLES
   ============================================ */
:root {
    /* Base Color Palette (Deep Sapphire & Royal Blue) */
    --bg-primary: #F9FBFF;
    --bg-secondary: #7096D1;
    --bg-surface: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-card-hover: #EEF4FC;
    --bg-glass: rgba(112, 150, 209, 0.12);
    --bg-glass-strong: rgba(208, 228, 254, 0.18);
    --bg-input: #FFFFFF;
    --bg-input-focus: #F0F5FC;
    
    /* Brand Accent Colors (@The_Pensiler Palette) */
    --primary: #7096D1;
    --primary-light: #8AADE0;
    --primary-dark: #4F76B5;
    --primary-glow: rgba(51, 77, 175, 0.35);
    --accent-ice: #d0e4fe;
    --accent-ice-light: #e8f2fe;
    --accent-white: #f9fbff;
    
    --gradient-primary: linear-gradient(135deg, #091f5c 0%, #334daf 50%, #7096d1 100%);
    --gradient-accent: linear-gradient(135deg, #334daf 0%, #d0e4fe 100%);
    --gradient-bg: radial-gradient(circle at 15% 15%, rgba(51, 77, 175, 0.25) 0%, transparent 45%),
                   radial-gradient(circle at 85% 85%, rgba(112, 150, 209, 0.15) 0%, transparent 50%),
                   linear-gradient(135deg, #04091a 0%, #091f5c 70%, #050b20 100%);
    
    /* Status Colors */
    --success: #00b894;
    --success-bg: rgba(0, 184, 148, 0.14);
    --warning: #fdcb6e;
    --warning-bg: rgba(253, 203, 110, 0.14);
    --danger: #ff7675;
    --danger-bg: rgba(255, 118, 117, 0.14);
    --info: #7096d1;
    --info-bg: rgba(112, 150, 209, 0.18);
    --complete: #55efc4;
    --complete-bg: rgba(85, 239, 196, 0.14);
    --secondary: #d0e4fe;
    --secondary-bg: rgba(208, 228, 254, 0.14);
    
    /* Category Colors */
    --purple: #7096d1;
    --purple-bg: rgba(112, 150, 209, 0.18);
    --blue: #334daf;
    --blue-bg: rgba(51, 77, 175, 0.25);
    --teal: #d0e4fe;
    --teal-bg: rgba(208, 228, 254, 0.18);
    
    /* Text Hierarchy */
    --text-primary: #172B4D;
    --text-secondary: #49627F;
    --text-muted: #71839A;
    --text-inverse: #FFFFFF;
    
    /* Borders & Shadows */
    --border: #DCE6F2;
    --border-hover: #B8CDE8;
    --border-focus: #7096D1;
    --shadow-sm: 0 2px 10px rgba(4, 9, 26, 0.3);
    --shadow-md: 0 8px 24px rgba(4, 9, 26, 0.45);
    --shadow-lg: 0 16px 40px rgba(4, 9, 26, 0.6);
    --shadow-glow: 0 0 25px rgba(51, 77, 175, 0.3);
    
    /* Layout Dimensions */
    --sidebar-width: 260px;
    --header-height: 64px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    
    /* Typography */
    --font-heading: 'Plus Jakarta Sans', 'Inter', -apple-system, sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    --font-xs: 0.75rem;
    --font-sm: 0.85rem;
    --font-base: 0.95rem;
    --font-md: 1.05rem;
    --font-lg: 1.2rem;
    --font-xl: 1.5rem;
    --font-2xl: 1.9rem;
    --font-3xl: 2.5rem;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--gradient-bg);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, .page-title, .brand-name {
    font-family: var(--font-heading);
}

a { color: var(--accent-ice); text-decoration: none; transition: var(--transition-fast); }
a:hover { color: var(--accent-white); }

img { max-width: 100%; height: auto; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(112, 150, 209, 0.25); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(208, 228, 254, 0.4); }

/* ============================================
   LAYOUT STRUCTURE
   ============================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition-normal);
}

.main-content {
    flex: 1;
    padding: 28px;
    margin-top: var(--header-height);
}

/* ============================================
   SIDEBAR NAV
   ============================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: rgba(9, 31, 92, 0.95);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition-normal);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-brand {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--border);
    min-height: var(--header-height);
}

.sidebar-brand .brand-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #334daf 0%, #7096d1 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.25rem;
    color: white;
    box-shadow: 0 4px 15px rgba(51, 77, 175, 0.45);
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    display: flex;
    flex-direction: column;
}

.sidebar-brand .brand-name {
    font-weight: 800;
    font-size: var(--font-md);
    letter-spacing: -0.5px;
    color: var(--accent-white);
}

.sidebar-brand .brand-tagline {
    font-size: var(--font-xs);
    color: var(--primary-light);
}

.sidebar-menu {
    padding: 18px 14px;
    flex: 1;
}

.menu-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 12px 12px 6px;
    margin-top: 12px;
    opacity: 0.8;
}

.menu-label:first-child { margin-top: 0; }

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: var(--font-sm);
    font-weight: 500;
    transition: var(--transition-fast);
    cursor: pointer;
    margin-bottom: 3px;
    position: relative;
    overflow: hidden;
}

.menu-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 0;
    background: linear-gradient(135deg, #334daf, #7096d1);
    border-radius: 0 4px 4px 0;
    transition: var(--transition-fast);
}

.menu-item:hover {
    background: var(--bg-card-hover);
    color: var(--accent-white);
    transform: translateX(2px);
}

.menu-item.active {
    background: rgba(51, 77, 175, 0.35);
    border: 1px solid rgba(112, 150, 209, 0.4);
    color: var(--accent-white);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(9, 31, 92, 0.3);
}

.menu-item.active::before {
    height: 70%;
}

.menu-item .menu-icon {
    width: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-light);
    flex-shrink: 0;
}

.menu-item.active .menu-icon {
    color: var(--accent-ice);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

/* ============================================
   HEADER & NAVBAR
   ============================================ */
.header {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    height: var(--header-height);
    background: rgba(4, 9, 26, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    z-index: 90;
    transition: left var(--transition-normal);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-left .page-title {
    font-size: var(--font-lg);
    font-weight: 700;
    color: var(--accent-white);
}

.menu-toggle {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.menu-toggle:hover { background: var(--bg-card-hover); }

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Search Trigger Button */
.header-search-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    color: var(--text-muted);
    font-size: var(--font-xs);
    cursor: pointer;
    transition: var(--transition-fast);
}

.header-search-btn:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    color: var(--text-secondary);
}

.header-search-btn kbd {
    background: var(--bg-glass-strong);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-family: monospace;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 14px 5px 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition-fast);
}

.header-user:hover { background: var(--bg-card-hover); border-color: var(--border-hover); }

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #334daf 0%, #7096d1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--font-sm);
    color: white;
    box-shadow: 0 2px 8px rgba(51, 77, 175, 0.4);
}

.user-info { display: flex; flex-direction: column; }
.user-name { font-size: var(--font-sm); font-weight: 600; line-height: 1.2; color: var(--accent-white); }
.user-role { font-size: var(--font-xs); color: var(--primary-light); text-transform: capitalize; }

/* ============================================
   CARDS & CONTAINERS
   ============================================ */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: var(--transition-normal);
    position: relative;
}

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

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

.card-title {
    font-size: var(--font-md);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--accent-white);
}

/* STAT CARDS */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    position: relative;
    overflow: hidden;
    transition: var(--transition-spring);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #091f5c, #334daf, #7096d1);
    opacity: 0;
    transition: var(--transition-normal);
}

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

.stat-card:hover::before { opacity: 1; }

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 14px;
    color: var(--accent-ice);
}

.stat-card .stat-icon.purple { background: var(--purple-bg); color: var(--purple); }
.stat-card .stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-card .stat-icon.blue { background: var(--blue-bg); color: var(--primary-light); }
.stat-card .stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-card .stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-card .stat-icon.teal { background: var(--teal-bg); color: var(--teal); }

.stat-card .stat-label {
    font-size: var(--font-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-card .stat-value {
    font-family: var(--font-heading);
    font-size: var(--font-xl);
    font-weight: 800;
    line-height: 1.2;
    color: var(--accent-white);
}

.stat-card .stat-change {
    font-size: var(--font-xs);
    color: var(--text-muted);
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ============================================
   TABLES
   ============================================ */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

table thead th {
    background: rgba(9, 31, 92, 0.5);
    padding: 14px 18px;
    text-align: left;
    font-size: var(--font-xs);
    font-weight: 700;
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table tbody td {
    padding: 14px 18px;
    font-size: var(--font-sm);
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    vertical-align: middle;
}

table tbody tr { transition: var(--transition-fast); }
table tbody tr:hover { background: rgba(51, 77, 175, 0.2); }
table tbody tr:last-child td { border-bottom: none; }

/* ============================================
   BADGES & STATUS DOTS
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: var(--font-xs);
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.2;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.badge-success { background: var(--success-bg); color: #00e6b8; border: 1px solid rgba(0,184,148,0.25); }
.badge-success .badge-dot { background: #00e6b8; box-shadow: 0 0 6px #00e6b8; }

.badge-warning { background: var(--warning-bg); color: #ffe082; border: 1px solid rgba(253,203,110,0.25); }
.badge-warning .badge-dot { background: #ffe082; }

.badge-danger { background: var(--danger-bg); color: #ff8a80; border: 1px solid rgba(255,118,117,0.25); }
.badge-danger .badge-dot { background: #ff8a80; }

.badge-info { background: var(--info-bg); color: #7096d1; border: 1px solid rgba(112,150,209,0.3); }
.badge-complete { background: var(--complete-bg); color: #55efc4; border: 1px solid rgba(85,239,196,0.25); }
.badge-secondary { background: var(--secondary-bg); color: var(--secondary); }
.badge-purple { background: var(--purple-bg); color: #d0e4fe; border: 1px solid rgba(112,150,209,0.3); }
.badge-blue { background: var(--blue-bg); color: #d0e4fe; border: 1px solid rgba(51,77,175,0.4); }
.badge-teal { background: var(--teal-bg); color: #d0e4fe; border: 1px solid rgba(208,228,254,0.3); }
.badge-primary { background: rgba(51, 77, 175, 0.3); color: var(--accent-ice); border: 1px solid rgba(112,150,209,0.4); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: var(--font-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    border: 1px solid transparent;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, #091f5c 0%, #334daf 100%);
    color: white;
    border: 1px solid rgba(112, 150, 209, 0.4);
    box-shadow: 0 4px 15px rgba(9, 31, 92, 0.45);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #334daf 0%, #7096d1 100%);
    box-shadow: 0 6px 22px rgba(51, 77, 175, 0.55);
    transform: translateY(-2px);
    color: white;
}

.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #00997b; color: white; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #e05252; color: white; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}
.btn-outline:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    color: var(--accent-white);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 8px 12px;
}
.btn-ghost:hover { background: var(--bg-card); color: var(--accent-white); }

.btn-sm { padding: 7px 14px; font-size: var(--font-xs); }
.btn-lg { padding: 14px 28px; font-size: var(--font-md); }

.btn-whatsapp { background: #25D366; color: white; box-shadow: 0 4px 15px rgba(37, 211, 102, 0.25); }
.btn-whatsapp:hover { background: #1eb857; color: white; transform: translateY(-1px); }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================
   FORM CONTROLS
   ============================================ */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 11px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: var(--font-sm);
    transition: var(--transition-fast);
    outline: none;
}

.form-control:focus {
    background: var(--bg-input-focus);
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(112, 150, 209, 0.25);
}

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

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237096d1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

select.form-control option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

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

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

/* ============================================
   TABS
   ============================================ */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    gap: 6px;
    overflow-x: auto;
}

.tab {
    padding: 12px 20px;
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: var(--font-heading);
}

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

.tab.active {
    color: var(--accent-ice);
    border-bottom-color: var(--primary-light);
}

/* ============================================
   MODALS & OVERLAYS
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 9, 26, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
    padding: 20px;
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.92) translateY(20px);
    transition: var(--transition-spring);
    box-shadow: var(--shadow-lg);
}

.modal-overlay.active .modal { transform: scale(1) translateY(0); }

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

.modal-title { font-size: var(--font-md); font-weight: 700; color: var(--accent-white); }

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px;
    transition: var(--transition-fast);
}
.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 24px; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 18px 24px;
    border-top: 1px solid var(--border);
}

/* ============================================
   FLASH / TOAST MESSAGES
   ============================================ */
.flash-message {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: var(--font-sm);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    backdrop-filter: blur(10px);
}

.flash-message .flash-close {
    margin-left: auto;
    background: none;
    border: none;
    color: inherit;
    opacity: 0.7;
    cursor: pointer;
    font-size: 1.2rem;
}

.flash-success { background: var(--success-bg); color: #00e6b8; border: 1px solid rgba(0,184,148,0.3); }
.flash-danger { background: var(--danger-bg); color: #ff8a80; border: 1px solid rgba(255,118,117,0.3); }
.flash-warning { background: var(--warning-bg); color: #ffe082; border: 1px solid rgba(253,203,110,0.3); }
.flash-info { background: var(--info-bg); color: #7096d1; border: 1px solid rgba(112,150,209,0.3); }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   PAGE HEADER & TOOLBAR
   ============================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-header-left h1 {
    font-size: var(--font-xl);
    font-weight: 800;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
    color: var(--accent-white);
}

.page-header-left .breadcrumb {
    font-size: var(--font-xs);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 220px;
}

.search-box .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.search-box input {
    padding-left: 42px;
}

/* ============================================
   GRID SYSTEM & UTILITIES
   ============================================ */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--primary-light) !important; }

.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }

.fs-xs { font-size: var(--font-xs); }
.fs-sm { font-size: var(--font-sm); }
.fs-md { font-size: var(--font-md); }
.fs-lg { font-size: var(--font-lg); }
.fs-xl { font-size: var(--font-xl); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.w-100 { width: 100%; }

/* ============================================
   RESPONSIVE DESIGN & MOBILE OPTIMIZATIONS
   ============================================ */

/* Sidebar Backdrop Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 9, 26, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999;
    display: none;
    opacity: 0;
    transition: opacity var(--transition-normal);
}
.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Table Wrapper for Horizontal Scroll */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.table-wrapper table:not(.table-detail):not([style*="border:none"]) {
    min-width: 650px;
}

/* Desktop & Large Tablet (> 1024px) */
@media (min-width: 1025px) {
    .menu-toggle { display: none !important; }
}

/* Laptop / Mid Tablet (<= 1024px) */
@media (max-width: 1024px) {
    .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .header { padding: 0 20px; }
    .main-content { padding: 20px; }
}

/* Tablet & Mobile Landscape (<= 768px) */
@media (max-width: 768px) {
    /* Navigation & Sidebar Drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
        box-shadow: none;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    
    .main-wrapper {
        margin-left: 0 !important;
        width: 100%;
    }
    
    .header {
        left: 0 !important;
        padding: 0 16px;
        width: 100%;
    }
    
    .menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: var(--radius-md);
        background: var(--bg-card);
        border: 1px solid var(--border);
        color: var(--text-primary);
        cursor: pointer;
        flex-shrink: 0;
    }

    .main-content {
        padding: 16px 14px;
    }
    
    /* Layout Grids */
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr !important;
    }
    
    /* Headers & Toolbars */
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .page-header-left h1 {
        font-size: var(--font-lg);
    }
    .page-header-actions, .page-header .btn {
        width: 100%;
        justify-content: center;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 12px;
    }
    .toolbar form {
        flex-direction: column;
        width: 100%;
        align-items: stretch;
        gap: 10px;
    }
    .toolbar form > * {
        width: 100% !important;
        min-width: 0 !important;
    }
    .search-box {
        width: 100%;
        min-width: 0;
    }
    
    /* Card Padding & Headers */
    .card {
        padding: 18px 14px;
        border-radius: var(--radius-md);
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .card-header .btn, .card-header .btn-group {
        width: 100%;
    }

    /* Modal Adjustments */
    .modal {
        max-width: 95vw;
        max-height: 92vh;
        margin: 10px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 8px;
    }
    .modal-footer .btn {
        width: 100%;
    }

    /* Header Controls */
    .header-search-btn kbd {
        display: none;
    }
    .header-user .user-role {
        display: none;
    }
    .user-dropdown {
        right: 12px !important;
        left: 12px !important;
        min-width: auto !important;
    }
}

/* Small Mobile Portrait (<= 576px) */
@media (max-width: 576px) {
    .header-search-btn span {
        display: none;
    }
    .header-search-btn {
        padding: 8px;
        border-radius: var(--radius-full);
    }
    
    .header-left .page-title {
        font-size: var(--font-base);
        max-width: 150px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .header-user {
        padding: 4px 8px;
    }
    .header-user .user-name {
        font-size: var(--font-xs);
        max-width: 90px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Forms on Mobile */
    .form-control, select.form-control, textarea.form-control {
        font-size: 16px !important;
    }

    .form-group-row, .d-flex.gap-2, .d-flex.gap-3 {
        flex-direction: column;
        align-items: stretch;
    }
    
    /* Login Page Mobile Fit */
    .auth-container {
        padding: 16px 12px;
    }
    .auth-card {
        padding: 24px 18px !important;
        border-radius: var(--radius-xl);
    }
}


