/* ═══════════════════════════════════════════════════════════════
   ציוד גדודי — Military Command Center Design System
   Applied with ui-ux-pro-max guidelines:
   • 4.5:1 contrast ratios (WCAG AA)
   • 44px minimum touch targets
   • 8dp spacing rhythm
   • 150-300ms micro-interaction timing
   • Semantic color tokens
   • Consistent elevation scale
   ═══════════════════════════════════════════════════════════════ */

/* ─── Design Tokens ─── */
:root {
    /* Primary Navy — authoritative, military command */
    --primary-50: #e8edf3;
    --primary-100: #c5d1e1;
    --primary-200: #9fb3cd;
    --primary-300: #7895b9;
    --primary-400: #5b7eaa;
    --primary-500: #1B3A5C;
    --primary-600: #163250;
    --primary-700: #102843;
    --primary-800: #0b1e34;
    --primary-900: #061425;
    --primary: var(--primary-500);
    --primary-light: #2a5080;
    --primary-dark: #0f2640;

    /* Olive Green — IDF military accent */
    --secondary-50: #eef1ec;
    --secondary-100: #d4ddd0;
    --secondary-200: #b8c7b1;
    --secondary-300: #9cb192;
    --secondary-400: #879f7b;
    --secondary-500: #4A6741;
    --secondary-600: #3f5838;
    --secondary-700: #33482d;
    --secondary-800: #273823;
    --secondary-900: #1c2819;
    --secondary: var(--secondary-500);
    --secondary-light: #5d8053;

    /* Teal Accent — tech, modern */
    --accent-50: #e0f5f9;
    --accent-100: #b3e8f2;
    --accent-200: #80d9ea;
    --accent-300: #4dcbe2;
    --accent-400: #26c0dc;
    --accent-500: #00B4D8;
    --accent-600: #009ab9;
    --accent-700: #007f99;
    --accent: var(--accent-500);
    --accent-light: #48CAE4;
    --accent-glow: rgba(0, 180, 216, 0.2);

    /* Semantic surfaces */
    --bg: #F0F2F5;
    --bg-elevated: #F7F8FA;
    --bg-card: #FFFFFF;
    --bg-inset: #E8EBF0;

    /* Semantic text — all pass 4.5:1 on white/light backgrounds */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --text: var(--text-primary);
    --text-light: var(--text-tertiary);

    /* Borders */
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --border-strong: #cbd5e1;

    /* Status colors */
    --danger: #DC3545;
    --danger-bg: #fef2f2;
    --danger-text: #991b1b;
    --success: #16a34a;
    --success-bg: #f0fdf4;
    --success-text: #166534;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --warning-text: #92400e;
    --info: var(--accent);
    --info-bg: var(--accent-50);
    --info-text: var(--accent-700);

    /* Elevation scale (consistent shadow system) */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-md: 0 8px 16px -4px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    --shadow-lg: 0 20px 40px -8px rgba(0,0,0,0.12), 0 8px 16px -4px rgba(0,0,0,0.06);
    --shadow-xl: 0 25px 50px -12px rgba(0,0,0,0.18);

    /* Radii */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Typography */
    --font: 'Heebo', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    --font-size-xs: 11px;
    --font-size-sm: 13px;
    --font-size-base: 14px;
    --font-size-md: 15px;
    --font-size-lg: 16px;
    --font-size-xl: 18px;
    --font-size-2xl: 22px;
    --font-size-3xl: 28px;
    --font-size-4xl: 36px;

    /* Spacing (8dp rhythm) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 28px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Transitions (150-300ms per ui-ux-pro-max rule) */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in: cubic-bezier(0.55, 0.055, 0.675, 0.19);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 150ms;
    --duration-normal: 200ms;
    --duration-slow: 300ms;
    --transition: all var(--duration-normal) var(--ease-out);

    /* Z-index scale */
    --z-base: 0;
    --z-dropdown: 10;
    --z-sticky: 20;
    --z-fixed: 40;
    --z-sidebar: 100;
    --z-mobile-toggle: 150;
    --z-modal: 1000;
    --z-confirm: 2000;
    --z-toast: 3000;

    /* Sidebar */
    --sidebar-width: 260px;
}

/* ─── Reset ─── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
    direction: rtl;
    font-family: var(--font);
    font-size: 16px;
    color: var(--text);
    background: var(--bg);
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body { min-height: 100vh; line-height: 1.5; }

/* Lucide SVG icon defaults */
svg.lucide { display: inline-block; vertical-align: middle; }

/* Global default icon size */
i > svg, .lucide-icon { width: 16px; height: 16px; }

a { color: var(--accent-600); text-decoration: none; transition: color var(--duration-fast) var(--ease-out); }
a:hover { color: var(--accent-700); text-decoration: underline; }

::selection { background: var(--accent-100); color: var(--primary-900); }

/* Focus visible — accessibility rule: 2-4px visible focus ring */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}

/* Remove default focus for mouse users */
:focus:not(:focus-visible) { outline: none; }

/* ═══════════════════════════════════
   LAYOUT
   ═══════════════════════════════════ */

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ─── */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-800) 0%, var(--primary) 40%, var(--primary-600) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    z-index: var(--z-sidebar);
    transition: transform var(--duration-slow) var(--ease-out);
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 39px,
            rgba(255,255,255,0.02) 39px,
            rgba(255,255,255,0.02) 40px
        );
    pointer-events: none;
}

