/**
 * PTN Manager - Design System v4.0
 * Dark Cyberpunk Theme - Inspired by Antigravity IDE
 */

/* =========================================================
   TOKENS - CSS Variables
   ========================================================= */
:root {
    /* Colors - Dark Theme */
    --bg-primary: #050710;
    --bg-secondary: #0A0F1E;
    --bg-card: rgba(15, 23, 42, 0.7);
    --bg-card-hover: rgba(30, 41, 59, 0.8);
    --bg-glass: rgba(15, 23, 42, 0.6);

    /* Colors - Accents */
    --primary: #3B82F6;
    --primary-glow: rgba(59, 130, 246, 0.4);
    --primary-light: rgba(59, 130, 246, 0.15);
    --secondary: #8B5CF6;
    --accent-yellow: #D4A04A;
    --accent-green: #4DB88A;
    --accent-cyan: #4BA8B8;
    --accent-red: #E06060;
    --accent-pink: #C86A94;
    --accent-orange: #D4864A;

    /* Colors - Text */
    --text-primary: #FFFFFF;
    --text-secondary: rgba(255, 255, 255, 0.85);
    --text-muted: rgba(255, 255, 255, 0.65);

    /* Colors - Borders */
    --border-glass: rgba(255, 255, 255, 0.1);
    --border-highlight: rgba(255, 255, 255, 0.2);
    --border-active: var(--primary);

    /* Typography — Dual Font System (Poppins headings + Inter body) */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-heading: 'Poppins', 'Inter', -apple-system, sans-serif;

    /* Font Scale — Fluid (auto-scales phone ↔ desktop) */
    --font-size-2xs: clamp(8px, 0.3vw + 7px, 9px);
    --font-size-xs: clamp(10px, 0.3vw + 9px, 11px);
    --font-size-sm: clamp(12px, 0.3vw + 11px, 13px);
    --font-size-base: clamp(13px, 0.4vw + 12px, 14px);
    --font-size-md: clamp(14px, 0.5vw + 13px, 15px);
    --font-size-lg: clamp(15px, 0.8vw + 13px, 16px);
    --font-size-xl: clamp(17px, 1.2vw + 14px, 20px);
    --font-size-2xl: clamp(20px, 2vw + 16px, 26px);
    --font-size-3xl: clamp(24px, 3vw + 18px, 32px);
    --font-size-4xl: clamp(28px, 4vw + 20px, 40px);
    --font-size-huge: clamp(32px, 5vw + 24px, 48px);

    /* Spacing — Fluid for key layout spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: clamp(12px, 1.5vw + 8px, 16px);
    --space-5: clamp(16px, 1.5vw + 12px, 20px);
    --space-6: clamp(16px, 3vw + 12px, 24px);
    --space-8: clamp(20px, 4.5vw + 14px, 32px);
    --space-10: clamp(28px, 4.5vw + 20px, 40px);

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Effects */
    --blur-glass: blur(20px);
    --shadow-glow: 0 0 40px rgba(59, 130, 246, 0.15);
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-float: 0 8px 32px rgba(0, 0, 0, 0.5);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;

    /* Layout */
    --navbar-height: 56px;
    --bottom-nav-height: 64px;
    --container-max: 1200px;
    --content-max: 1000px;
}

/* =========================================================
   BASE STYLES
   ========================================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 20% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(120, 90, 200, 0.08) 0%, transparent 50%);
    background-attachment: fixed;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: var(--primary);
    color: white;
}

/* =========================================================
   TYPOGRAPHY — Heading Hierarchy
   ========================================================= */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    margin-top: 0;
}

h1, .h1 {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h2, .h2 {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    letter-spacing: -0.01em;
}

h3, .h3 {
    font-size: var(--font-size-xl);
    font-weight: 600;
}

h4, .h4 {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

h5, .h5 {
    font-size: var(--font-size-base);
    font-weight: 600;
}

h6, .h6 {
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Body text utilities */
.text-2xs { font-size: var(--font-size-2xs); }
.text-xs  { font-size: var(--font-size-xs); }
.text-sm  { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-md  { font-size: var(--font-size-md); }
.text-lg  { font-size: var(--font-size-lg); }
.text-xl  { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }
.text-3xl { font-size: var(--font-size-3xl); }
.text-4xl { font-size: var(--font-size-4xl); }
.text-huge { font-size: var(--font-size-huge); }

/* =========================================================
   NAVBAR - Floating Pill Style
   ========================================================= */
/* =========================================================
   NAV V4 — Compact Unified Navbar
   Aesthetic: Industrial Refined — purposeful, clean, premium
   ========================================================= */
.nav-v4 {
    background: rgba(10, 14, 28, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.04) inset,
        0 8px 32px rgba(0, 0, 0, 0.4);
    padding: 5px 10px;
    margin: var(--space-4) auto;
    max-width: var(--content-max);
    display: flex;
    align-items: center;
    gap: 4px;
    position: sticky;
    top: var(--space-4);
    z-index: 1000;
}

/* ── Brand ── */
.nav-v4 .nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    padding: 0 10px 0 4px;
    margin-right: 2px;
    flex-shrink: 0;
}

.nav-v4 .brand-icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    color: white;
    box-shadow: 0 3px 10px rgba(124, 109, 240, 0.35);
}

.nav-v4 .brand-text {
    font-weight: 800;
    font-size: var(--font-size-base);
    color: var(--text-primary);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ── Nav Items (unified flow) ── */
.nav-v4 .nav-items {
    display: flex;
    align-items: center;
    gap: 1px;
}

.nav-v4 .nav-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    font-weight: 500;
    text-decoration: none;
    border-radius: 9px;
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative;
}

.nav-v4 .nav-item i {
    font-size: var(--font-size-sm);
    opacity: 0.7;
    transition: all 0.2s ease;
}

.nav-v4 .nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.07);
}

.nav-v4 .nav-item:hover i {
    opacity: 1;
    transform: scale(1.08);
}

/* ── Active state — bottom accent line ── */
.nav-v4 .nav-item.active {
    color: var(--text-primary);
    background: rgba(124, 109, 240, 0.12);
    font-weight: 600;
}

.nav-v4 .nav-item.active i {
    color: #A78BFA;
    opacity: 1;
}

.nav-v4 .nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #A78BFA, transparent);
    border-radius: 2px;
}

/* ── Dot separator ── */
.nav-v4 .nav-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    margin: 0 6px;
    flex-shrink: 0;
}

/* ── Spacer ── */
.nav-v4 .nav-spacer {
    flex: 1;
}

/* ── Avatar button ── */
.nav-v4 .nav-avatar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px 3px 3px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.nav-v4 .nav-avatar-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
}

.nav-v4 .avatar-circle {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, #7C6DF0, #E06060);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: white;
    letter-spacing: 0;
}

.nav-v4 .user-chevron {
    font-size: var(--font-size-2xs);
    opacity: 0.45;
    transition: transform 0.2s ease;
}

/* ── Dropdown ── */
.nav-v4 .nav-dropdown {
    position: relative;
}

.nav-v4 .dropdown-panel {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: rgba(12, 16, 30, 0.97);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.03) inset;
    padding: 6px;
    z-index: 100;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.nav-v4 .nav-dropdown.open .dropdown-panel {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.nav-v4 .nav-dropdown.open .user-chevron {
    transform: rotate(180deg);
}

/* Dropdown links */
.nav-v4 .dropdown-panel a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: 500;
    border-radius: 9px;
    transition: all 0.15s ease;
}

.nav-v4 .dropdown-panel a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.nav-v4 .dropdown-panel a i {
    font-size: var(--font-size-base);
    width: 18px;
    text-align: center;
    opacity: 0.6;
}

.nav-v4 .dropdown-panel a:hover i {
    opacity: 1;
}

/* Dropdown divider & header */
.nav-v4 .dropdown-panel .dd-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 4px 0;
}

.nav-v4 .dropdown-panel .dd-header {
    padding: 10px 12px 6px;
}

.nav-v4 .dropdown-panel .dd-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--font-size-sm);
}

.nav-v4 .dropdown-panel .dd-role {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: 1px;
}

/* Section labels */
.nav-v4 .dropdown-panel .dd-label {
    font-size: var(--font-size-2xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 6px 12px 2px;
    opacity: 0.6;
}

.nav-v4 .dropdown-panel a.text-danger {
    color: var(--accent-red) !important;
}

.nav-v4 .dropdown-panel a.text-warning {
    color: #D4A04A !important;
}

/* =========================================================
   BOTTOM NAVIGATION - Mobile
   ========================================================= */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-glass);
    backdrop-filter: var(--blur-glass);
    border-top: 1px solid var(--border-glass);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: var(--bottom-nav-height);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--space-2);
    color: var(--text-muted);
    text-decoration: none;
    font-size: var(--font-size-xs);
    font-weight: 500;
    transition: color var(--transition-fast);
}

.bottom-nav-item i {
    font-size: 20px;
}

.bottom-nav-item.active {
    color: var(--primary);
}

@media (max-width: 991.98px) {
    .bottom-nav {
        display: block;
    }

    .nav-desktop-only {
        display: none !important;
    }

    .nav-v4 {
        display: none !important;
    }

    body {
        padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
    }
}

/* =========================================================
   MAIN CONTAINER
   ========================================================= */
.main-container {
    max-width: var(--container-max);
    padding: var(--space-4) var(--space-6);
    margin: 0 auto;
}

@media (max-width: 767.98px) {
    .main-container {
        padding: var(--space-3);
    }
}

/* =========================================================
   PAGE HEADER
   ========================================================= */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

.page-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.page-title i {
    color: var(--primary);
}

/* =========================================================
   STAT CARDS - Bold Numbers Style
   ========================================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-4);
}

.stat-card {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: var(--space-6);
    background: var(--bg-card);
    backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    transition: all var(--transition-normal);
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

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

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

.stat-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-xl);
    margin-bottom: var(--space-4);
}

.stat-card-icon.primary {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-card-icon.success {
    background: rgba(77, 184, 138, 0.15);
    color: var(--accent-green);
}

.stat-card-icon.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-yellow);
}

.stat-card-icon.error {
    background: rgba(224, 96, 96, 0.15);
    color: var(--accent-red);
}

.stat-card-icon.info {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
}

.stat-card-value {
    font-size: var(--font-size-huge);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: var(--space-2);
}

.stat-card-label {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Action Card - Primary */
.action-card {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-5);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-xl);
    color: white;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

.action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.4);
    color: white;
}

.action-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    font-size: var(--font-size-xl);
}

