/* ============================================================
   InstaFreight — Global Design System
   app/static/css/app.css
   Generated: 2026-05-28
   ============================================================ */

/* ── 1. CSS Custom Properties (Design Tokens) ─────────────── */
:root {
    /* Brand Colors */
    --color-brand-50:  #fff1f1;
    --color-brand-100: #ffd7d7;
    --color-brand-200: #ffaeae;
    --color-brand-400: #f87171;
    --color-brand-500: #f44336;
    --color-brand-600: #c62828;
    --color-brand-700: #b71c1c;
    --color-brand-gradient: linear-gradient(135deg, #c62828 0%, #b71c1c 100%);
    --color-brand-gradient-hover: linear-gradient(135deg, #d32f2f 0%, #c62828 100%);

    /* Surface Colors */
    --bg-canvas:   hsl(210, 40%, 98%);
    --bg-card:     hsl(0, 0%, 100%);
    --bg-elevated: hsl(0, 0%, 100%);
    --bg-muted:    hsl(210, 40%, 96%);
    
    /* Glassmorphism Surface Tokens */
    --bg-glass: rgba(255, 255, 255, 0.75);
    --border-glass: rgba(255, 255, 255, 0.4);
    --backdrop-blur: blur(16px);

    /* Border Colors */
    --border-light:  hsl(214, 32%, 91%);
    --border-subtle: hsl(220, 13%, 95%);
    --border-brand:  rgba(198, 40, 40, 0.25);

    /* Text Colors */
    --text-primary:   hsl(222, 47%, 11%);
    --text-secondary: hsl(215, 14%, 34%);
    --text-muted:     hsl(215, 16%, 47%);
    --text-faint:     hsl(215, 20%, 65%);

    /* Semantic */
    --color-success:  #15803d;
    --color-warning:  #92400e;
    --color-error:    #991b1b;
    --color-info:     #1e40af;

    /* Shadows */
    --shadow-xs:     0 1px 2px 0 rgb(0 0 0 / 0.04);
    --shadow-sm:     0 1px 3px 0 rgb(0 0 0 / 0.05), 0 1px 2px -1px rgb(0 0 0 / 0.04);
    --shadow-md:     0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.04);
    --shadow-lg:     0 10px 15px -3px rgb(0 0 0 / 0.06), 0 4px 6px -4px rgb(0 0 0 / 0.04);
    --shadow-xl:     0 20px 25px -5px rgb(0 0 0 / 0.06), 0 8px 10px -6px rgb(0 0 0 / 0.04);
    --shadow-elite:  0 8px 32px 0 rgba(15, 23, 42, 0.04), 0 1px 2px 0 rgba(0, 0, 0, 0.02);
    --shadow-brand:  0 4px 14px rgb(198 40 40 / 0.2);
    --shadow-brand-lg: 0 8px 24px rgb(198 40 40 / 0.25);

    /* Typography */
    --font-body:    'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-heading: 'Outfit', system-ui, -apple-system, sans-serif;

    /* Border Radius */
    --radius-sm:   6px;
    --radius-md:   10px;
    --radius-lg:   14px;
    --radius-xl:   18px;
    --radius-2xl:  24px;
    --radius-pill: 9999px;

    /* Layout */
    --sidebar-width: 256px;
    --header-height: 64px;
    --mobile-header-height: 56px;

    /* Transition */
    --transition-fast:   0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base:   0.2s  cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.3s  cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── 2. Base Reset & Body ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
body {
    font-family: var(--font-body);
    background-color: var(--bg-canvas);
    background-image: 
        radial-gradient(at 0% 0%, rgba(198, 40, 40, 0.02) 0px, transparent 50%), 
        radial-gradient(at 50% 0%, rgba(99, 102, 241, 0.015) 0px, transparent 50%), 
        radial-gradient(at 100% 0%, rgba(16, 185, 129, 0.01) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.25;
    color: var(--text-primary);
}

/* ── 3. Cross-Browser Scrollbar ──────────────────────────── */
/* Webkit (Chrome, Safari, Edge) */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Custom Scrollbar for specific containers */
.custom-scrollbar::-webkit-scrollbar { width: 6px; height: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9999px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.list-scroll-wrapper {
    max-height: 65vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.5rem;
}
.table-scroll-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 65vh;
    -webkit-overflow-scrolling: touch;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
}

/* ── 4. HTMX Indicators ──────────────────────────────────── */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }
.htmx-request.htmx-indicator { display: inline-block; }

/* ── 5. Sidebar Layout System ────────────────────────────── */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.app-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--bg-card);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-smooth);
    position: relative;
    z-index: 30;
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    min-width: 0;
}