.sidebar-header {
    padding: var(--space-6) var(--space-5);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    position: relative;
}

.sidebar-header .logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-600) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.5px;
    box-shadow: 0 4px 12px rgba(0, 180, 216, 0.3);
    flex-shrink: 0;
}

.sidebar-header h2 {
    font-size: var(--font-size-xl);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.3px;
}

.sidebar-header small {
    font-size: var(--font-size-xs);
    opacity: 0.55;
    display: block;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4) var(--space-3);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.nav-section { margin-bottom: var(--space-6); }

.nav-section-title {
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.4;
    padding: 0 var(--space-3);
    margin-bottom: var(--space-2);
    font-weight: 500;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-3);
    border-radius: var(--radius);
    color: rgba(255,255,255,0.7);
    transition: all var(--duration-fast) var(--ease-out);
    cursor: pointer;
    font-size: var(--font-size-base);
    text-decoration: none;
    min-height: 44px; /* touch target minimum */
    position: relative;
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: white;
    text-decoration: none;
}

.nav-item:active {
    transform: scale(0.98);
}

.nav-item.active {
    background: rgba(0, 180, 216, 0.15);
    color: white;
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--accent);
    border-radius: 3px;
}

.nav-item i { font-size: 18px; width: 22px; text-align: center; flex-shrink: 0; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.user-avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-600) 100%);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--font-size-base);
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.15);
}

.user-name { font-size: var(--font-size-base); font-weight: 600; }
.user-role { font-size: var(--font-size-sm); opacity: 0.6; }

.btn-logout {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.8);
    border: 1px solid rgba(255,255,255,0.08);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-family: var(--font);
    width: 100%;
    justify-content: center;
    transition: var(--transition);
    text-decoration: none;
    min-height: 40px;
}

.btn-logout svg { width: 16px; height: 16px; }
.btn-logout:hover {
    background: rgba(220,53,69,0.15);
    border-color: rgba(220,53,69,0.3);
    color: #fca5a5;
    text-decoration: none;
}

/* ─── Main Content ─── */
.main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    padding: 0;
    min-height: 100vh;
    background: var(--bg);
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.page-content {
    flex: 1;
    padding: var(--space-6) var(--space-8);
}

/* ═══════════════════════════════════
   HERO BANNER
   ═══════════════════════════════════ */

.hero-banner {
    background: linear-gradient(135deg, var(--primary-800) 0%, var(--primary) 40%, var(--primary-600) 70%, var(--secondary-700) 100%);
    color: white;
    padding: var(--space-8) var(--space-8);
    position: relative;
    overflow: hidden;
}

/* Animated grid overlay */
.hero-banner::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        linear-gradient(90deg, transparent 49.5%, rgba(255,255,255,0.03) 49.5%, rgba(255,255,255,0.03) 50.5%, transparent 50.5%),
        linear-gradient(0deg, transparent 49.5%, rgba(255,255,255,0.03) 49.5%, rgba(255,255,255,0.03) 50.5%, transparent 50.5%);
    background-size: 40px 40px;
    animation: gridMove 25s linear infinite;
}

@keyframes gridMove {
    0% { transform: translate(0,0); }
    100% { transform: translate(40px,40px); }
}

/* Scanline effect */
.hero-banner::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(0deg, transparent 50%, rgba(255,255,255,0.015) 50%);
    background-size: 100% 4px;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-6);
}

.hero-title {
    font-size: var(--font-size-3xl);
    font-weight: 800;
    margin-bottom: var(--space-1);
    letter-spacing: -0.5px;
}

.hero-subtitle {
    font-size: var(--font-size-base);
    opacity: 0.75;
    font-weight: 300;
}

.hero-pills {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.hero-pill {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    border: 1px solid rgba(255,255,255,0.12);
    font-weight: 400;
    transition: var(--transition);
}

.hero-pill:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.2);
}

.hero-pill svg { width: 14px; height: 14px; }

.hero-pill .pill-value {
    font-weight: 700;
    font-size: var(--font-size-lg);
    font-family: var(--font-mono);
}

.hero-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    pointer-events: none;
    z-index: 1;
}

.hero-orb-1 {
    width: 220px; height: 220px;
    background: var(--accent);
    opacity: 0.12;
    top: -60px; left: 8%;
    animation: orbFloat 8s ease-in-out infinite;
}

.hero-orb-2 {
    width: 160px; height: 160px;
    background: var(--secondary);
    opacity: 0.08;
    bottom: -40px; right: 25%;
    animation: orbFloat 11s ease-in-out infinite reverse;
}

@keyframes orbFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-25px) scale(1.05); }
}

