:root {
    --primary: #AAC4F5;
    --primary-dark: #8CA9FF;
    --primary-light: #e8f0fe;
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.05);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.08), 0 8px 10px -6px rgb(0 0 0 / 0.05);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

input, select, textarea, button {
    -webkit-appearance: none;
    appearance: none;
    border-radius: 0;
}

input[type="checkbox"], input[type="radio"] {
    -webkit-appearance: auto;
    appearance: auto;
}

.glass {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.card {
    background: var(--white);
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--gray-100);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
}

.card-body { padding: 1.5rem; }

.stat-card {
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.stat-card .stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-card .stat-label {
    color: var(--gray-500);
    font-size: 0.875rem;
    font-weight: 500;
}

.stat-card .stat-change {
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    display: inline-block;
    margin-top: 0.5rem;
}

.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    padding: 0.625rem 1.25rem;
    transition: var(--transition);
    font-size: 0.875rem;
}

.btn-primary {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: var(--white);
}

.btn-primary:hover {
    background: #7b9aff;
    border-color: #7b9aff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(140, 169, 255, 0.4);
}

.btn-soft {
    background: var(--primary-light);
    color: var(--primary-dark);
    border: none;
}

.btn-soft:hover {
    background: var(--primary);
    color: var(--gray-800);
}

.btn-danger-soft {
    background: #fef2f2;
    color: var(--danger);
    border: none;
}

.btn-danger-soft:hover {
    background: #fee2e2;
    color: var(--danger);
}

.btn-success-soft {
    background: #ecfdf5;
    color: var(--success);
    border: none;
}

.form-control, .form-select {
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    transition: var(--transition);
    background: var(--white);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(140, 169, 255, 0.15);
    outline: none;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
    color: var(--gray-600);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.875rem 1rem;
}

.table tbody td {
    padding: 0.875rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.875rem;
}

.badge {
    padding: 0.375rem 0.75rem;
    font-weight: 500;
    border-radius: 999px;
    font-size: 0.75rem;
}