.action-card-text {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

/* =========================================================
   CARDS - Glass Style
   ========================================================= */
.card {
    background: var(--bg-card);
    backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: transparent;
    border-bottom: 1px solid var(--border-glass);
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--font-size-base);
}

.card-body {
    padding: var(--space-5);
}

.card-footer {
    padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--border-glass);
}

/* =========================================================
   TABLES - Minimal Dark Style
   ========================================================= */
.table-container {
    background: var(--bg-card);
    backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.table th {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-weight: 600;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--border-glass);
    white-space: nowrap;
}

.table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-glass);
    color: var(--text-primary);
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.table tbody tr:hover td {
    color: var(--text-primary);
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 500;
    line-height: 1.5;
    min-height: 44px;
    /* Touch target: iOS 44pt / Android 48dp */
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--font-size-xs);
}

.btn-lg {
    padding: var(--space-3) var(--space-6);
    font-size: var(--font-size-base);
}

/* Primary Button */
.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 0 20px var(--primary-glow);
}

.btn-primary:hover {
    background: #2563EB;
    border-color: #2563EB;
    color: white;
    box-shadow: 0 0 30px var(--primary-glow);
}

/* Success Button */
.btn-success {
    background: var(--accent-green);
    color: white;
    border-color: var(--accent-green);
}

.btn-success:hover {
    background: #3DA07A;
    border-color: #3DA07A;
    color: white;
}

/* Warning Button */
.btn-warning {
    background: var(--accent-yellow);
    color: #1E1B4B;
    border-color: var(--accent-yellow);
}

.btn-warning:hover {
    background: #D97706;
    border-color: #D97706;
    color: #1E1B4B;
}

/* Danger Button */
.btn-danger {
    background: var(--accent-red);
    color: white;
    border-color: var(--accent-red);
}

.btn-danger:hover {
    background: #C45050;
    border-color: #C45050;
    color: white;
}

/* Secondary/Outline Button */
.btn-secondary,
.btn-outline-primary {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-glass);
}

.btn-secondary:hover,
.btn-outline-primary:hover {
    background: var(--border-glass);
    color: var(--text-primary);
    border-color: var(--border-highlight);
}

.btn-light {
    background: var(--border-glass);
    color: var(--text-secondary);
    border-color: transparent;
}

.btn-light:hover {
    background: var(--border-highlight);
    color: var(--text-primary);
}

/* =========================================================
   FORMS
   ========================================================= */
.form-label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control,
.form-select {
    display: block;
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.5;
    min-height: 44px;
    /* Touch target */
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light), 0 0 20px var(--primary-glow);
}

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

.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23718096' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 12px;
    padding-right: 40px;
    -webkit-appearance: none;
    appearance: none;
}

.input-group {
    display: flex;
}

.input-group .form-control {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-group .btn {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* Custom Form Inputs */
.form-input-modern,
.form-select-modern {
    display: block;
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.form-input-modern:focus,
.form-select-modern:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

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

.form-input-modern.form-input-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-sm);
}

.form-input-modern.form-input-lg {
    padding: var(--space-4) var(--space-5);
    font-size: var(--font-size-lg);
}

.form-select-modern {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23718096' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 12px;
    padding-right: 40px;
    -webkit-appearance: none;
    appearance: none;
}

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

.form-label-modern {
    display: block;
    margin-bottom: var(--space-2);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group-modern {
    margin-bottom: var(--space-4);
}

/* =========================================================
   BADGES
   ========================================================= */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 3px var(--space-2);
    font-size: var(--font-size-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-success {
    background: rgba(77, 184, 138, 0.15);
    color: var(--accent-green);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-yellow);
}

.badge-danger {
    background: rgba(224, 96, 96, 0.15);
    color: var(--accent-red);
}

.badge-info {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
}

.badge-secondary {
    background: var(--border-glass);
    color: var(--text-muted);
}

/* Item Type Badges */
.badge-hc {
    background: rgba(77, 184, 138, 0.15);
    color: var(--accent-green);
}

.badge-dc {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-tb {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
}

/* =========================================================
   ALERTS
   ========================================================= */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-4);
    border: 1px solid;
}

.alert-success {
    background: rgba(77, 184, 138, 0.1);
    color: var(--accent-green);
    border-color: rgba(77, 184, 138, 0.3);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-yellow);
    border-color: rgba(245, 158, 11, 0.3);
}

.alert-danger {
    background: rgba(224, 96, 96, 0.1);
    color: var(--accent-red);
    border-color: rgba(224, 96, 96, 0.3);
}

.alert-info {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-cyan);
    border-color: rgba(6, 182, 212, 0.3);
}

.alert-primary {
    background: var(--primary-light);
    color: var(--primary);
    border-color: rgba(59, 130, 246, 0.3);
}

/* =========================================================
   TOAST NOTIFICATIONS
   ========================================================= */
.toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    pointer-events: none;
}

.toast {
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-lg);
    color: white;
    font-weight: 500;
    font-size: var(--font-size-sm);
    pointer-events: auto;
    animation: toastIn 0.3s ease forwards;
    max-width: 400px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.toast-success {
    background: var(--accent-green);
}

.toast-error {
    background: var(--accent-red);
}

.toast-warning {
    background: var(--accent-yellow);
    color: #1a1a2e;
}

.toast-info {
    background: var(--primary);
}

.toast-exit {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(40px);
    }
}

/* =========================================================
   SECTION HEADERS - Item Groups
   ========================================================= */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-3);
    font-weight: 600;
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-header-hc {
    background: rgba(77, 184, 138, 0.1);
    color: var(--accent-green);
    border: 1px solid rgba(77, 184, 138, 0.3);
}

.section-header-dc {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.section-header-tb {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.3);
}

.section-count {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px var(--space-2);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
}


/* =========================================================
   MODALS
   ========================================================= */
.modal-content {
    background: #0A0F1E !important;
    border: 1px solid var(--border-highlight);
    border-radius: var(--radius-xl);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.modal-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-glass);
}

.modal-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-5);
}

.modal-footer {
    padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--border-glass);
    gap: var(--space-2);
}

.btn-close {
    filter: invert(1);
    opacity: 0.5;
}

.btn-close:hover {
    opacity: 1;
}

/* Modal backdrop and z-index */
.modal-backdrop {
    z-index: 1040 !important;
    background: rgba(0, 0, 0, 0.85) !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
}

.modal {
    z-index: 1050 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

.modal-dialog {
    z-index: 1055 !important;
    position: relative !important;
    margin: 1.75rem auto !important;
}

/* Form controls in modal - dark theme */
.modal-body .form-control,
.modal-body .form-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    border-radius: var(--radius-md);
}

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

.modal-body .form-control:focus,
.modal-body .form-select:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    color: var(--text-primary);
}

.modal-body .form-label {
    color: var(--text-secondary);
}

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

/* =========================================================
   UTILITY CLASSES
   ========================================================= */
.text-primary {
    color: var(--primary) !important;
}

.text-success {
    color: var(--accent-green) !important;
}

.text-warning {
    color: var(--accent-yellow) !important;
}

.text-danger {
    color: var(--accent-red) !important;
}

.text-info {
    color: var(--accent-cyan) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

.text-white {
    color: var(--text-primary) !important;
}

.bg-primary {
    background-color: var(--primary) !important;
}

.bg-success {
    background-color: var(--accent-green) !important;
}

.bg-warning {
    background-color: var(--accent-yellow) !important;
}

.bg-danger {
    background-color: var(--accent-red) !important;
}

.bg-light {
    background-color: var(--border-glass) !important;
}

.bg-dark {
    background-color: var(--bg-secondary) !important;
}

.border {
    border: 1px solid var(--border-glass) !important;
}

.border-top {
    border-top: 1px solid var(--border-glass) !important;
}

.border-bottom {
    border-bottom: 1px solid var(--border-glass) !important;
}

.rounded {
    border-radius: var(--radius-md) !important;
}

.rounded-lg {
    border-radius: var(--radius-lg) !important;
}

.rounded-xl {
    border-radius: var(--radius-xl) !important;
}

.rounded-full {
    border-radius: var(--radius-full) !important;
}

.shadow {
    box-shadow: var(--shadow-card) !important;
}

.shadow-glow {
    box-shadow: var(--shadow-glow) !important;
}

/* Spacing */
.gap-1 {
    gap: var(--space-1) !important;
}

.gap-2 {
    gap: var(--space-2) !important;
}

.gap-3 {
    gap: var(--space-3) !important;
}

.gap-4 {
    gap: var(--space-4) !important;
}

/* Text */
.fw-medium {
    font-weight: 500 !important;
}

.fw-semibold {
    font-weight: 600 !important;
}

.fw-bold {
    font-weight: 700 !important;
}

.fs-xs {
    font-size: var(--font-size-xs) !important;
}

.fs-sm {
    font-size: var(--font-size-sm) !important;
}

.fs-base {
    font-size: var(--font-size-base) !important;
}

.fs-lg {
    font-size: var(--font-size-lg) !important;
}

.fs-xl {
    font-size: var(--font-size-xl) !important;
}

/* =========================================================
   GRID LAYOUTS
   ========================================================= */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-4);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-4);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 767.98px) {
    .page-title {
        font-size: var(--font-size-xl);
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }

    .stat-card {
        padding: var(--space-4);
    }

    .stat-card-value {
        font-size: var(--font-size-3xl);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .table th,
    .table td {
        padding: var(--space-2) var(--space-3);
        font-size: var(--font-size-xs);
    }

    .btn {
        padding: var(--space-2) var(--space-3);
        font-size: var(--font-size-xs);
    }

    .hide-mobile {
        display: none !important;
    }
}

@media (min-width: 768px) {
    .hide-desktop {
        display: none !important;
    }
}

/* =========================================================
   OFFCANVAS
   ========================================================= */
.offcanvas {
    background: var(--bg-secondary);
    border-color: var(--border-glass);
}

.offcanvas-header {
    border-bottom: 1px solid var(--border-glass);
}

.offcanvas-title {
    font-weight: 600;
    color: var(--text-primary);
}

/* =========================================================
   SCROLLBAR
   ========================================================= */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-highlight);
}

/* =========================================================
   EMPTY STATE
   ========================================================= */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-10);
    text-align: center;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: var(--font-size-huge);
    margin-bottom: var(--space-4);
    opacity: 0.3;
}

.empty-state-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

/* =========================================================
   PRINT
   ========================================================= */
@media print {
    body {
        background: white;
        color: black;
    }

    .nav-v4,
    .bottom-nav,
    .btn,
    .no-print {
        display: none !important;
    }

    .card {
        background: white;
        border: 1px solid #ddd;
        box-shadow: none;
    }
}

