/* ==================== CSS VARIABLES ==================== */
:root {
    --primary: #0B3D91;
    --primary-dark: #082a66;
    --primary-light: #1a5fd1;
    --secondary: #27AE60;
    --secondary-dark: #1e8b4d;
    --accent: #E74C3C;
    --warning: #F39C12;
    --info: #3498DB;
    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --surface-2: #F1F5F9;
    --text: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --border: #E2E8F0;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --radius: 16px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark-mode {
    --bg: #0F172A;
    --surface: #1E293B;
    --surface-2: #334155;
    --text: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;
    --border: #334155;
}

/* ==================== BASE ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; background: var(--bg); color: var(--text); height: 100%; overflow: hidden; }
body { position: fixed; width: 100%; top: 0; left: 0; }

/* ==================== SCREEN SYSTEM ==================== */
.screen {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--bg);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    display: none;
    flex-direction: column;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 1;
    padding-bottom: 80px;
}
.screen.active {
    display: flex;
    opacity: 1;
    transform: translateX(0);
    z-index: 10;
}

/* ==================== SPLASH ==================== */
#screen-splash {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, #0a2d6e 100%);
    padding-bottom: 0;
    z-index: 100;
}
#screen-splash.active { display: flex; }
.splash-content { text-align: center; color: white; padding: 40px; }
.splash-logo { margin-bottom: 24px; animation: splashPulse 2s ease-in-out infinite; }
.splash-content h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 4px; }
.splash-tagline { font-size: 16px; opacity: 0.85; font-weight: 500; margin-bottom: 40px; }
.splash-loader { width: 200px; height: 4px; background: rgba(255,255,255,0.2); border-radius: 2px; margin: 0 auto 16px; overflow: hidden; }
.splash-bar { width: 0%; height: 100%; background: var(--secondary); border-radius: 2px; animation: splashLoad 2s ease forwards; }
.splash-version { font-size: 12px; opacity: 0.6; margin-bottom: 8px; }
.splash-credit { font-size: 11px; opacity: 0.5; }
.splash-credit a { color: white; text-decoration: underline; }
.splash-credit .heart { color: #ff6b6b; }

@keyframes splashPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes splashLoad { 0% { width: 0%; } 100% { width: 100%; } }

/* ==================== ROLE SELECTION ==================== */
#screen-role-select { background: linear-gradient(180deg, var(--primary) 0%, var(--bg) 60%); padding: 0; }
.role-header { text-align: center; padding: 48px 24px 32px; color: white; }
.role-header h2 { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.role-header p { opacity: 0.85; font-size: 14px; }
.role-logo { margin-bottom: 16px; }
.role-grid { display: grid; gap: 16px; padding: 0 24px 24px; }
.role-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
}
.role-card:hover, .role-card:active { transform: translateY(-2px); border-color: var(--secondary); box-shadow: var(--shadow-lg); }
.role-icon {
    width: 56px; height: 56px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 24px;
    margin-bottom: 16px;
}
.role-card h3 { font-size: 18px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.role-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.role-footer { text-align: center; padding: 24px; font-size: 12px; color: var(--text-muted); }
.role-footer .credit { margin-top: 4px; }
.role-footer .heart { color: var(--accent); }
.role-footer a { color: var(--primary); text-decoration: none; font-weight: 500; }

/* ==================== AUTH SCREENS ==================== */
.auth-header {
    display: flex; align-items: center; gap: 16px;
    padding: 16px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 5;
}
.auth-header h2 { font-size: 18px; font-weight: 600; flex: 1; }
.auth-body { padding: 32px 24px; flex: 1; }
.auth-logo {
    width: 72px; height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 28px;
    margin: 0 auto 24px;
}
.auth-desc { text-align: center; color: var(--text-secondary); font-size: 14px; margin-bottom: 24px; }

/* ==================== FORMS ==================== */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.3px; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 14px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px; font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: var(--transition);
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(11,61,145,0.1);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input-group { display: flex; position: relative; }
.input-group input { padding-right: 48px; }
.toggle-password {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--text-muted);
    padding: 8px; cursor: pointer; font-size: 16px;
}
.office-hours .hours-grid { display: grid; gap: 8px; }
.office-hours .hours-grid > div { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 8px; }
.office-hours .hours-grid span { font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; }
.office-hours .hours-grid input { padding: 8px 12px; font-size: 13px; }

/* ==================== BUTTONS ==================== */
.btn-primary {
    width: 100%; padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white; border: none; border-radius: var(--radius-sm);
    font-size: 16px; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: var(--transition);
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn-primary:active { transform: translateY(0); }
.btn-outline {
    width: 100%; padding: 14px;
    background: transparent; color: var(--primary);
    border: 2px solid var(--primary); border-radius: var(--radius-sm);
    font-size: 15px; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: var(--transition);
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-outline:hover { background: var(--primary); color: white; }
.btn-back { background: none; border: none; color: var(--text); font-size: 18px; cursor: pointer; padding: 8px; }
.btn-icon { background: none; border: none; color: var(--text-secondary); font-size: 18px; cursor: pointer; padding: 8px; }
.btn-text { background: none; border: none; color: var(--primary); font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-sm { padding: 8px 16px; font-size: 13px; }

/* ==================== AUTH LINKS & DIVIDER ==================== */
.auth-divider { display: flex; align-items: center; gap: 16px; margin: 24px 0; color: var(--text-muted); font-size: 13px; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-links { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 24px; }
.auth-links a { color: var(--primary); font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; }

/* ==================== DASHBOARD ==================== */
.dashboard-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}
.dashboard-welcome h2 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.dashboard-welcome p { font-size: 13px; opacity: 0.8; }
.dashboard-body { padding: 20px; flex: 1; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 24px; }
.stat-card {
    background: var(--surface); border-radius: var(--radius-sm);
    padding: 16px; text-align: center; box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.stat-card i { font-size: 20px; color: var(--primary); margin-bottom: 8px; }
.stat-number { display: block; font-size: 22px; font-weight: 700; color: var(--text); }
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.quick-actions { margin-bottom: 24px; }
.quick-actions h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; color: var(--text); }
.actions-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.actions-grid.actions-3 { grid-template-columns: repeat(3, 1fr); }
.actions-grid.actions-2 { grid-template-columns: repeat(2, 1fr); }
.action-card {
    background: var(--surface); border-radius: var(--radius-sm);
    padding: 20px; text-align: center; box-shadow: var(--shadow);
    border: 1px solid var(--border); cursor: pointer; transition: var(--transition);
}
.action-card:hover { transform: translateY(-2px); border-color: var(--secondary); box-shadow: var(--shadow-lg); }
.action-card i { font-size: 24px; color: var(--secondary); margin-bottom: 8px; display: block; }
.action-card span { font-size: 13px; font-weight: 500; color: var(--text); }

.worker-banner {
    background: linear-gradient(135deg, #fff8e1, #fff3cd);
    border: 1px solid #ffc107;
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex; gap: 12px; align-items: flex-start;
    margin-bottom: 24px;
}
.worker-banner i { color: var(--warning); font-size: 20px; margin-top: 2px; }
.worker-banner p { font-size: 13px; color: #856404; line-height: 1.5; }

.info-banner {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border: 1px solid var(--info);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex; gap: 12px; align-items: flex-start;
}
.info-banner i { color: var(--info); font-size: 20px; margin-top: 2px; }
.info-banner p { font-size: 13px; color: #1565c0; line-height: 1.5; }

/* ==================== RECENT SECTION ==================== */
.recent-section { margin-bottom: 24px; }
.recent-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.recent-header h3 { font-size: 16px; font-weight: 600; }
.recent-list { display: flex; flex-direction: column; gap: 8px; }
.recent-item {
    background: var(--surface); border-radius: var(--radius-sm);
    padding: 16px; box-shadow: var(--shadow);
    border: 1px solid var(--border); cursor: pointer;
    display: flex; align-items: center; gap: 12px;
    transition: var(--transition);
}
.recent-item:hover { border-color: var(--primary); }
.recent-item i { font-size: 20px; color: var(--primary); }
.recent-item .info { flex: 1; }
.recent-item .info h4 { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.recent-item .info p { font-size: 12px; color: var(--text-muted); }
.recent-item .time { font-size: 11px; color: var(--text-muted); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state i { font-size: 40px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; }
.empty-state .sub { font-size: 12px; margin-top: 4px; }

/* ==================== PAGE HEADER ==================== */
.page-header {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 5;
}
.page-header h2 { font-size: 18px; font-weight: 600; flex: 1; }
.read-only-badge {
    background: var(--warning); color: white;
    padding: 4px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600;
}
.page-body { padding: 20px; flex: 1; }

/* ==================== SEARCH ==================== */
.search-box {
    display: flex; align-items: center; gap: 12px;
    background: var(--surface); border: 2px solid var(--border);
    border-radius: var(--radius-sm); padding: 4px 4px 4px 16px;
    margin-bottom: 8px;
}
.search-box i { color: var(--text-muted); font-size: 16px; }
.search-box input { flex: 1; border: none; background: none; padding: 12px 0; font-size: 15px; outline: none; color: var(--text); }
.search-box button {
    background: var(--primary); color: white; border: none;
    border-radius: var(--radius-sm); padding: 12px 16px;
    cursor: pointer; font-size: 16px;
}
.search-hint { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; padding-left: 4px; }

/* ==================== RESULTS ==================== */
.results-container { display: flex; flex-direction: column; gap: 12px; }
.patient-result-card {
    background: var(--surface); border-radius: var(--radius-sm);
    padding: 20px; box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.patient-result-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.patient-result-card .meta { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.patient-result-card .details { display: grid; gap: 8px; margin-bottom: 16px; }
.patient-result-card .detail-row { display: flex; gap: 8px; font-size: 13px; }
.patient-result-card .detail-row i { color: var(--primary); width: 20px; text-align: center; }
.patient-result-card .actions { display: flex; gap: 8px; }

/* ==================== PATIENT DETAIL ==================== */
.patient-detail-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white; padding: 24px; border-radius: var(--radius-sm);
    margin-bottom: 20px;
}
.patient-detail-header h3 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.patient-detail-header p { opacity: 0.85; font-size: 14px; }
.patient-info-grid { display: grid; gap: 12px; margin-bottom: 24px; }
.patient-info-row {
    display: flex; align-items: center; gap: 12px;
    background: var(--surface); padding: 14px 16px;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.patient-info-row i { color: var(--primary); font-size: 18px; width: 24px; text-align: center; }
.patient-info-row .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; }
.patient-info-row .value { font-size: 14px; font-weight: 500; color: var(--text); }

.remarks-section { margin-bottom: 24px; }
.remarks-section h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.remarks-list { display: flex; flex-direction: column; gap: 10px; }
.remark-card {
    background: var(--surface); border-radius: var(--radius-sm);
    padding: 16px; border: 1px solid var(--border);
    border-left: 4px solid var(--secondary);
}
.remark-card .remark-header { display: flex; justify-content: space-between; margin-bottom: 8px; }
.remark-card .remark-author { font-size: 13px; font-weight: 600; color: var(--primary); }
.remark-card .remark-date { font-size: 11px; color: var(--text-muted); }
.remark-card .remark-text { font-size: 14px; color: var(--text); line-height: 1.5; }

/* ==================== FIND CARE ==================== */
.find-care-search { padding: 16px 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.btn-location { margin-bottom: 12px; }
.find-care-filters {
    background: var(--surface-2); padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: none;
}
.find-care-filters.open { display: block; }
.filter-group { margin-bottom: 12px; }
.filter-group label { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; display: block; }
.filter-group select, .filter-group input[type="text"] {
    width: 100%; padding: 10px 12px;
    border: 2px solid var(--border); border-radius: var(--radius-sm);
    font-size: 14px; background: var(--surface); color: var(--text);
}
.filter-group input[type="range"] { width: 100%; }
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-label input { width: 18px; height: 18px; accent-color: var(--primary); }
.find-care-body { padding: 16px 20px; }

.provider-card {
    background: var(--surface); border-radius: var(--radius);
    padding: 20px; box-shadow: var(--shadow);
    border: 1px solid var(--border); margin-bottom: 16px;
    transition: var(--transition);
}
.provider-card:hover { border-color: var(--secondary); box-shadow: var(--shadow-lg); }
.provider-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.provider-header h3 { font-size: 16px; font-weight: 700; color: var(--text); }
.provider-profession {
    background: var(--primary); color: white;
    padding: 4px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 600; text-transform: uppercase;
}
.provider-distance { font-size: 13px; color: var(--secondary); font-weight: 600; margin-bottom: 8px; }
.provider-info { display: grid; gap: 8px; margin-bottom: 16px; }
.provider-info-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-secondary); }
.provider-info-row i { color: var(--primary); width: 18px; text-align: center; font-size: 14px; }
.provider-hours { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.provider-hours span {
    background: var(--surface-2); padding: 4px 10px;
    border-radius: 12px; font-size: 11px; color: var(--text-secondary);
}
.provider-hours span.open-now { background: #e8f5e9; color: var(--secondary); font-weight: 600; }
.provider-hours span.closed { background: #ffebee; color: var(--accent); }
.provider-actions { display: flex; gap: 8px; }
.provider-actions a, .provider-actions button {
    flex: 1; padding: 12px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 600; text-align: center;
    text-decoration: none; cursor: pointer; border: none; font-family: inherit;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.provider-actions .btn-call { background: var(--secondary); color: white; }
.provider-actions .btn-map { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }

/* ==================== PROFILE ==================== */
.profile-header {
    text-align: center; padding: 32px 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}
.profile-avatar {
    width: 80px; height: 80px; border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex; align-items: center; justify-content: center;
    font-size: 32px; margin: 0 auto 16px;
}
.profile-header h3 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.profile-header p { opacity: 0.8; font-size: 14px; }
.profile-details { padding: 20px; }
.profile-detail-row {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 0; border-bottom: 1px solid var(--border);
}
.profile-detail-row:last-child { border-bottom: none; }
.profile-detail-row i { color: var(--primary); font-size: 18px; width: 24px; text-align: center; }
.profile-detail-row .info { flex: 1; }
.profile-detail-row .label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; }
.profile-detail-row .value { font-size: 14px; font-weight: 500; color: var(--text); }

/* ==================== LOCATION ==================== */
.location-card {
    background: var(--surface); border-radius: var(--radius-sm);
    padding: 24px; text-align: center; box-shadow: var(--shadow);
    border: 1px solid var(--border); margin-bottom: 20px;
}
.location-card i { font-size: 40px; color: var(--primary); margin-bottom: 12px; }
.location-card p { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }
.coords-display {
    margin-top: 12px; padding: 12px;
    background: var(--surface-2); border-radius: var(--radius-sm);
    font-family: monospace; font-size: 13px; color: var(--text-secondary);
}

/* ==================== CHATBOT ==================== */
.chatbot-body { display: flex; flex-direction: column; flex: 1; background: var(--bg); }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.chat-message { display: flex; gap: 12px; max-width: 85%; }
.chat-message.bot { align-self: flex-start; }
.chat-message.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 14px; flex-shrink: 0;
}
.chat-message.user .chat-avatar { background: var(--secondary); }
.chat-bubble {
    background: var(--surface); padding: 14px 16px;
    border-radius: var(--radius-sm); box-shadow: var(--shadow);
    border: 1px solid var(--border); font-size: 14px; line-height: 1.5;
}
.chat-message.user .chat-bubble { background: var(--primary); color: white; border-color: var(--primary); }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chat-suggestions button {
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 20px; padding: 8px 14px; font-size: 12px;
    cursor: pointer; color: var(--text); font-family: inherit;
    transition: var(--transition);
}
.chat-suggestions button:hover { background: var(--primary); color: white; border-color: var(--primary); }
.chat-input-area {
    display: flex; gap: 8px; padding: 16px 20px;
    background: var(--surface); border-top: 1px solid var(--border);
}
.chat-input-area input { flex: 1; padding: 12px 16px; border: 2px solid var(--border); border-radius: 24px; font-size: 14px; outline: none; background: var(--bg); color: var(--text); }
.chat-input-area input:focus { border-color: var(--primary); }
.chat-input-area button {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--primary); color: white; border: none;
    cursor: pointer; font-size: 16px; flex-shrink: 0;
}

/* ==================== SETTINGS ==================== */
.settings-group { margin-bottom: 24px; }
.settings-group h3 { font-size: 13px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; padding: 0 4px; }
.settings-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px; background: var(--surface); border-radius: var(--radius-sm);
    margin-bottom: 8px; box-shadow: var(--shadow); border: 1px solid var(--border);
    cursor: pointer; transition: var(--transition);
}
.settings-item:hover { border-color: var(--primary); }
.settings-item span { display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 500; }
.settings-item span.danger { color: var(--accent); }
.settings-item i { color: var(--text-muted); font-size: 16px; }
.settings-item a { color: var(--primary); text-decoration: none; }

.toggle { position: relative; width: 48px; height: 26px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--border); border-radius: 26px; transition: 0.3s;
}
.toggle-slider::before {
    position: absolute; content: ''; height: 20px; width: 20px; left: 3px; bottom: 3px;
    background: white; border-radius: 50%; transition: 0.3s; box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(22px); }

/* ==================== BOTTOM NAV ==================== */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    display: flex; justify-content: space-around; align-items: center;
    background: var(--surface); border-top: 1px solid var(--border);
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    z-index: 50; backdrop-filter: blur(10px);
}
.nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    background: none; border: none; color: var(--text-muted);
    font-size: 10px; font-family: inherit; cursor: pointer;
    padding: 4px 12px; transition: var(--transition); flex: 1;
}
.nav-item i { font-size: 20px; }
.nav-item.active { color: var(--primary); }
.nav-item.nav-add {
    width: 52px; height: 52px; border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
    color: white; display: flex; align-items: center; justify-content: center;
    margin-top: -20px; box-shadow: var(--shadow-lg); flex: none;
}
.nav-item.nav-add i { font-size: 22px; }

/* ==================== FAB ==================== */
.fab {
    position: fixed; bottom: 90px; right: 20px;
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white; border: none; font-size: 22px;
    cursor: pointer; box-shadow: var(--shadow-lg);
    z-index: 40; display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.fab:hover { transform: scale(1.1); }

/* ==================== TOAST ==================== */
.toast {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-100px);
    background: var(--text); color: white; padding: 14px 24px;
    border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
    z-index: 1000; box-shadow: var(--shadow-lg); transition: transform 0.3s ease;
    max-width: 90%; text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--accent); }
.toast.success { background: var(--secondary); }

/* ==================== LOADING ==================== */
.loading-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.9); z-index: 999;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.dark-mode .loading-overlay { background: rgba(15,23,42,0.9); }
.loading-overlay.hidden { display: none; }
.spinner {
    width: 40px; height: 40px; border: 4px solid var(--border);
    border-top-color: var(--primary); border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.loading-overlay p { margin-top: 16px; color: var(--text-secondary); font-size: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== UTILITIES ==================== */
.hidden { display: none !important; }
.heart { color: #ff6b6b; }

/* ==================== RESPONSIVE ==================== */
@media (min-width: 768px) {
    body { max-width: 480px; margin: 0 auto; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
    .bottom-nav { max-width: 480px; left: 50%; transform: translateX(-50%); border-radius: 24px 24px 0 0; }
    .fab { right: calc(50% - 200px); }
    .toast { max-width: 400px; }
}

/* ==================== SCROLLBAR ==================== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ==================== PATIENT CARD ==================== */
.patient-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white; border-radius: var(--radius); padding: 24px;
    margin-bottom: 20px; box-shadow: var(--shadow-lg);
}
.patient-card h3 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.patient-card p { opacity: 0.85; font-size: 14px; margin-bottom: 16px; }
.patient-card .nin-display {
    background: rgba(255,255,255,0.15); padding: 10px 16px;
    border-radius: var(--radius-sm); font-family: monospace;
    font-size: 16px; letter-spacing: 2px; text-align: center;
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.screen.active > * { animation: fadeInUp 0.3s ease forwards; }
