/* --- CSS Variables & Design Tokens --- */
:root {
    --primary: #059669; /* emerald-600 */
    --primary-hover: #047857; /* emerald-700 */
    --primary-light: #d1fae5; /* emerald-100 */
    
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* --- Base --- */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: var(--font-family);
    color: var(--gray-800);
    background-color: #fff;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
main { flex: 1; }
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.prose { line-height: 1.75; }
.prose h1, .prose h2, .prose h3 { color: var(--gray-900); margin-top: 2rem; margin-bottom: 1rem; }
.prose p { margin-bottom: 1.25rem; }

/* --- Header & Nav --- */
.header {
    width: 100%; border-bottom: 1px solid var(--gray-200); background: #fff;
    position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow-sm);
}
.header-container {
    max-width: 1280px; margin: 0 auto; padding: 0 24px;
    height: 64px; display: flex; align-items: center; justify-content: space-between;
}
.logo { font-weight: 700; font-size: 1.25rem; color: var(--primary-hover); display: flex; align-items: center; gap: 8px; }
.logo-icon { background: var(--primary-light); padding: 6px; border-radius: 8px; }

.desktop-nav { display: none; align-items: center; gap: 24px; font-size: 0.875rem; font-weight: 500; color: var(--gray-600); }
@media(min-width: 768px) { .desktop-nav { display: flex; } }
.nav-link { transition: color 0.2s; }
.nav-link:hover { color: var(--primary); }
.nav-link.active { color: var(--primary-hover); font-weight: 600; }

.header-actions { display: none; align-items: center; gap: 16px; }
@media(min-width: 768px) { .header-actions { display: flex; } }

.mobile-menu-btn { display: block; background: none; border: none; color: var(--gray-600); cursor: pointer; padding: 8px; }
@media(min-width: 768px) { .mobile-menu-btn { display: none; } }

.mobile-dropdown { display: none; position: absolute; top: 64px; left: 0; width: 100%; background: #fff; border-bottom: 1px solid var(--gray-200); box-shadow: var(--shadow-lg); padding: 16px 24px; flex-direction: column; gap: 16px; z-index: 40; }
.mobile-dropdown.show { display: flex; }

/* --- Buttons --- */
.btn { display: inline-flex; align-items: center; justify-content: center; font-weight: 500; border-radius: 8px; cursor: pointer; transition: all 0.2s; border: none; }
.btn-sm { padding: 6px 12px; font-size: 0.875rem; }
.btn-lg { padding: 12px 32px; font-size: 1rem; height: 48px; border-radius: 12px; font-weight: 600; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-md); }
.btn-primary:hover { background: var(--primary-hover); transform: scale(0.98); }
.btn-outline { border: 1px solid var(--gray-300); background: transparent; color: var(--gray-600); }
.btn-outline:hover { background: var(--gray-50); color: var(--gray-900); }