/* =========================================================
   ITEM ROWS
   ========================================================= */
.item-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    gap: var(--space-3);
    transition: all var(--transition-fast);
}

.item-row:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-highlight);
}

.item-name {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
}

.item-quantity {
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
}

.item-unit {
    color: var(--text-muted);
    font-size: var(--font-size-xs);
}

/* =========================================================
   QR CODE
   ========================================================= */
.qr-code-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-4);
    background: white;
    border-radius: var(--radius-lg);
}

.qr-code-wrapper img {
    max-width: 200px;
    border-radius: var(--radius-md);
}

.qr-code-label {
    margin-top: var(--space-3);
    font-size: var(--font-size-sm);
    color: var(--bg-secondary);
    text-align: center;
}

/* =========================================================
   LOADING SKELETON
   ========================================================= */
.skeleton {
    background: linear-gradient(90deg, var(--border-glass) 25%, var(--bg-card) 50%, var(--border-glass) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* =========================================================
   MODERN UI COMPONENTS v5.0
   Premium Dark Theme Enhancement
   ========================================================= */

/* Section Title - Modern */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
}

.section-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.section-title i {
    color: var(--primary);
    font-size: var(--font-size-xl);
}

/* Stat Card Modern - Premium Design */
.stat-card-modern {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-5);
    background: var(--bg-card);
    backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    transition: all var(--transition-normal);
    overflow: hidden;
    min-height: 100px;
}

.stat-card-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0;
    transition: opacity var(--transition-normal);
}

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

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

.stat-card-modern .stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    font-size: 24px;
    flex-shrink: 0;
}

.stat-card-modern .stat-icon.primary {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(120, 90, 200, 0.2));
    color: var(--primary);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

.stat-card-modern .stat-icon.success {
    background: linear-gradient(135deg, rgba(77, 184, 138, 0.2), rgba(6, 182, 212, 0.2));
    color: var(--accent-green);
    box-shadow: 0 0 20px rgba(77, 184, 138, 0.2);
}

.stat-card-modern .stat-icon.warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(249, 115, 22, 0.2));
    color: var(--accent-yellow);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}

.stat-card-modern .stat-icon.danger {
    background: linear-gradient(135deg, rgba(224, 96, 96, 0.2), rgba(200, 106, 148, 0.2));
    color: var(--accent-red);
    box-shadow: 0 0 20px rgba(224, 96, 96, 0.2);
}

.stat-card-modern .stat-icon.info {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(59, 130, 246, 0.2));
    color: var(--accent-cyan);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.2);
}

.stat-card-modern .stat-content {
    flex: 1;
    min-width: 0;
}

.stat-card-modern .stat-label {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--space-1);
}

.stat-card-modern .stat-value {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

/* Action Card Modern - CTA Style */
.action-card-modern {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-5);
    min-height: 100px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--radius-xl);
    color: white;
    font-size: var(--font-size-lg);
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

.action-card-modern:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.5);
    color: white;
}

.action-card-modern i {
    font-size: var(--font-size-3xl);
}

/* Card Modern - Glass Style */
.card-modern {
    background: var(--bg-card);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.card-modern-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-glass);
    font-weight: 600;
    color: var(--text-primary);
}

.card-modern-body {
    padding: var(--space-5);
}

/* Table Modern - Dark Theme */
.table-responsive-modern {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-modern {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.table-modern thead th {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-weight: 600;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--border-glass);
    white-space: nowrap;
}

.table-modern tbody td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-glass);
    color: var(--text-secondary);
    vertical-align: middle;
}

.table-modern tbody tr:last-child td {
    border-bottom: none;
}

.table-modern tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.table-modern tbody tr:hover td {
    color: var(--text-primary);
}

/* Badge Modern */
.badge-modern {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 4px var(--space-3);
    font-size: var(--font-size-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-modern-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-modern-success {
    background: rgba(77, 184, 138, 0.15);
    color: var(--accent-green);
}

.badge-modern-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-yellow);
}

.badge-modern-danger {
    background: rgba(224, 96, 96, 0.15);
    color: var(--accent-red);
}

.badge-modern-info {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
}

.badge-modern-neutral {
    background: var(--border-glass);
    color: var(--text-muted);
}

/* Button Modern */
.btn-modern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 600;
    line-height: 1.5;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn-modern-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--font-size-xs);
}

.btn-modern-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.3);
}

.btn-modern-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
    color: white;
}

.btn-modern-success {
    background: linear-gradient(135deg, var(--accent-green), #2D7A5A);
    color: white;
    box-shadow: 0 2px 12px rgba(77, 184, 138, 0.2);
}

.btn-modern-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(77, 184, 138, 0.3);
    color: white;
}

.btn-modern-danger {
    background: linear-gradient(135deg, var(--accent-red), #B33A3A);
    color: white;
    box-shadow: 0 2px 12px rgba(224, 96, 96, 0.2);
}

.btn-modern-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(224, 96, 96, 0.3);
    color: white;
}

.btn-modern-warning {
    background: linear-gradient(135deg, var(--accent-yellow), var(--accent-orange));
    color: #1E1B4B;
    box-shadow: 0 2px 12px rgba(245, 158, 11, 0.3);
}

.btn-modern-warning:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
    color: #1E1B4B;
}

.btn-modern-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-glass);
}

.btn-modern-ghost:hover {
    background: var(--border-glass);
    color: var(--text-primary);
    border-color: var(--border-highlight);
}

.btn-modern-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--radius-md);
}

/* =========================================================
   TABLE ACTION BUTTONS - Consistent across all pages
   ========================================================= */
.material-table .action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: var(--font-size-base);
}

.action-btn-edit {
    background: linear-gradient(135deg, #D4A04A, #BF9040);
    color: white;
}

.action-btn-edit:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(212, 160, 74, 0.3);
    color: white;
}

.action-btn-delete {
    background: transparent;
    border: 1px solid var(--accent-red, #e74c3c);
    color: var(--accent-red, #e74c3c);
}

.action-btn-delete:hover {
    background: var(--accent-red, #e74c3c);
    color: white;
    transform: scale(1.1);
}

.action-btn-view {
    background: linear-gradient(135deg, #7c6df0, #6c5ce7);
    color: white;
}

.action-btn-view:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(124, 109, 240, 0.4);
    color: white;
}

/* Empty State Modern */
.empty-state-modern {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-10);
    text-align: center;
}

.empty-state-modern i {
    font-size: var(--font-size-huge);
    color: var(--accent-green);
    margin-bottom: var(--space-4);
    opacity: 0.8;
}

.empty-state-modern h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-2) 0;
}

.empty-state-modern p {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin: 0;
}

/* Delivery Card Modern - Dark Theme */
.delivery-card-modern {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-4);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.delivery-card-modern:hover {
    border-color: var(--border-highlight);
    box-shadow: var(--shadow-glow);
}

.delivery-header-modern {
    padding: var(--space-4) var(--space-5);
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.delivery-header-modern:hover {
    background: rgba(255, 255, 255, 0.04);
}

.delivery-details-modern {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

.delivery-card-modern.expanded .delivery-details-modern {
    max-height: 10000px;
}

.delivery-details-inner-modern {
    padding: var(--space-5);
    border-top: 1px solid var(--border-glass);
}

/* Section Headers for Item Groups - Dark Theme */
.section-card-modern {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-3);
}

.section-header-modern {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.section-header-modern.hc {
    background: linear-gradient(135deg, rgba(77, 184, 138, 0.2), rgba(77, 184, 138, 0.1));
    color: var(--accent-green);
}

.section-header-modern.dc {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.1));
    color: var(--primary);
}

.section-header-modern.tb {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(6, 182, 212, 0.1));
    color: var(--accent-cyan);
}

.section-header-modern.phu {
    background: linear-gradient(135deg, rgba(120, 90, 200, 0.2), rgba(120, 90, 200, 0.1));
    color: var(--secondary);
}

.section-header-modern.hong {
    background: linear-gradient(135deg, rgba(224, 96, 96, 0.2), rgba(224, 96, 96, 0.1));
    color: var(--accent-red);
}

/* Flex Utilities */
.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-wrap {
    flex-wrap: wrap;
}

/* Text Utilities */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Quantity Pills - Dark Theme */
.qty-pill-modern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    padding: 4px var(--space-2);
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: var(--font-size-xs);
}

.qty-pill-modern.hc {
    background: rgba(77, 184, 138, 0.15);
    color: var(--accent-green);
}

.qty-pill-modern.dc {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
}

.qty-pill-modern.tb {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-cyan);
}

.qty-pill-modern.phu {
    background: rgba(120, 90, 200, 0.15);
    color: var(--secondary);
}

/* Summary Badges */
.summary-badges-modern {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.summary-badge-modern {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.summary-badge-modern.hc {
    background: linear-gradient(135deg, rgba(77, 184, 138, 0.3), rgba(6, 182, 212, 0.2));
    color: var(--accent-green);
}

.summary-badge-modern.dc {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(120, 90, 200, 0.2));
    color: var(--primary);
}

.summary-badge-modern.tb {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.3), rgba(59, 130, 246, 0.2));
    color: var(--accent-cyan);
}

.summary-badge-modern.phu {
    background: linear-gradient(135deg, rgba(120, 90, 200, 0.3), rgba(59, 130, 246, 0.2));
    color: var(--secondary);
}

.summary-badge-modern.hong {
    background: linear-gradient(135deg, rgba(224, 96, 96, 0.3), rgba(200, 106, 148, 0.2));
    color: var(--accent-red);
}

/* Mobile Responsive */
@media (max-width: 767.98px) {
    .stat-card-modern {
        padding: var(--space-4);
        min-height: 80px;
    }

    .stat-card-modern .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }

    .stat-card-modern .stat-value {
        font-size: var(--font-size-2xl);
    }

    .action-card-modern {
        min-height: 80px;
        padding: var(--space-4);
    }

    .hide-mobile {
        display: none !important;
    }
}

/* =========================================================
   DARK THEME TEXT COLOR OVERRIDES
   Force white/light text on dark backgrounds
   ========================================================= */

/* Override Bootstrap default text colors */
body,
.card,
.card-body,
.table,
.table td,
.table th,
.list-group-item,
.modal-body,
.form-control,
.form-select,
td,
th {
    color: var(--text-primary) !important;
}

/* Text muted - brighter for dark theme */
.text-muted,
.small.text-muted,
td.text-muted,
.col-stt.text-muted,
.col-dvt.text-muted,
.col-ghichu.text-muted,
span.text-muted {
    color: var(--text-muted) !important;
}

