/* CBS Clinical Buddy System - Main Stylesheet */
/* Color Palette: Medical Blue/Teal */

:root {
    --primary: #0077B6;
    --primary-dark: #005F8A;
    --primary-light: #0096D6;
    --accent: #00B4D8;
    --accent-light: #90E0EF;
    --accent-pale: #CAF0F8;
    --bg: #F0F4F8;
    --bg-white: #FFFFFF;
    --text: #1B2A3D;
    --text-secondary: #4A6274;
    --text-muted: #8DA4B8;
    --border: #D0DCE6;
    --border-light: #E8EFF5;
    --success: #10B981;
    --success-bg: #ECFDF5;
    --warning: #F59E0B;
    --warning-bg: #FFFBEB;
    --danger: #EF4444;
    --danger-bg: #FEF2F2;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: 0.2s ease;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ===== Login Screen ===== */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    padding: 20px;
}

.login-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 440px;
    text-align: center;
}

.login-logo {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: #fff;
    font-size: 32px;
    font-weight: 700;
}

.login-card h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.login-card .subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 32px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-select,
.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    color: var(--text);
    background: var(--bg-white);
    transition: border-color var(--transition);
    appearance: none;
    -webkit-appearance: none;
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234A6274' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-select:focus,
.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 119, 182, 0.15);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    line-height: 1.4;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    width: 100%;
    padding: 12px;
    font-size: 15px;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 1.5px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border-light);
}

.btn-accent {
    background: var(--accent);
    color: #fff;
}

.btn-accent:hover {
    background: #009BBE;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #DC2626;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== App Layout ===== */
.app-layout {
    display: none;
    min-height: 100vh;
}

.app-layout.active {
    display: block;
}

/* Header */
.app-header {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
}

.header-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.nav-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg);
    padding: 4px;
    border-radius: var(--radius);
}

.nav-tab {
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border: none;
    background: transparent;
    transition: all var(--transition);
}

.nav-tab:hover {
    color: var(--text);
    background: var(--border-light);
}

.nav-tab.active {
    background: var(--bg-white);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.compliance-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success);
}

.compliance-badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
}

.country-selector {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    background: var(--bg-white);
    font-size: 13px;
    cursor: pointer;
    transition: border-color var(--transition);
}

.country-selector:hover {
    border-color: var(--primary);
}

.country-flag {
    font-size: 16px;
    line-height: 1;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    border-radius: 20px;
    background: var(--bg);
    font-size: 13px;
    font-weight: 500;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all var(--transition);
}

.logout-btn:hover {
    color: var(--danger);
    background: var(--danger-bg);
}

/* ===== Main Content ===== */
.app-main {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Page sections */
.page-section {
    display: none;
}

.page-section.active {
    display: block;
}

/* ===== Dashboard / Search ===== */
.dashboard-header {
    margin-bottom: 24px;
}

.dashboard-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.dashboard-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.search-container {
    position: relative;
    margin-bottom: 24px;
}

.search-input {
    width: 100%;
    padding: 14px 20px 14px 48px;
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: 16px;
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 119, 182, 0.12);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 18px;
}

.search-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    padding-left: 4px;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.stat-card .stat-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}

.stat-card .stat-sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Agent Cards */
.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.agent-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    transition: all var(--transition);
}

.agent-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--accent-light);
}

.agent-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.agent-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #fff;
}

.agent-icon.patient {
    background: linear-gradient(135deg, #0077B6, #00B4D8);
}

.agent-icon.prescription {
    background: linear-gradient(135deg, #10B981, #34D399);
}

.agent-card h3 {
    font-size: 16px;
    font-weight: 600;
}

.agent-card p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.agent-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.skill-tag {
    padding: 3px 10px;
    background: var(--accent-pale);
    color: var(--primary);
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

/* Search Results */
.search-results {
    margin-top: 16px;
}

.results-header {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.patient-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.patient-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-white);
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: all var(--transition);
}

.patient-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.patient-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.patient-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-pale);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.patient-name {
    font-weight: 600;
    font-size: 15px;
}

.patient-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.patient-arrow {
    color: var(--text-muted);
    font-size: 18px;
}

/* ===== Card Component ===== */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* ===== Patient Detail ===== */
.patient-detail-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
    padding: 24px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.patient-large-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    flex-shrink: 0;
}

