@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
    --bg: #0b0e17;
    --surface: #141824;
    --surface-2: #1a1f30;
    --surface-3: #202538;
    --border: #252a3d;
    --border-light: #2e3450;
    --accent: #00cfa8;
    --accent-dim: rgba(0, 207, 168, 0.12);
    --accent-hover: #00e8bb;
    --accent-glow: rgba(0, 207, 168, 0.25);
    --text: #eaecf4;
    --text-muted: #64748b;
    --text-dim: #94a3b8;
    --danger: #f04444;
    --danger-dim: rgba(240, 68, 68, 0.12);
    --warning: #f59e0b;
    --warning-dim: rgba(245, 158, 11, 0.12);
    --success: #10b981;
    --success-dim: rgba(16, 185, 129, 0.12);
    --info: #3b82f6;
    --info-dim: rgba(59, 130, 246, 0.12);
    --sidebar-w: 232px;
    --radius: 10px;
    --radius-sm: 7px;
    --radius-lg: 14px;
    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'DM Mono', monospace;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.25), 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.3), 0 2px 6px rgba(0,0,0,0.2);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.25);
}

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

/* Prevent white flash on load — set dark bg before stylesheet fully parses */
html { font-size: 14px; background: #0b0e17; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 13.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "cv02","cv03","cv04","cv11";
}

/* Fix iOS auto-detecting phone numbers and making them dark blue */
a[href^="tel:"] { color: inherit; text-decoration: none; }

.app-shell { display: flex; min-height: 100dvh; }

/* ── SIDEBAR ── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-brand {
    padding: 12px 16px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}

.brand-icon { color: var(--accent); font-size: 22px; line-height: 1; display: none; }
.brand-name {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.4px;
    color: var(--text);
}

.clinic-badge { padding: 8px 16px; border-bottom: 1px solid var(--border); }
.clinic-name { display: block; font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clinic-role { display: block; font-size: 10px; color: var(--accent); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600; }

.sidebar-nav { padding: 8px 10px; flex: 1; display: flex; flex-direction: column; gap: 1px; overflow-y: auto; scrollbar-width: none; -ms-overflow-style: none; }
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-item {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px; border-radius: var(--radius-sm);
    color: var(--text-muted); text-decoration: none;
    font-size: 13.5px; font-weight: 500; transition: all 0.15s ease;
    letter-spacing: -0.1px;
}
.nav-item:hover { background: var(--surface-2); color: var(--text-dim); }
.nav-item.active {
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 600;
    border: 1px solid rgba(0,207,168,0.15);
}
.nav-icon { width: 16px; height: 16px; text-align: center; flex-shrink: 0; font-size: 15px; }

.sidebar-footer { padding: 8px 10px; border-top: 1px solid var(--border); margin-top: auto; display: flex; flex-direction: column; gap: 1px; }

/* ── MAIN CONTENT ── */
.main-content { margin-left: var(--sidebar-w); flex: 1; min-width: 0; padding: 28px 30px; min-height: 100vh; }

.mobile-header { display: none; }