/* Secondary text */
.text-secondary,
.text-dark {
    color: var(--text-secondary) !important;
}

/* Keep specific colored text */
.text-primary {
    color: var(--primary) !important;
}

.text-success {
    color: var(--accent-green) !important;
}

.text-warning {
    color: var(--accent-yellow) !important;
}

.text-danger {
    color: var(--accent-red) !important;
}

.text-info {
    color: var(--accent-cyan) !important;
}

/* Bootstrap table overrides */
.table-light,
.table-light th,
.table-light td,
thead.table-light th {
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-secondary) !important;
    border-color: var(--border-glass) !important;
}

.table-hover tbody tr:hover,
.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-primary) !important;
}

/* Card backgrounds */
.card,
.card-header,
.card-body,
.card-footer {
    background: var(--bg-card) !important;
    border-color: var(--border-glass) !important;
}

.card-header {
    border-bottom-color: var(--border-glass) !important;
}

.card-footer {
    border-top-color: var(--border-glass) !important;
}

/* Material table in views - force white text */
.material-table td,
.material-table th,
.compact-table td,
.compact-table th {
    color: var(--text-primary) !important;
}

.material-table thead th,
.compact-table thead th {
    color: var(--text-secondary) !important;
}

/* Remove Bootstrap bg-light class effect */
.bg-light {
    background: transparent !important;
}

/* fw-semibold should be white */
.fw-semibold,
.fw-bold {
    color: var(--text-primary) !important;
}

/* =========================================================
   LEGACY CLASS ALIASES
   Maps old inline class names → design-system equivalents
   so PHP views can drop their <style> blocks
   ========================================================= */

/* --- Detail Card (xem_phieu_chi_tiet) --- */
.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.detail-card .card-body {
    background: transparent;
}

.detail-card .card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-glass);
}

.detail-card .card-footer {
    background: transparent;
    border-top: 1px solid var(--border-glass);
}

/* --- Status Badges --- */
.status-locked {
    background: linear-gradient(135deg, var(--accent-red) 0%, #A83A3A 100%);
}

.status-open {
    background: linear-gradient(135deg, var(--accent-green) 0%, #2D7A5A 100%);
}

/* --- Summary Badges (legacy aliases) --- */
.summary-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.summary-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.summary-badge.hc {
    background: linear-gradient(135deg, rgba(77, 184, 138, 0.3), rgba(75, 168, 184, 0.2));
    color: var(--accent-green);
}

.summary-badge.dc {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(120, 90, 200, 0.2));
    color: var(--primary);
}

.summary-badge.tb {
    background: linear-gradient(135deg, rgba(75, 168, 184, 0.3), rgba(59, 130, 246, 0.2));
    color: var(--accent-cyan);
}

.summary-badge.phu {
    background: linear-gradient(135deg, rgba(120, 90, 200, 0.3), rgba(59, 130, 246, 0.2));
    color: var(--secondary);
}

.summary-badge.hong {
    background: linear-gradient(135deg, rgba(224, 96, 96, 0.3), rgba(200, 106, 148, 0.2));
    color: var(--accent-red);
}

/* --- Delivery Card (legacy aliases) --- */
.delivery-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-4);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.delivery-card:hover {
    border-color: var(--border-highlight);
    box-shadow: var(--shadow-glow);
}

.delivery-header {
    padding: var(--space-4) var(--space-5);
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.delivery-header:hover {
    background: rgba(255, 255, 255, 0.04);
}

.delivery-header .expand-icon {
    transition: transform 0.3s ease;
}

.delivery-card.expanded .delivery-header .expand-icon {
    transform: rotate(180deg);
}

.delivery-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
}

.delivery-card.expanded .delivery-details {
    max-height: 10000px;
}

.delivery-details-inner {
    padding: var(--space-5);
    border-top: 1px solid var(--border-glass);
}

/* --- Section Card (legacy aliases) --- */
.section-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-3);
}

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

.section-header .badge {
    background: rgba(255, 255, 255, 0.9) !important;
    color: #333 !important;
    font-weight: 600;
}

/* section-header.hc/dc/tb/phu/hong colors → centralized in UNIFIED SECTION HEADER COLORS block */

/* --- Compact Table (xem_phieu_chi_tiet) --- */
.compact-table {
    width: 100%;
    font-size: var(--font-size-sm);
}

.compact-table th,
.compact-table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-glass);
}

.compact-table thead th {
    background: rgba(255, 255, 255, 0.03);
    font-weight: 600;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    color: var(--text-muted);
}

.compact-table tbody tr:last-child td {
    border-bottom: none;
}

.compact-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* --- Material Table (xem_lan_giao) --- */
.material-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--font-size-base);
}

.material-table th,
.material-table td {
    padding: 10px 12px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-glass);
    color: var(--text-primary);
}

.material-table thead th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.material-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.material-table tbody tr:last-child td {
    border-bottom: none;
}

/* Fixed column widths for material-table */
.col-stt {
    width: 50px;
    text-align: center;
}

.col-ten {
    width: 35%;
    min-width: 180px;
}

.col-dvt {
    width: 60px;
    text-align: center;
}

.col-slgiao {
    width: 70px;
    text-align: center;
}

.col-slnhan {
    width: 70px;
    text-align: center;
}

.col-tinhtrang {
    width: 90px;
    text-align: center;
}

.col-ghichu {
    width: auto;
}

.col-action {
    width: 40px;
    text-align: center;
}

/* --- Quantity Pills (legacy) --- */
.qty-pill {
    display: inline-block;
    min-width: 32px;
    padding: 4px var(--space-2);
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: var(--font-size-xs);
    text-align: center;
}

.qty-pill.hc {
    background: rgba(77, 184, 138, 0.15);
    color: var(--accent-green);
}

.qty-pill.dc {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
}

.qty-pill.tb {
    background: rgba(75, 168, 184, 0.15);
    color: var(--accent-cyan);
}

.qty-pill.phu {
    background: rgba(120, 90, 200, 0.15);
    color: var(--secondary);
}


/* --- Action Buttons - Premium (shared) --- */
.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-fast);
    border: none;
    cursor: pointer;
}

.action-btn i {
    transition: transform 0.2s ease;
}

.action-btn:hover i {
    transform: scale(1.15);
}

.btn-su-co {
    background: linear-gradient(135deg, var(--accent-red), #B33A3A);
    color: white;
    box-shadow: 0 2px 8px rgba(224, 96, 96, 0.2);
}

.btn-su-co:hover {
    box-shadow: 0 4px 12px rgba(224, 96, 96, 0.3);
    transform: translateY(-1px);
    color: white;
}

.btn-cap-nhat {
    background: linear-gradient(135deg, var(--accent-green), #2D7A5A);
    color: white;
    box-shadow: 0 2px 8px rgba(77, 184, 138, 0.2);
}

.btn-cap-nhat:hover {
    box-shadow: 0 4px 12px rgba(77, 184, 138, 0.3);
    transform: translateY(-1px);
    color: white;
}

.btn-chi-tiet {
    background: linear-gradient(135deg, var(--secondary), #4A42B0);
    color: white;
    box-shadow: 0 2px 8px rgba(120, 90, 200, 0.3);
}

.btn-chi-tiet:hover {
    box-shadow: 0 4px 12px rgba(120, 90, 200, 0.4);
    transform: translateY(-1px);
    color: white;
}

.btn-xoa {
    background: linear-gradient(135deg, var(--accent-red), #B33A3A);
    color: white;
    box-shadow: 0 2px 8px rgba(224, 96, 96, 0.2);
}

.btn-xoa:hover {
    box-shadow: 0 4px 12px rgba(224, 96, 96, 0.3);
    transform: translateY(-1px);
    color: white;
}

.actions-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* --- Autocomplete List (xem_lan_giao) --- */
.autocomplete-list {
    position: absolute;
    z-index: 1000;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
}

.autocomplete-list div {
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-primary);
}

.autocomplete-list div:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* --- Mobile Responsive for Delivery Detail (xem_lan_giao) --- */
@media (max-width: 767.98px) {
    .material-table {
        min-width: 550px;
        font-size: var(--font-size-sm);
    }

    .material-table th,
    .material-table td {
        padding: 8px 6px;
    }

    .material-table thead th {
        font-size: var(--font-size-xs);
    }

    .qty-badge {
        min-width: 30px;
        padding: 2px 6px;
        font-size: var(--font-size-xs);
    }

    .col-ghichu {
        min-width: 100px;
    }

    /* Scroll hint for tables */
    .table-responsive {
        position: relative;
    }

    .table-responsive::after {
        content: '← → Vuốt ngang';
        position: absolute;
        top: -28px;
        right: 12px;
        font-size: var(--font-size-2xs);
        color: var(--text-muted);
        background: var(--bg-card);
        padding: 2px 8px;
        border-radius: 10px;
        border: 1px solid var(--border-glass);
        pointer-events: none;
        animation: fadeOutHint 3s forwards;
        animation-delay: 2s;
    }

    @keyframes fadeOutHint {
        from {
            opacity: 1;
        }

        to {
            opacity: 0;
        }
    }

    /* Fixed action bar on mobile */
    .mobile-fixed-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-card);
        border-top: 1px solid var(--border-glass);
        padding: 12px 16px;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
        z-index: 1000;
    }

    .mobile-fixed-actions .btn {
        width: 100%;
        padding: 12px;
        font-size: var(--font-size-base);
    }

    /* Touch-friendly form elements */
    .form-control,
    .form-select {
        min-height: 44px;
        font-size: 16px;
        /* Prevents iOS zoom */
    }
}

/* =============================================
   PHASE 2: Extracted Inline Styles
   ============================================= */

/* --- Section Cards & Material Tables (shared by bai_hoc, mon_hoc views) --- */
.section-card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
    background: var(--bg-card);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.section-header {
    padding: 12px 20px;
    font-weight: 600;
    font-size: var(--font-size-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

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

.section-header .badge {
    background: rgba(255, 255, 255, 0.9) !important;
    color: #333 !important;
    font-weight: 600;
}

/* Section header solid colors → centralized in UNIFIED SECTION HEADER COLORS block */

/* Section header color variants - subtle/transparent (for mon_hoc/xem.php) */
.section-header.hc-subtle {
    background: linear-gradient(135deg, rgba(77, 184, 138, 0.2), rgba(77, 184, 138, 0.1));
    color: var(--accent-green);
}

.section-header.dc-subtle {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(120, 90, 200, 0.1));
    color: var(--primary);
}

.section-header.tb-subtle {
    background: linear-gradient(135deg, rgba(75, 168, 184, 0.2), rgba(59, 130, 246, 0.1));
    color: var(--accent-cyan);
}

/* Material table */
.material-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.material-table th,
.material-table td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-glass);
    color: var(--text-primary);
}