/* ═══════════════════════════════════
   STATS CARDS
   ═══════════════════════════════════ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    transition: all var(--duration-normal) var(--ease-out);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 3px;
    height: 100%;
    opacity: 0;
    transition: opacity var(--duration-fast) var(--ease-out);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border);
}

.stat-card:hover::after { opacity: 1; }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg { width: 22px; height: 22px; }

.stat-icon.blue { background: var(--accent-50); color: var(--accent-600); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning); }
.stat-icon.navy { background: var(--primary-50); color: var(--primary); }

.stat-card:has(.stat-icon.blue)::after { background: var(--accent); }
.stat-card:has(.stat-icon.green)::after { background: var(--success); }
.stat-card:has(.stat-icon.red)::after { background: var(--danger); }
.stat-card:has(.stat-icon.orange)::after { background: var(--warning); }
.stat-card:has(.stat-icon.navy)::after { background: var(--primary); }

.stat-info h3 {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    font-family: var(--font);
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.stat-info p {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-top: var(--space-1);
    font-weight: 400;
}

/* ═══════════════════════════════════
   CARDS
   ═══════════════════════════════════ */

.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: box-shadow var(--duration-normal) var(--ease-out);
}

.card:hover { box-shadow: var(--shadow); }

.card-header {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-elevated);
}

.card-header h3 {
    font-size: var(--font-size-lg);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-primary);
}

.card-header h3 i { color: var(--accent-600); font-size: 18px; }
.card-header h3 svg { width: 18px; height: 18px; color: var(--accent-600); flex-shrink: 0; }

.card-body { padding: var(--space-5); }

/* ═══════════════════════════════════
   TABLES
   ═══════════════════════════════════ */

.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-base);
}

thead { background: var(--bg-elevated); }

th {
    padding: var(--space-3) var(--space-4);
    text-align: right;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    position: sticky;
    top: 0;
    background: var(--bg-elevated);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    color: var(--text-primary);
}

tbody tr {
    transition: background var(--duration-fast) var(--ease-out);
}

tbody tr:hover td { background: var(--bg-elevated); }
tbody tr:last-child td { border-bottom: none; }

/* Sortable table headers */
th.sortable-th { transition: color var(--duration-fast) var(--ease-out); }
th.sortable-th:hover { color: var(--accent-600); }
th.sortable-th::after {
    content: '⇅';
    margin-right: 4px;
    font-size: 10px;
    opacity: 0.3;
}
th.sort-asc::after { content: '▲'; opacity: 0.8; color: var(--accent-600); }
th.sort-desc::after { content: '▼'; opacity: 0.8; color: var(--accent-600); }
th.sort-asc, th.sort-desc { color: var(--accent-600); }

/* ═══════════════════════════════════
   BUTTONS
   Per ui-ux-pro-max: min 44px touch, press feedback, disabled states
   ═══════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    font-family: var(--font);
    text-decoration: none;
    line-height: 1.4;
    min-height: 36px;
    position: relative;
    user-select: none;
    letter-spacing: 0.1px;
}

.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.97); }

/* Lucide SVG icons inside buttons */
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-light); }

.btn-accent {
    background: var(--accent-600);
    color: white;
}
.btn-accent:hover {
    background: var(--accent-700);
}

.btn-success {
    background: var(--success);
    color: white;
}
.btn-success:hover { background: #15803d; }

.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover { background: #b91c1c; }

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg-elevated); border-color: var(--border-strong); color: var(--text-primary); }

.btn-secondary {
    background: var(--secondary);
    color: white;
}
.btn-secondary:hover { background: var(--secondary-light); }

.btn-sm { padding: 4px 10px; font-size: var(--font-size-xs); min-height: 28px; border-radius: var(--radius-xs); }
.btn-sm svg { width: 13px; height: 13px; }
.btn-lg { padding: 10px 20px; font-size: var(--font-size-base); min-height: 44px; }
.btn-lg svg { width: 18px; height: 18px; }

.btn:disabled, .btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    min-height: unset;
}
.btn-icon svg { width: 15px; height: 15px; }

/* ═══════════════════════════════════
   FORMS
   Per ui-ux-pro-max: visible labels, helper text, focus management
   ═══════════════════════════════════ */

.form-group { margin-bottom: var(--space-4); }

.form-group label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.form-control {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: var(--font-size-base);
    font-family: var(--font);
    transition: all var(--duration-fast) var(--ease-out);
    background: white;
    color: var(--text-primary);
    min-height: 44px; /* touch target */
}

.form-control::placeholder { color: var(--text-tertiary); }

.form-control:hover { border-color: var(--border-strong); }

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 14px center;
    padding-left: 36px;
    cursor: pointer;
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

/* ═══════════════════════════════════
   BADGES
   ═══════════════════════════════════ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.badge-active { background: var(--success-bg); color: var(--success-text); }
.badge-pending { background: var(--warning-bg); color: var(--warning-text); }
.badge-returned { background: var(--accent-50); color: var(--accent-700); }
.badge-danger { background: var(--danger-bg); color: var(--danger-text); }
.badge-info { background: var(--accent-50); color: var(--accent-700); }

/* ═══════════════════════════════════
   MODALS
   Per user rules: NEVER close on outside click
   Per ui-ux-pro-max: animate from trigger source, proper scrim
   ═══════════════════════════════════ */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: var(--z-modal);
    justify-content: center;
    align-items: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalIn var(--duration-slow) var(--ease-spring);
}