/* ── PAGE HEADER ── */
.page-header { margin-bottom: 22px; display: flex; align-items: flex-end; justify-content: space-between; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.6px; color: #ffffff; line-height: 1.2; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 3px; font-weight: 400; }

/* ── CARDS ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 16px;
    padding-bottom: 11px;
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

/* ── STAT CARDS ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    background: var(--accent);
    opacity: 0.45;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.7px; margin-bottom: 7px; font-weight: 600; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text); font-family: var(--font-mono); letter-spacing: -0.5px; line-height: 1.2; }
.stat-accent { color: var(--accent); }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
thead th {
    text-align: left;
    padding: 12px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    white-space: nowrap;
}
tbody td {
    padding: 12px 10px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
    transition: background 0.12s;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255,255,255,0.018); }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; letter-spacing: 0.3px; white-space: nowrap; }
.badge-success { background: var(--success-dim); color: var(--success); }
.badge-warning { background: var(--warning-dim); color: var(--warning); }
.badge-danger  { background: var(--danger-dim);  color: var(--danger); }
.badge-muted   { background: var(--surface-3); color: var(--text); border: 1px solid var(--border-light); }
.badge-accent  { background: var(--accent-dim); color: var(--accent); }
.badge-info    { background: var(--info-dim); color: var(--info); }

/* ── ROW STATUS STRIPS ── */
tr.row-scheduled td:first-child, tr.row-confirmed td:first-child { border-left: 3px solid var(--info); }
tr.row-waiting td:first-child { border-left: 3px solid var(--warning); }
tr.row-in_progress td:first-child { border-left: 3px solid var(--accent); }
tr.row-completed td:first-child { border-left: 3px solid var(--success); }
tr.row-cancelled td:first-child, tr.row-no_show td:first-child { border-left: 3px solid var(--danger); }
tr.row-completed, tr.row-cancelled, tr.row-no_show { opacity: 0.55; transition: opacity 0.2s; }
tr.row-completed:hover, tr.row-cancelled:hover, tr.row-no_show:hover { opacity: 0.85; }

/* ── ROW ACTION MENU (Kebab ⋮) ── */
.row-actions { display: flex; align-items: center; gap: 6px; }
.row-actions form { margin: 0; display: flex; align-items: center; }

.action-menu { position: relative; }
.action-menu-trigger {
    background: none; border: 1px solid var(--border); color: var(--text-muted);
    width: 28px; height: 28px; border-radius: 6px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 700; line-height: 1;
    transition: all 0.15s;
    letter-spacing: 2px;
}
.action-menu-trigger:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

.action-menu-dropdown {
    display: none; position: fixed;
    background: var(--surface-2); border: 1px solid var(--border-light);
    border-radius: 8px; min-width: 180px; padding: 4px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5); z-index: 9999;
}
.action-menu:focus-within .action-menu-dropdown,
.action-menu.open .action-menu-dropdown { display: block; }

.action-menu-dropdown button,
.action-menu-dropdown .menu-item {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 8px 10px; border: none; background: none;
    color: var(--text-dim); font-size: 12px; font-weight: 500;
    font-family: var(--font); cursor: pointer; border-radius: 5px;
    transition: all 0.12s; text-align: left; white-space: nowrap;
}
.action-menu-dropdown button:hover,
.action-menu-dropdown .menu-item:hover { background: var(--surface-3); color: var(--text); }
.action-menu-dropdown .menu-icon { width: 16px; text-align: center; font-size: 13px; flex-shrink: 0; }
.action-menu-dropdown .menu-divider { height: 1px; background: var(--border); margin: 4px 6px; }
.action-menu-dropdown .menu-danger:hover { background: var(--danger-dim); color: var(--danger); }

/* Status select — compact inline */
.status-select {
    padding: 5px 8px; font-size: 11px; font-weight: 600;
    border: 1px solid var(--border); border-radius: 6px;
    outline: none; background: var(--surface-2); color: var(--text);
    font-family: var(--font); cursor: pointer; max-width: 138px;
}
.status-select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }
.btn-update-sm {
    padding: 5px 10px; font-size: 11px; font-weight: 500;
    border-radius: 6px; cursor: pointer; border: 1px solid var(--border-light);
    background: var(--surface-3); color: var(--text); font-family: var(--font);
    transition: all 0.15s; min-height: 0;
}
.btn-update-sm:hover { border-color: var(--accent); color: var(--accent); }

