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

/* ========== CSS VARIABLES ========== */
:root {
    --primary: #1565C0;
    --primary-light: #1976D2;
    --primary-dark: #0D47A1;
    --primary-bg: #E3F0FF;
    --accent: #2979FF;
    --success: #2E7D32;
    --success-bg: #E8F5E9;
    --warning: #E65100;
    --warning-bg: #FFF3E0;
    --danger: #C62828;
    --danger-bg: #FFEBEE;
    --grey-50: #F8F9FA;
    --grey-100: #F1F3F4;
    --grey-200: #E8EAED;
    --grey-300: #DADCE0;
    --grey-400: #BDC1C6;
    --grey-500: #80868B;
    --grey-600: #5F6368;
    --grey-700: #3C4043;
    --grey-800: #202124;
    --white: #FFFFFF;
    --nav-height: 70px;
    --header-height: 60px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: 0.2s ease;
}

/* ========== RESET ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: 'Inter', sans-serif;
    background: var(--grey-50);
    color: var(--grey-800);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ========== APP WRAPPER ========== */
.app-wrapper {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--white);
    position: relative;
    box-shadow: var(--shadow-lg);
}

/* ========== TOP HEADER ========== */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--white);
    border-bottom: 1px solid var(--grey-200);
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: var(--header-height);
}
.app-header h1 { font-size: 1.25rem; font-weight: 700; color: var(--grey-800); }
.app-header .header-left { display: flex; align-items: center; gap: 12px; }
.header-logo {
    width: 40px; height: 40px; border-radius: 50%;
    background: linear-gradient(135deg, #1565C0, #0288D1);
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 800; font-size: 0.9rem;
    flex-shrink: 0;
}
.header-icon-btn {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--grey-100); border: none; display: flex;
    align-items: center; justify-content: center; cursor: pointer;
    transition: background var(--transition);
}
.header-icon-btn:hover { background: var(--grey-200); }
.header-icon-btn svg { width: 20px; height: 20px; color: var(--grey-600); }

/* ========== PAGE CONTENT ========== */
.page-content {
    padding: 20px;
    padding-bottom: calc(var(--nav-height) + 16px);
    min-height: calc(100vh - var(--header-height));
}

/* ========== BOTTOM NAVIGATION ========== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: var(--nav-height);
    background: var(--white);
    border-top: 1px solid var(--grey-200);
    display: flex;
    align-items: stretch;
    z-index: 200;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}
.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 4px;
    color: var(--grey-500);
    transition: color var(--transition);
    text-decoration: none;
}
.nav-item.active { color: var(--primary); }
.nav-item:hover { color: var(--primary-light); }
.nav-item svg { width: 22px; height: 22px; }
.nav-item span { font-size: 0.68rem; font-weight: 500; letter-spacing: 0.01em; }

/* ========== STAT CARDS ========== */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--grey-200);
}
.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--grey-500);
    font-weight: 500;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--grey-800);
    line-height: 1.1;
    margin-bottom: 6px;
}
.stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
}
.stat-badge.green { background: var(--success-bg); color: var(--success); }
.stat-badge.orange { background: var(--warning-bg); color: var(--warning); }

/* ========== SECTION HEADERS ========== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.section-title { font-size: 1rem; font-weight: 700; color: var(--grey-800); }
.section-link { font-size: 0.82rem; color: var(--primary); font-weight: 500; }

/* ========== APPOINTMENT CARDS ========== */
.appointment-list { display: flex; flex-direction: column; gap: 10px; }
.appointment-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 14px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--grey-200);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: border-color var(--transition), box-shadow var(--transition);
    cursor: pointer;
}
.appointment-card:hover { border-color: var(--primary-light); box-shadow: var(--shadow-md); }
.appointment-card.active-card { 
    border-color: var(--primary); 
    box-shadow: 0 0 0 2px rgba(21,101,192,0.15);
}
.appt-avatar {
    width: 44px; height: 44px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; font-weight: 700; color: var(--white);
    flex-shrink: 0;
}
.appt-info { flex: 1; min-width: 0; }
.appt-name { font-size: 0.95rem; font-weight: 600; color: var(--grey-800); margin-bottom: 3px; }
.appt-meta { font-size: 0.78rem; color: var(--grey-500); display: flex; align-items: center; gap: 4px; }