.patient-detail-info {
    flex: 1;
}

.patient-detail-info h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.patient-id-badge {
    display: inline-block;
    padding: 2px 10px;
    background: var(--bg);
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 8px;
}

.patient-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.patient-tag {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.patient-tag.age {
    background: var(--accent-pale);
    color: var(--primary);
}

.patient-tag.gender {
    background: #EDE9FE;
    color: #7C3AED;
}

.patient-tag.blood {
    background: var(--danger-bg);
    color: var(--danger);
}

.patient-detail-actions {
    display: flex;
    gap: 8px;
}

/* Grid for patient sections */
.patient-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.patient-grid .full-width {
    grid-column: 1 / -1;
}

/* ===== Tables ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 10px 16px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 2px solid var(--border);
    background: var(--bg);
}

.data-table td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-light);
}

.data-table tr:hover td {
    background: var(--accent-pale);
}

/* Status indicators */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-dot.normal {
    background: var(--success);
}

.status-dot.abnormal {
    background: var(--danger);
}

.status-dot.pending {
    background: var(--warning);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.active {
    background: var(--success-bg);
    color: var(--success);
}

.status-badge.completed {
    background: var(--accent-pale);
    color: var(--primary);
}

.status-badge.cancelled {
    background: var(--bg);
    color: var(--text-muted);
}

/* ===== Timeline ===== */
.timeline {
    position: relative;
    padding-left: 28px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -24px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--bg-white);
    box-shadow: 0 0 0 2px var(--primary);
}

.timeline-date {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 2px;
}

.timeline-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.timeline-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ===== Prescription Form ===== */
.prescription-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group-inline {
    margin-bottom: 16px;
}

.form-group-inline label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

textarea.form-input {
    min-height: 80px;
    resize: vertical;
}

/* Interaction checker panel */
.interaction-panel {
    position: sticky;
    top: 84px;
}

.interaction-result {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 8px;
    font-size: 13px;
}

.interaction-result.safe {
    background: var(--success-bg);
    border: 1px solid var(--success);
    color: #065F46;
}

.interaction-result.warning {
    background: var(--warning-bg);
    border: 1px solid var(--warning);
    color: #92400E;
}

.interaction-result.danger {
    background: var(--danger-bg);
    border: 1px solid var(--danger);
    color: #991B1B;
}

.interaction-title {
    font-weight: 600;
    margin-bottom: 2px;
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    top: 72px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 400px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: slideIn 0.3s ease;
    font-size: 14px;
    line-height: 1.4;
}

.toast.info {
    background: var(--bg-white);
    border-left: 4px solid var(--primary);
    color: var(--text);
}

.toast.success {
    background: var(--success-bg);
    border-left: 4px solid var(--success);
    color: #065F46;
}

.toast.warning {
    background: var(--warning-bg);
    border-left: 4px solid var(--warning);
    color: #92400E;
}

.toast.error {
    background: var(--danger-bg);
    border-left: 4px solid var(--danger);
    color: #991B1B;
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.5;
    font-size: 16px;
    padding: 0;
    margin-left: auto;
    flex-shrink: 0;
}

.toast-close:hover {
    opacity: 1;
}

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

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-10px); }
}

.toast.removing {
    animation: fadeOut 0.3s ease forwards;
}

/* ===== Loading Spinner ===== */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2.5px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.spinner.lg {
    width: 36px;
    height: 36px;
    border-width: 3px;
}

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