/* ── BUTTONS ── */
.btn {
    box-sizing: border-box;
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer; border: none; text-decoration: none;
    transition: all 0.18s ease;
    letter-spacing: 0.1px;
    white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #0b0e17; box-shadow: 0 2px 10px var(--accent-glow); }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 5px 18px var(--accent-glow); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary { background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--border-light); color: var(--text); background: var(--surface-3); }
.btn-danger { background: var(--danger-dim); color: var(--danger); border: 1px solid rgba(240,68,68,0.25); }
.btn-danger:hover { background: rgba(240,68,68,0.2); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── FORMS ── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full-width { grid-column: 1 / -1; }

label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

input, select, textarea {
    -webkit-appearance: none; appearance: none;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 11px;
    color: var(--text);
    font-family: var(--font);
    font-size: 13px;
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
input::placeholder { color: var(--text-muted); }

/* Fix WebKit Autofill Background */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px var(--surface-2) inset !important;
    -webkit-text-fill-color: var(--text) !important;
    transition: background-color 5000s ease-in-out 0s;
    caret-color: var(--text);
}
select option { background: var(--surface-2); }
textarea { resize: vertical; min-height: 80px; }

/* Restore native checkboxes and radios */
input[type="checkbox"], input[type="radio"] {
    -webkit-appearance: auto; appearance: auto;
    width: auto; padding: 0; margin: 0;
    border: none; background: transparent; cursor: pointer;
}

.form-actions { margin-top: 20px; display: flex; gap: 10px; align-items: center; }
.form-row { display: flex; align-items: flex-end; gap: 15px; flex-wrap: wrap; }

/* ── ALERTS ── */
.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; font-weight: 500; }
.alert-success { background: var(--success-dim); border: 1px solid rgba(16,185,129,0.25); color: var(--success); }
.alert-error   { background: var(--danger-dim);  border: 1px solid rgba(240,68,68,0.25);  color: var(--danger); }
.alert-warning { background: var(--warning-dim); border: 1px solid rgba(245,158,11,0.25); color: var(--warning); }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 44px 24px; color: var(--text-muted); }
.empty-state-icon { font-size: 30px; margin-bottom: 10px; opacity: 0.3; }
.empty-state-text { font-size: 13px; font-weight: 500; }

/* ── LOGIN ── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-box {
    width: 100%; max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 36px;
    box-shadow: var(--shadow-lg);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand-icon { font-size: 32px; color: var(--accent); display: none; margin-bottom: 8px; }
.login-brand-name { font-size: 19px; font-weight: 700; letter-spacing: -0.5px; }
.login-subtitle { font-size: 13px; font-weight: 500; color: var(--text-muted); margin-top: 4px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }

/* ── DATE / TIME PICKERS ── */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(1); cursor: pointer; opacity: 0.5;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover { opacity: 0.9; }

/* ── RANGE SLIDER ── */
input[type="range"] {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 5px;
    background: var(--surface-3);
    border-radius: 4px; outline: none; padding: 0; border: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--accent); cursor: pointer;
    box-shadow: 0 0 0 3px var(--accent-dim), 0 2px 5px rgba(0,0,0,0.3);
    transition: transform 0.1s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }
input[type="range"]:focus::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--accent-dim); }



/* ==========================================================
   TABLET RESPONSIVENESS (Max-width 1024px)
   ========================================================== */
@media (max-width: 1024px) {
    :root { --sidebar-w: 80px; }
    .sidebar-brand { justify-content: center; padding: 16px 0; }
    .brand-name { display: none; }
    .brand-icon { display: block; font-size: 24px; color: var(--accent); }
    .clinic-badge { display: none; }
    .nav-item { justify-content: center; padding: 12px 0; flex-direction: column; gap: 6px; font-size: 10px; text-align: center; }
    .nav-icon { margin: 0; font-size: 20px; }
    .main-content { padding: 24px 20px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: 1fr; }
}

/* ==========================================================
   MOBILE RESPONSIVENESS (Max-width 768px)
   ========================================================== */