/* ========== STATUS BADGES ========== */
.badge {
    display: inline-flex; align-items: center; padding: 4px 10px;
    border-radius: 20px; font-size: 0.72rem; font-weight: 600;
    white-space: nowrap; flex-shrink: 0;
}
.badge-checked-in  { background: var(--success-bg); color: var(--success); }
.badge-in-progress { background: var(--primary-bg); color: var(--primary); }
.badge-waiting     { background: var(--grey-100);   color: var(--grey-600); }
.badge-complete    { background: var(--grey-100);   color: var(--grey-500); }
.badge-cancelled   { background: var(--danger-bg);  color: var(--danger); }
.badge-settled     { background: var(--success-bg); color: var(--success); }
.badge-collected   { background: var(--warning-bg); color: var(--warning); }
.badge-pending     { background: var(--danger-bg);  color: var(--danger); }

/* ========== QUICK ACTIONS ========== */
.quick-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 24px;
}
.qa-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--grey-200);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.qa-card:hover { border-color: var(--primary-light); box-shadow: var(--shadow-md); }
.qa-icon-wrapper {
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
}
.qa-card-title { font-size: 0.9rem; font-weight: 700; color: var(--grey-800); }
.qa-card-sub { font-size: 0.75rem; color: var(--grey-500); line-height: 1.3; }

/* ========== NOTIFICATION BELL ========== */
.notif-btn {
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--grey-100); display: flex; align-items: center; justify-content: center;
    color: var(--grey-700); cursor: pointer; transition: background var(--transition); border: none;
}
.notif-btn:hover { background: var(--grey-200); }

/* ========== SCHEDULE VIEW ALL LINK ========== */
.section-link { font-size: 0.85rem; color: var(--primary); font-weight: 600; }