.loading-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    gap: 12px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ===== Audit Trail (admin) ===== */
.audit-section {
    display: none;
}

.audit-section.visible {
    display: block;
}

.audit-log-entry {
    display: flex;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}

.audit-time {
    color: var(--text-muted);
    font-family: monospace;
    font-size: 12px;
    white-space: nowrap;
}

.audit-action {
    font-weight: 500;
}

.audit-user {
    color: var(--primary);
    font-weight: 600;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.empty-state p {
    font-size: 14px;
}

/* ===== Back Navigation ===== */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    cursor: pointer;
    transition: color var(--transition);
}

.back-link:hover {
    color: var(--primary);
    text-decoration: none;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .app-header {
        padding: 0 8px;
        height: 56px;
    }

    .header-center {
        display: none;
    }

    .header-right {
        gap: 6px;
    }

    /* Hide non-essential header items on mobile */
    .compliance-badge,
    .country-selector {
        display: none;
    }

    .user-badge {
        padding: 4px 8px 4px 4px;
        font-size: 12px;
    }

    .logout-btn {
        min-height: 44px;
        min-width: 44px;
        padding: 8px;
    }

    .nav-mobile {
        display: flex;
        gap: 4px;
        padding: 8px 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        background: var(--bg-white);
        border-bottom: 1px solid var(--border-light);
        white-space: nowrap;
    }

    .nav-mobile .nav-tab {
        min-height: 44px;
        padding: 8px 16px;
        font-size: 14px;
        flex-shrink: 0;
    }

    .app-main {
        padding: 12px;
    }

    .patient-grid {
        grid-template-columns: 1fr;
    }

    .prescription-layout {
        grid-template-columns: 1fr;
    }

    .interaction-panel {
        position: static;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .stats-row {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card .stat-value {
        font-size: 22px;
    }

    .patient-detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 16px;
    }

    .patient-large-avatar {
        width: 56px;
        height: 56px;
        font-size: 22px;
    }

    .patient-detail-info h2 {
        font-size: 18px;
    }

    .patient-tags {
        justify-content: center;
    }

    .patient-detail-actions {
        justify-content: center;
        width: 100%;
    }

    .patient-detail-actions .btn {
        flex: 1;
        min-height: 44px;
    }

    .agents-grid {
        grid-template-columns: 1fr;
    }

    .agent-card {
        padding: 16px;
    }

    .login-card {
        padding: 24px 16px;
        max-width: 100%;
    }

    .login-card h1 {
        font-size: 20px;
    }

    .form-select,
    .form-input {
        min-height: 44px;
        font-size: 16px; /* prevents iOS zoom */
    }

    .btn-primary {
        min-height: 48px;
        font-size: 16px;
    }

    /* Search */
    .search-input {
        font-size: 16px;
        padding: 12px 16px 12px 44px;
        min-height: 48px;
    }

    .search-icon {
        left: 14px;
    }

    /* Patient list items — bigger touch targets */
    .patient-item {
        padding: 14px 12px;
        min-height: 56px;
    }

    /* Toast */
    .toast-container {
        left: 8px;
        right: 8px;
        max-width: none;
    }

    /* Tables: horizontal scroll wrapper */
    .card-body {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* Dashboard header */
    .dashboard-header h2 {
        font-size: 20px;
    }

    /* Back link touch target */
    .back-link {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        padding: 8px 0;
    }
}

@media (max-width: 375px) {
    .app-header {
        padding: 0 6px;
    }

    .header-title {
        font-size: 15px;
    }

    .app-main {
        padding: 8px;
    }

    .stats-row {
        gap: 8px;
    }

    .stat-card .stat-value {
        font-size: 18px;
    }

    .login-card {
        padding: 20px 12px;
    }
}

@media (min-width: 769px) {
    .nav-mobile {
        display: none;
    }
}

/* ===== Utility ===== */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.text-sm {
    font-size: 13px;
}

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