@media (max-width: 768px) {
    /* Hide top elements in sidebar */
    .sidebar .sidebar-brand, .clinic-badge { display: none; }

    /* Transform Sidebar to Bottom Navigation */
    .sidebar {
        width: 100%;
        height: auto;
        top: auto;
        bottom: 0;
        flex-direction: row;
        border-right: none;
        border-top: 1px solid var(--border);
        z-index: 1000;
        padding: 5px;
        background: rgba(22, 27, 34, 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }

    /* Convert Navigation to horizontal scrolling */
    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0;
        gap: 5px;
        white-space: nowrap;
        scrollbar-width: none; /* Hide scrollbar Firefox */
    }
    .sidebar-nav::-webkit-scrollbar { display: none; } /* Hide scrollbar Chrome/Safari */

    /* Make Navigation Items stack icon and text */
    .nav-item {
        flex-direction: column;
        gap: 4px;
        padding: 8px 12px;
        min-width: 65px;
        justify-content: center;
        flex: 1;
    }
    .nav-icon { font-size: 18px; margin-bottom: 2px; }
    
    /* Optional: Hide labels for extreme small screens, or shrink them */
    .nav-item { font-size: 10px; }

    /* Sidebar Footer (Logout Button) as part of bottom nav */
    .sidebar-footer { display: none !important; }

    .mobile-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
    .mobile-header .sidebar-brand { border-bottom: none; padding: 0; margin: 0; }
    .mobile-signout { color: var(--text-muted); font-size: 11px; text-decoration: none; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); text-transform: uppercase; letter-spacing: 0.5px; }

    /* Restore native scrolling and prevent rubber-band jitter */
    html, body {
        position: relative;
        width: 100%;
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior-y: none; /* Prevents scroll bounce on modern browsers */
    }
    
    /* Hardware accelerate bottom nav to prevent shaking during scroll */
    .sidebar {
        transform: translate3d(0, 0, 0);
        -webkit-transform: translate3d(0, 0, 0);
        will-change: transform;
    }
    
    .app-shell {
        flex-direction: column;
        height: auto;
        min-height: 0 !important;
    }

    .login-box { padding: 24px 20px; border: none; background: transparent; max-width: 100%; margin-top: 40px; }
    .login-page { align-items: flex-start; padding: 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; }

    /* Hide Sidebar Footer on mobile so nav items have 100% width */
    .sidebar-footer { display: none !important; }

    /* Main Content Adjustments */
    .main-content {
        margin-left: 0;
        padding: 20px 15px;
        padding-bottom: 90px; /* Space for bottom nav */
        width: 100%;
        height: auto;
        flex: 1;
    }

    /* Header Adjustments */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .page-title { font-size: 20px; }
    .page-subtitle { font-size: 12px; }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    /* Cards & Grids */
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px !important;
    }
    .stat-label { font-size: 10px; }
    .stat-value { font-size: 16px; }
    .card {
        padding: 16px;
    }

    /* Modals */
    .modal-content {
        width: 95%;
        margin: 20px auto;
        padding: 20px;
        border-radius: var(--radius);
        max-height: 90vh;
        overflow-y: auto;
    }
    .modal-grid { grid-template-columns: 1fr; gap: 15px; }

    /* SVG Body Map scaling */
    .body-wrapper {
        transform: scale(0.8);
        transform-origin: top center;
    }
    
    /* Forms */
    .search-bar { width: 100%; }
    .form-row, .page-header form { flex-direction: column !important; align-items: stretch !important; gap: 15px !important; }
    .form-row button[type="submit"] { margin-top: 8px; } /* Create space above buttons in stacked forms */
    
    /* Slim down mobile inputs to look less bold */
    input[type="text"], input[type="password"], input[type="email"], input[type="search"], input[type="date"], input[type="number"], select { height: 36px !important; padding: 6px 12px !important; border-width: 1px !important; }
    input[type="text"], input[type="password"], input[type="email"], input[type="search"], input[type="date"], input[type="number"], select, textarea { width: 100% !important; max-width: 100% !important; min-width: 0 !important; font-size: 16px !important; box-sizing: border-box !important; margin: 0 !important; }
    .form-group { width: 100% !important; min-width: 0 !important; box-sizing: border-box !important; }
    
    /* Responsive Stacked Tables */
    .table-wrap { overflow: visible !important; border: none !important; background: transparent; }
    .table-wrap table { display: block; width: 100%; min-width: 0 !important; border: none; background: transparent; }
    .table-wrap thead { display: none; }
    .table-wrap tbody { display: block; width: 100%; background: transparent; }
    .table-wrap tr { display: block; margin-bottom: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 0; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
    .table-wrap td { display: block; text-align: left !important; border-bottom: 1px solid var(--border) !important; padding: 12px 16px !important; position: relative; width: 100%; box-sizing: border-box; }
    .table-wrap td::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
    .table-wrap td:last-child { border-bottom: none !important; }
    
    /* Fix form button text visibility in Safari */
    .btn { -webkit-appearance: none; appearance: none; }
    
    /* Better button wraps */
    form[style*="flex"] { flex-direction: column; align-items: stretch !important; gap: 12px !important; flex-wrap: nowrap !important; max-width: 100%; box-sizing: border-box; }
    form[style*="flex"] .btn { width: 100%; justify-content: center; box-sizing: border-box !important; margin: 0 !important; }
    .card > div[style*="flex-wrap:wrap"] { justify-content: space-between; }
    .card > div[style*="flex-wrap:wrap"] .btn { flex: 1; min-width: 30%; justify-content: center; padding: 10px 8px; font-size: 13px; }
    
    /* Login Box */
    .login-box { padding: 24px 20px; margin: 15px; width: auto; }
}