.app-header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    flex-shrink: 0;
    box-shadow: var(--shadow-xs);
}

.app-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background: transparent;
}

/* Mobile Header */
.mobile-header {
    display: none;
    height: var(--mobile-header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-subtle);
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 40;
    box-shadow: var(--shadow-sm);
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 29;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity var(--transition-smooth);
}
.sidebar-overlay.active {
    opacity: 1;
}

/* Mobile breakpoint */
@media (max-width: 767px) {
    .app-layout {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .mobile-header { display: flex; }

    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: min(var(--sidebar-width), 85vw);
        transform: translateX(-110%);
        z-index: 40;
        box-shadow: var(--shadow-xl);
    }
    .app-sidebar.sidebar-open {
        transform: translateX(0);
    }
    .sidebar-overlay { display: block; }

    .app-main {
        height: auto;
        flex: none;
        width: 100%;
    }

    .app-header {
        display: none; /* hidden on mobile — mobile-header replaces it */
    }

    .app-content {
        overflow-y: visible;
        padding: 1rem;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .app-content { padding: 1.5rem; }
    .app-header { padding: 0 1.5rem; }
}

/* ── 6. Navigation Items ─────────────────────────────────── */
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: background var(--transition-fast), color var(--transition-fast);
    text-decoration: none;
    cursor: pointer;
}
.nav-item:hover {
    background: var(--bg-muted);
    color: var(--color-brand-600);
}
.nav-item.active {
    background: var(--color-brand-600);
    color: white;
    box-shadow: 0 2px 8px rgb(198 40 40 / 0.25);
}
.nav-item .nav-icon {
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
}

/* ── 7. Cards ─────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-sm);
}

.card-body { padding: 1.5rem; }

/* Card with hover lift */
.card-hover {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    cursor: pointer;
}
.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.card-hover:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Stat card with left colored border */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.stat-card-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* ── 8. Buttons ──────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-lg);
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all var(--transition-base);
    min-height: 40px; /* touch target */
    white-space: nowrap;
    letter-spacing: 0.01em;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
    background: var(--color-brand-gradient);
    color: white;
    box-shadow: var(--shadow-brand);
}
.btn-primary:hover {
    background: var(--color-brand-gradient-hover);
    box-shadow: var(--shadow-brand-lg);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    background: var(--bg-muted);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}