@keyframes modalIn {
    from { transform: scale(0.92) translateY(20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: var(--font-size-xl);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
    transform: rotate(90deg);
}

.modal-body { padding: var(--space-6); }

.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-start;
    gap: var(--space-3);
    background: var(--bg-elevated);
}

/* ═══════════════════════════════════
   CUSTOM CONFIRM DIALOG
   Per user rules: custom styled, NEVER browser confirm()
   ═══════════════════════════════════ */

.confirm-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: var(--z-confirm);
    justify-content: center;
    align-items: center;
}

.confirm-overlay.active { display: flex; }

.confirm-dialog {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    max-width: 420px;
    width: 90%;
    text-align: center;
    color: var(--text-primary);
    animation: modalIn var(--duration-slow) var(--ease-spring);
    box-shadow: var(--shadow-xl);
}

.confirm-icon { font-size: 48px; margin-bottom: var(--space-4); color: var(--warning); }
.confirm-icon svg { width: 48px; height: 48px; }
.confirm-title { font-size: var(--font-size-2xl); font-weight: 700; margin-bottom: var(--space-2); color: var(--text-primary); }
.confirm-message { font-size: var(--font-size-base); color: var(--text-secondary); margin-bottom: var(--space-6); line-height: 1.7; }

.confirm-buttons { display: flex; gap: var(--space-3); justify-content: center; }

/* ═══════════════════════════════════
   SEARCH & FILTER BAR
   ═══════════════════════════════════ */

.toolbar {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
    flex-wrap: wrap;
    align-items: center;
}

.search-box {
    flex: 1;
    min-width: 220px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: var(--space-3) var(--space-4) var(--space-3) 42px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: var(--font-size-base);
    font-family: var(--font);
    transition: var(--transition);
    background: white;
    min-height: 44px;
}

.search-box input:hover { border-color: var(--border-strong); }

.search-box input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-box > svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    width: 16px;
    height: 16px;
    pointer-events: none;
    z-index: 1;
}

.filter-tabs {
    display: flex;
    gap: var(--space-1);
    background: var(--bg-inset);
    padding: var(--space-1);
    border-radius: var(--radius);
}

.filter-tab {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-family: var(--font);
    color: var(--text-secondary);
    transition: var(--transition);
    min-height: 36px;
}

.filter-tab.active {
    background: white;
    color: var(--primary);
    font-weight: 600;
    box-shadow: var(--shadow-xs);
}

.filter-tab:hover:not(.active) { color: var(--text-primary); }

/* ═══════════════════════════════════
   SIGNATURE PAD
   ═══════════════════════════════════ */

.signature-container {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-md);
    padding: var(--space-2);
    background: white;
    text-align: center;
}

.signature-container canvas {
    width: 100%;
    height: 200px;
    cursor: crosshair;
    border-radius: var(--radius);
}

.signature-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-2);
    justify-content: center;
}

/* ═══════════════════════════════════
   ACTIVITY FEED
   ═══════════════════════════════════ */

.activity-feed { list-style: none; }

.activity-item {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border-light);
    align-items: flex-start;
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    margin-top: 7px;
    flex-shrink: 0;
}

.activity-dot.login { background: var(--accent); }
.activity-dot.create { background: var(--success); }
.activity-dot.edit { background: var(--warning); }
.activity-dot.delete { background: var(--danger); }
.activity-dot.checkout { background: var(--secondary); }

.activity-text { font-size: var(--font-size-sm); line-height: 1.6; color: var(--text-primary); }
.activity-time { font-size: var(--font-size-xs); color: var(--text-tertiary); margin-top: 2px; }

/* ═══════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════ */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-400) 40%, var(--accent-700) 70%, var(--secondary-500) 100%);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        linear-gradient(90deg, transparent 49.5%, rgba(255,255,255,0.025) 49.5%, rgba(255,255,255,0.025) 50.5%, transparent 50.5%),
        linear-gradient(0deg, transparent 49.5%, rgba(255,255,255,0.025) 49.5%, rgba(255,255,255,0.025) 50.5%, transparent 50.5%);
    background-size: 40px 40px;
    animation: gridMove 25s linear infinite;
}

.login-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl), 0 0 80px rgba(0, 180, 216, 0.08);
    width: 90%;
    max-width: 420px;
    position: relative;
    z-index: 2;
    overflow: hidden;
    animation: modalIn var(--duration-slow) var(--ease-spring);
}

.login-header {
    background: linear-gradient(135deg, var(--primary-400) 0%, var(--primary) 100%);
    color: white;
    padding: var(--space-8);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-header::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(0, 180, 216, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(74, 103, 65, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.login-logo {
    width: 68px;
    height: 68px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-600) 100%);
    border-radius: var(--radius-lg);
    margin: 0 auto var(--space-4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 800;
    box-shadow: 0 8px 24px rgba(0, 180, 216, 0.35);
    position: relative;
    z-index: 1;
}

.login-header h1 {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    margin-bottom: var(--space-1);
    position: relative;
    z-index: 1;
}

.login-header p {
    font-size: var(--font-size-base);
    opacity: 0.7;
    position: relative;
    z-index: 1;
    font-weight: 300;
}

.login-body { padding: var(--space-8); }

.login-body .form-control {
    height: 48px;
    font-size: var(--font-size-md);
}

.login-body .btn {
    width: 100%;
    min-height: 48px;
    font-size: var(--font-size-lg);
    justify-content: center;
}

.otp-section { display: none; }
.otp-section.active { display: block; }
.credentials-section.hidden { display: none; }

.otp-inputs {
    display: flex;
    gap: var(--space-2);
    justify-content: center;
    direction: ltr;
    margin: var(--space-5) 0;
}

.otp-input {
    width: 48px;
    height: 58px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    transition: var(--transition);
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.otp-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: white;
}

/* ═══════════════════════════════════
   SMS SIGN PAGE (Public)
   ═══════════════════════════════════ */

.sign-container {
    min-height: 100vh;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-5);
}

.sign-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    overflow: hidden;
}