/* ========== DASHBOARD CHECKED-IN BADGE STYLE ========== */
.badge-checked-in { background: #E8F5E9; color: #2E7D32; }

/* ========== AVATAR COLORS ========== */
.av-blue   { background: linear-gradient(135deg, #1565C0, #1976D2); }
.av-teal   { background: linear-gradient(135deg, #00796B, #00897B); }
.av-orange { background: linear-gradient(135deg, #E65100, #F4511E); }
.av-purple { background: linear-gradient(135deg, #6A1B9A, #8E24AA); }
.av-green  { background: linear-gradient(135deg, #2E7D32, #388E3C); }
.av-pink   { background: linear-gradient(135deg, #AD1457, #D81B60); }
.av-indigo { background: linear-gradient(135deg, #283593, #3949AB); }

/* ========== FLOATING ACTION BUTTON ========== */
.fab {
    position: fixed;
    bottom: calc(var(--nav-height) + 16px);
    right: calc(50% - 240px + 16px);
    width: 54px; height: 54px;
    background: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 20px rgba(21,101,192,0.4);
    cursor: pointer; border: none; z-index: 150;
    transition: transform var(--transition), box-shadow var(--transition);
}
.fab:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(21,101,192,0.5); }
.fab svg { width: 26px; height: 26px; color: white; }

/* ========== SCHEDULE PAGE ========== */
.view-tabs {
    display: flex;
    background: var(--grey-100);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: 16px;
}
.view-tab {
    flex: 1; text-align: center; padding: 8px;
    border-radius: var(--radius-sm); font-size: 0.85rem;
    font-weight: 500; color: var(--grey-500);
    cursor: pointer; transition: all var(--transition); border: none;
    background: transparent;
}
.view-tab.active { background: var(--white); color: var(--primary); font-weight: 600; box-shadow: var(--shadow-sm); }

.date-nav {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; padding: 0 4px;
}
.date-nav-btn {
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--grey-100); cursor: pointer; border: none;
    transition: background var(--transition);
}
.date-nav-btn:hover { background: var(--grey-200); }
.date-nav-title { font-size: 1rem; font-weight: 600; color: var(--grey-800); display: flex; align-items: center; gap: 8px; }

/* Timeline */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-row {
    display: flex; align-items: flex-start; gap: 12px; padding: 8px 0;
    min-height: 80px; position: relative;
}
.timeline-time {
    width: 48px; font-size: 0.75rem; font-weight: 500;
    color: var(--grey-500); padding-top: 8px; flex-shrink: 0; text-align: right;
}
.timeline-dot {
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--grey-300); margin-top: 11px; flex-shrink: 0;
    position: relative; z-index: 1;
}
.timeline-dot.dot-blue   { background: var(--primary); }
.timeline-dot.dot-orange { background: #FF8F00; }
.timeline-row::before {
    content: ''; position: absolute;
    left: 66px; top: 0; bottom: 0;
    width: 2px; background: var(--grey-200); z-index: 0;
}
.timeline-content { flex: 1; }

.appt-card-timeline {
    background: var(--white);
    border: 1px solid var(--grey-200);
    border-radius: var(--radius-md);
    padding: 14px;
    box-shadow: var(--shadow-sm);
}
.appt-card-timeline.complete { opacity: 0.7; }
.appt-card-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.appt-card-identity { display: flex; align-items: center; gap: 10px; }
.appt-card-name { font-size: 0.92rem; font-weight: 600; color: var(--grey-800); }
.appt-card-phone { font-size: 0.78rem; color: var(--grey-500); display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.appt-card-actions { display: flex; gap: 8px; align-items: center; }

.btn-bill {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-size: 0.82rem;
    font-weight: 600;
    display: flex; align-items: center; gap: 6px;
    cursor: pointer;
    transition: background var(--transition);
    flex: 1;
}
.btn-bill:hover { background: var(--primary-dark); }

.btn-icon-sm {
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    border: none; cursor: pointer; transition: background var(--transition);
    flex-shrink: 0;
}
.btn-icon-sm.green-bg { background: var(--success-bg); color: var(--success); }
.btn-icon-sm.blue-bg  { background: var(--primary-bg); color: var(--primary); }
.btn-icon-sm:hover { filter: brightness(0.92); }

.add-slot {
    border: 2px dashed var(--grey-300);
    border-radius: var(--radius-md);
    padding: 16px;
    color: var(--grey-400);
    font-size: 0.85rem;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    cursor: pointer; transition: all var(--transition);
    background: transparent;
    width: 100%;
}
.add-slot:hover { border-color: var(--primary-light); color: var(--primary); }

/* ========== PATIENTS ========== */
.search-bar {
    display: flex; align-items: center; gap: 10px;
    background: var(--grey-100); border-radius: var(--radius-md);
    padding: 10px 14px; margin-bottom: 20px;
    border: 1.5px solid transparent;
    transition: border-color var(--transition), background var(--transition);
}
.search-bar:focus-within { background: var(--white); border-color: var(--primary); }
.search-bar input {
    flex: 1; border: none; background: transparent; outline: none;
    font-size: 0.9rem; color: var(--grey-800);
}
.search-bar input::placeholder { color: var(--grey-400); }
.search-bar svg { width: 18px; height: 18px; color: var(--grey-400); flex-shrink: 0; }

.patient-list { display: flex; flex-direction: column; gap: 10px; }
.patient-card {
    background: var(--white);
    border: 1px solid var(--grey-200);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex; align-items: center; gap: 12px;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.patient-card:hover { border-color: var(--primary-light); box-shadow: var(--shadow-md); }
.patient-info { flex: 1; min-width: 0; }
.patient-name { font-size: 0.95rem; font-weight: 600; color: var(--grey-800); margin-bottom: 3px; }
.patient-meta { font-size: 0.78rem; color: var(--grey-500); margin-bottom: 4px; }
.patient-phone { font-size: 0.78rem; color: var(--grey-600); display: flex; align-items: center; gap: 4px; }
.patient-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0; }

.btn-sm {
    padding: 6px 14px; border-radius: var(--radius-sm);
    font-size: 0.78rem; font-weight: 600; border: none; cursor: pointer;
    transition: all var(--transition);
}
.btn-sm.primary  { background: var(--primary-bg); color: var(--primary); }
.btn-sm.primary:hover { background: var(--primary); color: white; }
.btn-sm.danger   { background: var(--danger-bg); color: var(--danger); }
.btn-sm.success  { background: var(--success-bg); color: var(--success); }
.btn-sm.default  { background: var(--grey-100); color: var(--grey-600); }

/* ========== BILLING PAGE ========== */
.bill-hero {
    background: linear-gradient(135deg, #1565C0 0%, #1976D2 50%, #0288D1 100%);
    border-radius: var(--radius-xl);
    padding: 24px;
    color: white;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}
.bill-hero::before {
    content: '';
    position: absolute;
    top: -30px; right: -30px;
    width: 120px; height: 120px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
}
.bill-hero::after {
    content: '';
    position: absolute;
    bottom: -20px; left: 40%;
    width: 80px; height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
}
.bill-hero .hero-label { font-size: 0.82rem; opacity: 0.85; margin-bottom: 8px; }
.bill-hero .hero-amount { font-size: 2rem; font-weight: 800; margin-bottom: 12px; }
.hero-growth {
    display: inline-flex; align-items: center; gap: 6px;
    background: rgba(255,255,255,0.15); border-radius: 20px;
    padding: 4px 12px; font-size: 0.78rem; font-weight: 500;
}

.payment-split {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 14px; margin-bottom: 24px;
}
.split-card {
    background: var(--white);
    border: 1px solid var(--grey-200);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}
.split-card .split-label { font-size: 0.78rem; color: var(--grey-500); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.split-card .split-amount { font-size: 1.2rem; font-weight: 800; color: var(--grey-800); margin-bottom: 10px; }
.split-action { background: var(--grey-100); border: none; border-radius: var(--radius-sm); padding: 7px 12px; font-size: 0.75rem; font-weight: 500; color: var(--grey-600); cursor: pointer; display: flex; align-items: center; gap: 5px; }

.transaction-list { display: flex; flex-direction: column; gap: 10px; }
.transaction-item {
    background: var(--white);
    border: 1px solid var(--grey-200);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex; align-items: center; gap: 12px;
    box-shadow: var(--shadow-sm);
}
.txn-icon {
    width: 42px; height: 42px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.txn-icon.upi  { background: #E8F0FE; color: #1565C0; }
.txn-icon.cash { background: var(--success-bg); color: var(--success); }
.txn-icon.card { background: #F3E5F5; color: #7B1FA2; }
.txn-icon.bank { background: #E3F2FD; color: #1565C0; }
.txn-info { flex: 1; min-width: 0; }
.txn-name { font-size: 0.9rem; font-weight: 600; color: var(--grey-800); margin-bottom: 3px; }
.txn-meta { font-size: 0.75rem; color: var(--grey-500); }
.txn-right { text-align: right; flex-shrink: 0; }
.txn-amount { font-size: 0.95rem; font-weight: 700; color: var(--grey-800); margin-bottom: 4px; }

/* ========== SETTINGS PAGE ========== */
.settings-profile {
    display: flex; align-items: center; gap: 14px;
    padding: 20px 0; margin-bottom: 20px;
    border-bottom: 1px solid var(--grey-200);
}
.settings-logo {
    width: 56px; height: 56px; border-radius: var(--radius-md);
    background: linear-gradient(135deg, #E3F2FD, #BBDEFB);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.settings-clinic-name { font-size: 1rem; font-weight: 700; color: var(--grey-800); }
.settings-role { font-size: 0.8rem; color: var(--grey-500); margin-top: 2px; }
.settings-edit-btn { margin-left: auto; color: var(--primary); display: flex; align-items: center; }

.settings-menu { background: var(--white); border-radius: var(--radius-lg); border: 1px solid var(--grey-200); overflow: hidden; box-shadow: var(--shadow-sm); margin-bottom: 20px; }
.settings-item {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 20px; border-bottom: 1px solid var(--grey-100);
    cursor: pointer; text-decoration: none; color: inherit;
    transition: background var(--transition);
}
.settings-item:last-child { border-bottom: none; }
.settings-item:hover { background: var(--grey-50); }
.settings-item-icon {
    width: 38px; height: 38px; border-radius: var(--radius-sm);
    background: var(--grey-100); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.settings-item-text { flex: 1; }
.settings-item-label { font-size: 0.9rem; font-weight: 600; color: var(--grey-800); }
.settings-item-sub { font-size: 0.75rem; color: var(--grey-500); margin-top: 2px; }

.logout-btn {
    width: 100%; background: #FFF5F5; border: 1px solid #FFCDD2;
    border-radius: var(--radius-md); padding: 16px; color: var(--danger);
    font-size: 0.95rem; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 10px;
    transition: background var(--transition);
}
.logout-btn:hover { background: #FFEBEE; }

/* ========== MODALS ========== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 300; display: flex; align-items: flex-end; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-sheet {
    background: var(--white);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%; max-width: 480px;
    max-height: 90vh; overflow-y: auto;
    padding: 24px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}
.modal-overlay.open .modal-sheet { transform: translateY(0); }
.modal-handle {
    width: 36px; height: 4px; background: var(--grey-300);
    border-radius: 2px; margin: 0 auto 16px;
}
.modal-title { font-size: 1.1rem; font-weight: 700; color: var(--grey-800); margin-bottom: 20px; }

/* ========== FORM ELEMENTS ========== */
.form-group { margin-bottom: 14px; }
.form-label { font-size: 0.8rem; font-weight: 600; color: var(--grey-600); margin-bottom: 6px; display: block; }
.form-control {
    width: 100%; padding: 11px 14px;
    border: 1.5px solid var(--grey-200);
    border-radius: var(--radius-sm); font-size: 0.88rem;
    color: var(--grey-800); background: var(--white);
    outline: none; transition: border-color var(--transition);
}
.form-control:focus { border-color: var(--primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn-primary {
    width: 100%; padding: 13px;
    background: var(--primary); color: white;
    border: none; border-radius: var(--radius-md);
    font-size: 0.95rem; font-weight: 600; cursor: pointer;
    transition: background var(--transition);
    margin-top: 8px;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary {
    width: 100%; padding: 13px;
    background: var(--grey-100); color: var(--grey-600);
    border: none; border-radius: var(--radius-md);
    font-size: 0.95rem; font-weight: 600; cursor: pointer;
    transition: background var(--transition);
    margin-top: 6px;
}

/* ========== ALERTS ========== */
.alert {
    padding: 12px 16px; border-radius: var(--radius-sm);
    font-size: 0.85rem; font-weight: 500; margin-bottom: 16px;
    display: flex; align-items: center; gap: 8px;
}
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-danger   { background: var(--danger-bg);  color: var(--danger); }

/* ========== BILL ITEMS EDITOR ========== */
.bill-item-row {
    display: grid; grid-template-columns: 1fr 60px 80px 28px;
    gap: 6px; align-items: start; margin-bottom: 8px;
}
.bill-total-box {
    background: var(--grey-50); border-radius: var(--radius-sm);
    padding: 12px 14px; margin: 12px 0;
    display: flex; justify-content: space-between; align-items: center;
}
.bill-total-label { font-size: 0.85rem; color: var(--grey-600); font-weight: 500; }
.bill-total-value { font-size: 1.1rem; font-weight: 800; color: var(--grey-800); }

/* ========== PAGINATION ========== */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 20px; flex-wrap: wrap; }
.pagination .page-btn {
    min-width: 36px; height: 36px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.82rem; font-weight: 500; border: 1px solid var(--grey-200);
    cursor: pointer; transition: all var(--transition); background: var(--white); color: var(--grey-700);
}
.pagination .page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination .page-btn:hover:not(.active) { background: var(--grey-100); }

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center; padding: 40px 20px; color: var(--grey-400);
}
.empty-state svg { width: 56px; height: 56px; margin-bottom: 12px; }
.empty-state p { font-size: 0.9rem; }

/* ========== AUTH PAGES ========== */
.auth-wrapper {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #E3F0FF 0%, #F0F4FF 50%, #E8F5E9 100%);
    padding: 20px;
}
.auth-card {
    background: var(--white); border-radius: var(--radius-xl);
    padding: 36px 28px; width: 100%; max-width: 400px;
    box-shadow: var(--shadow-lg);
}
.auth-logo {
    width: 64px; height: 64px; border-radius: 50%;
    background: linear-gradient(135deg, #1565C0, #0288D1);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px; color: white; font-size: 1.5rem; font-weight: 800;
}
.auth-title { font-size: 1.4rem; font-weight: 800; text-align: center; color: var(--grey-800); margin-bottom: 6px; }
.auth-sub   { font-size: 0.85rem; color: var(--grey-500); text-align: center; margin-bottom: 28px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 0.82rem; color: var(--grey-500); }
.auth-footer a { color: var(--primary); font-weight: 500; }

/* ========== BILL DETAIL ========== */
.bill-detail-header { background: var(--grey-50); border-radius: var(--radius-md); padding: 16px; margin-bottom: 20px; }
.bill-detail-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.bill-detail-label { font-size: 0.82rem; color: var(--grey-500); }
.bill-detail-value { font-size: 0.9rem; font-weight: 600; color: var(--grey-800); }
.bill-items-table { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.bill-items-table th { font-size: 0.75rem; color: var(--grey-500); padding: 8px 0; border-bottom: 1px solid var(--grey-200); text-align: left; }
.bill-items-table td { font-size: 0.85rem; padding: 10px 0; border-bottom: 1px solid var(--grey-100); }
.bill-items-table td:last-child { text-align: right; font-weight: 600; }

/* ========== PROFILE SETTINGS PAGE ========== */
.profile-upload-container {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 30px 20px; background: var(--white);
    border-bottom: 1px solid var(--grey-100);
}
.profile-upload-circle {
    width: 80px; height: 80px; border-radius: 50%;
    border: 2px dashed #B0C4DF; background: #F8FAFC;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 12px; cursor: pointer; overflow: hidden;
    transition: background var(--transition);
}
.profile-upload-circle:hover { background: #E3F0FF; }
.profile-upload-circle img { width: 100%; height: 100%; object-fit: cover; }
.upload-placeholder { color: #93A5BE; display: flex; align-items: center; justify-content: center; }
.profile-upload-text { font-size: 0.9rem; font-weight: 600; color: var(--primary); margin-bottom: 4px; }
.profile-upload-sub { font-size: 0.75rem; color: #93A5BE; }
.hidden-file-input { display: none; }

.profile-section-card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 20px; border: 1px solid var(--grey-200);
    margin: 0 20px 20px; box-shadow: var(--shadow-sm);
}
.input-with-icon { position: relative; display: flex; align-items: center; }
.input-with-icon .input-icon {
    position: absolute; left: 14px; display: flex; align-items: center; justify-content: center;
}
.input-with-icon .has-icon { padding-left: 42px; }

.sticky-bottom-bar {
    position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: 480px; background: var(--white);
    padding: 16px 20px; border-top: 1px solid var(--grey-200);
    z-index: 100; box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
}

/* ========== PATIENT DETAIL ========== */
.patient-detail-hero { background: var(--primary-bg); border-radius: var(--radius-xl); padding: 24px; display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.detail-section { margin-bottom: 20px; }
.detail-section-title { font-size: 0.85rem; font-weight: 700; color: var(--grey-500); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 12px; }

/* ========== SECURITY PAGE ========== */
.security-section-title {
    font-size: 0.78rem; font-weight: 700; color: var(--grey-600);
    text-transform: uppercase; letter-spacing: 0.05em; margin: 24px 20px 8px;
}
.security-list {
    background: var(--white);
    border-top: 1px solid var(--grey-200);
    border-bottom: 1px solid var(--grey-200);
}
.security-item {
    display: flex; align-items: center; gap: 14px;
    padding: 16px 20px; border-bottom: 1px solid var(--grey-100);
    text-decoration: none; color: inherit;
}
.security-item:last-child { border-bottom: none; }
.security-item-icon {
    width: 44px; height: 44px; border-radius: var(--radius-md);
    background: var(--primary-bg); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.security-item-icon.grey { background: var(--grey-100); color: var(--grey-600); }
.security-item-text { flex: 1; min-width: 0; }
.security-item-label { font-size: 0.95rem; font-weight: 500; color: var(--grey-800); display: flex; align-items: center; gap: 8px; }
.security-item-sub { font-size: 0.82rem; color: var(--grey-500); margin-top: 2px; }
.security-item-action { font-size: 0.9rem; font-weight: 600; color: var(--primary); cursor: pointer; border: none; background: none; }
.security-item-action.danger { color: var(--danger); border: 1px solid #FFCDD2; padding: 6px 14px; border-radius: var(--radius-sm); font-size: 0.78rem; font-weight: 600; }
.badge-current { background: #E8F5E9; color: #2E7D32; font-size: 0.65rem; padding: 3px 8px; border-radius: 4px; font-weight: 700; display: inline-block;}

/* ========== TOGGLE SWITCH ========== */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--grey-300); transition: .3s; border-radius: 24px;
}
.slider:before {
    position: absolute; content: ""; height: 20px; width: 20px; left: 2px; bottom: 2px;
    background-color: white; transition: .3s; border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(20px); }

.btn-outline-primary {
    width: calc(100% - 40px); margin: 24px 20px; padding: 14px;
    background: transparent; color: var(--primary);
    border: 1.5px solid var(--primary); border-radius: var(--radius-md);
    font-size: 0.95rem; font-weight: 600; cursor: pointer;
    transition: background var(--transition);
}
.btn-outline-primary:hover { background: var(--primary-bg); }

/* ========== REPORTS & ANALYTICS ========== */
.report-month-selector {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 10px; margin-bottom: 20px;
}
.month-nav-btn {
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    color: var(--grey-500); cursor: pointer; transition: color var(--transition);
}
.month-nav-btn:hover { color: var(--grey-800); }
.month-text { text-align: center; }
.month-title { font-size: 1rem; font-weight: 700; color: var(--grey-800); }
.month-sub { font-size: 0.72rem; color: var(--grey-500); }

.report-card {
    background: var(--white);
    border: 1px solid var(--grey-200);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    text-align: center;
    position: relative;
    overflow: hidden;
}
.report-primary-card { padding: 32px 24px; border: none; box-shadow: 0 8px 30px rgba(0,0,0,0.06); }
.report-card-top-accent {
    position: absolute; top: 0; left: 0; right: 0; height: 6px;
    background: var(--primary);
}
.report-label { font-size: 0.75rem; font-weight: 700; color: var(--grey-500); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.report-amount { font-size: 2.2rem; font-weight: 800; color: var(--primary-light); margin-bottom: 12px; }
.report-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 600;
}
.report-badge.green { background: var(--success-bg); color: var(--success); }

.report-metrics-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px;
}
.report-metric-card {
    background: var(--white); border: 1px solid var(--grey-200);
    border-radius: var(--radius-lg); padding: 20px; text-align: center;
    box-shadow: var(--shadow-sm); display: flex; flex-direction: column; align-items: center;
}
.metric-icon {
    width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
}
.metric-icon.blue { background: #E3F2FD; color: #1565C0; }
.metric-icon.purple { background: #F3E5F5; color: #7B1FA2; }
.metric-value { font-size: 1.5rem; font-weight: 800; color: var(--grey-800); }
.metric-label { font-size: 0.8rem; color: var(--grey-500); margin-top: 4px; }

.report-section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.report-section-title { font-size: 0.95rem; font-weight: 700; color: var(--grey-800); text-align: left; }
.report-link { font-size: 0.8rem; color: var(--primary); font-weight: 600; }

.report-chart-container { margin: 20px 0 10px; opacity: 0.7; }
.chart-skeleton { width: 100%; height: 80px; }
.chart-labels { display: flex; justify-content: space-between; padding: 0 10px; font-size: 0.7rem; color: var(--grey-400); font-weight: 600; }

.breakdown-item { margin-bottom: 18px; text-align: left; }
.breakdown-item:last-child { margin-bottom: 0; }
.breakdown-info { display: flex; align-items: center; margin-bottom: 8px; }
.breakdown-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; margin-right: 12px; flex-shrink: 0; }
.breakdown-icon.green { background: var(--success-bg); color: var(--success); }
.breakdown-icon.orange { background: var(--warning-bg); color: var(--warning); }
.breakdown-label { font-size: 0.9rem; font-weight: 600; color: var(--grey-800); flex: 1; }
.breakdown-stats { text-align: right; }
.breakdown-val { font-size: 0.9rem; font-weight: 700; color: var(--grey-800); }
.breakdown-percent { font-size: 0.7rem; color: var(--grey-500); }

.progress-bar-bg { width: 100%; height: 6px; background: var(--grey-100); border-radius: 4px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 4px; }
.progress-bar-fill.top-color { background: #00E676; }
.progress-bar-fill.bottom-color { background: #FF9800; }

/* ========== RESPONSIVE FIXES ========== */
@media (max-width: 360px) {
    .stats-grid { grid-template-columns: 1fr; }
    .payment-split { grid-template-columns: 1fr; }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--grey-300); border-radius: 2px; }