/* --- Hero Section --- */
.hero { position: relative; height: 100vh; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.slide-container { position: absolute; inset: 0; z-index: 0; }
.slide-img { position: absolute; inset: 0; opacity: 1; transition: opacity 2s; }
.gradient-1 { background: linear-gradient(135deg, #064e3b 0%, #059669 40%, #34d399 100%); }
.hero-overlay { background: rgba(0,0,0,0.2); z-index: 1; }
.hero-content { z-index: 10; max-width: 800px; padding: 0 24px; text-align: center; }
.hero-title { font-size: 3rem; font-weight: 700; color: #fff; line-height: 1.2; }
@media(min-width: 768px) { .hero-title { font-size: 4rem; } }
.text-emerald-300 { color: #6ee7b7; }
.hero-subtitle { color: #d1fae5; font-size: 1.25rem; margin-top: 1.5rem; }
.scroll-down { position: absolute; bottom: 32px; z-index: 10; color: rgba(255,255,255,0.7); display: flex; justify-content: center; width: 100%; transition: color 0.3s; }
.scroll-down:hover { color: #fff; }

/* --- Sections & Cards --- */
.bg-gray-50 { background-color: var(--gray-50); }
.bg-white { background-color: #fff; }
.py-20 { padding-top: 5rem; padding-bottom: 5rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.max-w-5xl { max-width: 1024px; margin: 0 auto; }
.max-w-3xl { max-width: 768px; margin: 0 auto; }
.text-center { text-align: center; }
.mb-14 { margin-bottom: 3.5rem; }
.mb-8 { margin-bottom: 2rem; }
.section-title { font-size: 2.25rem; font-weight: 700; color: var(--gray-900); }

.grid { display: grid; }
.gap-8 { gap: 2rem; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
@media(min-width: 768px) { .md-grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.card { background: #fff; padding: 2rem; border-radius: 1rem; box-shadow: var(--shadow-sm); border: 1px solid var(--gray-200); transition: all 0.3s; }
.card:hover { box-shadow: var(--shadow-lg); border-color: #6ee7b7; }
.card-icon { width: 3.5rem; height: 3.5rem; border-radius: 0.75rem; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; margin-bottom: 1.25rem; transition: transform 0.3s; }
.card:hover .card-icon { transform: scale(1.1); }
.card-title { font-size: 1.125rem; font-weight: 600; color: var(--gray-900); margin-bottom: 0.5rem; }
.card-text { color: var(--gray-600); font-size: 0.875rem; line-height: 1.625; }

/* Colors */
.bg-emerald-100 { background-color: #d1fae5; }
.text-emerald-600 { color: #059669; }
.bg-teal-100 { background-color: #ccfbf1; }
.text-teal-600 { color: #0d9488; }
.bg-green-100 { background-color: #dcfce7; }
.text-green-600 { color: #16a34a; }

/* --- Footer --- */
.footer { background: var(--gray-50); border-top: 1px solid var(--gray-200); margin-top: auto; }
.footer-container { max-width: 1280px; margin: 0 auto; padding: 3rem 1.5rem; display: flex; flex-direction: column; align-items: center; gap: 1.5rem; }
@media(min-width: 768px) { .footer-container { flex-direction: row; justify-content: space-between; } }
.footer-brand { display: flex; flex-direction: column; align-items: center; font-size: 0.875rem; color: var(--gray-500); }
@media(min-width: 768px) { .footer-brand { align-items: flex-start; } }
.footer-logo { font-weight: 600; color: var(--gray-900); font-size: 1.125rem; margin-bottom: 4px; }
.footer-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 2rem; font-size: 0.875rem; font-weight: 500; color: var(--gray-600); }
.footer-nav a:hover { color: var(--primary); }
.staff-login { color: var(--gray-400); }

/* --- Utilities --- */
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.animate-bounce-slow { animation: bounce 3s infinite; }
@keyframes bounce { 0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(0.8,0,1,1); } 50% { transform: none; animation-timing-function: cubic-bezier(0,0,0.2,1); } }

/* --- Language Switcher --- */
.lang-switcher { display: flex; align-items: center; gap: 4px; font-size: 0.8125rem; font-weight: 500; }
.lang-switcher a { padding: 4px 8px; border-radius: 6px; color: var(--gray-500); transition: all 0.2s; }
.lang-switcher a:hover { color: var(--primary); background: var(--gray-100); }
.lang-switcher a.active { color: var(--primary); background: var(--primary-light); font-weight: 600; }
.lang-switcher .divider { color: var(--gray-300); }

/* ==============================================
   ADMIN STYLES (Skeleton for Krish)
   ============================================== */

/* --- Login Page --- */
.login-page {
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at top left, rgba(209, 250, 229, 0.55), transparent 32rem),
        linear-gradient(135deg, #f8fafc 0%, #eefdf6 100%);
    padding: 4rem 1.5rem;
}
.login-page > div {
    width: 100%;
    max-width: 440px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(209, 250, 229, 0.95);
    border-radius: 1.25rem;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.13);
    padding: 2.75rem;
}
.login-page h1 {
    font-size: 2rem;
    line-height: 1.2;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}
.login-page p {
    color: var(--gray-600);
}
.login-page form {
    margin-top: 2rem;
}
.login-page form > div {
    margin-bottom: 1.25rem;
}
.role-choice {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0.35rem;
    border-radius: 0.9rem;
    background: var(--gray-100);
}
.role-choice label {
    margin: 0;
    cursor: pointer;
}
.role-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.role-choice span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border-radius: 0.7rem;
    color: var(--gray-600);
    font-size: 0.9rem;
    font-weight: 700;
    transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
}
.role-choice input:checked + span {
    background: #fff;
    color: var(--primary-hover);
    box-shadow: var(--shadow-sm);
}
.role-choice label:focus-within span {
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.16);
}
.login-page label {
    display: block;
    color: var(--gray-700);
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.45rem;
}
.login-page input {
    width: 100%;
    min-height: 46px;
    padding: 0.75rem 0.95rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.75rem;
    color: var(--gray-900);
    background: #fff;
    font: inherit;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.login-page input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.14);
}
.login-page button[type="submit"] {
    width: 100%;
    min-height: 48px;
    margin-top: 0.25rem;
    border-radius: 0.75rem;
    font-weight: 700;
}
.login-page .border-t {
    border-top: 1px solid var(--gray-100);
}
.login-page .text-emerald-600 {
    color: var(--primary);
}
.login-page .text-emerald-600:hover {
    color: var(--primary-hover);
}
@media (max-width: 520px) {
    .login-page {
        align-items: flex-start;
        padding: 2rem 1rem;
    }
    .login-page > div {
        padding: 2rem 1.25rem;
        border-radius: 1rem;
    }
}
.login-card { background: #fff; border-radius: 1rem; box-shadow: var(--shadow-lg); padding: 2.5rem; width: 100%; max-width: 420px; border: 1px solid var(--gray-200); }
.login-card h1 { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); margin-bottom: 0.5rem; text-align: center; }
.login-card .subtitle { color: var(--gray-500); font-size: 0.875rem; text-align: center; margin-bottom: 2rem; }
.login-error { background: #fef2f2; color: #b91c1c; padding: 0.75rem 1rem; border-radius: 8px; font-size: 0.875rem; margin-bottom: 1rem; border: 1px solid #fecaca; }
.login-locked { background: #fffbeb; color: #92400e; padding: 0.75rem 1rem; border-radius: 8px; font-size: 0.875rem; margin-bottom: 1rem; border: 1px solid #fde68a; }

/* --- Form Elements (shared) --- */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--gray-700); margin-bottom: 0.375rem; }
.form-input {
    width: 100%; padding: 0.625rem 0.875rem; border: 1px solid var(--gray-300);
    border-radius: 8px; font-size: 0.875rem; color: var(--gray-800);
    transition: border-color 0.2s, box-shadow 0.2s; background: #fff;
    font-family: var(--font-family);
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15); }
.form-input::placeholder { color: var(--gray-400); }
.form-select {
    width: 100%; padding: 0.625rem 0.875rem; border: 1px solid var(--gray-300);
    border-radius: 8px; font-size: 0.875rem; color: var(--gray-800);
    background: #fff 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='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 12px center;
    appearance: none; cursor: pointer; font-family: var(--font-family);
}
.form-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15); }
.form-hint { font-size: 0.75rem; color: var(--gray-500); margin-top: 0.25rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media(max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
.form-section { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--gray-200); }
.form-section:last-child { border-bottom: none; margin-bottom: 0; }
.form-section-title { font-size: 1rem; font-weight: 600; color: var(--gray-900); margin-bottom: 1rem; }
.form-checkbox { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.form-checkbox input[type="checkbox"] { width: 1rem; height: 1rem; accent-color: var(--primary); cursor: pointer; }
.form-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; }

/* --- Admin Layout --- */
.admin-container { max-width: 1280px; margin: 0 auto; padding: 2rem 1.5rem; }
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem; flex-wrap: wrap; gap: 1rem; }
.admin-title { font-size: 1.75rem; font-weight: 700; color: var(--gray-900); }

/* --- Admin Tabs --- */
.admin-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--gray-200); margin-bottom: 2rem; overflow-x: auto; }
.admin-tab {
    padding: 0.75rem 1.25rem; font-size: 0.875rem; font-weight: 500;
    color: var(--gray-500); border-bottom: 2px solid transparent;
    margin-bottom: -2px; cursor: pointer; white-space: nowrap;
    transition: all 0.2s; background: none; border-top: none; border-left: none; border-right: none;
}
.admin-tab:hover { color: var(--gray-700); }
.admin-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* --- Stats Bar (Dashboard Overview) --- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
    background: #fff; border: 1px solid var(--gray-200); border-radius: 0.75rem;
    padding: 1.25rem; display: flex; flex-direction: column; gap: 0.25rem;
}
.stat-label { font-size: 0.8125rem; color: var(--gray-500); font-weight: 500; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--gray-900); }
.stat-card.highlight { border-color: var(--primary); background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%); }
.stat-card.highlight .stat-value { color: var(--primary-hover); }

/* --- Data Table (Inventory, Reservations, Users) --- */
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.table-search {
    padding: 0.5rem 0.875rem; border: 1px solid var(--gray-300); border-radius: 8px;
    font-size: 0.875rem; min-width: 280px; font-family: var(--font-family);
}
.table-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15); }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table thead { background: var(--gray-50); border-bottom: 2px solid var(--gray-200); }
.data-table th {
    padding: 0.75rem 1rem; text-align: left; font-weight: 600; color: var(--gray-600);
    white-space: nowrap; cursor: pointer; user-select: none;
}
.data-table th:hover { color: var(--gray-900); }
.data-table th.sorted-asc::after { content: ' â–²'; font-size: 0.625rem; }
.data-table th.sorted-desc::after { content: ' â–¼'; font-size: 0.625rem; }
.data-table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); vertical-align: middle; }
.data-table tbody tr { transition: background 0.15s; }
.data-table tbody tr:hover { background: var(--gray-50); }

/* Responsive Table */
.table-wrapper { overflow-x: auto; border: 1px solid var(--gray-200); border-radius: 0.75rem; }

/* --- Status Badges --- */
.badge { display: inline-flex; align-items: center; padding: 0.25rem 0.625rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.025em; }
.badge-available { background: #dcfce7; color: #166534; }
.badge-reserved { background: #fef9c3; color: #854d0e; }
.badge-assigned { background: #dbeafe; color: #1e40af; }

/* --- Action Buttons (Admin table rows) --- */
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-success { background: var(--primary); color: #fff; }
.btn-success:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--gray-500); padding: 0.375rem 0.5rem; }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-700); }
.btn-xs { padding: 0.25rem 0.5rem; font-size: 0.75rem; border-radius: 6px; }

/* --- Confirmation Dialog --- */
.confirm-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 100; display: flex; align-items: center; justify-content: center; }
.confirm-dialog { background: #fff; border-radius: 1rem; padding: 2rem; max-width: 400px; width: 90%; box-shadow: var(--shadow-lg); }
.confirm-dialog h3 { font-size: 1.125rem; font-weight: 600; margin-bottom: 0.5rem; }
.confirm-dialog p { color: var(--gray-600); font-size: 0.875rem; margin-bottom: 1.5rem; }
.confirm-actions { display: flex; gap: 0.75rem; justify-content: flex-end; }

/* --- Camera / Photo Upload Area --- */
.photo-upload-area {
    border: 2px dashed var(--gray-300); border-radius: 0.75rem; padding: 2rem;
    text-align: center; cursor: pointer; transition: all 0.2s; background: var(--gray-50);
}
.photo-upload-area:hover { border-color: var(--primary); background: #ecfdf5; }
.photo-upload-area.has-photo { border-style: solid; padding: 0.5rem; }
.photo-preview { max-width: 100%; max-height: 300px; border-radius: 0.5rem; object-fit: contain; }
.camera-controls { display: flex; gap: 0.75rem; margin-top: 1rem; justify-content: center; }

/* --- Print Label (Brother VC-500W) --- */
@media print {
    body * { visibility: hidden; }
    .print-label, .print-label * { visibility: visible; }
    .print-label { position: absolute; left: 0; top: 0; width: 50mm; height: 25mm; }
}

/* --- Empty State --- */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--gray-500); }
.empty-state svg { width: 64px; height: 64px; margin: 0 auto 1rem; color: var(--gray-300); }
.empty-state h3 { font-size: 1.125rem; font-weight: 600; color: var(--gray-700); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.875rem; }