.material-table thead th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.material-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.material-table tbody tr:last-child td {
    border-bottom: none;
}

.material-table .form-control {
    background: var(--bg-primary);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
}

.material-table .form-control:focus {
    background: var(--bg-primary);
    border-color: var(--primary);
    color: var(--text-primary);
}

.add-row-btn {
    margin: 10px 15px 15px;
}

/* Material table column widths */
.col-stt {
    width: 60px;
    text-align: center;
}

.col-ten {
    width: 30%;
    min-width: 200px;
}

.col-quycach {
    width: 20%;
    min-width: 120px;
}

.col-dvt {
    width: 80px;
    text-align: center;
}

.col-soluong {
    width: 100px;
    text-align: center;
}

.col-ghichu {
    width: auto;
}

/* Quantity badges in material tables */
.qty-badge {
    display: inline-block;
    min-width: 50px;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: var(--font-size-base);
    white-space: nowrap;
    text-align: center;
}

.qty-dc {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.qty-tb {
    background: rgba(75, 168, 184, 0.2);
    color: #22d3ee;
}

.qty-hc {
    background: rgba(77, 184, 138, 0.2);
    color: #34d399;
}

.qty-phu {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

/* --- QR Page (xem_phieu/qr.php) --- */
.qr-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    padding: 48px 40px;
    border-radius: 24px;
    text-align: center;
    max-width: 90%;
    width: 420px;
    animation: fadeIn 0.5s ease;
}

.qr-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 32px;
}

.qr-container {
    background: white;
    padding: 20px;
    border-radius: 16px;
    display: inline-block;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.qr-link {
    display: block;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    word-break: break-all;
    text-decoration: none;
    transition: all 0.2s ease;
    margin-bottom: 24px;
}

.qr-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: var(--primary);
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-print {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}

.btn-print:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.btn-dashboard {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-dashboard:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    color: white;
}

.actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

@media print {
    .qr-card {
        border: none;
        box-shadow: none;
        background: white;
    }

    .qr-title {
        -webkit-text-fill-color: #333;
        color: #333;
    }

    .btn-action,
    .actions {
        display: none !important;
    }
}

/* --- Success Pages (tao_phieu/success.php, nhan_phieu/success.php) --- */
.success-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.success-card {
    width: 100%;
    max-width: 500px;
    background: var(--bg-card);
    backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.success-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-cyan));
}

.success-icon {
    font-size: var(--font-size-huge);
    color: var(--accent-green);
    animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }

    to {
        transform: scale(1);
    }
}

.success-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--accent-green);
    margin: var(--space-4) 0;
}

.lesson-name {
    font-size: var(--font-size-lg);
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: var(--space-4);
}

.qr-wrapper {
    background: white;
    padding: 20px;
    border-radius: var(--radius-lg);
    display: inline-block;
    margin: var(--space-4) 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* nhan_phieu/success - header variant */
.success-header {
    background: linear-gradient(135deg, #2D7A5A 0%, #4DB88A 100%);
    padding: var(--space-8) var(--space-6);
    color: white;
}

.success-header .success-icon {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-4);
    font-size: var(--font-size-4xl);
    animation: pulse 2s infinite;
    color: white;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.success-body {
    padding: var(--space-6);
}

.info-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-bottom: var(--space-5);
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border-glass);
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.info-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* --- Error Page (nhan_phieu/error.php) --- */
.error-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 400px;
    text-align: center;
    overflow: hidden;
}

.error-header {
    background: linear-gradient(135deg, #B33A3A 0%, #E06060 100%);
    padding: var(--space-8) var(--space-6);
    color: white;
}

.error-icon {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-4);
    font-size: var(--font-size-4xl);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.error-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin: 0;
}

.error-body {
    padding: var(--space-6);
}

.error-message {
    background: rgba(224, 96, 96, 0.15);
    color: var(--accent-red);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-bottom: var(--space-5);
    font-size: var(--font-size-sm);
}

/* --- System Reset Page --- */
.reset-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.reset-card {
    width: 100%;
    max-width: 480px;
    background: var(--bg-card);
    backdrop-filter: var(--blur-glass);
    border: 1px solid rgba(224, 96, 96, 0.3);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.reset-card-header {
    background: linear-gradient(135deg, var(--accent-red), #B33A3A);
    padding: var(--space-5) var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.reset-card-header i {
    font-size: var(--font-size-2xl);
}

.reset-card-header h4 {
    margin: 0;
    font-weight: 700;
    color: white;
}

.reset-card-body {
    padding: var(--space-6);
}

.warning-text {
    color: var(--accent-red);
    font-weight: 600;
    line-height: 1.8;
    margin-bottom: var(--space-5);
}

.form-input {
    display: block;
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(224, 96, 96, 0.2);
}

.alert-error {
    padding: var(--space-3) var(--space-4);
    background: rgba(224, 96, 96, 0.15);
    border: 1px solid rgba(224, 96, 96, 0.3);
    border-radius: var(--radius-md);
    color: var(--accent-red);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-4);
}

/* --- User Guide Page (huong_dan/index.php) --- */
.user-guide-container {
    background: var(--bg-card);
    backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
}

.user-guide-container h1 {
    color: var(--text-primary);
    font-weight: 700;
    font-size: var(--font-size-3xl);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--primary);
}

.user-guide-container h2 {
    color: var(--text-primary);
    font-weight: 600;
    font-size: var(--font-size-2xl);
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding-left: 0.75rem;
    border-left: 4px solid var(--primary);
}

.user-guide-container h3 {
    color: var(--text-primary);
    font-weight: 600;
    font-size: var(--font-size-xl);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.user-guide-container h4 {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: var(--font-size-xl);
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.user-guide-container p {
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.user-guide-container ul,
.user-guide-container ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.user-guide-container li {
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.user-guide-container hr {
    border: none;
    border-top: 2px solid var(--border-glass);
    margin: 2rem 0;
}

.user-guide-container strong {
    color: var(--text-primary);
    font-weight: 600;
}

.user-guide-container code {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: var(--font-size-base);
    color: var(--accent-cyan);
}

.back-btn {
    margin-bottom: 1.5rem;
}

@media print {

    .back-btn,
    .navbar {
        display: none !important;
    }

    .user-guide-container {
        box-shadow: none;
        padding: 0;
        background: white;
    }

    .user-guide-container h1,
    .user-guide-container h2,
    .user-guide-container h3,
    .user-guide-container p,
    .user-guide-container li,
    .user-guide-container strong {
        color: #333;
    }
}

/* --- Lesson List Page styles moved to unified table section --- */

.lesson-name {
    color: var(--text-primary);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.lesson-name:hover {
    color: var(--primary);
}

.item-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    background: rgba(75, 168, 184, 0.15);
    color: var(--accent-cyan);
}

.action-btn.action-btn-edit,
.action-btn.action-btn-delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.action-btn-edit {
    background: linear-gradient(135deg, #D4A04A, #BF9040);
    color: white;
}

.action-btn-edit:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(212, 160, 74, 0.3);
    color: white;
}

.action-btn-delete {
    background: transparent;
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
}

.action-btn-delete:hover {
    background: var(--accent-red);
    color: white;
    transform: scale(1.1);
}

/* --- Import Pages (vat_tu/import.php, bai_hoc/import.php, mon_hoc/import.php) --- */
.import-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.import-card .card-header {
    background: linear-gradient(135deg, var(--accent-green) 0%, #2D7A5A 100%);
    border-radius: 0;
    padding: 1.25rem 1.5rem;
}

.import-card .card-header h4 {
    margin: 0;
    font-weight: 600;
    color: white;
}

.import-card .card-body {
    background: transparent;
    padding: 1.5rem;
}

.btn-import {
    background: linear-gradient(135deg, var(--accent-green) 0%, #2D7A5A 100%);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
}

.btn-import:hover {
    background: linear-gradient(135deg, #2D7A5A 0%, #047857 100%);
    color: white;
    transform: translateY(-1px);
}

.btn-back {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    border-radius: var(--radius-lg);
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

/* --- Avatar Component (tra_cuu/index.php) --- */
.avatar-modern {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-base);
}

.avatar-modern-sm {
    width: 32px;
    height: 32px;
    font-size: var(--font-size-sm);
}

.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-with-icon input {
    padding-left: calc(var(--space-4) + var(--space-4) + 8px);
}

.form-input-lg {
    height: 48px;
    font-size: var(--font-size-base);
}

/* --- Vat Tu Index utilities --- */
.form-input-sm {
    padding: var(--space-1) var(--space-2);
    font-size: var(--font-size-sm);
    height: auto;
}

.btn-group .btn-modern {
    border-radius: 0;
}

.btn-group .btn-modern:first-child {
    border-radius: var(--radius) 0 0 var(--radius);
}

.btn-group .btn-modern:last-child {
    border-radius: 0 var(--radius) var(--radius) 0;
}

.btn-group .btn-modern.active {
    background: var(--primary);
    color: white;
}

/* --- User Management (user/index.php) --- */
.card-modern .table {
    background: transparent !important;
}

.card-modern .table thead {
    background: rgba(255, 255, 255, 0.03) !important;
}

.card-modern .table tbody {
    background: var(--bg-card) !important;
}

.card-modern .table tbody tr {
    background: transparent !important;
}

.card-modern .table tbody td {
    background: transparent !important;
    color: var(--text-primary);
}

/* --- Login Page (user/login.php) --- */
.login-body {
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 20% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(120, 90, 200, 0.1) 0%, transparent 50%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.login-logo {
    font-size: var(--font-size-4xl);
    margin-bottom: var(--space-4);
}

.login-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-2);
}

.login-subtitle {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-6);
}

.login-form .form-group {
    margin-bottom: var(--space-4);
    text-align: left;
}

.login-form .form-label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-2);
}

.login-form .form-control {
    background: var(--bg-primary);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    transition: all var(--transition-fast);
}

.login-form .form-control:focus {
    background: var(--bg-primary);
    border-color: var(--primary);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

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

.login-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-weight: 600;
    font-size: var(--font-size-lg);
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.login-alert {
    background: rgba(224, 96, 96, 0.15);
    border: 1px solid rgba(224, 96, 96, 0.3);
    color: var(--accent-red);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
    font-size: var(--font-size-sm);
}

/* Floating particles for login */
.login-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.login-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(59, 130, 246, 0.3);
    border-radius: 50%;
    animation: floatUp linear infinite;
}

@keyframes floatUp {
    from {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    to {
        transform: translateY(-10vh) scale(1);
        opacity: 0;
    }
}

/* --- Bai Hoc Form page title --- */
.page-title-gradient {
    font-size: var(--font-size-2xl);
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

/* --- Main container (standalone pages without header.php) --- */
.main-container {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    padding: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

/* --- Fullscreen centered layout (for standalone pages) --- */
.fullscreen-center {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* File selector button in dark theme */
.form-control::file-selector-button {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    margin-right: 1rem;
    border-radius: var(--radius-md);
}

/* --- Login Page (user/login.php) - Extended --- */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent-cyan));
}

.login-logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-lg);
    font-size: var(--font-size-3xl);
    color: white;
    box-shadow: 0 0 30px var(--primary-glow);
}

.form-hint {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-4);
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--primary-glow);
}

.btn-login:active {
    transform: translateY(0);
}

.login-footer {
    text-align: center;
    margin-top: var(--space-6);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-glass);
    color: var(--text-muted);
    font-size: var(--font-size-xs);
}