.badge-success { background: #ecfdf5; color: var(--success); }
.badge-warning { background: #fffbeb; color: var(--warning); }
.badge-danger { background: #fef2f2; color: var(--danger); }
.badge-info { background: #eff6ff; color: var(--info); }
.badge-cancelled { background: #f3f4f6; color: #6b7280; }
.badge-pending { background: #fffbeb; color: #d97706; }
.badge-released { background: #eff6ff; color: #2563eb; }
.badge-confirmed { background: #ecfdf5; color: #059669; }
.badge-returned { background: #fef2f2; color: #dc2626; }
.badge-completed { background: #f0fdf4; color: #16a34a; }

.alert {
    border: none;
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
}

.sidebar {
    width: 0;
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    background: var(--white);
    border-right: 1px solid var(--gray-100);
    transition: width 0.3s ease;
}
.sidebar.open {
    width: 260px;
    overflow-y: auto;
    z-index: 1070;
    box-shadow: 0 0 40px rgba(0,0,0,0.18);
}
.sidebar.open .nav-wrap {
    overflow-y: visible;
}
.sidebar.open ~ .main-content::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1049;
    pointer-events: none;
}
.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar .brand { flex-shrink: 0; }
.sidebar .nav-wrap {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}
.sidebar .nav-wrap::-webkit-scrollbar { width: 5px; }
.sidebar .nav-wrap::-webkit-scrollbar-track { background: transparent; }
.sidebar .nav-wrap::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 4px; visibility: hidden; }
.sidebar .nav-wrap:hover::-webkit-scrollbar-thumb { visibility: visible; }
.sidebar .nav-wrap::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

.sidebar .brand {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar .brand .logo-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--white);
    font-weight: 700;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.sidebar .brand .brand-text { flex: 1; min-width: 0; }
.sidebar .brand h5 {
    font-weight: 700;
    margin: 0;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar .brand small {
    color: var(--gray-500);
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.sidebar .brand .collapse-toggle {
    width: 28px; height: 28px;
    align-items: center; justify-content: center;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xs);
    background: var(--white);
    color: var(--gray-400);
    cursor: pointer;
    font-size: 0.75rem;
    transition: var(--transition);
    flex-shrink: 0;
}
.sidebar .brand .collapse-toggle:hover {
    background: var(--gray-50);
    color: var(--gray-600);
}

/* collapsed sidebar (legacy, hidden toggle) */
.sidebar.collapsed { width: 0; overflow: hidden; }
.sidebar.collapsed .brand { padding: 1rem 0; justify-content: center; }
.sidebar.collapsed .brand .brand-text { display: none; }
.sidebar.collapsed .brand .collapse-toggle { display: flex; }
.sidebar.collapsed .nav-section { display: none; }
.sidebar.collapsed .nav-item { padding: 0.75rem 0; justify-content: center; }
.sidebar.collapsed .nav-item i { width: auto; font-size: 1.125rem; margin: 0; }
.sidebar.collapsed .nav-item .nav-label { display: none; }
.sidebar.collapsed ~ .main-content { margin-left: 75px; }
.sidebar.collapsed .collapse-toggle i { transform: scaleX(-1); }

.sidebar .nav-section {
    padding: 1rem 1.5rem 0.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray-400);
    font-weight: 600;
}

.sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--gray-600);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.875rem;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.sidebar .nav-item:hover {
    background: var(--gray-50);
    color: var(--gray-800);
}

.sidebar .nav-item.active {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-left-color: var(--primary-dark);
}

.sidebar .nav-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.main-content {
    margin-left: 0;
    min-height: 100vh;
    -webkit-overflow-scrolling: touch;
}

body.stale-mode .main-content {
    margin-left: 0 !important;
    width: 100%;
    max-width: 100%;
}

body.stale-mode .content-wrapper {
    padding-left: 1rem;
    padding-right: 1rem;
}

body.stale-mode .topbar {
    padding-left: 1rem;
    padding-right: 1rem;
    width: 100%;
}

@media (min-width: 769px) {
    body.stale-mode .main-content {
        width: 100vw;
        margin-left: 0 !important;
    }
}

/* Desktop: the sidebar is a persistent rail that can collapse to an
   icon-only mini rail. The topbar hamburger toggles between them. */
@media (min-width: 769px) {
    .sidebar {
        width: 260px;
        overflow-y: auto;
        box-shadow: none;
        z-index: 1000;
    }
    .sidebar .sidebar-close {
        display: none;
    }
    .sidebar.open {
        width: 260px;
        overflow-y: auto;
        box-shadow: none;
    }
    .sidebar.open ~ .main-content::before {
        content: none;
    }
    .sidebar ~ .main-content {
        margin-left: 260px;
        transition: margin-left 0.3s ease;
    }
    .sidebar.collapsed {
        width: 75px;
    }
    .sidebar.collapsed ~ .main-content {
        margin-left: 75px;
    }
    .sidebar.collapsed .brand {
        padding: 1.5rem 0;
        justify-content: center;
    }
    .sidebar.collapsed .brand .brand-text {
        display: none;
    }
    .sidebar .brand .collapse-toggle {
        display: none;
    }
    .sidebar.collapsed .brand .collapse-toggle {
        display: none;
    }
    .sidebar.collapsed .nav-section {
        display: none;
    }
    .sidebar.collapsed .nav-item {
        padding: 0.85rem 0;
        justify-content: center;
        position: relative;
    }
    .sidebar.collapsed .nav-item i {
        width: auto;
        font-size: 1.125rem;
        margin: 0;
    }
    .sidebar.collapsed .nav-item .nav-label {
        display: none;
    }
    /* The logout/role blocks at the bottom of the rail collapse to the icon too */
    .sidebar.collapsed .nav-wrap > div:not(.nav-section):not(.nav-item) {
        padding: 0.85rem 0 !important;
        display: flex;
        justify-content: center;
        border-top: 1px solid var(--gray-100);
    }
    .sidebar.collapsed .nav-wrap > div:not(.nav-section):not(.nav-item) .nav-label,
    .sidebar.collapsed .nav-wrap > div:not(.nav-section):not(.nav-item) form {
        display: none !important;
    }
    .sidebar.collapsed .nav-wrap > div:not(.nav-section):not(.nav-item) a {
        padding: 0.5rem 0 !important;
        justify-content: center !important;
        display: flex !important;
    }
}

.sidebar {
    -webkit-overflow-scrolling: touch;
}

.topbar {
    padding: 1rem 2rem;
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar .search-box {
    position: relative;
    width: 320px;
}

.topbar .search-box input {
    padding-left: 2.5rem;
    border-radius: 50px;
    background: var(--gray-50);
    border: 1px solid transparent;
}

.topbar .search-box input:focus {
    background: var(--white);
    border-color: var(--primary-dark);
}

.topbar .search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

.content-wrapper {
    padding: 1.5rem 2rem;
}

.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.avatar-sm { width: 28px; height: 28px; font-size: 0.75rem; }
.avatar-lg { width: 48px; height: 48px; font-size: 1.25rem; }

.avatar-primary { background: var(--primary-light); color: var(--primary-dark); }
.avatar-success { background: #ecfdf5; color: var(--success); }
.avatar-warning { background: #fffbeb; color: var(--warning); }
.avatar-danger { background: #fef2f2; color: var(--danger); }
.avatar-info { background: #eff6ff; color: var(--info); }

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: #ffffff;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background: radial-gradient(circle at 30% 50%, rgba(170, 196, 245, 0.3) 0%, transparent 50%),
                radial-gradient(circle at 70% 50%, rgba(140, 169, 255, 0.3) 0%, transparent 50%);
    animation: loginBg 20s ease infinite;
}

@keyframes loginBg {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(5%, 5%) rotate(1deg); }
    66% { transform: translate(-5%, -2%) rotate(-1deg); }
}

.login-card {
    width: 100%;
    max-width: 340px;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
    position: relative;
    z-index: 1;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-card .login-header {
    text-align: center;
    margin-bottom: 0.5rem;
}

.login-card .login-header .logo {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 0.3rem;
    font-size: 0.9rem;
    color: var(--white);
    font-weight: 800;
}

.login-card h4 {
    font-weight: 700;
    color: var(--gray-900);
    font-size: 0.95rem;
    margin-bottom: 0.15rem;
}

.login-card p {
    color: var(--gray-500);
    font-size: 0.65rem;
    margin-bottom: 0;
}

.floating-shapes {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0; left: 0;
    pointer-events: none;
    z-index: 0;
}

.shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.15;
    animation: float 15s infinite;
}

.shape:nth-child(1) {
    width: 300px; height: 300px;
    background: var(--primary);
    top: -100px; right: -100px;
    animation-delay: 0s;
}

.shape:nth-child(2) {
    width: 200px; height: 200px;
    background: var(--primary-dark);
    bottom: -50px; left: -50px;
    animation-delay: -5s;
}

.shape:nth-child(3) {
    width: 150px; height: 150px;
    background: var(--primary);
    bottom: 30%; right: 10%;
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
}

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
}

.toast-custom {
    background: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 1rem 1.25rem;
    min-width: 300px;
    margin-bottom: 0.5rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state i {
    font-size: 3rem;
    color: var(--gray-300);
    margin-bottom: 1rem;
}

.empty-state h6 { color: var(--gray-500); }
.empty-state p { color: var(--gray-400); font-size: 0.875rem; }

.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-xs);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card { height: 120px; }
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text-sm { height: 10px; width: 60%; }

.progress {
    height: 8px;
    border-radius: 999px;
    background: var(--gray-100);
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 999px;
    transition: width 0.5s ease;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.page-subtitle {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 3rem;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary-dark);
    background: var(--primary-light);
}

.upload-zone i {
    font-size: 3rem;
    color: var(--gray-300);
    margin-bottom: 1rem;
}

.upload-zone h6 { font-weight: 600; }

.upload-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.upload-preview .file-item {
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.upload-preview .file-item i { color: var(--danger); cursor: pointer; }

.attendance-scanner {
    text-align: center;
    padding: 2rem;
}

.attendance-scanner #scanner {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    border-radius: var(--radius);
    overflow: hidden;
}

.attendance-scanner .scan-result {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: var(--radius-sm);
    animation: slideUp 0.3s ease;
}

.attendance-scanner .scan-result.success {
    background: #ecfdf5;
    color: var(--success);
}

.attendance-scanner .scan-result.error {
    background: #fef2f2;
    color: var(--danger);
}

.pagination .page-link {
    border: none;
    padding: 0.5rem 0.75rem;
    color: var(--gray-600);
    border-radius: var(--radius-xs);
    margin: 0 2px;
    font-size: 0.875rem;
}

.pagination .page-item.active .page-link {
    background: var(--primary-dark);
    color: var(--white);
}

.mobile-tabs { display: none; }

@media (max-width: 768px) {
    :root {
        --radius: 12px;
        --radius-sm: 8px;
    }
    .sidebar {
        width: 0;
        overflow: hidden;
        transition: width 0.3s ease;
    }
    .sidebar.open {
        width: 100vw;
        overflow-y: auto;
        z-index: 1070;
    }
    .sidebar.open .nav-wrap {
        overflow-y: visible;
    }
    .sidebar.open ~ .main-content::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 1049;
        pointer-events: none;
    }
    .main-content {
        margin-left: 0;
    }
    .content-wrapper {
        padding: 1.25rem 0.75rem;
        padding-bottom: 5rem;
    }
    .topbar {
        padding: 0.5rem 0.75rem;
        padding-top: env(safe-area-inset-top, 0.5rem);
    }
    .topbar .search-box {
        width: auto;
        flex: 1;
        max-width: 200px;
    }
    .topbar .search-box input {
        font-size: 16px;
    }
    .sidebar-toggle {
        display: flex !important;
    }
    .stat-card .stat-value {
        font-size: 1.5rem;
    }
    .stat-card {
        padding: 1rem;
    }
    .stat-card .stat-icon {
        width: 36px; height: 36px;
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    .card {
        border-radius: var(--radius);
    }
    .card-header {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }
    .card-body {
        padding: 0.75rem;
    }
    .table thead th {
        padding: 0.5rem 0.5rem;
        font-size: 0.65rem;
    }
    .table tbody td {
        padding: 0.5rem 0.5rem;
        font-size: 0.8rem;
    }
    .btn {
        padding: 0.5rem 0.875rem;
        font-size: 0.8rem;
    }
    .form-control, .form-select {
        padding: 0.5rem 0.75rem;
        font-size: 16px;
    }
    .page-title {
        font-size: 1.125rem;
    }
    .page-subtitle {
        font-size: 0.8rem;
        margin-bottom: 1rem;
    }
    .content-wrapper h1.page-title {
        line-height: 1.3;
    }
    .dropdown-menu {
        position: fixed;
        top: auto !important;
        left: 0.5rem !important;
        right: 0.5rem !important;
        bottom: 0.5rem !important;
        width: auto !important;
        transform: none !important;
        border-radius: var(--radius);
        max-height: 70vh;
        overflow-y: auto;
    }
    .upload-zone {
        padding: 1.5rem;
    }
    .upload-zone i {
        font-size: 2rem;
    }
    input, select, textarea {
        font-size: 16px !important;
    }
    .dropdown-menu {
        padding-bottom: calc(env(safe-area-inset-bottom, 0.5rem) + 0.5rem) !important;
    }
    .table tbody tr:active {
        background: var(--gray-50);
    }
    .table tbody td:first-child {
        padding-left: 0.75rem;
    }
    .table tbody td:last-child {
        padding-right: 0.75rem;
    }
    .form-check-input {
        width: 1.25em;
        height: 1.25em;
        margin-top: 0;
    }
    .btn-sm {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }
    .btn-tour {
        bottom: 4.5rem !important;
        right: 0.75rem !important;
        padding: 0.5rem 0.75rem !important;
        font-size: 0.7rem !important;
        border-radius: 50px !important;
    }
    .table-responsive {
        margin: 0 -0.75rem;
        width: calc(100% + 1.5rem);
    }
    .login-card {
        padding: 1.5rem;
        margin: 1rem;
        max-width: none;
        border-radius: var(--radius);
    }
    .login-card .login-header .logo {
        width: 48px; height: 48px;
        font-size: 1.25rem;
    }
    input, select, textarea {
        font-size: 16px !important;
    }
    .dropdown-menu {
        padding-bottom: calc(env(safe-area-inset-bottom, 0.5rem) + 0.5rem) !important;
    }
}

/* Phones in landscape / fullscreen (Safari, Firefox, Chrome home-screen or
   fullscreen mode): the viewport is wider than 768px, so the desktop left
   rail would otherwise appear. Keep the hamburger drawer behaviour instead. */
@media (max-width: 900px) and (hover: none) and (max-height: 500px) {
    .sidebar {
        width: 0;
        overflow: hidden;
        transition: width 0.3s ease;
    }
    .sidebar.open {
        width: 100vw;
        overflow-y: auto;
        z-index: 1070;
    }
    .sidebar.open .nav-wrap {
        overflow-y: visible;
    }
    .sidebar.open ~ .main-content::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 1049;
        pointer-events: none;
    }
    .main-content {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: flex !important;
    }
    .sidebar-close {
        display: flex !important;
    }
}

@media (max-width: 768px) {
    .mobile-tabs {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1060;
        background: var(--white);
        border-top: 1px solid var(--gray-100);
        padding: 0.25rem 0;
        padding-bottom: env(safe-area-inset-bottom, 0.25rem);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    }
    .mobile-tab {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 0.375rem 0;
        color: var(--gray-400);
        text-decoration: none;
        font-size: 0.6rem;
        transition: var(--transition);
        gap: 0.125rem;
    }
    .mobile-tab i {
        font-size: 1.25rem;
    }
    .mobile-tab span {
        font-size: 0.6rem;
        font-weight: 500;
    }
    .mobile-tab:active {
        color: var(--primary-dark);
        transform: scale(0.95);
    }
}

@media (max-width: 480px) {
    .topbar .search-box {
        width: 120px;
    }
    .topbar .search-box input {
        font-size: 14px;
        padding: 0.375rem 0.75rem;
        padding-left: 2rem;
    }
    .stat-card .stat-value {
        font-size: 1.25rem;
    }
    .content-wrapper {
        padding: 0.5rem;
        padding-bottom: 4.5rem;
    }
    .row.g-3 > [class*="col-"] {
        padding-right: 0.375rem;
        padding-left: 0.375rem;
    }
    .row.g-3 {
        margin-right: -0.375rem;
        margin-left: -0.375rem;
    }
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.dropdown-menu {
    border: none;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-xl);
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: var(--radius-xs);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.dropdown-item:hover {
    background: var(--gray-50);
}

.notification-dot {
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    position: absolute;
    top: 0;
    right: 0;
}

.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-xl);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1050;
    display: none;
}

.search-results-dropdown.show {
    display: block;
}

.search-result-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--gray-700);
    transition: var(--transition);
}

.search-result-item:hover {
    background: var(--gray-50);
}

.search-result-item .result-type {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
    font-weight: 600;
}

.loading-spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary-dark);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.page-enter {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

tr.htmx-swapping {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Table-to-card view for all screen sizes */
table.table-card-view thead { display: none; }
table.table-card-view tbody tr {
    display: flex; flex-direction: column;
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow);
    background: var(--white);
}
table.table-card-view tbody td {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.35rem 0;
    border: none;
    font-size: 0.8rem;
    gap: 0.5rem;
}
table.table-card-view tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--gray-500);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
    min-width: 80px;
}
table.table-card-view tbody td:empty { display: none; }
table.table-card-view tbody tr:active {
    background: var(--gray-50);
}

/* Invigilator chat */
.chat-msg {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 0.5rem;
}
.chat-msg-mine {
    justify-content: flex-end;
}
.chat-name {
    font-size: 0.62rem;
    font-weight: 700;
    color: #8e8e93;
    margin-bottom: 0.15rem;
}
.chat-msg-mine .chat-name {
    text-align: right;
}
.chat-bubble {
    max-width: 78%;
    background: #f5f5f7;
    border-radius: 14px 14px 14px 4px;
    padding: 0.55rem 0.8rem;
    font-size: 0.83rem;
    word-break: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.chat-msg-mine .chat-bubble {
    background: #eef4ff;
    border-radius: 14px 14px 4px 14px;
}
.chat-time {
    font-size: 0.6rem;
    color: #aeaeb2;
    margin-top: 0.2rem;
    text-align: right;
}

/* ===== WhatsApp-style invigilator chat ===== */
.chat-wa {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 0.35rem;
}
.chat-wa-mine {
    justify-content: flex-end;
}
.chat-wa-inner {
    max-width: 80%;
    display: flex;
    flex-direction: column;
}
.chat-wa-bubble {
    position: relative;
    padding: 0.45rem 0.65rem 0.3rem;
    font-size: 0.83rem;
    line-height: 1.35;
    word-break: break-word;
    box-shadow: 0 1px 0.5px rgba(0,0,0,0.08);
    border-radius: 8px;
}
.chat-wa-inner:not(.chat-wa-mine) .chat-wa-bubble {
    background: #ffffff;
    border-top-left-radius: 2px;
}
.chat-wa-mine .chat-wa-bubble {
    background: #d9fdd3;
    border-top-right-radius: 2px;
}
.chat-wa-time {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.2rem;
    font-size: 0.62rem;
    color: rgba(0,0,0,0.45);
    margin-top: 0.1rem;
    min-width: 46px;
    user-select: none;
}
.chat-wa-ticks {
    color: #53bdeb;
    font-size: 0.68rem;
    line-height: 1;
}
.chat-wa-ticks.unread {
    color: #8696a0;
}
.chat-wa-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}
.chat-wa-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}
.chat-wa-avatar.mine {
    order: 2;
}
.chat-wa-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f0f2f5;
    border-radius: 50px;
    padding: 0.35rem 0.35rem 0.35rem 1rem;
}
.chat-wa-input input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.85rem;
}
.chat-wa-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #00a884;
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.chat-wa-send:disabled {
    opacity: 0.5;
}