.btn-secondary:hover {
    background: var(--border-light);
    color: var(--text-primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}
.btn-ghost:hover {
    background: var(--bg-muted);
    color: var(--text-primary);
}

.btn-danger {
    background: #fff1f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
.btn-danger:hover {
    background: #fee2e2;
    color: #7f1d1d;
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.75rem;
    min-height: 32px;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 0.9375rem;
    min-height: 48px;
}

/* Touch-friendly on mobile */
@media (max-width: 767px) {
    .btn { min-height: 44px; }
    .btn-sm { min-height: 40px; }
}

/* ── 9. Badges & Pills ───────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.badge-open     { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.badge-booked   { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-pending  { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.badge-cancelled{ background: #fff1f2; color: #9f1239; border: 1px solid #fecdd3; }
.badge-verified { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.badge-brand    { background: var(--color-brand-50); color: var(--color-brand-600); border: 1px solid var(--color-brand-100); }
.badge-purple   { background: #faf5ff; color: #7c3aed; border: 1px solid #e9d5ff; }
.badge-blue     { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ── 10. Form Elements ───────────────────────────────────── */
.form-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.375rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: var(--radius-md);
    color: #0f172a;
    font-size: 0.8125rem;
    font-family: var(--font-body);
    font-weight: 500;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    min-height: 40px;
    line-height: 1.5;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    background: #ffffff;
    border-color: var(--color-brand-600);
    box-shadow: 0 0 0 3px rgb(198 40 40 / 0.1);
}
.form-input::placeholder,
.form-textarea::placeholder { color: #94a3b8; font-weight: 400; }
.form-input:disabled,
.form-select:disabled { opacity: 0.55; cursor: not-allowed; }

.form-input.is-error,
.form-select.is-error {
    border-color: #f87171;
    background: #fff8f8;
    box-shadow: 0 0 0 3px rgb(248 113 113 / 0.12);
}
.form-error-msg {
    font-size: 0.6875rem;
    color: #dc2626;
    font-weight: 500;
    margin-top: 4px;
    display: none;
}

/* Custom select arrow */
.form-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.875rem center;
    padding-right: 2.5rem;
}

/* Mobile touch targets */
@media (max-width: 767px) {
    .form-input, .form-select, .form-textarea { min-height: 44px; }
}

/* ── 11. Skeleton Loaders ─────────────────────────────────── */
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}
.skeleton-text  { height: 0.875rem; }
.skeleton-title { height: 1.5rem; }
.skeleton-card  { height: 6rem; }
.skeleton-avatar{ width: 2.25rem; height: 2.25rem; border-radius: 50%; }