/* Login particles */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: -1;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
    opacity: 0.3;
    animation: float 15s infinite ease-in-out;
}

.particle:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
}

.particle:nth-child(2) {
    left: 20%;
    animation-delay: 2s;
}

.particle:nth-child(3) {
    left: 30%;
    animation-delay: 4s;
}

.particle:nth-child(4) {
    left: 40%;
    animation-delay: 6s;
}

.particle:nth-child(5) {
    left: 50%;
    animation-delay: 8s;
}

.particle:nth-child(6) {
    left: 60%;
    animation-delay: 10s;
}

.particle:nth-child(7) {
    left: 70%;
    animation-delay: 12s;
}

.particle:nth-child(8) {
    left: 80%;
    animation-delay: 14s;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }

    10% {
        opacity: 0.3;
    }

    90% {
        opacity: 0.3;
    }

    100% {
        transform: translateY(-100vh) scale(1);
        opacity: 0;
    }
}

/* --- Nhan Phieu Index (nhan_phieu/index.php) --- */
.status-select {
    font-weight: 500;
    transition: all var(--transition-fast);
    min-width: 100px !important;
    padding: 8px 12px !important;
    font-size: var(--font-size-sm) !important;
    text-align: center;
    border-radius: 20px !important;
    appearance: none;
    -webkit-appearance: none;
    background-image: none !important;
}

.status-select[data-value="Bình thường"] {
    background: var(--accent-green) !important;
    color: white !important;
    border-color: var(--accent-green) !important;
}

.status-select[data-value="Hỏng/Vỡ"] {
    background: var(--accent-red) !important;
    color: white !important;
    border-color: var(--accent-red) !important;
}

.status-select[data-value="Thiếu"] {
    background: #D4A04A !important;
    color: white !important;
    border-color: #D4A04A !important;
}

.material-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-4);
}

.material-header {
    padding: var(--space-3) var(--space-4);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
}

.material-header.hc {
    background: linear-gradient(135deg, #D4A04A 0%, #BF9040 100%);
}

.material-header.dc {
    background: linear-gradient(135deg, #198754 0%, #20c997 100%);
}

.material-header.tb {
    background: linear-gradient(135deg, #0d6efd 0%, #6610f2 100%);
}

/* ==========================================================
   UNIFIED SECTION HEADER COLORS
   Single source of truth for all material category headers.
   Classes: .section-header, .section-header-bar, .ip-section-header
   Modifiers: .hc (amber), .dc (green), .tb (blue), .hong (red), .phu (purple)
   ========================================================== */

/* --- Base section-header (flat style, used in xem_phieu, xem_lan_giao, mon_hoc_xem) --- */
.section-header {
    padding: 12px 20px;
    font-weight: 600;
    font-size: var(--font-size-lg);
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    border-bottom: 1px solid var(--border-glass);
}

.section-header .header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.section-header .badge-count {
    background: rgba(255, 255, 255, 0.9) !important;
    color: #333 !important;
    font-weight: 600;
    margin-left: 8px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: var(--font-size-sm);
    display: inline-block;
}

.section-header .count {
    margin-left: auto;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border-radius: 12px;
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.section-header h5 {
    margin: 0;
    font-weight: 600;
    color: inherit;
}

/* HC = Hóa chất (Amber/Gold) */
.section-header.hc,
.section-header-bar.hc,
.ip-section-header.hc {
    background: linear-gradient(135deg, #D4A04A 0%, #BF9040 100%);
}

/* DC = Dụng cụ (Green) */
.section-header.dc,
.section-header-bar.dc,
.ip-section-header.dc {
    background: linear-gradient(135deg, #198754 0%, #20c997 100%);
}

/* TB = Thiết bị (Blue-Indigo) */
.section-header.tb,
.section-header-bar.tb,
.ip-section-header.tb {
    background: linear-gradient(135deg, #0d6efd 0%, #6610f2 100%);
}

/* Hong = Sự cố / Hỏng (Red) */
.section-header.hong {
    background: linear-gradient(135deg, #dc3545 0%, #c0392b 100%);
}

/* Phu = Mượn thêm (Purple) */
.section-header.phu {
    background: linear-gradient(135deg, #6f42c1 0%, #5e35b1 100%);
}

/* --- section-header-bar (gradient bar, used in tao_phieu, bai_hoc_xem) --- */
.section-header-bar {
    padding: 12px 20px;
    font-weight: 600;
    font-size: var(--font-size-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: white;
}

.section-header-bar .header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-header-bar .count-badge {
    background: rgba(255, 255, 255, 0.9) !important;
    color: #333 !important;
    font-weight: 600;
    margin-left: 8px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: var(--font-size-sm);
    display: inline-block;
}

/* --- ip-section-header (import preview) --- */
.ip-section-header {
    padding: 0.8rem 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white !important;
}

/* --- section-card base (shared across all views) --- */
.section-card {
    border-radius: 12px;
    border: 1px solid var(--border-glass, rgba(255, 255, 255, 0.08));
    background: var(--bg-card, #1a1d2e);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

/* --- Quantity badges (consistent colors) --- */
.qty-badge.qty-hc,
.qty-pill.hc {
    background: rgba(212, 160, 74, 0.2);
    color: #D4A04A;
}

.qty-badge.qty-dc,
.qty-pill.dc {
    background: rgba(25, 135, 84, 0.2);
    color: #20c997;
}

.qty-badge.qty-tb,
.qty-pill.tb {
    background: rgba(13, 110, 253, 0.2);
    color: #60a5fa;
}

.qty-pill.phu {
    background: rgba(111, 66, 193, 0.2);
    color: #a78bfa;
}

/* --- Summary badges (delivery card headers) --- */
.summary-badge.hc {
    background: rgba(212, 160, 74, 0.15);
    color: #D4A04A;
}

.summary-badge.dc {
    background: rgba(25, 135, 84, 0.15);
    color: #20c997;
}

.summary-badge.tb {
    background: rgba(13, 110, 253, 0.15);
    color: #60a5fa;
}

.summary-badge.hong {
    background: rgba(220, 53, 69, 0.15);
    color: #f87171;
}

.summary-badge.phu {
    background: rgba(111, 66, 193, 0.15);
    color: #a78bfa;
}

.material-item {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-glass);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--space-3);
    align-items: start;
}

.material-item:last-child {
    border-bottom: none;
}

.material-name {
    font-weight: 500;
    color: var(--text-primary);
}

.material-spec {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.material-qty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 28px;
    padding: 0 var(--space-2);
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.material-qty.hc {
    background: rgba(77, 184, 138, 0.15);
    color: var(--accent-green);
}

.material-qty.dc {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
}

.material-qty.tb {
    background: rgba(75, 168, 184, 0.15);
    color: var(--accent-cyan);
}

.material-controls {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 140px;
}

.submit-wrapper {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-glass);
    padding: var(--space-4);
    padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    z-index: var(--z-fixed);
}

.submit-wrapper .btn-modern {
    width: 100%;
    padding: var(--space-4);
    font-size: var(--font-size-base);
    font-weight: 600;
}

@media (min-width: 768px) {
    .material-item {
        grid-template-columns: 1fr 120px 180px;
    }

    .material-controls {
        flex-direction: row;
        min-width: auto;
    }

    .submit-wrapper {
        padding: var(--space-4) var(--space-6);
    }
}

/* --- Import Wizard (bai_hoc/import.php, mon_hoc/import.php) --- */
.step-indicator {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-glass);
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.3s;
}

.step.active {
    background: linear-gradient(135deg, var(--accent-green) 0%, #2D7A5A 100%);
    border-color: transparent;
    color: white;
}

.step .num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.drop-zone {
    border: 2px dashed var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 3rem;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
}

.drop-zone h5,
.drop-zone p {
    color: var(--text-primary);
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--accent-green);
    background: rgba(77, 184, 138, 0.08);
}

.drop-zone i {
    font-size: var(--font-size-huge);
    color: var(--accent-green);
    margin-bottom: 1rem;
}

.file-selected {
    background: rgba(77, 184, 138, 0.1);
    border-color: var(--accent-green);
}

.file-selected i {
    color: var(--accent-green);
}

.template-box {
    background: rgba(212, 160, 74, 0.1);
    border: 1px solid rgba(212, 160, 74, 0.3);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-top: 1.5rem;
    color: var(--text-primary);
}

.template-box h6 {
    color: #D4A04A;
}

.template-box ul {
    color: var(--text-secondary);
}

.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 15, 26, 0.95);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.loading-overlay.show {
    display: flex;
}

.loading-overlay .spinner-border {
    width: 4rem;
    height: 4rem;
    border-width: 0.4rem;
}

.loading-overlay h5,
.loading-overlay p {
    color: var(--text-primary);
}

.feature-icon {
    font-size: var(--font-size-3xl);
    margin-bottom: 0.5rem;
}

.feature-card {
    text-align: center;
    padding: 1rem;
}

.feature-card h6,
.feature-section h6 {
    color: var(--text-primary);
}

.feature-card small,
.feature-section small {
    color: var(--text-muted);
}

/* --- Tra Cuu Detail (tra_cuu/detail.php) --- */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
}

.student-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.student-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-red), #D4A04A);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-2xl);
    color: white;
}

.student-info h2 {
    color: var(--text-primary);
    font-weight: 700;
    margin: 0;
}

.student-info .badge-count {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(224, 96, 96, 0.15);
    color: var(--accent-red);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 600;
    margin-top: 4px;
}

.detail-table-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.detail-table {
    width: 100%;
    margin: 0;
}

.detail-table th,
.detail-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-glass);
    color: var(--text-primary);
}

.detail-table thead th {
    background: rgba(255, 255, 255, 0.03);
    font-weight: 600;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    color: var(--text-secondary);
}

.detail-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.detail-table tbody tr:last-child td {
    border-bottom: none;
}

.status-badge {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.status-success {
    background: rgba(77, 184, 138, 0.15);
    color: var(--accent-green);
}

.status-danger {
    background: rgba(224, 96, 96, 0.15);
    color: var(--accent-red);
}

.status-info {
    background: rgba(75, 168, 184, 0.15);
    color: var(--accent-cyan);
}

.status-warning {
    background: rgba(212, 160, 74, 0.15);
    color: #D4A04A;
}

.class-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: rgba(120, 90, 200, 0.15);
    color: var(--secondary);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.qty-value {
    color: var(--accent-red);
    font-weight: 700;
}

.detail-table-card .actions-row {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

@media print {
    .actions-row {
        display: none;
    }

    .detail-table-card {
        border: 1px solid #ddd;
    }

    .detail-table th,
    .detail-table td {
        color: #333;
    }
}

/* --- Search Results (tra_cuu/search_result.php) --- */
.search-results-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.search-results-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 1.25rem 1.5rem;
}

.search-results-header h5 {
    margin: 0;
    font-weight: 600;
}

.search-results-body {
    padding: 1.5rem;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
}

.results-table th,
.results-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-glass);
    color: var(--text-primary);
}

.results-table thead th {
    background: rgba(255, 255, 255, 0.03);
    font-weight: 600;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    color: var(--text-secondary);
}

.results-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.results-table tbody tr:last-child td {
    border-bottom: none;
}

.vat-tu-badge {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(212, 160, 74, 0.15);
    color: #D4A04A;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.qty-count-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(224, 96, 96, 0.15);
    color: var(--accent-red);
    border-radius: 50%;
    font-weight: 700;
    font-size: var(--font-size-sm);
}

.results-count {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* --- Return Success (tra_cuu/return_success.php) --- */
.icon-success {
    font-size: var(--font-size-huge);
    color: var(--accent-green);
    animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }

    to {
        transform: scale(1);
    }
}

/* --- Advanced Search (tim_kiem/index.php) --- */
.search-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.search-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 1.25rem 1.5rem;
}

.search-header h4 {
    margin: 0;
    font-weight: 600;
    font-size: var(--font-size-lg);
}

.search-body {
    padding: 1.5rem;
}

.btn-search {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: var(--radius-md);
    padding: 0.75rem 2rem;
    font-weight: 600;
    color: white;
    transition: all 0.3s ease;
}

.btn-search:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
    color: white;
}