/* --- Additional Utilities --- */
.whitespace-pre-line { white-space: pre-line; }
.text-4xl { font-size: 2.25rem; }
.text-5xl { font-size: 3rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-mono { font-family: monospace; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-10 { margin-bottom: 2.5rem; }
.mb-12 { margin-bottom: 3rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-10 { margin-top: 2.5rem; }
.mt-16 { margin-top: 4rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-8 { padding-left: 2rem; padding-right: 2rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-3xl { border-radius: 1.5rem; }
.shadow-xl { box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); }
.shadow-2xl { box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); }
.w-full { width: 100%; }
.max-w-md { max-width: 28rem; }
.max-w-2xl { max-width: 42rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.flex-1 { flex: 1 1 0%; }
.inline-block { display: inline-block; }
.transition-all { transition: all 0.3s; }
.transition-colors { transition: color 0.3s, background-color 0.3s; }
.outline-none { outline: 2px solid transparent; outline-offset: 2px; }
.ring-2 { --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--shadow, 0 0 #0000); }
.focus\:ring-emerald-500:focus { --tw-ring-color: #10b981; }
.focus\:border-emerald-500:focus { border-color: #10b981; }

/* ==============================================
   MATCHER STYLES (Phase 2 Overhaul)
   ============================================== */

/* --- Utilities for Matcher (Since full Tailwind isn't present) --- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.relative { position: relative; }
.absolute { position: absolute; }
.left-0 { left: 0; }
.top-1\/2 { top: 50%; }
.-translate-y-1\/2 { transform: translateY(-50%); }
.transform { transform: var(--tw-transform, translate(0,0)); }
.scale-110 { transform: scale(1.1); }
.group:hover .group-hover\:scale-110 { transform: scale(1.1); }
.transition-transform { transition-property: transform; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.h-1 { height: 0.25rem; }
.z-0 { z-index: 0; }
.z-10 { z-index: 10; }
.hidden { display: none !important; }
.block { display: block !important; }

.w-5 { width: 1.25rem; } .h-5 { height: 1.25rem; }
.w-8 { width: 2rem; } .h-8 { height: 2rem; }
.w-10 { width: 2.5rem; } .h-10 { height: 2.5rem; }
.w-12 { width: 3rem; } .h-12 { height: 3rem; }
.w-20 { width: 5rem; } .h-20 { height: 5rem; }
.w-24 { width: 6rem; } .h-24 { height: 6rem; }
.w-32 { width: 8rem; } .h-32 { height: 8rem; }
.h-16 { height: 4rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.p-10 { padding: 2.5rem; }
.p-12 { padding: 3rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pb-4 { padding-bottom: 1rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-8 { margin-top: 2rem; }
.-ml-8 { margin-left: -2rem; }
.flex-shrink-0 { flex-shrink: 0; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.gap-10 { gap: 2.5rem; }
.gap-12 { gap: 3rem; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.justify-end { justify-content: flex-end; }
.h-full { height: 100%; }
@media (min-width: 768px) {
    .md-grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md-grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md-grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .md-grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .md-col-start-5 { grid-column-start: 5; }
    .md-w-1-3 { width: 33.333333%; }
}

/* --- Progress Bar --- */
.matcher-progress { position: relative; max-width: 600px; margin: 0 auto; }
.progress-step { display: flex; flex-direction: column; align-items: center; position: relative; }
.step-circle { transition: all 0.3s ease; }
.step-label { transition: color 0.3s ease; }

/* --- Matcher Cards --- */
.matcher-card {
    background: #fff;
    border: 2px solid var(--gray-200);
    border-radius: 1rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    text-align: left;
    width: 100%;
}
.matcher-card:hover, .matcher-card:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    outline: none;
    transform: translateY(-2px);
}
.matcher-card:focus-visible {
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.3);
}

/* --- Secondary / Smooth Buttons --- */
.back-btn {
    background: var(--gray-100);
    color: var(--gray-600);
    padding: 0.5rem 1rem;
    border-radius: 9999px; /* Pill shape */
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}
.back-btn:hover {
    background: var(--gray-200);
    color: var(--gray-900);
    transform: translateX(-2px);
}
.skip-btn {
    background: #fff;
    border: 1px solid var(--gray-200);
    color: var(--gray-600);
    padding: 0.75rem 1.5rem;
    border-radius: 9999px; /* Pill shape */
    transition: all 0.2s ease;
    cursor: pointer;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}
.skip-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary-hover);
    background: var(--primary-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

/* --- Rx Form --- */
.rx-input {
    text-align: center;
    font-variant-numeric: tabular-nums;
    transition: all 0.2s;
}
.rx-input:focus {
    transform: scale(1.02);
}

/* --- Results Carousel --- */
.result-card {
    transition: opacity 0.3s ease;
}
.result-card.hidden {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    top: 0; left: 0; right: 0;
}
.result-card.block {
    opacity: 1;
    position: relative;
}

/* --- Animations --- */
.animate-fade-in-up {
    animation: fadeInUp 0.5s ease-out forwards;
}
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@media (prefers-reduced-motion: reduce) {
    .animate-fade-in-up {
        animation: none;
    }
    .matcher-card, .step-circle, .rx-input, .back-btn, .skip-btn {
        transition: none;
        transform: none !important;
    }
}

/* ==============================================
   ADMIN LAYOUT CLASSES
   ============================================== */
.app-layout { display: flex; min-height: 100vh; background: var(--gray-50); }

.sidebar { width: 260px; background: #fff; border-right: 1px solid var(--gray-200); display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-brand { padding: 1.5rem; border-bottom: 1px solid var(--gray-100); }
.brand-row { display: flex; align-items: center; gap: 0.75rem; }
.logo-box { color: var(--primary); }
.brand-row h2 { font-size: 1.125rem; font-weight: 700; color: var(--gray-900); }
.brand-row span { font-size: 0.75rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }

.sidebar-nav { flex: 1; padding: 1.5rem 1rem; overflow-y: auto; }
.nav-section-title { font-size: 0.75rem; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.05em; margin: 1.5rem 0 0.5rem 0.5rem; }
.nav-section-title:first-child { margin-top: 0; }
.nav-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 0.75rem; border-radius: 0.5rem; color: var(--gray-600); font-size: 0.875rem; font-weight: 500; transition: all 0.2s; }
.nav-item svg { width: 20px; height: 20px; }
.nav-item:hover { background: var(--gray-50); color: var(--gray-900); }
.nav-item.active { background: #ecfdf5; color: var(--primary-hover); }

.sidebar-footer { padding: 1rem; border-top: 1px solid var(--gray-100); background: #fdfdfd; }
.user-card { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; padding: 0.5rem; }
.user-avatar { width: 36px; height: 36px; background: var(--primary-light); color: var(--primary-hover); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 1rem; }
.user-info { flex: 1; min-width: 0; }
.u-name { font-size: 0.875rem; font-weight: 600; color: var(--gray-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-role { font-size: 0.75rem; color: var(--gray-500); }
.btn-full { width: 100%; justify-content: center; }

.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 1.5rem 2rem; background: #fff; border-bottom: 1px solid var(--gray-200); }
.topbar h1 { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.breadcrumb { font-size: 0.875rem; color: var(--gray-500); margin-top: 0.25rem; }
.topbar-actions { display: flex; align-items: center; gap: 1rem; }

.page-body { padding: 2rem; flex: 1; overflow-y: auto; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.25rem; margin-bottom: 2rem; }
.stat-card { display: flex; flex-direction: row; align-items: center; gap: 1rem; background: #fff; border: 1px solid var(--gray-200); border-radius: 0.75rem; padding: 1.25rem; }
.stat-icon { width: 48px; height: 48px; border-radius: 0.5rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon svg { width: 24px; height: 24px; }
.stat-icon.green { background: #dcfce7; color: #166534; }
.stat-icon.blue  { background: #dbeafe; color: #1e40af; }
.stat-icon.amber { background: #fef3c7; color: #92400e; }
.stat-icon.red   { background: #fee2e2; color: #991b1b; }
.stat-body { flex: 1; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--gray-900); line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--gray-500); margin-top: 0.25rem; font-weight: 500; }

/* Admin card overrides */
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.card-header h2 { font-size: 1.125rem; font-weight: 600; color: var(--gray-900); margin: 0; }

/* Admin forms */
.add-glasses-card {
    max-width: 1120px;
}
.form-note {
    color: var(--gray-500);
    font-size: 0.875rem;
}
.admin-form {
    display: grid;
    gap: 1.25rem;
}
.admin-form .form-group {
    margin-bottom: 0;
}
.admin-form .form-group > label,
.admin-form .rx-toggle label {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--gray-700);
    font-size: 0.875rem;
    font-weight: 600;
}
.admin-form input[type="text"],
.admin-form input[type="email"],
.admin-form input[type="password"],
.admin-form input[type="number"],
.admin-form input[type="date"],
.admin-form select,
.admin-form textarea {
    width: 100%;
    min-height: 42px;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    background: #fff;
    color: var(--gray-800);
    font-family: var(--font-family);
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.add-glasses-card .admin-form input[type="text"],
.add-glasses-card .admin-form input[type="number"],
.add-glasses-card .admin-form select,
.add-glasses-card .admin-form textarea {
    width: 100%;
    max-width: none;
}
.admin-form textarea {
    min-height: 104px;
    resize: vertical;
}
.admin-form select {
    cursor: pointer;
}
.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}
.admin-form input[type="file"] {
    width: 100%;
    padding: 0.65rem;
    border: 1px dashed var(--gray-300);
    border-radius: 8px;
    background: var(--gray-50);
    color: var(--gray-600);
    font-family: var(--font-family);
}
.admin-form input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary);
}
.admin-form .form-row {
    gap: 1.25rem;
}
.photo-field {
    max-width: 560px;
}
.photo-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.75rem;
    color: var(--gray-500);
    font-size: 0.8125rem;
}
.check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.65rem 1rem;
}
.check-grid label,
.rx-toggle label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-700);
    font-size: 0.875rem;
    font-weight: 500;
}
.rx-panel {
    display: grid;
    gap: 1rem;
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    padding: 1rem;
    background: var(--gray-50);
}
.rx-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.rx-header h3 {
    margin: 0;
    color: var(--gray-900);
    font-size: 1rem;
}
.rx-header p {
    margin: 0.2rem 0 0;
    color: var(--gray-500);
    font-size: 0.8125rem;
}
.rx-eye-card {
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    padding: 1rem;
    background: #fff;
}
.rx-eye-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
    color: var(--gray-800);
}
.rx-eye-title span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #d1fae5;
    color: var(--primary);
    font-weight: 700;
}
.rx-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}
.rx-pd-row {
    max-width: 360px;
}
.add-glasses-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.5rem;
}
@media(max-width: 900px) {
    .rx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media(max-width: 640px) {
    .card-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.5rem;
    }
    .rx-grid { grid-template-columns: 1fr; }
    .rx-header,
    .add-glasses-actions {
        align-items: stretch;
        flex-direction: column;
    }
}

/* Table */
.table-wrap { overflow-x: auto; }
.table-wrap table { width: 100%; border-collapse: collapse; }
.table-wrap th, .table-wrap td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--gray-100); font-size: 0.875rem; }
.table-wrap th { font-weight: 600; color: var(--gray-500); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; }
.table-wrap tbody tr:hover { background: var(--gray-50); }

/* Inventory cards */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}
.filter-bar input,
.filter-bar select {
    min-height: 40px;
    border: 1px solid var(--gray-300);
    border-radius: 0.5rem;
    background: #fff;
    color: var(--gray-800);
    font: inherit;
    font-size: 0.875rem;
    padding: 0.55rem 0.75rem;
}
.filter-bar input[name="q"] {
    min-width: 260px;
    flex: 1 1 280px;
}
.filter-bar input:focus,
.filter-bar select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.14);
}
.glasses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}
.glass-card {
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 0.875rem;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}
.glass-card:hover {
    border-color: #a7f3d0;
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}
.glass-card-img {
    position: relative;
    height: 190px;
    background: linear-gradient(135deg, var(--gray-50), var(--gray-100));
    overflow: hidden;
}
.glass-card-img img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}
.glass-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    font-size: 0.875rem;
}
.glass-placeholder svg {
    width: 56px;
    height: 56px;
}
.status-pill {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    max-width: calc(100% - 1.5rem);
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--primary-hover);
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
    box-shadow: var(--shadow-sm);
}
.status-pill.distributed {
    color: #1d4ed8;
}
.glass-card-info {
    padding: 1rem;
}
.glass-card-name {
    color: var(--gray-900);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.25;
    text-transform: uppercase;
}
.glass-card-sub {
    margin-top: 0.35rem;
    color: var(--gray-600);
    font-size: 0.82rem;
    line-height: 1.45;
}
.glass-card-badges {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.85rem;
}
.badge-green { background: #dcfce7; color: #166534; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-amber { background: #fef3c7; color: #92400e; }
.glass-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0 1rem 1rem;
}
.photo-upload-mini {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    width: 100%;
}
.photo-upload-mini input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.alert {
    border-radius: 0.75rem;
    padding: 0.875rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    font-weight: 600;
}
.alert-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
}
.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.52);
    padding: 1.25rem;
}
.modal-backdrop.open {
    display: flex;
}
.modal {
    width: min(100%, 460px);
    max-height: calc(100vh - 2.5rem);
    overflow: auto;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 1rem;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
}
.modal-header h3 {
    margin: 0;
    color: var(--gray-900);
    font-size: 1.125rem;
    font-weight: 800;
}
.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 999px;
    background: var(--gray-100);
    color: var(--gray-500);
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
}
.modal-close:hover {
    background: var(--gray-200);
    color: var(--gray-900);
}
.modal-body {
    padding: 1.5rem;
}
.modal-body label {
    display: block;
    color: var(--gray-700);
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}
.modal-body input,
.modal-body textarea {
    width: 100%;
    border: 1px solid var(--gray-300);
    border-radius: 0.625rem;
    color: var(--gray-900);
    font: inherit;
    padding: 0.65rem 0.75rem;
}
.modal-body textarea {
    min-height: 96px;
    resize: vertical;
}
.modal-body input:focus,
.modal-body textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.14);
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem 1.5rem;
}
.camera-modal .modal {
    width: min(100%, 720px);
}
#cameraVideo,
#cameraCanvas {
    width: 100%;
    max-height: 440px;
    display: block;
    background: var(--gray-900);
    border-radius: 0.75rem;
    object-fit: contain;
}
.camera-message {
    margin-top: 0.75rem;
    color: var(--gray-500);
    font-size: 0.875rem;
}
@media (max-width: 640px) {
    .modal-backdrop {
        align-items: flex-end;
        padding: 0.75rem;
    }
    .modal {
        border-radius: 1rem 1rem 0.75rem 0.75rem;
    }
    .modal-footer {
        flex-direction: column-reverse;
    }
    .modal-footer .btn {
        width: 100%;
    }
}

/* Empty state */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--gray-400); }
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 1rem; }
.empty-state h3 { font-size: 1.125rem; font-weight: 600; color: var(--gray-600); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.875rem; }