/* ===== Seating map - Apple Maps style floor plan ===== */
#seatingBoard {
    position: relative;
    overflow: hidden;
    min-height: 240px;
    border-radius: 24px;
    padding: 1.1rem 0.9rem 0.7rem;
    background:
        radial-gradient(90% 70% at 50% -10%, rgba(255,255,255,0.95), rgba(255,255,255,0) 58%),
        repeating-linear-gradient(0deg, rgba(80,92,115,0.06) 0 1px, transparent 1px 44px),
        repeating-linear-gradient(90deg, rgba(80,92,115,0.06) 0 1px, transparent 1px 44px),
        linear-gradient(180deg, #eef0f4 0%, #e7eaf0 100%);
    box-shadow:
        inset 0 0 0 1px rgba(0,0,0,0.06),
        inset 0 1px 0 rgba(255,255,255,0.9),
        0 14px 40px -18px rgba(20,30,60,0.35);
}
#seatingBoard.seat-zoomed {
    overflow: auto;
}
.seat-zoom-btn {
    min-width: 26px;
    height: 26px;
    border: none;
    border-radius: 50px;
    background: #f0f3f8;
    color: #55607a;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.4rem;
    transition: all 0.15s ease;
}
.seat-zoom-btn:hover { background: #8b5cf6; color: #fff; }
.seat-zoom-lbl { font-size: 0.6rem; min-width: 42px; }
#seatingBoard::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(120% 90% at 50% 50%, transparent 62%, rgba(60,70,95,0.08) 100%);
    pointer-events: none;
}
.board-caption {
    position: relative;
    z-index: 4;
    text-align: center;
    font-size: 0.52rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    color: #9aa1ac;
    margin: 0.15rem 0 0.6rem;
}
/* seating map movie player */
.movie-bar {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 0.6rem;
    padding: 0.45rem 0.6rem;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(8px);
    border: 1px solid #e8eaf0;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(20,30,60,0.08);
}
.movie-btn {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    border: none;
    background: #f0f3f8;
    color: #55607a;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
    transition: all 0.15s ease;
}
.movie-btn:hover { background: #8b5cf6; color: #fff; }
#moviePlay { background: #8b5cf6; color: #fff; width: 36px; height: 36px; border-radius: 50%; }
#moviePlay:hover { transform: scale(1.06); }
#movieSlider { flex: 1; min-width: 0; accent-color: #8b5cf6; cursor: pointer; }
.movie-time {
    font-size: 0.66rem;
    font-weight: 700;
    color: #55607a;
    min-width: 58px;
    text-align: center;
    letter-spacing: 0.04em;
}
.movie-speed {
    border: 1px solid #e5e8ef;
    border-radius: 8px;
    background: #fff;
    color: #55607a;
    font-size: 0.66rem;
    font-weight: 700;
    padding: 0.2rem 0.3rem;
    cursor: pointer;
}
.movie-log {
    position: relative;
    z-index: 5;
    max-height: 160px;
    overflow-y: auto;
    margin: 0 0 0.6rem;
    padding: 0.35rem 0.5rem;
    background: rgba(245,247,250,0.92);
    backdrop-filter: blur(8px);
    border: 1px solid #e8eaf0;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(20,30,60,0.08);
}
.movie-log-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.66rem;
    color: #4b5468;
    padding: 0.28rem 0.4rem;
    border-radius: 8px;
    line-height: 1.3;
}
.movie-log-item i { font-size: 0.7rem; color: #8b5cf6; }
.movie-log-item.active { background: #efe9ff; font-weight: 600; }
.movie-log-time {
    font-size: 0.58rem;
    font-weight: 700;
    color: #9aa1ac;
    flex-shrink: 0;
    width: 44px;
}
.seat-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    z-index: 6;
    display: inline-flex;
    align-items: center;
    gap: 0.18rem;
    font-size: 0.5rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.14rem 0.34rem;
    border-radius: 20px;
    color: #fff;
    box-shadow: 0 2px 6px rgba(20,30,60,0.25);
    white-space: nowrap;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.seat-badge-leave { background: linear-gradient(135deg, #34c759, #28a745); }
.seat-badge-mis { background: linear-gradient(135deg, #ff3b30, #d70015); animation: moviePulse 1.4s ease-in-out infinite; }
@keyframes moviePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.09); }
}
.seat-vacant .seat-pin { background: #f2f3f6; border-style: dashed; }
.seat-name-vac { color: #b0b6c0; }
#seatingRows {
    position: relative;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}
.seat-row {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    flex-wrap: nowrap;
    padding: 0.7rem 0.25rem 0.55rem;
    border-top: 1px dashed rgba(115,125,145,0.4);
}
.seat-row:first-child {
    border-top: none;
}
/* walk pattern overlay */
.walk-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: none;
    z-index: 3;
}
#seatingRows.pattern-show .walk-svg {
    display: block;
}
.foot-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: block;
    z-index: 2;
}
#seatingRows.pattern-show .foot-svg {
    display: none;
}
.seat-card, .seat-cell {
    width: 86px;
    text-align: center;
    flex-shrink: 0;
    position: relative;
}
.seat-card {
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.16,1,0.3,1);
}
.seat-pin {
    width: 54px;
    height: 54px;
    margin: 0 auto 0.32rem;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #fff;
    box-shadow: 0 3px 8px rgba(30,40,70,0.22), 0 0 0 1px rgba(30,40,70,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9aa1ac;
    position: relative;
    font-size: 1.15rem;
    transition: transform 0.25s cubic-bezier(0.16,1,0.3,1), box-shadow 0.25s ease;
}
.seat-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    background: #e6e9ef;
}
.seat-att .seat-pin {
    box-shadow: 0 0 0 2.5px rgba(52,199,89,0.85), 0 4px 10px rgba(52,199,89,0.3), 0 0 0 1px rgba(0,0,0,0.05);
}
.seat-sub .seat-pin {
    box-shadow: 0 0 0 2.5px rgba(10,132,255,0.85), 0 4px 10px rgba(10,132,255,0.3), 0 0 0 1px rgba(0,0,0,0.05);
}
.seat-both .seat-pin {
    box-shadow: 0 0 0 2.5px rgba(139,92,246,0.9), 0 4px 10px rgba(139,92,246,0.35), 0 0 0 1px rgba(0,0,0,0.05);
}
.seat-dot {
    position: absolute;
    right: -3px;
    bottom: -3px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #b9bec6;
    border: 2.5px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.seat-dot.att { background: #34c759; }
.seat-dot.sub { background: #0a84ff; }
.seat-dot.both { background: linear-gradient(135deg, #34c759, #8b5cf6); }
.seat-check {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: #34c759;
    color: #fff;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    pointer-events: none;
}
.seat-card:hover .seat-pin {
    transform: translateY(-6px) scale(1.1);
    box-shadow: 0 12px 24px -6px rgba(30,40,70,0.45), 0 0 0 2.5px rgba(255,255,255,0.95);
}
.seat-card:hover {
    z-index: 6;
}
.seat-name {
    font-size: 0.59rem;
    font-weight: 600;
    color: #1d1d1f;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 86px;
    line-height: 1.2;
}
.seat-name-vac {
    color: #b3b9c2;
    font-weight: 700;
}
.seat-idx {
    font-size: 0.5rem;
    font-weight: 600;
    color: #8e8e93;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 86px;
    font-variant-numeric: tabular-nums;
    margin-top: 0.08rem;
}
.seat-idx-avatar { color: #b0b5bd; }
.seat-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    margin-top: 0.22rem;
}
.seat-num {
    font-size: 0.54rem;
    font-weight: 700;
    color: #55575d;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 999px;
    padding: 0.06rem 0.42rem;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.seat-time {
    font-size: 0.54rem;
    font-weight: 600;
    color: #8e8e93;
    font-variant-numeric: tabular-nums;
}
.seat-initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(140deg, #6f7cff, #8b5cf6 60%, #c084fc);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    border-radius: 50%;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.3);
}
.seat-initials-plain {
    background: linear-gradient(140deg, #c9ced8, #e6e9f0);
    color: #8e8e93;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
}
.seat-vacant .seat-pin {
    background: rgba(255,255,255,0.65);
    border: 1.5px dashed #c2c8d2;
    box-shadow: none;
    color: #b9bec6;
}
.seat-vacant .seat-num { border-color: #e3e6ec; color: #b9bec6; }
.seat-vacant .seat-idx { display: none; }

/* staggered drop-in */
.anim-in {
    opacity: 0;
    animation: seatIn 0.55s cubic-bezier(0.16,1,0.3,1) forwards;
}
@keyframes seatIn {
    from { opacity: 0; translate: 0 14px; scale: 0.85; }
    to   { opacity: 1; translate: 0 0;    scale: 1; }
}

/* venue chips */
.seat-venue-chip {
    border: none;
    border-radius: 999px;
    padding: 0.42rem 0.95rem;
    font-size: 0.68rem;
    font-weight: 600;
    background: rgba(0,0,0,0.04);
    color: #55575d;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
    transition: all 0.18s ease;
}
.seat-venue-chip:hover { background: rgba(0,0,0,0.07); color: #1c1c1e; }
.seat-venue-chip.seat-save {
    background: rgba(16,185,129,0.10);
    color: #0d9f6e;
    box-shadow: inset 0 0 0 1px rgba(16,185,129,0.35);
}
.seat-venue-chip.seat-save:hover { background: rgba(16,185,129,0.18); color: #0d9f6e; }
.seat-venue-chip.seat-save:disabled { opacity: 0.55; }
.seat-venue-chip.active {
    background: linear-gradient(180deg, #0a84ff, #0071e3);
    color: #fff;
    box-shadow: 0 4px 14px -2px rgba(10,132,255,0.55), inset 0 1px 0 rgba(255,255,255,0.3), 0 0 0 1px rgba(10,132,255,0.5);
}

/* segmented control */
.seat-seg {
    display: inline-flex;
    background: rgba(0,0,0,0.055);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
}
.seat-seg-btn {
    border: none;
    background: transparent;
    padding: 0.3rem 0.72rem;
    min-width: 2.2rem;
    font-size: 0.68rem;
    font-weight: 600;
    color: #8e8e93;
    border-radius: 999px;
    transition: all 0.18s ease;
}
.seat-seg-btn:hover { color: #1c1c1e; }
.seat-seg-btn.active {
    background: #fff;
    color: #000;
    box-shadow: 0 1px 4px rgba(0,0,0,0.16), 0 0 0 0.5px rgba(0,0,0,0.05);
}

/* legend */
.seat-leg {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-right: 0.3rem;
    vertical-align: -1px;
}
.seat-leg.att { background: #34c759; box-shadow: 0 0 8px rgba(52,199,89,0.6); }
.seat-leg.sub { background: #0a84ff; box-shadow: 0 0 8px rgba(10,132,255,0.6); }
.seat-leg.both { background: linear-gradient(120deg, #34c759, #8b5cf6); box-shadow: 0 0 8px rgba(139,92,246,0.55); }
.seat-leg.vac { background: transparent; border: 1.5px dashed #d4d6da; }
.seat-leg.done { background: #34c759; box-shadow: 0 0 0 2px #fff inset; }

/* ===== Seat callout - Apple Maps annotation ===== */
.seat-card {
    cursor: pointer;
}
#seatPopover {
    position: fixed;
    z-index: 3000;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -100%) scale(0.9);
    transform-origin: bottom center;
    transition: opacity 0.16s ease, transform 0.22s cubic-bezier(0.16,1,0.3,1.15);
    width: 246px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 18px 44px -8px rgba(20,25,50,0.35), 0 0 0 1px rgba(0,0,0,0.05);
    padding: 0.8rem 0.9rem 0.6rem;
    color: #1d1d1f;
    text-align: left;
}
#seatPopover::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -7px;
    width: 14px;
    height: 14px;
    background: #fff;
    transform: translateX(-50%) rotate(45deg);
    box-shadow: 1px 1px 1px rgba(0,0,0,0.08);
}
#seatPopover.below {
    transform: translate(-50%, 0) scale(0.9);
    transform-origin: top center;
}
#seatPopover.below::after {
    top: -7px;
    bottom: auto;
    box-shadow: -1px -1px 1px rgba(0,0,0,0.08);
}
#seatPopover.show {
    opacity: 1;
    transform: translate(-50%, -100%) scale(1);
}
#seatPopover.below.show {
    transform: translate(-50%, 0) scale(1);
}
.callout-head {
    display: flex;
    gap: 0.7rem;
    align-items: center;
    margin-bottom: 0.55rem;
}
.callout-avatar {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 50%;
    padding: 2px;
    background: linear-gradient(135deg, #34c759, #0a84ff 55%, #8b5cf6);
    box-shadow: 0 4px 10px -2px rgba(30,40,70,0.25);
}
.callout-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}
.callout-avatar .pop-initials {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(140deg, #6f7cff, #8b5cf6);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
}
.callout-info {
    min-width: 0;
}
.callout-name {
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: -0.01em;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}
.callout-index {
    font-size: 0.65rem;
    color: #8e8e93;
    margin-top: 0.14rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.callout-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.35rem;
}
.callout-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.58rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 0.2rem 0.52rem;
    background: #f2f3f6;
    color: #55575d;
}
.callout-chip.att { background: rgba(52,199,89,0.14); color: #1e9e47; }
.callout-chip.sub { background: rgba(10,132,255,0.14); color: #0a7bff; }
.callout-chip.both { background: rgba(139,92,246,0.14); color: #7b3ff2; }
.callout-chip .seat-dot {
    position: static;
    width: 8px;
    height: 8px;
    border: none;
    box-shadow: none;
}
.callout-times {
    border-top: 1px solid #f0f1f4;
    padding-top: 0.1rem;
}
.callout-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
    padding: 0.48rem 0;
    font-size: 0.68rem;
    color: #8e8e93;
}
.callout-row + .callout-row {
    border-top: 1px solid #f0f1f4;
}
.callout-row-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 500;
    color: #55575d;
}
.callout-row .pop-val {
    font-weight: 700;
    color: #1d1d1f;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.callout-row .pop-scan {
    font-weight: 500;
    color: #8e8e93;
    font-size: 0.56rem;
}

/* ===== Seating map on small phones ===== */
/* =============================================================
   PREMIUM POLISH + MOBILE HARDENING  (shared by every template)
   ============================================================= */
html { scroll-behavior: smooth; }

/* -- finer, softer system font rendering -- */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* --- Buttons: consistent premium pills, tactile feedback --- */
.btn {
    border-radius: 50px;
    letter-spacing: -0.01em;
}
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(140, 169, 255, 0.22);
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary-dark), #6f8dff);
    border: none;
    box-shadow: 0 6px 16px -6px rgba(140, 169, 255, 0.55);
}
.btn-primary:active { transform: scale(0.97); }
.btn-soft:active { transform: scale(0.97); }

/* ---- Premium card: soften + refine hover ---- */
.card {
    border-radius: var(--radius);
}
.card:hover { box-shadow: var(--shadow-xl); }

/* ---- Shared stat/list "tile" look (matches inline markup) ---- */
.icon-chip {
    width: 44px; height: 44px; min-width: 44px;
    border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #e8f0fe, #d4e4ff);
    color: #4a7cf7;
    flex-shrink: 0;
}

/* ---------- Tables: always mobile scrollable ---------- */
/* Any table inside a padded card-body gets its own horizontal scroll,
   so wide tables never burst the layout on phones. */
@media (max-width: 768px) {
    .card-body:has(> table),
    .card-body:has(> .table-responsive) {
        padding-left: 0;
        padding-right: 0;
    }
    .card-body > table,
    .card-body > .table-responsive > table {
        display: block;
        min-width: max-content;
        width: max-content;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
    .card-body > .table-responsive { overflow-x: auto; }
    /* first cell breathing room after flush edges */
    .card-body > table > thead th:first-child,
    .card-body > table > tbody th:first-child,
    .card-body > table > tbody td:first-child { padding-left: 0.9rem; }
    .card-body > table > thead th:last-child,
    .card-body > table > tbody td:last-child { padding-right: 0.9rem; }
}

/* Bare tables inside a card with inline overflow (common pattern). */
@media (max-width: 768px) {
    .card-body { min-width: 0; }
    .card { max-width: 100vw; }
    /* Last resort: any table that is NOT already inside a scroll wrapper
       gets its own horizontal scroll so nothing bursts the viewport. */
    .card-body > table:not(:has(~ .table-responsive)),
    .card > table,
    .content-wrapper > table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ---------- Global overflow safety ---------- */
img, video, canvas { max-width: 100%; height: auto; }
.content-wrapper { overflow-x: visible; }
body { overflow-x: hidden; }

/* ---------- Refined page headers (budget for all roles) ---------- */
.page-title {
    letter-spacing: -0.02em;
    color: var(--gray-900);
}
.page-subtitle, .text-muted { color: var(--gray-500) !important; }

/* ---------- Empty states a touch more inviting ---------- */
.empty-state i { filter: drop-shadow(0 6px 12px rgba(148, 163, 184, 0.35)); }

/* ---------- Mobile bottom tab: premium floating -- on small screens ---------- */
@media (max-width: 768px) {
    .mobile-tabs {
        position: fixed;
        left: 0.6rem; right: 0.6rem; bottom: 0.6rem;
        border-radius: 22px;
        border: 1px solid rgba(255,255,255,0.6);
        box-shadow:
            0 10px 30px -8px rgba(30,41,59,0.35),
            0 2px 8px rgba(30,41,59,0.08),
            0 0 0 1px rgba(0,0,0,0.03);
        background: rgba(255,255,255,0.92);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        padding: 0.3rem 0.25rem calc(env(safe-area-inset-bottom, 0.25rem) + 0.1rem);
    }
    .mobile-tab {
        border-radius: 16px;
        padding: 0.35rem 0;
        color: var(--gray-400);
    }
    .mobile-tab i { font-size: 1.35rem; }
    .mobile-tab span { font-size: 0.6rem; font-weight: 600; }
    .mobile-tab[aria-current] { color: var(--primary-dark); }
    .content-wrapper { padding-bottom: calc(6rem + env(safe-area-inset-bottom, 0rem)); }
}

/* ---------- Bottom sheet safe area ---------- */
@media (max-width: 768px) {
    .modal-dialog .modal-body { padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0rem)); }
}

/* ---------- Link/tap affordance on touch ---------- */
@media (hover: none) {
    .card,
    .stat-card,
    a { -webkit-tap-highlight-color: rgba(140, 169, 255, 0.18); }
}

/* ---------- Scrollbars (WebKit, desktop) ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* =============================================================
   SEATING MAP — small phone polish (unchanged feature, refined)
   ============================================================= */
@media (max-width: 640px) {
    .seat-card, .seat-cell { width: 58px; }
    .seat-pin { width: 40px; height: 40px; margin-bottom: 0.22rem; font-size: 0.95rem; }
    .seat-row { gap: 0.3rem; padding: 0.5rem 0.1rem 0.35rem; }
    .seat-name { font-size: 0.5rem; max-width: 58px; }
    .seat-idx { font-size: 0.42rem; max-width: 58px; margin-top: 0.04rem; }
    .seat-num, .seat-time { font-size: 0.46rem; }
    .seat-initials { font-size: 0.72rem; }
    .seat-dot { width: 12px; height: 12px; border-width: 2px; }
    .seat-check { width: 14px; height: 14px; font-size: 0.5rem; }
    #seatPopover { width: 220px; padding: 0.7rem 0.75rem 0.5rem; }
    .board-caption { font-size: 0.56rem; letter-spacing: 0.08em; }
    .movie-bar { padding: 0.35rem 0.4rem; gap: 0.3rem; }
    .movie-speed { padding: 0.2rem 0.3rem; font-size: 0.65rem; }
}