.btn-reset {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.btn-reset:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.btn-export {
    background: linear-gradient(135deg, var(--accent-green) 0%, #2D7A5A 100%);
    border: none;
    border-radius: var(--radius-md);
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    color: white;
    transition: all 0.3s ease;
}

.btn-export:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(77, 184, 138, 0.4);
    color: white;
}

.results-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.results-header {
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.results-header h5 {
    color: var(--text-primary);
}

.stat-badge {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.status-using {
    background: rgba(212, 160, 74, 0.15);
    color: #D4A04A;
}

.status-returned {
    background: rgba(77, 184, 138, 0.15);
    color: var(--accent-green);
}

.status-pending {
    background: rgba(224, 96, 96, 0.15);
    color: var(--accent-red);
}

.status-compensated {
    background: rgba(75, 168, 184, 0.15);
    color: var(--accent-cyan);
}

.incident-badge {
    background: var(--accent-red);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xs);
    font-weight: 700;
}

.no-results {
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-muted);
}

.no-results i {
    font-size: var(--font-size-huge);
    opacity: 0.3;
    margin-bottom: 1rem;
}

.filter-tag {
    display: inline-flex;
    align-items: center;
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.quick-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.quick-stat-item {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    text-align: center;
    transition: all 0.3s ease;
}

.quick-stat-item:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
}

.quick-stat-item .number {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.quick-stat-item .label {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    margin-top: 0.3rem;
}

.date-range-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 2rem;
    color: var(--text-muted);
}

.animate-fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .quick-stats {
        flex-wrap: wrap;
    }

    .quick-stat-item {
        flex: 1 1 45%;
    }
}

/* --- Create QR / Tao Phieu (tao_phieu.php) --- */
.wizard-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-8);
    margin-bottom: var(--space-8);
    padding: var(--space-4) 0;
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    opacity: 0.4;
    transition: all 0.3s ease;
}

.wizard-step.active {
    opacity: 1;
}

.wizard-step.completed {
    opacity: 0.7;
}

.wizard-step-number {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--font-size-lg);
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.wizard-step.active .wizard-step-number {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.wizard-step.completed .wizard-step-number {
    background: var(--accent-green);
    border-color: transparent;
    color: white;
}

.wizard-step-label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.wizard-step.active .wizard-step-label {
    color: var(--text-primary);
}

.wizard-connector {
    width: 80px;
    height: 3px;
    background: var(--border-glass);
    border-radius: 2px;
}

.wizard-connector.completed {
    background: linear-gradient(90deg, var(--accent-green), var(--primary));
}

.selection-card {
    background: var(--bg-card);
    border: 2px solid var(--border-glass);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.selection-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.15);
}

.selection-card.selected {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(120, 90, 200, 0.05));
}

.selection-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.selection-card.selected::before {
    opacity: 1;
}

.selection-card-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(120, 90, 200, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-3xl);
    color: var(--primary);
    margin-bottom: var(--space-4);
}

.selection-card-title {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.selection-card-desc {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.select-wrapper {
    position: relative;
}

.select-modern {
    width: 100%;
    padding: var(--space-4);
    font-size: var(--font-size-lg);
    font-weight: 500;
    background: var(--bg-card);
    border: 2px solid var(--border-glass);
    border-radius: var(--radius-xl);
    color: var(--text-primary);
    appearance: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.select-modern:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.select-modern:hover {
    border-color: var(--primary);
}

.select-modern option {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: var(--space-3);
}

.select-wrapper::after {
    content: '▼';
    position: absolute;
    right: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: var(--font-size-sm);
}

.form-section {
    animation: fadeInUp 0.4s ease forwards;
    margin-top: var(--space-6);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.material-section {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-bottom: var(--space-4);
    animation: fadeInUp 0.4s ease forwards;
}

.material-section-header {
    padding: var(--space-4) var(--space-5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: white;
}

.material-section-header.hc {
    background: linear-gradient(135deg, #D4A04A 0%, #BF9040 100%);
}

.material-section-header.dc {
    background: linear-gradient(135deg, #198754 0%, #20c997 100%);
}

.material-section-header.tb {
    background: linear-gradient(135deg, #0d6efd 0%, #6610f2 100%);
}

.material-section-header i {
    font-size: var(--font-size-xl);
    margin-right: var(--space-2);
}

.count-badge {
    background: rgba(255, 255, 255, 0.25);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
}

.material-table-modern {
    width: 100%;
}

.material-table-modern th,
.material-table-modern td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-glass);
    color: var(--text-primary);
}

.material-table-modern thead th {
    background: rgba(255, 255, 255, 0.03);
    font-weight: 600;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    color: var(--text-secondary);
}

.material-table-modern tbody tr:last-child td {
    border-bottom: none;
}

.material-table-modern tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.material-table-modern input[type="number"],
.material-table-modern input[type="text"] {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    color: var(--text-primary);
    text-align: center;
    min-width: 80px;
    font-weight: 600;
}

.material-table-modern input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.submit-section {
    text-align: center;
    padding: var(--space-6) 0;
    margin-top: var(--space-4);
}

.btn-create-qr {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-8);
    background: linear-gradient(135deg, var(--accent-green) 0%, #2D7A5A 100%);
    color: white;
    font-size: var(--font-size-lg);
    font-weight: 700;
    border: none;
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(77, 184, 138, 0.2);
}

.btn-create-qr:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(77, 184, 138, 0.3);
}

.btn-create-qr i {
    font-size: var(--font-size-2xl);
}

.empty-state-icon {
    font-size: var(--font-size-4xl);
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

@media (max-width: 767.98px) {
    .wizard-container {
        gap: var(--space-4);
    }

    .wizard-step-label {
        display: none;
    }

    .wizard-connector {
        width: 40px;
    }

    .selection-card {
        padding: var(--space-4);
    }

    .selection-card-icon {
        width: 48px;
        height: 48px;
        font-size: var(--font-size-2xl);
    }
}

/* --- Import Preview (bai_hoc/import_preview, mon_hoc/import_preview) --- */
.preview-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    overflow: hidden;
}

.preview-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 1.5rem;
}

.step-indicator {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1rem 0;
}

.step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    font-size: var(--font-size-base);
    color: rgba(255, 255, 255, 0.8);
}

.step.active {
    background: white;
    color: var(--primary);
    font-weight: 600;
}

.step.done {
    background: var(--accent-green);
    color: white;
}

.step .num {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.2);
    font-size: var(--font-size-sm);
}

.step.active .num {
    background: var(--primary);
    color: white;
}

.step.done .num {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

.summary-box {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-item {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
}

.summary-item h3 {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    margin: 0;
}

.summary-item small {
    color: var(--text-muted);
}

.summary-item.total h3 {
    color: var(--primary);
}

.summary-item.existing h3 {
    color: var(--accent-green);
}

.summary-item.new h3 {
    color: #D4A04A;
}

.section-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
}

/* section-header base + colors → centralized in UNIFIED SECTION HEADER COLORS block */

.item-table {
    width: 100%;
    border-collapse: collapse;
}

.item-table th {
    text-align: left;
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.item-table td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border-glass);
    font-size: var(--font-size-base);
    color: var(--text-primary);
}

.badge-status {
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    display: inline-block;
    white-space: nowrap;
}

.badge-exists {
    background: rgba(77, 184, 138, 0.15);
    color: var(--accent-green);
}

.badge-new {
    background: rgba(212, 160, 74, 0.15);
    color: #D4A04A;
}

.badge-auto-mapped {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
    cursor: pointer;
}

.badge-auto-mapped:hover {
    background: rgba(59, 130, 246, 0.25);
}

.mapping-select {
    font-size: var(--font-size-sm);
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-glass);
    background: var(--bg-primary);
    color: var(--text-primary);
    width: 100%;
    max-width: 180px;
}

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

.auto-map-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.auto-map-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.auto-mapped-info {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.auto-map-dropdown {
    display: none;
    margin-top: 4px;
}

.auto-map-dropdown.show {
    display: block;
}

.btn-change-mapping {
    font-size: var(--font-size-2xs);
    color: #fff;
    background: var(--secondary);
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.btn-change-mapping:hover {
    background: var(--primary);
}

.btn-confirm {
    background: linear-gradient(135deg, var(--accent-green) 0%, #2D7A5A 100%);
    border: none;
    padding: 0.8rem 2rem;
    font-weight: 600;
    color: white;
    border-radius: 8px;
}

.btn-confirm:hover {
    background: linear-gradient(135deg, #2D7A5A 0%, #1F6347 100%);
    color: white;
}

/* --- Nhan Phieu Page (nhan_phieu/index.php) --- */
.nhan-phieu-page {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
}

.page-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-5);
}

.page-header h1 {
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin: 0;
}

.page-header .subtitle {
    opacity: 0.8;
    font-size: var(--font-size-sm);
    margin-top: var(--space-1);
}

/* --- Return Success (tra_cuu/return_success.php) --- */
.success-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
}

.success-card h2 {
    color: var(--accent-green) !important;
}

.success-card .text-muted {
    color: var(--text-muted) !important;
}

.success-card .alert-info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--primary);
    border-radius: 10px;
}