.sign-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-700) 100%);
    color: white;
    padding: var(--space-6);
    text-align: center;
}

.sign-body { padding: var(--space-6); }

.sign-details {
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin-bottom: var(--space-5);
    border: 1px solid var(--border-light);
}

.sign-detail-row {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border-light);
    font-size: var(--font-size-base);
}

.sign-detail-row:last-child { border-bottom: none; }
.sign-detail-label { color: var(--text-secondary); min-width: 100px; flex-shrink: 0; }
.sign-detail-value { font-weight: 600; color: var(--text-primary); }

/* ═══════════════════════════════════
   CHECKOUT STEPS
   ═══════════════════════════════════ */

.checkout-steps {
    display: flex;
    gap: var(--space-1);
    margin-bottom: var(--space-8);
    padding: 0 var(--space-5);
    position: relative;
}

.step {
    flex: 1;
    text-align: center;
    position: relative;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--bg-inset);
    color: var(--text-tertiary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--font-size-base);
    margin-bottom: var(--space-2);
    transition: all var(--duration-slow) var(--ease-spring);
    border: 2px solid transparent;
}

.step.active .step-number {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-600) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 180, 216, 0.3);
    transform: scale(1.05);
}

.step.completed .step-number {
    background: var(--success);
    color: white;
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.25);
}

.step-label {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    font-weight: 400;
}

.step.active .step-label { color: var(--text-primary); font-weight: 600; }
.step.completed .step-label { color: var(--success-text); }

.step-content { display: none; }
.step-content.active { display: block; animation: fadeIn var(--duration-slow) var(--ease-out); }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════ */

.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-5);
    color: var(--text-tertiary);
}

.empty-state i { font-size: 56px; margin-bottom: var(--space-4); opacity: 0.3; }
.empty-state svg { width: 56px; height: 56px; margin-bottom: var(--space-4); opacity: 0.3; }
.empty-state h3 { font-size: var(--font-size-xl); color: var(--text-secondary); margin-bottom: var(--space-2); font-weight: 600; }
.empty-state p { font-size: var(--font-size-base); max-width: 300px; margin: 0 auto; line-height: 1.6; }

/* ─── Low stock ─── */
.low-stock {
    color: var(--danger);
    font-weight: 700;
    font-family: var(--font-mono);
}

/* ═══════════════════════════════════
   TOAST NOTIFICATIONS
   Per ui-ux-pro-max: auto-dismiss 3-5s, aria-live for accessibility
   ═══════════════════════════════════ */