/* ── 12. Animations ──────────────────────────────────────── */
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in-up {
    animation: fadeSlideUp 0.35s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.fade-in { animation: fadeIn 0.25s ease forwards; }

@keyframes pulse-ring {
    0%   { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(198, 40, 40, 0.7); }
    70%  { transform: scale(1);    box-shadow: 0 0 0 8px rgba(198, 40, 40, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(198, 40, 40, 0); }
}
.notification-pulse { animation: pulse-ring 2s infinite; }

@keyframes float {
    0%,100% { transform: translateY(0)   rotate(0deg); }
    33%      { transform: translateY(-9px) rotate(0.4deg); }
    66%      { transform: translateY(-4px) rotate(-0.3deg); }
}
.float-anim { animation: float 8s ease-in-out infinite; }

/* ── 13. Page Content Stagger ───────────────────────────── */
.page-content > * {
    animation: fadeSlideUp 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.page-content > *:nth-child(1) { animation-delay: 0.02s; }
.page-content > *:nth-child(2) { animation-delay: 0.06s; }
.page-content > *:nth-child(3) { animation-delay: 0.10s; }
.page-content > *:nth-child(4) { animation-delay: 0.14s; }
.page-content > *:nth-child(5) { animation-delay: 0.18s; }

/* ── 14. Empty States ─────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    gap: 1rem;
}
.empty-state img {
    width: clamp(120px, 30%, 200px);
    opacity: 0.9;
    margin-bottom: 0.5rem;
}
.empty-state-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--text-primary);
}
.empty-state-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    max-width: 360px;
    line-height: 1.6;
}

/* Dashed bordered empty state */
.empty-dashed {
    border: 1.5px dashed var(--border-light);
    border-radius: var(--radius-xl);
    padding: 2.5rem 1.5rem;
    text-align: center;
}

/* ── 15. Progress Steps ──────────────────────────────────── */
.progress-steps {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}
.progress-step {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    min-width: 0;
}
.progress-step-dot {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    border: 2px solid var(--border-light);
    background: var(--bg-card);
    color: var(--text-faint);
    transition: all var(--transition-base);
}
.progress-step.active .progress-step-dot {
    background: var(--color-brand-600);
    border-color: var(--color-brand-600);
    color: white;
    box-shadow: 0 0 0 4px var(--color-brand-50);
}
.progress-step.done .progress-step-dot {
    background: #15803d;
    border-color: #15803d;
    color: white;
}
.progress-step-label {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-faint);
    margin-left: 0.5rem;
    white-space: nowrap;
}
.progress-step.active .progress-step-label { color: var(--color-brand-600); }
.progress-step.done .progress-step-label   { color: #15803d; }
.progress-connector {
    flex: 1;
    height: 2px;
    background: var(--border-light);
    margin: 0 0.25rem;
    min-width: 1rem;
}
.progress-connector.done { background: #15803d; }

/* ── 16. Toast Notifications ─────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    font-size: 0.875rem;
    font-weight: 500;
    color: white;
    pointer-events: auto;
    transform: translateY(8px);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: min(360px, calc(100vw - 3rem));
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: #16a34a; }
.toast-error   { background: var(--color-brand-600); }
.toast-info    { background: #2563eb; }
.toast-warning { background: #d97706; }

/* ── 17. Dropdown Panel ──────────────────────────────────── */
.dropdown-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    z-index: 50;
}

/* Notification dropdown responsive */
.notif-dropdown {
    width: 320px;
    max-width: calc(100vw - 2rem);
}

/* ── 18. Mobile List Cards ───────────────────────────────── */
/* On mobile, tables/grids collapse to stacked cards */
@media (max-width: 767px) {
    .mobile-stack { display: flex; flex-direction: column; gap: 0.75rem; }
    .desktop-only { display: none !important; }
}
@media (min-width: 768px) {
    .mobile-only { display: none !important; }
}

/* Item card for list views */
.list-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.list-card:hover {
    border-color: var(--color-brand-100);
    box-shadow: var(--shadow-md);
}

.list-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}
.list-card-route {
    font-size: 0.8125rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-wrap: wrap;
}
.list-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

/* ── 19. Modal & Slide-Over ──────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: fadeIn 0.2s ease;
}
.modal-panel {
    background: var(--bg-card);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    animation: fadeSlideUp 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (max-width: 767px) {
    .modal-backdrop { align-items: flex-end; padding: 0; }
    .modal-panel {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        max-height: 92vh;
        max-width: 100%;
    }
}

/* ── 20. Verification Steps ──────────────────────────────── */
.verification-step {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-lg);
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
}
.verification-step-num {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    flex-shrink: 0;
}

/* ── 21. Utility Helpers ─────────────────────────────────── */
.truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.glass-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

/* Focus visible (keyboard nav accessibility) */
:focus-visible {
    outline: 2px solid var(--color-brand-600);
    outline-offset: 2px;
}

/* Dividers */
.divider {
    border: none;
    border-top: 1px solid var(--border-subtle);
    margin: 1.25rem 0;
}

/* Section label */
.section-label {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ── 22. Responsive Breakpoints Reference ─────────────────
   xs:  < 480px   (small phones)
   sm:  480–767px (large phones)
   md:  768–1023px (tablets)
   lg:  1024–1279px (laptops)
   xl:  ≥ 1280px  (desktops)
   ─────────────────────────────────────────────────────── */

/* ── 23. Elite Slide-Over Drawer Panel ────────────────── */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-smooth);
}
.drawer-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.drawer-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 500px;
    background: var(--bg-card);
    box-shadow: -10px 0 40px -10px rgba(0, 0, 0, 0.12);
    z-index: 101;
    transform: translateX(100%);
    transition: transform var(--transition-spring);
    display: flex;
    flex-direction: column;
}
.drawer-panel.active {
    transform: translateX(0);
}

.drawer-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-muted);
}
.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}
.drawer-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-muted);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

@media (max-width: 767px) {
    .drawer-panel {
        max-width: 100%;
    }
}

/* ── 24. Page Section Headers (Mini Hero) ────────────── */
.page-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 60%, #1e1b4b 100%);
    border-radius: var(--radius-2xl);
    padding: 2rem 2.25rem;
    color: white;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.18), inset 0 1px 0 rgba(255,255,255,0.06);
}
.page-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 60% 50% at 85% 30%, rgba(198, 40, 40, 0.15), transparent),
                radial-gradient(ellipse 50% 40% at 15% 80%, rgba(99, 102, 241, 0.1), transparent);
    pointer-events: none;
}
.page-hero > * { position: relative; z-index: 1; color: inherit; }
.page-hero-title {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.5rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: #ffffff;
}
.page-hero-subtitle {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.72);
    margin-top: 0.375rem;
    font-weight: 400;
}
@media (max-width: 767px) {
    .page-hero { padding: 1.5rem 1.25rem; border-radius: var(--radius-xl); }
    .page-hero-title { font-size: 1.25rem; }
}