.hide-desktop { display: none; }
@media (max-width: 768px) { 
    .hide-mobile { display: none !important; } 
    .hide-desktop { display: block; }
    
    .mobile-card {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        padding: 16px;
        margin-bottom: 14px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }
    .mc-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 12px;
        padding-bottom: 12px;
        border-bottom: 1px solid var(--border-light);
    }
    .mc-header-left { display: flex; align-items: center; gap: 12px; }
    .mc-title { font-weight: 600; font-size: 15px; color: var(--text); margin-bottom: 2px; display: flex; align-items: center; flex-wrap: wrap; }
    .mc-subtitle { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
    .mc-body { margin-bottom: 14px; }
    .mc-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        margin-bottom: 14px;
    }
    .mc-stat { display: flex; flex-direction: column; gap: 4px; }
    .mc-label { font-size: 10px; text-transform: uppercase; color: var(--text-muted); font-weight: 600; letter-spacing: 0.5px; }
    .mc-val { font-size: 13px; color: var(--text); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
    
    .mc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
    .mc-actions .btn { flex: 1; justify-content: center; min-width: 45%; }
    
    /* Hero Queue Card Mobile Fix */
    .hero-queue-card {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 16px !important;
    }
    .hero-queue-card > div { width: 100%; }
    .hero-queue-card > div:last-child { display: flex; flex-direction: column; gap: 8px; }
    .hero-queue-card form { width: 100%; display: flex; margin: 0; }
    .hero-queue-card .btn { width: 100%; justify-content: center; margin: 0; }
}

/* ── OS SPECIFIC TWEAKS ── */
/* Windows */
.os-windows body { font-size: 13px; font-weight: 400; }
.os-windows .sidebar-brand { padding: 10px 16px 10px; }
.os-windows .clinic-badge { padding: 6px 16px; }
.os-windows .nav-item { padding: 5px 10px; gap: 6px; font-size: 12px; }
.os-windows th, .os-windows td { padding: 10px 12px; font-size: 13px; }
.os-windows ::-webkit-scrollbar { width: 10px; height: 10px; }
.os-windows ::-webkit-scrollbar-track { background: var(--bg); }
.os-windows ::-webkit-scrollbar-thumb { background: #3b4256; border-radius: 5px; border: 2px solid var(--bg); }
.os-windows ::-webkit-scrollbar-thumb:hover { background: #4d5670; }
.os-windows input, .os-windows select, .os-windows textarea, .os-windows .btn { border-radius: 4px; }

/* Mac */
.os-mac body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-weight: 400; }
.os-mac ::-webkit-scrollbar { width: 14px; height: 14px; }
.os-mac ::-webkit-scrollbar-track { background: transparent; }
.os-mac ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border: 4px solid transparent; background-clip: padding-box; border-radius: 8px; }
.os-mac ::-webkit-scrollbar-thumb:hover { background-color: rgba(255,255,255,0.3); }

/* iOS & Android (Touch devices) */
.os-ios body, .os-android body { overscroll-behavior-y: none; }
.os-ios .btn, .os-android .btn, .os-ios input, .os-android input, .os-ios select, .os-android select { min-height: 44px; /* Apple/Android touch target guidelines */ }
.os-ios .sidebar, .os-android .sidebar { padding-bottom: env(safe-area-inset-bottom, 20px); }
.os-ios .main-content, .os-android .main-content { padding-bottom: calc(90px + env(safe-area-inset-bottom, 20px)); }