.toast-container {
    position: fixed;
    top: var(--space-5);
    left: var(--space-5);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.toast {
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    color: white;
    font-size: var(--font-size-base);
    box-shadow: var(--shadow-lg);
    animation: toastSlide var(--duration-slow) var(--ease-spring);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 300px;
    font-weight: 500;
    transition: all var(--duration-slow) var(--ease-out);
}

.toast-success { background: linear-gradient(135deg, var(--success) 0%, #15803d 100%); }
.toast-error { background: linear-gradient(135deg, var(--danger) 0%, #b91c1c 100%); }
.toast-info { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-600) 100%); }

@keyframes toastSlide {
    from { transform: translateX(-120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ═══════════════════════════════════
   PERMISSION CHECKBOXES
   ═══════════════════════════════════ */

.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-2);
}

.permission-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-elevated);
    border-radius: var(--radius);
    font-size: var(--font-size-sm);
    border: 1px solid var(--border-light);
    transition: var(--transition);
    cursor: pointer;
    min-height: 40px;
}

.permission-item:hover { border-color: var(--accent-200); background: var(--accent-50); }

.permission-item input[type="checkbox"] {
    accent-color: var(--accent);
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

/* ═══════════════════════════════════
   MOBILE TOGGLE
   Min 44px touch target per ui-ux-pro-max
   ═══════════════════════════════════ */

.mobile-toggle {
    display: none;
    position: fixed;
    top: var(--space-3);
    right: var(--space-3);
    z-index: var(--z-mobile-toggle);
    width: 48px;
    height: 48px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.mobile-toggle svg { width: 22px; height: 22px; }
.mobile-toggle:hover { background: var(--primary-light); }
.mobile-toggle:active { transform: scale(0.95); }

/* ═══════════════════════════════════
   FOOTER
   ═══════════════════════════════════ */

.app-footer {
    text-align: center;
    padding: var(--space-4) var(--space-3);
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

.app-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.app-footer a:hover {
    text-decoration: underline;
}

/* ═══════════════════════════════════
   RESPONSIVE
   Per ui-ux-pro-max: mobile-first, systematic breakpoints
   ═══════════════════════════════════ */

@media (max-width: 1024px) {
    .page-content { padding: var(--space-5) var(--space-6); }
}

@media (max-width: 768px) {
    .mobile-toggle { display: flex; }

    .sidebar {
        transform: translateX(100%);
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: -8px 0 40px rgba(0,0,0,0.25);
    }

    .main-content { margin-right: 0; }

    .page-content { padding: var(--space-4); }

    .hero-banner { padding: var(--space-5) var(--space-4); }

    .hero-content {
        flex-direction: column;
        gap: var(--space-4);
        text-align: center;
    }

    .hero-title { font-size: var(--font-size-2xl); }

    .hero-pills { justify-content: center; }

    .stats-grid { grid-template-columns: 1fr 1fr; gap: var(--space-2); }
    .stat-card { padding: var(--space-2) var(--space-3); gap: var(--space-2); }
    .stat-icon { width: 36px; height: 36px; }
    .stat-info h3 { font-size: 18px; }
    .stat-info p { font-size: 11px; }

    .form-row { grid-template-columns: 1fr; }

    .toolbar { flex-direction: column; }
    .toolbar .search-box { min-width: unset; }

    .modal { width: 95%; max-height: 90vh; }

    table { font-size: var(--font-size-sm); }
    th, td { padding: var(--space-2) var(--space-3); }

    .checkout-steps { flex-wrap: wrap; gap: var(--space-3); }

    .card-header { padding: var(--space-3) var(--space-4); }
    .card-body { padding: var(--space-4); }
    .modal-body { padding: var(--space-4); }
    .modal-header { padding: var(--space-4) var(--space-5); }
    .modal-footer { padding: var(--space-3) var(--space-5); }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr 1fr; gap: var(--space-1); }
    .stat-card { padding: var(--space-2); gap: var(--space-1); flex-direction: column; align-items: center; text-align: center; }
    .stat-icon { width: 30px; height: 30px; font-size: 14px; }
    .stat-info h3 { font-size: 16px; }
    .stat-info p { font-size: 10px; }
    .login-card { width: 95%; }
    .login-body { padding: var(--space-6); }
    .otp-input { width: 42px; height: 50px; font-size: 20px; }
    .hero-title { font-size: var(--font-size-xl); }

    .confirm-dialog { padding: var(--space-6); }
    .confirm-title { font-size: var(--font-size-xl); }
}

/* ═══════════════════════════════════
   PRINT
   ═══════════════════════════════════ */

@media print {
    .sidebar, .mobile-toggle, .toolbar, .btn, .toast-container { display: none !important; }
    .main-content { margin-right: 0 !important; }
    .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
    .hero-banner { background: #1B3A5C !important; -webkit-print-color-adjust: exact; }
    .hero-banner::before, .hero-banner::after, .hero-orb { display: none; }
}

/* ═══════════════════════════════════
   REDUCED MOTION
   Per ui-ux-pro-max: respect prefers-reduced-motion
   ═══════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .stat-card:hover { transform: none; }
    .btn:active { transform: none; }
    .nav-item:active { transform: none; }
}

/* ═══════════════════════════════════
   SCROLLBAR STYLING
   ═══════════════════════════════════ */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ═══════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════ */

.text-mono { font-family: var(--font-mono); }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-muted { color: var(--text-secondary) !important; }

/* ═══════════════════════════════════
   PAGE ENTRANCE ANIMATIONS
   ═══════════════════════════════════ */

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeSlideRight {
    from { opacity: 0; transform: translateX(-16px); }
    to { opacity: 1; transform: translateX(0); }
}

.page-content > .toolbar {
    animation: fadeSlideUp 0.35s var(--ease-out) both;
}

.page-content > .card {
    animation: fadeSlideUp 0.4s var(--ease-out) 0.08s both;
}

/* ═══════════════════════════════════
   ENHANCED TABLE ROWS
   ═══════════════════════════════════ */

tbody tr {
    animation: fadeSlideRight 0.3s var(--ease-out) both;
}

tbody tr:nth-child(1) { animation-delay: 0.02s; }
tbody tr:nth-child(2) { animation-delay: 0.04s; }
tbody tr:nth-child(3) { animation-delay: 0.06s; }
tbody tr:nth-child(4) { animation-delay: 0.08s; }
tbody tr:nth-child(5) { animation-delay: 0.1s; }
tbody tr:nth-child(6) { animation-delay: 0.12s; }
tbody tr:nth-child(7) { animation-delay: 0.14s; }
tbody tr:nth-child(8) { animation-delay: 0.16s; }
tbody tr:nth-child(9) { animation-delay: 0.18s; }
tbody tr:nth-child(10) { animation-delay: 0.2s; }
tbody tr:nth-child(n+11) { animation-delay: 0.22s; }

/* ═══════════════════════════════════
   CHECKOUT STEP CONNECTOR LINES
   ═══════════════════════════════════ */

.checkout-steps {
    counter-reset: step;
    justify-content: center;
    padding-top: 4px;
}

.step::after {
    content: '';
    position: absolute;
    top: 20px;
    left: -50%;
    width: 100%;
    height: 2px;
    background: var(--border);
    z-index: -1;
    transition: background var(--duration-slow) var(--ease-out);
}

.step:first-child::after { display: none; }

.step.completed::after,
.step.active::after {
    background: var(--accent);
}

/* ═══════════════════════════════════
   SOLDIER LIST (Checkout page)
   ═══════════════════════════════════ */

.soldier-item {
    border-bottom: 1px solid var(--border-light) !important;
    transition: all var(--duration-fast) var(--ease-out) !important;
    border-radius: var(--radius-sm);
    margin: 0 var(--space-1);
}

.soldier-item:hover {
    background: var(--accent-50) !important;
    border-color: var(--accent-200) !important;
    padding-right: 20px !important;
}

.soldier-item.selected {
    background: var(--accent-50) !important;
    border-right: 3px solid var(--accent) !important;
}

/* ═══════════════════════════════════
   DATA DISPLAY ENHANCEMENT
   ═══════════════════════════════════ */

td .text-mono,
.data-value {
    font-family: var(--font-mono);
    font-weight: 600;
    letter-spacing: -0.3px;
}

.data-ltr {
    direction: ltr;
    text-align: right;
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* ═══════════════════════════════════
   GROUPS CARD GRID
   ═══════════════════════════════════ */

.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: var(--space-4);
}

.groups-grid .card {
    transition: all var(--duration-normal) var(--ease-out);
    display: flex;
    flex-direction: column;
}

.groups-grid .card .card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.groups-grid .card .card-body .perm-tags {
    flex: 1;
}

.groups-grid .card .card-body > div:last-child {
    margin-top: auto;
    padding-top: var(--space-3);
}

.groups-grid .card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.groups-grid .card:nth-child(1) { animation: fadeSlideUp 0.35s var(--ease-out) 0.05s both; }
.groups-grid .card:nth-child(2) { animation: fadeSlideUp 0.35s var(--ease-out) 0.1s both; }
.groups-grid .card:nth-child(3) { animation: fadeSlideUp 0.35s var(--ease-out) 0.15s both; }
.groups-grid .card:nth-child(4) { animation: fadeSlideUp 0.35s var(--ease-out) 0.2s both; }
.groups-grid .card:nth-child(5) { animation: fadeSlideUp 0.35s var(--ease-out) 0.25s both; }
.groups-grid .card:nth-child(6) { animation: fadeSlideUp 0.35s var(--ease-out) 0.3s both; }

/* ═══════════════════════════════════
   PERMISSION TAGS (Groups page)
   ═══════════════════════════════════ */

.perm-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-bottom: var(--space-3);
}

.perm-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    white-space: nowrap;
}

.perm-tag.users,
.perm-tag.inventory,
.perm-tag.checkouts,
.perm-tag.groups,
.perm-tag.reports,
.perm-tag.audit,
.perm-tag.settings { background: var(--bg-inset); color: var(--text-secondary); border: 1px solid var(--border-light); }

/* ═══════════════════════════════════
   REPORT SUMMARY CARDS
   ═══════════════════════════════════ */

.report-section {
    animation: fadeSlideUp 0.4s var(--ease-out) both;
    margin-bottom: var(--space-5);
}

.report-section:nth-child(2) {
    animation-delay: 0.1s;
}

/* ═══════════════════════════════════
   AUDIT LOG ACTION BADGES
   ═══════════════════════════════════ */

.audit-time {
    white-space: nowrap;
    font-size: var(--font-size-sm);
    font-family: var(--font-mono);
    color: var(--text-secondary);
    letter-spacing: -0.3px;
}

.audit-ip {
    direction: ltr;
    text-align: right;
    font-size: var(--font-size-xs);
    font-family: var(--font-mono);
    color: var(--text-tertiary);
}

/* ═══════════════════════════════════
   MY EQUIPMENT - SECTION CARDS
   ═══════════════════════════════════ */

.equipment-section {
    margin-bottom: var(--space-5);
    animation: fadeSlideUp 0.4s var(--ease-out) both;
}

.equipment-section:nth-child(2) {
    animation-delay: 0.1s;
}

.equipment-section .card-header h3 i {
    font-size: 18px;
}

/* Active equipment badge pulse */
.badge-active-pulse {
    background: var(--success-bg);
    color: var(--success-text);
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.2); }
    50% { box-shadow: 0 0 0 4px rgba(22, 163, 74, 0); }
}

/* ═══════════════════════════════════
   FILTER TABS ENHANCEMENT
   ═══════════════════════════════════ */

.filter-tabs {
    border: 1px solid var(--border-light);
}

.filter-tab {
    position: relative;
}

.filter-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    right: 10%;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}