.success-card .btn-primary {
    background: linear-gradient(135deg, var(--primary), #6366F1);
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
}

/* Action Buttons - Back/Edit */
.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: var(--font-size-base);
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-action-back {
    background: transparent;
    border: 1px solid var(--border-glass, rgba(255, 255, 255, 0.15));
    color: var(--text-secondary, #a0a0a0);
}

.btn-action-back:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary, #e0e0e0);
}

/* =========================================================
   TABLE MODERN - Consistent across all pages
   ========================================================= */
.table-wrapper-modern {
    background: var(--bg-card);
    backdrop-filter: var(--blur-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.table-responsive-modern {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-modern,
.lesson-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.table-modern th,
.lesson-table th {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-weight: 600;
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--border-glass);
    white-space: nowrap;
}

.table-modern td,
.lesson-table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-glass);
    color: var(--text-primary);
    vertical-align: middle;
    font-size: var(--font-size-sm);
}

.table-modern tbody tr:last-child td,
.lesson-table tbody tr:last-child td {
    border-bottom: none;
}

.table-modern tbody tr:hover,
.lesson-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* =========================================================
   SECTION HEADER - Page titles
   ========================================================= */
.section-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.section-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.section-title i {
    color: var(--primary);
}

/* =========================================================
   RESPONSIVE - Mobile First
   ========================================================= */

/* --- MOBILE: < 768px --- */
@media (max-width: 767.98px) {
    /* Font sizes now handled by clamp() in :root — no override needed */

    .page-title {
        font-size: var(--font-size-xl);
    }

    .section-title {
        font-size: var(--font-size-lg);
    }

    .stat-card-value {
        font-size: var(--font-size-2xl);
    }

    .stat-card {
        padding: var(--space-4);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-3);
    }

    .card-body {
        padding: var(--space-3);
    }

    .card-header {
        padding: var(--space-3) var(--space-4);
        font-size: var(--font-size-sm);
    }

    .table th,
    .table td,
    .table-modern th,
    .table-modern td,
    .lesson-table th,
    .lesson-table td {
        padding: var(--space-2) var(--space-3);
        font-size: var(--font-size-xs);
    }

    .btn {
        padding: var(--space-2) var(--space-3);
        font-size: var(--font-size-xs);
    }

    .btn-lg {
        padding: var(--space-2) var(--space-4);
        font-size: var(--font-size-sm);
    }

    .modal-dialog {
        margin: var(--space-3);
    }

    .modal-body {
        padding: var(--space-3);
    }

    .modal-header {
        padding: var(--space-3) var(--space-4);
    }

    .form-control,
    .form-select {
        padding: var(--space-2) var(--space-3);
        font-size: var(--font-size-sm);
    }

    .page-header {
        margin-bottom: var(--space-4);
    }

    .section-header {
        margin-bottom: var(--space-4);
    }

    /* Hide text on small buttons, show only icon */
    .btn-sm .btn-text {
        display: none;
    }


    /* --- Delivery Card & Expand on Mobile --- */
    .delivery-header {
        padding: var(--space-3);
    }

    .delivery-details-inner {
        padding: var(--space-3);
    }

    .section-card {
        margin-bottom: var(--space-2);
    }

    .section-header {
        padding: 8px 12px;
        font-size: var(--font-size-sm);
    }

    /* ── Compact table on mobile: horizontal scroll like material-table ── */
    .section-card {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .compact-table {
        min-width: 480px;
    }

    .compact-table th,
    .compact-table td {
        padding: 6px 8px;
        font-size: var(--font-size-xs);
    }

    .compact-table thead th {
        font-size: var(--font-size-2xs);
        padding: 5px 8px;
    }

    /* Hide less-important columns on mobile to reduce scroll */
    .compact-table th:nth-child(3),
    .compact-table td:nth-child(3) {
        display: none;
        /* ĐVT */
    }

    .qty-pill {
        padding: 1px 6px;
        font-size: var(--font-size-xs);
    }

    /* Actions row wrap on mobile */
    .actions-row {
        gap: 6px;
    }

    .action-btn {
        font-size: var(--font-size-xs);
        padding: 5px 10px;
    }

    /* Summary badges smaller */
    .summary-badges .badge {
        font-size: var(--font-size-xs);
        padding: 3px 8px;
    }

    /* Material table on mobile */
    .material-table th,
    .material-table td {
        padding: var(--space-2);
        font-size: var(--font-size-xs);
    }
}

/* --- SMALL PHONE: < 375px (iPhone SE, Galaxy A series) --- */
@media (max-width: 374.98px) {
    .stats-grid {
        grid-template-columns: 1fr;
        /* 1 column on tiny screens */
    }

    .bottom-nav-item span {
        font-size: var(--font-size-2xs);
    }

    .bottom-nav-item i {
        font-size: 18px;
    }

    .wizard-step-number {
        width: 36px;
        height: 36px;
        font-size: var(--font-size-sm);
    }

    .wizard-connector {
        width: 24px;
    }

    .page-title {
        font-size: var(--font-size-lg);
    }

    .navbar-brand span {
        display: none;
        /* Only show icon on tiny phones */
    }

    .navbar-modern-v2 {
        padding: var(--space-1) var(--space-2);
        margin: var(--space-2);
    }

    .main-container {
        padding: var(--space-2);
    }

    .selection-card {
        padding: var(--space-3);
    }

    .selection-card-icon {
        width: 40px;
        height: 40px;
        font-size: var(--font-size-xl);
    }

    .stat-card-icon {
        width: 36px;
        height: 36px;
        font-size: var(--font-size-base);
    }

    .action-card {
        padding: var(--space-3);
    }

    .action-card-icon {
        width: 40px;
        height: 40px;
    }
}

/* --- TABLET: 768px - 991px --- */
@media (min-width: 768px) and (max-width: 991.98px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .stat-card-value {
        font-size: var(--font-size-3xl);
    }
}

/* =========================================================
   UTILITY CLASSES - Thay th? inline styles
   ========================================================= */

/* --- Glass surfaces --- */
.surface-glass {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
}

/* --- Alert variants (glass) --- */
.alert-glass {
    border-radius: var(--radius-md);
    padding: var(--space-4);
}

.alert-glass-success {
    background: rgba(77, 184, 138, 0.15);
    border: 1px solid rgba(77, 184, 138, 0.3);
    color: var(--accent-green);
}

.alert-glass-danger {
    background: rgba(224, 96, 96, 0.15);
    border: 1px solid rgba(224, 96, 96, 0.3);
    color: var(--accent-red);
}

.alert-glass-info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--primary);
}

.alert-glass-warning {
    background: rgba(212, 160, 74, 0.15);
    border: 1px solid rgba(212, 160, 74, 0.3);
    color: var(--accent-yellow);
}

/* --- Flex helpers --- */
.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.gap-1 {
    gap: var(--space-1);
}

.gap-2 {
    gap: var(--space-2);
}

.gap-3 {
    gap: var(--space-3);
}

.gap-4 {
    gap: var(--space-4);
}

/* --- Text color helpers --- */
.text-accent-green {
    color: var(--accent-green);
}

.text-accent-red {
    color: var(--accent-red);
}

.text-accent-yellow {
    color: var(--accent-yellow);
}

.text-accent-cyan {
    color: var(--accent-cyan);
}

.text-accent-blue {
    color: var(--primary);
}

.text-muted-glass {
    color: var(--text-muted);
}

/* --- Icon sizes --- */
.icon-hero {
    font-size: var(--font-size-huge);
}

.icon-xl {
    font-size: var(--font-size-3xl);
}

.icon-lg {
    font-size: var(--font-size-2xl);
}

.icon-md {
    font-size: var(--font-size-xl);
}

/* --- Table column widths --- */
.col-id {
    width: 50px;
}

.col-stt {
    width: 40px;
}

.col-action {
    width: 80px;
}

.col-status {
    width: 100px;
}

.col-date {
    width: 120px;
}

.col-name {
    min-width: 140px;
}

/* --- Animation delays --- */
.delay-1 {
    animation-delay: 0.1s;
}

.delay-2 {
    animation-delay: 0.2s;
}

.delay-3 {
    animation-delay: 0.3s;
}

.delay-4 {
    animation-delay: 0.4s;
}

.delay-5 {
    animation-delay: 0.5s;
}

/* --- Border helpers --- */
.border-glass {
    border: 1px solid var(--border-glass);
}

.border-bottom-glass {
    border-bottom: 1px solid var(--border-glass);
}

/* --- Spacing overrides --- */
.p-glass {
    padding: var(--space-5);
}

.p-glass-sm {
    padding: var(--space-3);
}

.mb-0 {
    margin-bottom: 0;
}

.mt-3 {
    margin-top: var(--space-3);
}

.mt-4 {
    margin-top: var(--space-4);
}

/* --- Badge count (section headers) --- */
.badge-count {
    background: #fff !important;
    color: #333 !important;
    margin-left: 8px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: var(--font-size-sm);
}


/* --- Alert glass info variant --- */
.alert-glass-info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--primary);
    border-radius: 10px;
}

/* --- Accessibility: Reduce motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}