/* ==================== BASE ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: Arial, sans-serif; background: #f5f5f5; padding: 20px; }

.container { max-width: 900px; margin: 0 auto; background: white; padding: 30px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }
h1 { color: #2c3e50; margin-bottom: 15px; font-size: 24px; }
h2 { color: #555; font-size: 18px; margin-bottom: 20px; }
h3 { color: #34495e; font-size: 16px; margin-bottom: 10px; }
h4 { color: #555; font-size: 14px; margin-bottom: 8px; }

/* ==================== BUTTONS ==================== */
button { padding: 12px 24px; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; font-weight: 600; transition: background 0.3s; }
.btn-primary { background: #3498db; color: white; }
.btn-primary:hover { background: #2980b9; }
.btn-success { background: #27ae60; color: white; }
.btn-success:hover { background: #229954; }
.btn-secondary { background: #95a5a6; color: white; }
.btn-secondary:hover { background: #7f8c8d; }
.btn-danger { background: #e74c3c; color: white; }
.btn-danger:hover { background: #c0392b; }
.btn-teal { background: #009688; color: white; }
.btn-teal:hover { background: #00796b; }
.btn-small { padding: 6px 12px; font-size: 12px; }
button:disabled { opacity: 0.6; cursor: not-allowed; }

.button-group { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* ==================== FORMS ==================== */
label { display: block; margin-bottom: 5px; color: #555; font-size: 14px; }
input, select, textarea {
    width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 4px;
    font-size: 14px; font-family: Arial, sans-serif; margin-bottom: 10px;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

/* ==================== CONNECTION INDICATOR ==================== */
.connection-indicator {
    position: fixed; top: 20px; left: 20px; z-index: 1001;
    padding: 8px 16px; border-radius: 20px; font-size: 12px; font-weight: 600;
    display: flex; align-items: center; gap: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.connection-indicator.online { background: #d4edda; color: #155724; }
.connection-indicator.offline { background: #f8d7da; color: #721c24; }
.connection-indicator.connecting { background: #fff3cd; color: #856404; }
.connection-dot { width: 8px; height: 8px; border-radius: 50%; }
.connection-indicator.online .connection-dot { background: #28a745; }
.connection-indicator.offline .connection-dot { background: #dc3545; }
.connection-indicator.connecting .connection-dot { background: #ffc107; animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ==================== LOGIN ==================== */
.login-screen { text-align: center; padding: 60px 20px; max-width: 400px; margin: 0 auto; }
.login-form { background: #f5f5f5; padding: 30px; border-radius: 12px; }
.login-form label { text-align: left; font-weight: 600; }
.login-btn {
    width: 100%; padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white; border: none; border-radius: 8px; font-size: 16px; font-weight: 600;
    cursor: pointer; transition: all 0.3s;
}
.login-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(102,126,234,0.4); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.login-error { background: #f8d7da; color: #721c24; padding: 10px; border-radius: 6px; margin-bottom: 15px; font-size: 14px; }

/* ==================== LOCATION SELECTOR ==================== */
.location-screen { text-align: center; padding: 60px 20px; }
.location-buttons {
    display: flex; gap: 20px; justify-content: center;
    max-width: 500px; margin: 0 auto;
}
.location-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
    width: 180px; height: 180px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e3edf7 100%);
    border: 2px solid #c3cfe2; border-radius: 16px; cursor: pointer;
    font-size: 16px; font-weight: 600; color: #333; transition: all 0.2s;
}
.location-btn:hover {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border-color: #90caf9; transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}
.location-icon { width: 60px; height: 60px; color: #36597A; flex-shrink: 0; }

/* ==================== DASHBOARD ==================== */
.dashboard-screen { padding: 10px 0; }
.user-name { font-weight: 600; color: #333; }
.location-badge {
    display: inline-block; background: #e3f2fd; color: #1565C0;
    padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
}

/* Dashboard toolbar */
.dashboard-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; margin-bottom: 15px; border-bottom: 1px solid #e0e0e0;
}
.toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar-actions { display: flex; gap: 8px; align-items: center; }
.toolbar-btn {
    padding: 7px 14px; background: #f5f5f5; border: 1px solid #e0e0e0;
    border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600;
    transition: all 0.2s;
}
.toolbar-btn:hover { background: #e3f2fd; border-color: #90caf9; }
.toolbar-btn-walkin { color: #2e7d32; }
.toolbar-btn-walkin:hover { background: #e8f5e9; border-color: #a5d6a7; }
.toolbar-btn-stock { color: #880e4f; }
.toolbar-btn-stock:hover { background: #fce4ec; border-color: #f48fb1; }
.toolbar-btn-logout { color: #c62828; }
.toolbar-btn-logout:hover { background: #ffebee; border-color: #ef9a9a; }

.patient-actions-bar {
    display: flex; justify-content: flex-end; gap: 8px; margin: 10px 0;
}

/* ==================== PATIENT SEARCH ==================== */
.patient-search-section {
    background: #e3f2fd; padding: 20px; border-radius: 8px; margin-bottom: 20px;
}
.search-input-group { display: flex; gap: 10px; margin-bottom: 15px; }
.search-input-group input { flex: 1; }
.search-results { max-height: 300px; overflow-y: auto; background: white; border-radius: 6px; }
.search-result-item {
    padding: 12px 15px; border-bottom: 1px solid #eee;
    cursor: pointer; transition: background 0.2s;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: #f5f5f5; }
.search-result-name { font-weight: 600; color: #333; }
.search-result-info { font-size: 12px; color: #666; }
.search-no-results { padding: 20px; text-align: center; color: #666; font-style: italic; }

/* ==================== PATIENT SUMMARY ==================== */
.patient-summary {
    background: white; padding: 15px; border-radius: 8px; margin-top: 15px;
    border: 1px solid #e0e0e0;
}
.patient-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
}
.patient-name { font-size: 18px; color: #2c3e50; }
.patient-age { font-size: 14px; color: #666; margin-left: 8px; }
.patient-details { font-size: 13px; color: #555; line-height: 1.6; }
.avs-display { font-family: 'Courier New', monospace; color: #1565C0; }

/* ==================== MEDICAL DATA ==================== */
.medical-section {
    margin-top: 12px; padding-top: 12px; border-top: 1px solid #eee;
}
.medical-row { margin-bottom: 6px; font-size: 13px; }
.medical-row strong { color: #555; margin-right: 6px; }
.medical-tag {
    display: inline-block; background: #e8f5e9; color: #2e7d32;
    padding: 2px 8px; border-radius: 12px; font-size: 12px; margin: 2px 4px 2px 0;
}
.medical-tag.immune { background: #ffebee; color: #c62828; }
.medical-tag.allergy { background: #fff3e0; color: #e65100; }

/* ==================== CASES ==================== */
.case-view { margin-top: 20px; }
.case-list-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;
}
.case-card {
    background: #f5f5f5; border: 2px solid #e0e0e0; border-radius: 8px;
    padding: 12px 16px; margin-bottom: 10px; cursor: pointer; transition: all 0.2s;
}
.case-card:hover { border-color: #2196F3; }
.case-card.active { border-color: #2196F3; background: #e3f2fd; }
.case-card.open { border-left: 4px solid #27ae60; }
.case-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.case-type { font-weight: 600; color: #333; }
.case-status { font-size: 12px; padding: 2px 8px; border-radius: 12px; }
.case-status.ouvert { background: #e8f5e9; color: #2e7d32; }
.case-status.termine { background: #f5f5f5; color: #666; }
.case-status.annule { background: #ffebee; color: #c62828; }
.case-destinations { font-size: 14px; color: #1565C0; margin-bottom: 4px; }
.case-dates { font-size: 12px; color: #999; }

/* ==================== CASE DETAIL ==================== */
.case-detail {
    background: #fafafa; border: 1px solid #e0e0e0; border-radius: 8px;
    padding: 20px; margin-top: 15px;
}
.case-detail-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }

.case-voyage-detail { margin-bottom: 15px; padding: 10px; background: #f8f9fa; border-radius: 6px; }
.voyage-destinations-detail { margin-bottom: 6px; font-size: 13px; line-height: 1.6; }
.voyage-dest-row { color: #333; }

.case-medical-snapshot {
    margin-bottom: 15px; padding: 10px; background: #fff8f0;
    border-radius: 6px; border-left: 3px solid #ff9800; font-size: 13px;
}
.case-medical-snapshot .history-section-title { margin-bottom: 6px; }

.patient-gender { font-size: 12px; color: #888; margin-left: 6px; }
.patient-weight { color: #555; }
.medical-warning { color: #c62828; font-weight: 500; }

/* ==================== CONSULTATIONS ==================== */
.consultation-card {
    background: white; border-left: 4px solid #2196F3;
    padding: 12px; margin-bottom: 10px; border-radius: 0 6px 6px 0;
    cursor: pointer; transition: background 0.15s;
}
.consultation-card:hover { background: #f5f9ff; }
.consultation-card.expanded { background: #f5f9ff; }
.consultation-header { display: flex; justify-content: space-between; align-items: center; }
.consultation-type { font-weight: 600; color: #1976D2; font-size: 14px; }
.consultation-practitioner { font-weight: 400; color: #888; font-size: 12px; }
.consultation-date { font-size: 12px; color: #666; }
.consultation-notes { font-size: 13px; color: #555; margin-top: 4px; white-space: pre-line; }
.consultation-expand { margin-top: 10px; padding-top: 10px; border-top: 1px solid #e8e8e8; }
.consultation-loading { font-size: 12px; color: #999; font-style: italic; }
.expand-indicator { margin-left: 6px; font-size: 10px; color: #999; }

.add-consultation { display: flex; gap: 10px; margin-top: 15px; flex-wrap: wrap; }

/* ==================== NEW CASE FORM ==================== */
.new-case-form {
    background: #fff3e0; padding: 15px; border-radius: 8px;
    margin-bottom: 15px; border: 1px solid #ffcc02;
}
.form-row { margin-bottom: 10px; }
.form-row label { font-weight: 600; font-size: 13px; }
.form-actions { display: flex; gap: 10px; margin-top: 10px; }

/* ==================== CONSULTATION FORM ==================== */
.consultation-form { padding: 10px 0; }
.consultation-form h1 { font-size: 22px; margin-bottom: 8px; }
.practitioner-info { font-size: 14px; color: #555; margin-bottom: 15px; }

/* ==================== ACCORDION ==================== */
.accordion-section {
    border: 1px solid #e0e0e0; border-radius: 8px; margin-bottom: 10px;
}
.accordion-section.active { border-color: #2196F3; }
.accordion-header {
    display: flex; align-items: center; gap: 10px; padding: 12px 16px;
    background: #f5f5f5; cursor: pointer; font-weight: 600; font-size: 15px;
    color: #333; transition: background 0.2s; user-select: none;
}
.accordion-header:hover { background: #e8e8e8; }
.accordion-section.active .accordion-header { background: #e3f2fd; color: #1565C0; }
.accordion-icon { font-size: 12px; width: 16px; text-align: center; }
.accordion-content { padding: 16px; }

/* ==================== CHRONOMETER ==================== */
.chronometer {
    position: fixed; top: 20px; right: 20px; z-index: 1000;
    background: white; border: 2px solid #2196F3; border-radius: 12px;
    padding: 10px 16px; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex; align-items: center; gap: 12px;
}
.chrono-time {
    font-family: 'Courier New', monospace; font-size: 20px; font-weight: 700;
    color: #333; min-width: 70px; text-align: center;
}
.chrono-status { font-size: 11px; color: #666; }
.chrono-controls { display: flex; gap: 6px; }
.chrono-controls button {
    padding: 4px 10px; font-size: 12px; border-radius: 4px;
}

/* ==================== PATIENT EDIT FORM ==================== */
.patient-edit-form { font-size: 13px; }
.patient-compact-view { line-height: 1.8; }
.patient-compact-view .edit-toggle {
    float: right; font-size: 12px; color: #1565C0; cursor: pointer;
    text-decoration: underline;
}
.patient-edit-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.patient-edit-grid label { font-weight: 600; margin-bottom: 2px; }
.patient-edit-grid input { margin-bottom: 4px; }
.field-full { grid-column: 1 / -1; }
.age-display {
    font-size: 13px; color: #555; padding: 4px 0;
}
.age-display.child { color: #e65100; font-weight: 600; }
.weight-notice {
    background: #fff8e1; border: 1px solid #ffecb3; border-radius: 6px;
    padding: 8px 12px; margin-top: 8px; font-size: 12px; color: #f57f17;
    display: flex; align-items: center; gap: 8px;
}
.weight-notice input { width: 80px; margin: 0; padding: 4px 8px; }

/* ==================== NOTES SECTION ==================== */
.notes-section .conseil-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px;
}
.notes-section .conseil-item {
    display: flex; align-items: center; gap: 6px; font-size: 13px; color: #555;
}
.notes-section .conseil-item input[type="checkbox"] {
    width: auto; margin: 0;
}
.notes-section textarea {
    min-height: 120px; resize: vertical;
}

/* ==================== VACCINE PANEL ==================== */
.vaccine-lot-status {
    font-size: 12px; color: #666; margin-bottom: 10px;
    padding: 6px 10px; background: #f5f5f5; border-radius: 4px;
}

/* Vaccine card */
.vax-card {
    background: #fafafa; border: 1px solid #e0e0e0; border-radius: 8px;
    padding: 14px 16px; margin-bottom: 10px; position: relative;
    transition: border-color 0.2s;
}
.vax-card:hover { border-color: #90caf9; }
.vax-card.vax-planning { border-left: 4px solid #ff9800; background: #fffaf5; }
.vax-card.vax-preloaded { border-left: 4px solid #7c4dff; background: #f3f0ff; }
.vax-card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
}
.vax-card-title { display: flex; align-items: center; gap: 8px; }
.vax-card-name { font-weight: 700; font-size: 15px; color: #1565C0; }
.vax-preloaded-badge {
    display: inline-block; font-size: 10px; font-weight: 700;
    padding: 2px 8px; border-radius: 10px;
    background: #ede7f6; color: #7c4dff; border: 1px solid #d1c4e9;
}
.vax-card .remove-btn {
    padding: 4px 10px; font-size: 12px; background: #ffebee; color: #c62828;
    border: 1px solid #ffcdd2; border-radius: 4px; cursor: pointer;
    font-weight: 600; transition: background 0.2s;
}
.vax-card .remove-btn:hover { background: #ffcdd2; }

/* Administered toggle */
.vax-toggle {
    display: flex; align-items: center; gap: 6px; margin-bottom: 10px;
    font-size: 13px;
}
.vax-toggle input[type="checkbox"] { width: auto; margin: 0; }
.vax-toggle label {
    display: inline; margin: 0; font-weight: 600; color: #333; cursor: pointer;
}
.vax-planning-hint { font-size: 11px; color: #e65100; font-weight: 400; margin-left: 4px; }

/* Dose + Lot + Site row */
.vax-fields {
    display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
    font-size: 13px; flex-wrap: wrap;
}
.vax-fields label {
    display: inline; margin: 0; font-weight: 600; color: #555; white-space: nowrap;
}
.vax-fields select {
    width: auto; margin: 0; padding: 6px 10px; font-size: 13px;
}
.vax-dose-select { min-width: 70px; }
.vax-lot-select { min-width: 240px; flex: 1; }
.lot-tag-expiring {
    display: inline-block; font-size: 11px; font-weight: 600;
    padding: 1px 8px; border-radius: 10px;
    background: #fff3e0; color: #e65100;
}

/* Site injection radios */
.vax-site-group { display: inline-flex; gap: 14px; flex-wrap: wrap; }
.vax-site-radio {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 13px; color: #555; cursor: pointer; white-space: nowrap;
}
.vax-site-radio input[type="radio"] { width: auto; margin: 0; }
.vax-site-missing { font-size: 11px; color: #e65100; margin-left: 8px; }

/* Boosters inside card */
.vax-boosters { margin-top: 10px; padding-top: 10px; border-top: 1px dashed #ddd; }
.vax-boosters-title {
    font-size: 11px; color: #999; font-weight: 600;
    text-transform: uppercase; margin-bottom: 6px;
}
.vax-booster-line {
    display: flex; align-items: center; gap: 10px; margin-bottom: 4px;
    font-size: 13px; color: #555;
}
.vax-booster-dose { font-weight: 600; min-width: 60px; color: #333; }
.vax-booster-interval { min-width: 70px; color: #999; font-size: 12px; }
.vax-booster-line input[type="date"] { width: auto; margin: 0; padding: 4px 8px; font-size: 13px; }
.vax-no-booster { font-size: 12px; color: #999; font-style: italic; }
.vax-add-booster {
    margin-top: 6px; padding: 3px 10px; font-size: 11px; font-weight: 600;
    background: #f5f5f5; color: #1565C0; border: 1px dashed #90caf9;
    border-radius: 4px; cursor: pointer; transition: background 0.2s;
}
.vax-add-booster:hover { background: #e3f2fd; }

/* Add vaccine dropdown */
.vax-dropdown-wrapper { position: relative; margin-bottom: 16px; }
.vax-add-btn {
    padding: 12px 20px; background: #e3f2fd; color: #1565C0;
    border: 2px dashed #90caf9; border-radius: 8px; cursor: pointer;
    font-size: 14px; font-weight: 600; width: 100%; text-align: center;
    transition: all 0.2s;
}
.vax-add-btn:hover { background: #bbdefb; border-color: #42a5f5; }
.vax-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
    background: white; border: 1px solid #ddd; border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15); max-height: 380px; overflow-y: auto;
}
.vax-dropdown-search {
    padding: 8px 12px; border-bottom: 1px solid #eee;
    position: sticky; top: 0; background: white; z-index: 1;
}
.vax-dropdown-search input { margin: 0; padding: 8px 10px; font-size: 13px; }
.vax-dropdown-group {
    padding: 6px 12px; font-size: 11px; font-weight: 700; color: #999;
    text-transform: uppercase; background: #f9f9f9; border-bottom: 1px solid #eee;
}
.vax-dropdown-item {
    padding: 9px 14px; cursor: pointer; font-size: 13px;
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #f5f5f5; transition: background 0.1s;
}
.vax-dropdown-item:hover { background: #e3f2fd; }
.vax-dropdown-item.disabled { opacity: 0.35; cursor: not-allowed; }
.vax-dropdown-meta { font-size: 11px; color: #999; }

/* ==================== PRESCRIPTION PANEL ==================== */
.prescription-panel h4 { color: #009688; margin-bottom: 12px; }
.medication-selector {
    display: flex; gap: 10px; align-items: flex-end; margin-bottom: 15px; flex-wrap: wrap;
}
.medication-selector select { flex: 1; min-width: 200px; }
.medication-selector button { white-space: nowrap; }

.custom-med-fields {
    display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap;
}
.custom-med-fields input { flex: 1; min-width: 150px; }

.medication-list { margin-top: 10px; }
.medication-item {
    background: #f5f5f5; border: 1px solid #e0e0e0; border-radius: 8px;
    padding: 12px; margin-bottom: 10px; position: relative;
}
.medication-item-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;
}
.medication-name { font-weight: 600; color: #333; font-size: 14px; }
.medication-item .remove-btn {
    padding: 2px 8px; font-size: 11px; background: #ffebee; color: #c62828;
    border: 1px solid #ffcdd2; border-radius: 4px; cursor: pointer;
}
.medication-item .remove-btn:hover { background: #ffcdd2; }
.medication-dosing {
    width: 100%; min-height: 60px; resize: vertical;
    font-size: 13px; padding: 8px; border: 1px solid #ddd; border-radius: 4px;
    font-family: Arial, sans-serif;
}

.prescription-settings {
    display: flex; gap: 15px; align-items: center; margin-top: 15px;
    padding-top: 12px; border-top: 1px solid #eee; font-size: 13px;
}
.prescription-settings label { display: inline; margin: 0; font-weight: 600; }
.prescription-settings input, .prescription-settings select {
    width: auto; margin: 0; padding: 4px 8px;
}

/* ==================== DOSSIER STATUS ==================== */
.dossier-status {
    background: #f9f9f9; border: 1px solid #e0e0e0; border-radius: 8px;
    padding: 15px; margin-top: 15px;
}
.dossier-status h4 { color: #555; margin-bottom: 10px; font-size: 14px; }
.status-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 4px 0; font-size: 13px; color: #555;
}
.status-check { color: #27ae60; font-weight: 600; }
.status-missing { color: #e74c3c; }

/* ==================== MODAL ==================== */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 2000;
    display: flex; align-items: center; justify-content: center;
}
.modal-content {
    background: white; border-radius: 12px; width: 90%; max-width: 600px;
    max-height: 80vh; overflow: hidden; box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; background: #f5f5f5; border-bottom: 1px solid #e0e0e0;
}
.modal-header h2 { font-size: 18px; color: #333; margin: 0; }
.modal-close {
    background: none; border: none; font-size: 20px; color: #666;
    cursor: pointer; padding: 4px 8px; line-height: 1;
}
.modal-close:hover { color: #333; }
.modal-body { padding: 20px; overflow-y: auto; max-height: calc(80vh - 60px); }

/* ==================== TIMELINE ==================== */
.timeline { padding: 10px 0 10px 20px; border-left: 3px solid #e0e0e0; }
.timeline-item {
    position: relative; padding: 0 0 20px 20px;
}
.timeline-dot {
    position: absolute; left: -11px; top: 4px;
    width: 16px; height: 16px; border-radius: 50%; border: 3px solid white;
    box-shadow: 0 0 0 2px #e0e0e0;
}
.dot-case { background: #2196F3; }
.dot-consultation { background: #27ae60; }
.dot-observation { background: #ff9800; }
.timeline-date { font-size: 11px; color: #999; margin-bottom: 2px; }
.timeline-content { font-size: 13px; }
.timeline-title { font-weight: 600; color: #333; }
.timeline-details { font-size: 12px; color: #666; margin-top: 2px; }

/* ==================== PENDING FORMS ==================== */
.pending-forms-screen { padding: 10px 0; }
.pending-forms-header {
    display: flex; justify-content: space-between; align-items: center;
    gap: 10px; margin-bottom: 15px;
}
.pending-forms-search {
    display: flex; gap: 8px; flex: 1;
}
.pending-forms-search input { flex: 1; margin: 0; }
.refresh-btn {
    padding: 8px 12px; background: #f5f5f5; border: 1px solid #e0e0e0;
    border-radius: 4px; cursor: pointer; font-size: 16px; transition: background 0.2s;
}
.refresh-btn:hover { background: #e3f2fd; }
.manual-entry-btn {
    padding: 8px 14px; background: #e8f5e9; color: #2e7d32;
    border: 1px solid #a5d6a7; border-radius: 6px; cursor: pointer;
    font-size: 13px; font-weight: 600; white-space: nowrap; transition: background 0.2s;
}
.manual-entry-btn:hover { background: #c8e6c9; }

.form-date-header {
    font-size: 13px; font-weight: 700; color: #666; padding: 8px 0 6px;
    margin-top: 10px; border-bottom: 1px solid #eee; margin-bottom: 8px;
}
.form-date-header.today { color: #1565C0; }
.form-date-header.past { color: #999; }
.no-forms-message { text-align: center; color: #999; font-style: italic; padding: 30px 20px; }

.form-card {
    display: flex; align-items: center;
    padding: 0; background: #fff; border: 1px solid #e0e0e0;
    border-radius: 8px; margin-bottom: 8px; cursor: pointer; transition: all 0.2s;
    overflow: hidden;
}
.form-card:hover { border-color: #2196F3; background: #f8fbff; }
.form-card.status-received { border-left: 4px solid #27ae60; }
.form-card.status-awaiting { border-left: 4px solid #ff9800; }
.form-card.status-draft-linked { border-left: 4px solid #ce93d8; }
.form-card.status-draft { border-left: 4px solid #90caf9; }
.form-card-info { flex: 1; padding: 10px 12px; }
.form-card-name { font-weight: 600; color: #333; font-size: 14px; }
.form-card-details { font-size: 12px; color: #666; margin-top: 2px; }
.form-card-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; padding: 10px 12px; }

/* Appointment time column */
.appointment-time {
    flex: 0 0 60px; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; color: #555;
    background: #f5f5f5; align-self: stretch;
    border-right: 1px solid #e0e0e0; padding: 8px;
}

.form-card-badge, .form-status-badge {
    display: inline-block; font-size: 11px; font-weight: 600; padding: 3px 10px;
    border-radius: 12px; white-space: nowrap;
}
.badge-form-received { background: #e8f5e9; color: #2e7d32; }
.badge-awaiting-form { background: #fff3e0; color: #e65100; }
.badge-draft-linked { background: #f3e5f5; color: #7b1fa2; }
.badge-draft { background: #e3f2fd; color: #1565C0; }
.badge-new { background: #e8f5e9; color: #2e7d32; }
.badge-known { background: #e3f2fd; color: #1565C0; }

/* ==================== SHARED ==================== */
.no-data-message { text-align: center; color: #999; font-style: italic; padding: 20px; }
.cases-summary { margin-top: 12px; padding-top: 12px; border-top: 1px solid #eee; }
.open-cases-hint { font-size: 12px; color: #27ae60; margin-top: 4px; }

/* ==================== CHECKBOX MULTISELECT ==================== */
.checkbox-multiselect {
    display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px;
}
.checkbox-item {
    display: flex; align-items: center; gap: 6px; font-size: 13px; color: #555;
}
.checkbox-item input[type="checkbox"] { width: auto; margin: 0; }
.checkbox-item .detail-input {
    flex: 1; padding: 3px 6px; font-size: 12px; margin: 0; min-width: 100px;
}

/* ==================== VOYAGE EDITOR ==================== */
.destination-row {
    display: grid; grid-template-columns: 1.5fr 1fr 1fr auto; gap: 8px;
    align-items: center; margin-bottom: 6px;
}
.destination-row input, .destination-row select { margin: 0; }
.destination-row .remove-dest {
    padding: 4px 10px; font-size: 14px; background: #ffebee; color: #c62828;
    border: 1px solid #ffcdd2; border-radius: 4px; cursor: pointer;
}
.destination-row .remove-dest:hover { background: #ffcdd2; }
.destination-header {
    display: grid; grid-template-columns: 1.5fr 1fr 1fr auto; gap: 8px;
    font-size: 12px; color: #999; font-weight: 600; margin-bottom: 4px;
}
.voyage-compact { font-size: 13px; line-height: 1.6; }
.voyage-compact .dest-line { margin-bottom: 2px; }
.voyage-cols { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-top: 8px; }
.voyage-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.voyage-chip {
    display: inline-block; padding: 2px 8px; border-radius: 12px;
    font-size: 11px; font-weight: 600;
}
.voyage-chip.travel { background: #e3f2fd; color: #1565C0; }
.voyage-chip.neutral { background: #f5f5f5; color: #555; }
.voyage-chip.activity { background: #e8f5e9; color: #2e7d32; }
.voyage-chip.rural { background: #fff3e0; color: #e65100; }
.voyage-section-label { font-size: 11px; color: #999; font-weight: 600; text-transform: uppercase; }
/* Country autocomplete */
.country-autocomplete-wrapper { position: relative; }
.country-autocomplete-wrapper input { width: 100%; }
.country-dropdown {
    position: absolute; top: 100%; left: 0; right: 0;
    background: #fff; border: 1px solid #ddd; border-top: none;
    border-radius: 0 0 4px 4px; max-height: 200px;
    overflow-y: auto; z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.country-dropdown-item {
    padding: 8px 12px; cursor: pointer; font-size: 13px;
}
.country-dropdown-item:hover, .country-dropdown-item.highlighted {
    background: #e3f2fd;
}
/* Date warnings */
.date-warnings { grid-column: 1 / -1; }
.date-warnings span { font-size: 11px; margin-right: 12px; }
.date-warning-error { color: #c62828; }
.date-warning-warn { color: #e65100; }

/* ==================== MEDICAL EDITOR ==================== */
.medical-editor { font-size: 13px; }
.medical-compact { line-height: 1.8; }
.medical-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.medical-field { margin-bottom: 10px; }
.medical-field label { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.radio-group { display: inline-flex; gap: 12px; }
.radio-inline {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 13px; color: #555; cursor: pointer; white-space: nowrap; margin: 0;
}
.radio-inline input[type="radio"] { width: auto; margin: 0; }
.detail-textarea {
    width: 100%; min-height: 40px; resize: vertical; font-size: 13px;
    padding: 6px 8px; margin-top: 4px;
}
/* Medical section cards */
.med-group {
    background: #fafafa; border: 1px solid #e8e8e8; border-radius: 6px;
    padding: 10px 12px; margin-bottom: 8px;
}
.med-group.comorbidities { border-left: 3px solid #c62828; }
.med-group.allergies { border-left: 3px solid #e65100; }
.med-group.medications { border-left: 3px solid #1565C0; }
.med-group.gynecology { border-left: 3px solid #7B1FA2; }
.med-group.vaccination { border-left: 3px solid #00796b; }

/* ==================== PATIENT HISTORY ==================== */
.history-toggle {
    width: 100%; padding: 10px 16px; background: #f5f5f5; border: 1px solid #e0e0e0;
    border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600;
    color: #555; text-align: left; transition: background 0.2s;
}
.history-toggle:hover { background: #e8e8e8; }
.history-consultation {
    background: #fafafa; border: 1px solid #e0e0e0; border-radius: 8px;
    padding: 12px 16px; margin-bottom: 10px;
}
.history-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px; font-size: 14px;
}
.history-type { font-weight: 600; color: #1565C0; }
.history-date { font-size: 12px; color: #999; }
.history-section { margin-bottom: 8px; }
.history-section-title { font-size: 11px; color: #999; font-weight: 600; text-transform: uppercase; margin-bottom: 4px; }
.history-list { font-size: 13px; color: #555; line-height: 1.6; }
.history-notes { font-size: 13px; color: #555; white-space: pre-line; }
.history-notes.truncated { max-height: 60px; overflow: hidden; position: relative; }
.history-notes.truncated::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0;
    height: 30px; background: linear-gradient(transparent, #fafafa);
}
.history-show-more {
    font-size: 12px; color: #1565C0; cursor: pointer; border: none;
    background: none; padding: 2px 0; text-decoration: underline;
}

/* (home-action-stock removed — replaced by toolbar-btn-stock) */

/* ==================== STOCK SCREEN ==================== */
.stock-screen { padding: 10px 0; }
.stock-header {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 10px; margin-bottom: 20px;
}
.stock-header-left {
    display: flex; align-items: center; gap: 12px;
}
.stock-header-left h1 { margin: 0; font-size: 22px; }
.stock-header-right {
    display: flex; gap: 8px; align-items: center;
}

/* Summary cards */
.stock-summary {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px;
}
.stock-stat-card {
    background: #f5f5f5; border-radius: 8px; padding: 14px 16px;
    text-align: center; border: 1px solid #e0e0e0;
}
.stock-stat-card.stock-stat-warn { background: #fff3e0; border-color: #ffcc80; }
.stock-stat-card.stock-stat-danger { background: #ffebee; border-color: #ef9a9a; }
.stock-stat-value { font-size: 28px; font-weight: 700; color: #333; }
.stock-stat-label { font-size: 12px; color: #666; margin-top: 4px; }

/* Search / controls */
.stock-controls { margin-bottom: 15px; }
.stock-search-input {
    width: 100%; padding: 10px 14px; border: 1px solid #ddd;
    border-radius: 6px; font-size: 14px;
}

/* Table */
.stock-table-wrapper { overflow-x: auto; }
.stock-table {
    width: 100%; border-collapse: collapse; font-size: 13px;
}
.stock-table th {
    text-align: left; padding: 10px 12px; background: #f5f5f5;
    border-bottom: 2px solid #ddd; font-size: 12px; color: #666;
    text-transform: uppercase; white-space: nowrap;
}
.stock-table td { padding: 10px 12px; border-bottom: 1px solid #eee; }
.stock-table tbody tr:hover { background: #fafafa; }

.stock-cell-vaccine { font-weight: 600; color: #1565C0; }
.stock-cell-lot { font-family: 'Courier New', monospace; font-size: 13px; }
.stock-cell-qty { font-weight: 600; min-width: 80px; }
.stock-cell-actions { white-space: nowrap; }

/* Status rows */
.stock-status-expired td { background: #fff5f5; }
.stock-status-expiring td { background: #fffaf0; }
.stock-status-out_of_stock td { background: #fafafa; color: #999; }

/* Status badges */
.stock-status-badge {
    display: inline-block; font-size: 11px; font-weight: 600;
    padding: 2px 10px; border-radius: 12px; white-space: nowrap;
}
.badge-ok { background: #e8f5e9; color: #2e7d32; }
.badge-low_stock { background: #fff3e0; color: #e65100; }
.badge-expiring { background: #fff8e1; color: #f57f17; }
.badge-expired { background: #ffebee; color: #c62828; }
.badge-out_of_stock { background: #f5f5f5; color: #999; }

/* Action buttons */
.stock-action-btn {
    padding: 4px 8px; font-size: 14px; background: #f5f5f5;
    border: 1px solid #ddd; border-radius: 4px; cursor: pointer;
    margin-right: 4px; transition: background 0.2s; line-height: 1;
}
.stock-action-btn:hover { background: #e3f2fd; }
.stock-action-delete:hover { background: #ffebee; }
.stock-confirm-delete { font-size: 12px; color: #c62828; margin-right: 6px; }

/* Inline adjustment */
.stock-adjust-inline {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.stock-adjust-input {
    width: 70px; padding: 4px 8px; font-size: 13px;
    margin: 0; border: 1px solid #90caf9; border-radius: 4px;
}
.stock-adjust-reason {
    width: auto; padding: 4px 8px; font-size: 12px;
    margin: 0; border: 1px solid #ddd; border-radius: 4px;
}

/* ==================== PIN MODAL ==================== */
.pin-modal { max-width: 360px; }
.pin-description { font-size: 13px; color: #666; margin-bottom: 16px; }
.pin-field { margin-bottom: 12px; }
.pin-field label { font-weight: 600; font-size: 13px; }
.pin-input {
    width: 100%; padding: 12px; font-size: 24px; text-align: center;
    letter-spacing: 12px; font-family: 'Courier New', monospace;
    border: 2px solid #ddd; border-radius: 8px;
}
.pin-input:focus { border-color: #667eea; }
.pin-error { background: #ffebee; color: #c62828; padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; font-size: 13px; }
.pin-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.pin-modal-error {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: #c62828; color: white; padding: 8px 20px; border-radius: 6px;
    font-size: 13px; z-index: 3000;
}

/* ==================== STOCK LOT FORM ==================== */
.stock-lot-modal { max-width: 500px; }
.stock-form-row { margin-bottom: 12px; }
.stock-form-row label { font-weight: 600; font-size: 13px; }
.stock-form-row input, .stock-form-row select { width: 100%; }
.stock-form-row-inline { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stock-form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* Vaccine autocomplete */
.stock-vaccine-autocomplete { position: relative; }
.stock-vaccine-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
    background: white; border: 1px solid #ddd; border-top: none;
    border-radius: 0 0 6px 6px; max-height: 200px; overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.stock-vaccine-option {
    padding: 8px 12px; cursor: pointer; font-size: 13px;
}
.stock-vaccine-option:hover { background: #e3f2fd; }

/* PDF upload */
.pdf-upload-section { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px dashed #ddd; }
.import-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.pdf-upload-btn {
    display: inline-block; padding: 8px 16px; background: #f5f5f5;
    border: 1px dashed #bbb; border-radius: 6px; cursor: pointer;
    font-size: 13px; color: #555; transition: background 0.2s;
}
.pdf-upload-label { cursor: pointer; }
.pdf-upload-btn:hover { background: #e3f2fd; border-color: #90caf9; }
.pdf-parsing { font-size: 12px; color: #1565C0; margin-left: 10px; }
.pdf-error { font-size: 12px; color: #c62828; margin-left: 10px; }

/* Wide modal for PDF preview + lot review side by side */
.stock-lot-modal-wide { max-width: 950px; }

/* Multi-lot review */
.multi-lot-layout {
    display: flex; gap: 16px;
}
.pdf-preview-pane {
    flex: 0 0 45%; min-width: 0;
}
.pdf-preview-frame {
    width: 100%; height: 500px; border: 1px solid #ddd; border-radius: 6px;
}
.pdf-preview-image {
    width: 100%; max-height: 500px; object-fit: contain; border: 1px solid #ddd; border-radius: 6px;
}
.multi-lot-pane {
    flex: 1; min-width: 0; overflow-y: auto; max-height: 500px;
}
.multi-lot-review h3 { font-size: 15px; margin-bottom: 6px; }
.multi-lot-hint { font-size: 12px; color: #666; margin-bottom: 12px; }
.multi-lot-item {
    background: #fafafa; border: 1px solid #e0e0e0; border-radius: 6px;
    padding: 10px 12px; margin-bottom: 8px;
}
.multi-lot-check {
    display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.multi-lot-check input[type="checkbox"] { width: auto; margin: 0; }
.multi-lot-name { display: inline; margin: 0; font-weight: 600; color: #1565C0; }
.multi-lot-fields {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
}
.multi-lot-fields label { font-size: 11px; }
.multi-lot-fields input { font-size: 12px; padding: 6px 8px; }
.multi-lot-fields input.input-missing { border-color: #e57373; background: #fff5f5; }

/* ==================== LOW STOCK BADGE (VaccinePanel) ==================== */
.lot-tag-low-stock {
    display: inline-block; font-size: 10px; font-weight: 700;
    padding: 1px 6px; border-radius: 8px;
    background: #ffebee; color: #c62828; margin-left: 4px;
}

/* ==================== VACCINATEUR ROLE ==================== */
.role-badge-vaccinateur {
    display: inline-block; background: #f3e5f5; color: #7B1FA2;
    padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
}

/* ==================== VACCINATION SCREEN ==================== */
.vaccination-screen { padding: 10px 0; }
.vaccination-header {
    display: flex; align-items: center; gap: 16px; margin-bottom: 20px;
}
.vaccination-header-info { flex: 1; }
.vaccination-header h1 { font-size: 22px; margin-bottom: 2px; }

.vaccination-patient-card {
    background: #f5f9ff; border: 1px solid #bbdefb; border-radius: 8px;
    padding: 14px 18px; margin-bottom: 16px;
}
.vaccination-patient-name { font-size: 18px; font-weight: 700; color: #1565C0; }
.vaccination-patient-details { font-size: 13px; color: #555; margin-top: 4px; }

/* Medical alerts panel */
.medical-alerts {
    background: #fff8f0; border: 1px solid #ffcc80; border-left: 4px solid #ff9800;
    border-radius: 6px; padding: 12px 16px; margin-bottom: 16px;
}
.medical-alerts-title {
    font-size: 12px; font-weight: 700; color: #e65100;
    text-transform: uppercase; margin-bottom: 8px;
}
.medical-alert-item {
    font-size: 13px; padding: 4px 8px; border-radius: 4px; margin-bottom: 4px;
}
.medical-alert-item.alert-danger {
    background: #ffebee; color: #c62828;
}
.medical-alert-item.alert-warning {
    background: #fff3e0; color: #e65100;
}

.vaccination-vaccines-section { margin-bottom: 16px; }
.vaccination-note-section { margin-bottom: 16px; }
.vaccination-note-section label { font-weight: 600; font-size: 13px; }
.vaccination-note-section textarea { min-height: 60px; resize: vertical; }

.vaccination-save-section {
    display: flex; justify-content: center; padding-top: 10px;
    border-top: 1px solid #eee;
}

/* ==================== FORM LINK MODAL ==================== */
.form-link-modal { max-width: 500px; }
.form-link-modal .modal-body { padding: 0 20px; max-height: 50vh; overflow-y: auto; }
.link-event-info {
    background: #f0f4f8; padding: 12px 16px; border-radius: 8px;
    margin-bottom: 16px; font-size: 14px;
}
.link-forms-label { font-size: 13px; font-weight: 600; color: #555; margin-bottom: 8px; }
.form-link-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border: 2px solid #eee; border-radius: 8px;
    margin-bottom: 8px; cursor: pointer; transition: border-color 0.15s;
}
.form-link-item:hover { border-color: #12AD98; }
.form-link-item.selected { border-color: #12AD98; background: #f0faf8; }
.form-link-radio { flex-shrink: 0; }
.form-link-details { flex: 1; min-width: 0; }
.form-link-name { font-weight: 600; font-size: 14px; }
.form-link-meta { font-size: 12px; color: #888; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.similarity-score {
    flex-shrink: 0; font-size: 11px; font-weight: 700;
    padding: 3px 8px; border-radius: 12px;
}
.score-high { background: #e8f5e9; color: #2e7d32; }
.score-medium { background: #fff3e0; color: #e65100; }
.score-low { background: #fce4ec; color: #c62828; }
.modal-footer {
    display: flex; gap: 10px; padding: 16px 20px;
    border-top: 1px solid #eee; justify-content: flex-end;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 600px) {
    body { padding: 10px; }
    .container { padding: 15px; }
    .dashboard-toolbar { flex-direction: column; gap: 8px; align-items: flex-start; }
    .toolbar-actions { width: 100%; justify-content: flex-end; }
    .toolbar-btn { padding: 6px 10px; font-size: 12px; }
    .pending-forms-header { flex-direction: column; }
    .appointment-time { flex: 0 0 50px; font-size: 13px; }
    .vax-site-group { flex-direction: column; gap: 6px; }
    .vax-fields { flex-direction: column; align-items: flex-start; }
    .vax-lot-select { min-width: auto; width: 100%; }
    .vax-booster-line { flex-wrap: wrap; }
    .patient-edit-grid { grid-template-columns: 1fr; }
    .search-input-group { flex-direction: column; }
    .button-group { flex-direction: column; }
    .chronometer { top: auto; bottom: 10px; right: 10px; }
    .medication-selector { flex-direction: column; }
    .prescription-settings { flex-direction: column; align-items: flex-start; }
    .checkbox-multiselect { grid-template-columns: 1fr; }
    .destination-row { grid-template-columns: 1fr 1fr; }
    .destination-header { display: none; }
    .voyage-cols { grid-template-columns: 1fr; }
    .medical-grid { grid-template-columns: 1fr; }
    .stock-summary { grid-template-columns: repeat(2, 1fr); }
    .stock-header { flex-direction: column; align-items: flex-start; }
    .stock-header-right { width: 100%; justify-content: flex-end; }
    .stock-table { font-size: 12px; }
    .stock-table th, .stock-table td { padding: 8px 6px; }
    .stock-form-row-inline { grid-template-columns: 1fr; }
    .multi-lot-fields { grid-template-columns: 1fr; }
    .multi-lot-layout { flex-direction: column; }
    .pdf-preview-pane { flex: none; }
    .pdf-preview-frame { height: 300px; }
    .multi-lot-pane { max-height: none; }
    .stock-lot-modal-wide { max-width: 95vw; }
    .stock-adjust-inline { flex-direction: column; align-items: flex-start; }
}