/* ═══════════════════════════════════
   QUANTITY HIGHLIGHT CELLS
   ═══════════════════════════════════ */

.qty-cell {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: var(--font-size-base);
}

.qty-cell.available { color: var(--success); }
.qty-cell.low { color: var(--danger); }
.qty-cell.neutral { color: var(--text-primary); }

/* ═══════════════════════════════════
   EXPORT BUTTONS (Reports page hero)
   ═══════════════════════════════════ */

.export-pill {
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    border: 1px solid rgba(255,255,255,0.15);
    color: white;
    text-decoration: none;
    transition: all var(--duration-fast) var(--ease-out);
    cursor: pointer;
}

.export-pill:hover {
    background: rgba(255,255,255,0.22);
    border-color: rgba(255,255,255,0.3);
    transform: translateY(-1px);
    color: white;
    text-decoration: none;
}

.export-pill:active {
    transform: scale(0.97);
}

/* ═══════════════════════════════════
   MOBILE RESPONSIVE ADDITIONS
   ═══════════════════════════════════ */

@media (max-width: 768px) {
    /* Prevent horizontal scroll on all pages */
    html, body { overflow-x: hidden; }
    .page-content { overflow-x: hidden; }
    .groups-grid { grid-template-columns: 1fr; }
    .perm-tags { gap: var(--space-1); }
    .perm-tag { font-size: 9px; padding: 2px 6px; }

    /* Filter tabs: horizontal scroll instead of wrap */
    .filter-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .filter-tabs::-webkit-scrollbar { display: none; }
    .filter-tab { flex-shrink: 0; }

    /* ─── Mobile Table → Card View ─── */
    .table-wrapper table thead { display: none; }
    .table-wrapper table,
    .table-wrapper table tbody { display: block; width: 100%; }
    .table-wrapper table tbody tr {
        display: block;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        margin-bottom: var(--space-3);
        padding: var(--space-3) var(--space-4);
        box-shadow: var(--shadow-xs);
    }
    .table-wrapper table tbody tr:hover td { background: transparent; }
    .table-wrapper table tbody td {
        display: flex;
        align-items: baseline;
        padding: var(--space-2) 0;
        border-bottom: 1px solid var(--border-light);
        gap: var(--space-3);
    }
    .table-wrapper table tbody td::before {
        content: attr(data-label) ":";
        font-weight: 600;
        font-size: var(--font-size-sm);
        color: var(--text-secondary);
        flex-shrink: 0;
        min-width: 80px;
    }
    .table-wrapper table tbody td:last-child { border-bottom: none; }
    /* Hide empty label cells */
    .table-wrapper table tbody td[data-label=""]::before { display: none; }
    .table-wrapper table tbody td[data-label=""] {
        justify-content: center;
        padding-top: var(--space-3);
    }

    /* Fix LTR cells (numbers, IPs, phones) in card view - keep flex layout RTL */
    .table-wrapper table tbody td.data-ltr,
    .table-wrapper table tbody td.audit-ip,
    .table-wrapper table tbody td.audit-time {
        direction: rtl !important;
    }

    /* IP address centered in audit card */
    .table-wrapper table tbody td.audit-ip {
        justify-content: center;
    }

    /* Toolbar buttons stack on mobile */
    .toolbar .btn { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
    .export-pill { font-size: var(--font-size-xs); padding: var(--space-1) var(--space-3); }

    /* Toast full-width on small phones */
    .toast-container { left: var(--space-3); right: var(--space-3); }
    .toast { min-width: unset; width: 100%; font-size: var(--font-size-sm); }

    /* Checkout steps vertical */
    .checkout-steps {
        flex-direction: column;
        align-items: center;
        gap: var(--space-2);
        padding: 0 var(--space-3);
    }
    .checkout-steps .step::after { display: none; }

    /* Modal tighter on very small screens */
    .modal { width: 98%; max-height: 95vh; border-radius: var(--radius-md); }
    .modal-header { padding: var(--space-3) var(--space-4); }
    .modal-header h3 { font-size: var(--font-size-lg); }
    .modal-body { padding: var(--space-3) var(--space-4); }
    .modal-footer { padding: var(--space-3) var(--space-4); gap: var(--space-2); }
    .modal-footer .btn { flex: 1; justify-content: center; }

    /* Permission grid single column */
    .permission-grid { grid-template-columns: 1fr; }

    /* Card header/body tighter */
    .card-header { padding: var(--space-2) var(--space-3); }
    .card-header h3 { font-size: var(--font-size-base); }
    .card-body { padding: var(--space-3); }

    /* Sign detail rows stack */
    .sign-detail-row { flex-direction: column; gap: var(--space-1); }
    .sign-detail-label { min-width: unset; }

    /* Buttons full width */
    .btn-lg { width: 100%; justify-content: center; }

    /* Hero pills smaller */
    .hero-pill { padding: var(--space-1) var(--space-3); font-size: var(--font-size-xs); }
    .hero-pill .pill-value { font-size: var(--font-size-base); }
}

/* Very narrow phones (320-360px) */
@media (max-width: 360px) {
    .sidebar { width: 88vw; }
    .page-content { padding: var(--space-3); }
    .otp-input { width: 36px; height: 44px; font-size: 18px; }
    .login-body { padding: var(--space-4); }
    .login-header { padding: var(--space-6); }
    .stat-card { padding: var(--space-1); }
    .stat-icon { width: 26px; height: 26px; font-size: 12px; }
    .stat-info h3 { font-size: 14px; }
    .stat-info p { font-size: 9px; }
}

/* ═══════════════════════════════════
   REDUCED MOTION - new animations
   ═══════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    tbody tr { animation: none; }
    .page-content > .toolbar,
    .page-content > .card,
    .groups-grid .card,
    .equipment-section,
    .report-section { animation: none; }
    .badge-active-pulse { animation: none; }
}