/* ── 25. Elite Data Table ───────────────────────────── */
.elite-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8125rem;
}
.elite-table thead th {
    padding: 0.75rem 1rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-faint);
    background: var(--bg-muted);
    border-bottom: 1.5px solid var(--border-light);
    white-space: nowrap;
    text-align: left;
}
.elite-table tbody tr {
    transition: background var(--transition-fast);
}
.elite-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(198, 40, 40, 0.02), rgba(198, 40, 40, 0.04));
}
.elite-table tbody td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    vertical-align: middle;
}
.elite-table tbody tr:last-child td {
    border-bottom: none;
}

/* ── 26. Filter Panel Collapsible ───────────────────── */
.filter-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--transition-base);
}
.filter-panel:hover {
    box-shadow: var(--shadow-md);
}
.filter-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    cursor: pointer;
    user-select: none;
}
.filter-panel-header:hover {
    background: var(--bg-muted);
}
.filter-panel-chevron {
    transition: transform var(--transition-base);
    color: var(--text-faint);
    font-size: 0.75rem;
}
.filter-panel-body {
    padding: 0 1.5rem 1.5rem;
}

/* ── 27. Micro-Animation Utilities ──────────────────── */
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}
.scale-in {
    animation: scaleIn 0.25s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes slideRight {
    from { opacity: 0; transform: translateX(-16px); }
    to   { opacity: 1; transform: translateX(0); }
}
.slide-right {
    animation: slideRight 0.3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes gradientShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.gradient-animate {
    background-size: 200% 200%;
    animation: gradientShift 6s ease infinite;
}

/* ── 28. Premium Info Grid (Detail View) ────────────── */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
}
.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.info-label {
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}
.info-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

/* ── 29. Accent Line (Top Border Gradient) ──────────── */
.accent-top {
    border-top: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--color-brand-600), #6366f1, var(--color-brand-400)) 1;
}

/* ── 30. Animated Counter Badge ─────────────────────── */
.counter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 0.375rem;
    border-radius: var(--radius-pill);
    font-size: 0.6875rem;
    font-weight: 700;
    background: var(--color-brand-600);
    color: white;
    box-shadow: 0 2px 8px rgba(198, 40, 40, 0.3);
    animation: scaleIn 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── 31. Premium Section Card ───────────────────────── */
.section-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-elite);
    overflow: hidden;
}
.section-card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.section-card-body {
    padding: 1.5rem;
}
@media (max-width: 767px) {
    .section-card-header { padding: 1rem 1.25rem; }
    .section-card-body { padding: 1.25rem; }
}

/* ── 32. Glow Effect on Primary Actions ─────────────── */
.glow-brand {
    position: relative;
}
.glow-brand::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(198,40,40,0.4), rgba(99,102,241,0.2));
    filter: blur(12px);
    opacity: 0;
    transition: opacity var(--transition-base);
    z-index: -1;
}
.glow-brand:hover::after {
    opacity: 1;
}

/* ── 33. Smooth Tab Bar ────────────────────────────── */
.tab-bar {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-muted);
    border-radius: var(--radius-lg);
    padding: 0.25rem;
}
.tab-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
}
.tab-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.6);
}
.tab-item.active {
    color: var(--text-primary);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

/* ── 34. Custom Scrollable Form Controls ──────────────── */
.options-list {
    overflow: auto !important;
    white-space: nowrap !important;
}
.options-list .option-item {
    white-space: nowrap !important;
}

.overflow-x-auto {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}
.table-scroll-wrapper {
    overflow: auto !important;
    max-height: 600px;
    -webkit-overflow-scrolling: touch;
}
.table-scroll-wrapper table th, 
.table-scroll-wrapper table td,
.overflow-x-auto table th, 
.overflow-x-auto table td {
    white-space: nowrap;
}
table, .elite-table {
    min-width: 600px; /* Force minimum width to trigger horizontal scroll container on small viewport */
}
@media (min-width: 768px) {
    table, .elite-table {
        min-width: 100%; /* Reset on desktop */
    }
}
