:root {
  --primary: #136f63;
  --primary-dark: #0d554d;
  --primary-soft: #e7f3f1;
  --accent: #eaa11a;
  --danger: #c43a3a;
  --warning: #a96705;
  --success: #247553;
  --ink: #1f2a35;
  --muted: #6d7885;
  --line: #d9e0e5;
  --border: var(--line);
  --text: var(--ink);
  --line-dark: #8f9aa4;
  --paper: #ffffff;
  --canvas: #f3f6f7;
  --disabled: #c8c8c8;
  --shadow: 0 14px 36px rgba(25, 49, 56, .09);
  --radius: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 9px;
  padding: 10px 11px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(19,111,99,.12);
}
input:disabled {
  background: var(--disabled);
  border-color: #b7b7b7;
  cursor: not-allowed;
}
label { color: #3c4854; font-weight: 600; }
label > input, label > textarea, label > select { display: block; margin-top: 7px; font-weight: 400; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: 254px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0f514b, #123b3a);
  color: #fff;
  padding: 24px 16px;
  box-shadow: 8px 0 30px rgba(7,35,33,.12);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 7px 24px; }
.brand-icon {
  width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center;
  background: #fff; color: var(--primary-dark); font-weight: 900; letter-spacing: -.6px;
}
.brand strong { display: block; letter-spacing: .8px; font-size: 16px; }
.brand span { display: block; margin-top: 4px; color: #c8e6e1; font-size: 12px; }
.nav { display: grid; gap: 7px; }
.nav-btn {
  width: 100%; border: 0; border-radius: 11px; background: transparent; color: #dcefeb;
  display: flex; align-items: center; gap: 12px; padding: 12px 13px; text-align: left;
  transition: background .15s, color .15s, transform .15s;
}
.nav-btn b { width: 24px; text-align: center; font-size: 18px; }
.nav-btn:hover { background: rgba(255,255,255,.08); color: #fff; transform: translateX(2px); }
.nav-btn.active { background: #fff; color: var(--primary-dark); box-shadow: 0 10px 20px rgba(0,0,0,.12); }
.sidebar-bottom { margin-top: auto; padding: 16px 7px 0; color: #d9ebe8; font-size: 12px; }
.sidebar-bottom span { display: block; margin-top: 8px; color: #b9d8d3; }
.offline-chip { display: inline-flex; gap: 7px; align-items: center; padding: 7px 9px; background: rgba(255,255,255,.08); border-radius: 999px; }

.main { min-height: 100vh; margin-left: 254px; }
.topbar {
  position: sticky; top: 0; z-index: 35;
  min-height: 82px;
  display: flex; align-items: center; gap: 14px;
  padding: 15px 28px;
  background: rgba(255,255,255,.93);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #e4eaed;
}
.menu-btn { display: none; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.topbar-title { min-width: 220px; }
.topbar h1 { margin: 0; font-size: 22px; }
.topbar p { margin: 5px 0 0; color: var(--muted); }
.topbar-actions { margin-left: auto; display: flex; align-items: flex-end; gap: 10px; }
.month-control { min-width: 190px; font-size: 12px; color: var(--muted); }
.month-control input { margin-top: 4px; padding: 8px 10px; }
.content { padding: 26px 28px 50px; }
.view { display: none; }
.view.active { display: block; animation: view-enter .18s ease-out; }
@keyframes view-enter { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.primary-btn, .secondary-btn, .ghost-btn, .danger-btn, .file-btn {
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}
.primary-btn { background: var(--primary); color: #fff; box-shadow: 0 7px 18px rgba(19,111,99,.22); }
.primary-btn:hover { background: var(--primary-dark); }
.secondary-btn { background: var(--primary-soft); color: var(--primary-dark); border-color: #c6ded9; }
.ghost-btn, .file-btn { background: #fff; color: #34414d; border-color: var(--line); }
.ghost-btn:hover, .file-btn:hover { border-color: var(--primary); color: var(--primary); }
.danger-btn { background: var(--danger); color: #fff; }
.file-btn { position: relative; overflow: hidden; cursor: pointer; display: inline-flex; align-items: center; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.button-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.hero {
  min-height: 190px;
  display: flex; align-items: center; justify-content: space-between; gap: 22px;
  padding: 34px;
  border-radius: 20px;
  color: #fff;
  background:
    radial-gradient(circle at 88% 15%, rgba(255,255,255,.2), transparent 22%),
    linear-gradient(135deg, #146f64, #164b4d 70%, #253a47);
  box-shadow: var(--shadow);
}
.hero h2 { margin: 7px 0 10px; font-size: clamp(25px, 4vw, 38px); }
.hero p { max-width: 720px; margin: 0; color: #d9efeb; line-height: 1.55; }
.eyebrow { text-transform: uppercase; letter-spacing: 1.5px; font-size: 11px; font-weight: 800; color: #bde4dc; }
.hero .primary-btn { background: #fff; color: var(--primary-dark); box-shadow: none; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin: 20px 0; }
.stat-card { background: #fff; border: 1px solid #e1e7ea; border-radius: var(--radius); padding: 19px; box-shadow: var(--shadow); }
.stat-card span { color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; margin: 10px 0 6px; font-size: 28px; color: #172a34; }
.stat-card small { color: #8a949e; }
.dashboard-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 18px; }
.panel { background: #fff; border: 1px solid #e0e6e9; border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; padding: 20px 21px 14px; }
.panel-head h3 { margin: 0; font-size: 17px; }
.panel-head p { margin: 6px 0 0; color: var(--muted); line-height: 1.45; }
.coverage-list { padding: 5px 21px 22px; display: grid; gap: 14px; }
.coverage-item { display: grid; grid-template-columns: 160px 1fr 64px; align-items: center; gap: 10px; }
.coverage-item b { font-size: 12px; }
.coverage-item em { font-style: normal; text-align: right; font-weight: 800; }
.coverage-track { height: 9px; border-radius: 999px; background: #e9eef0; overflow: hidden; }
.coverage-track span { display: block; height: 100%; width: 0; background: var(--primary); border-radius: inherit; transition: width .25s; }
.quality-list { padding: 4px 21px 22px; display: grid; gap: 10px; }
.quality-item { display: grid; grid-template-columns: 10px 1fr; gap: 10px; border: 1px solid #e4eaed; padding: 11px 12px; border-radius: 11px; }
.quality-item .quality-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 4px; background: var(--success); }
.quality-item.warn .quality-dot { background: var(--accent); }
.quality-item.danger .quality-dot { background: var(--danger); }
.quality-item b { display: block; font-size: 12px; }
.quality-item span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.completion-panel { margin-top: 18px; padding: 18px 21px; display: grid; grid-template-columns: 260px 1fr; align-items: center; gap: 25px; }
.completion-panel h3 { margin: 0; }
.completion-panel p { margin: 5px 0 0; color: var(--muted); }
.progress { height: 14px; border-radius: 999px; background: #e7ecee; overflow: hidden; }
.progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #52a58f); transition: width .25s; }

.section-title { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin: 2px 0 18px; }
.section-title > div { display: grid; grid-template-columns: 46px 1fr; column-gap: 12px; align-items: center; }
.section-title h2 { margin: 0; font-size: 23px; }
.section-title p { grid-column: 2; margin: 5px 0 0; color: var(--muted); }
.section-number { grid-row: 1 / span 2; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; background: var(--primary-soft); color: var(--primary-dark); font-weight: 900; }
.form-card { padding-bottom: 20px; }
.form-grid { display: grid; gap: 15px; padding: 2px 21px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.form-grid.one { grid-template-columns: 1fr; }
.form-grid.compact { gap: 10px; }
.district-reserved-note {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  min-height: 72px;
  padding: 12px 14px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: #f8fafc;
}
.district-reserved-note strong { color: var(--text); }
.district-reserved-note span { color: var(--muted); font-size: 0.88rem; line-height: 1.35; }
.district-date-blank { display: inline-block; margin-top: 1.2mm; letter-spacing: 0.3px; font-weight: 700; }
.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.stack { display: grid; gap: 18px; }
.full-label { display: block; padding: 4px 21px; }
.info-banner { margin: 0 0 15px; padding: 13px 15px; border: 1px solid #c9e0dc; background: #edf8f5; border-radius: 12px; color: #31524e; }
.info-banner strong { margin-right: 5px; }
.table-panel { overflow: hidden; }
.wide-panel { border-radius: 14px; }
.table-toolbar { display: flex; justify-content: space-between; align-items: end; gap: 15px; padding: 15px 17px; border-bottom: 1px solid var(--line); }
.table-toolbar label { width: min(380px,100%); font-size: 12px; color: var(--muted); }
.table-toolbar input { margin-top: 4px; padding: 8px 10px; }
.table-toolbar span { color: var(--muted); font-size: 12px; }
.table-wrap { overflow: auto; }
.table-wrap.extra-wide { max-height: calc(100vh - 260px); }
.table-wrap.small-wrap { padding: 0 20px 2px; }
.entry-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.entry-table th, .entry-table td { border-right: 1px solid #cfd7dc; border-bottom: 1px solid #cfd7dc; padding: 6px; text-align: center; vertical-align: middle; }
.entry-table tr > :first-child { border-left: 1px solid #cfd7dc; }
.entry-table thead tr:first-child th { border-top: 1px solid #cfd7dc; }
.entry-table th { background: #edf1f3; color: #27333e; font-weight: 800; }
.entry-table tbody tr:hover td { background-color: #f8fbfb; }
.entry-table tbody td:first-child { text-align: left; font-weight: 700; background: #fbfcfd; }
.entry-table input { min-width: 66px; border: 0; border-radius: 0; padding: 7px 5px; text-align: center; background: transparent; }
.entry-table input:focus { box-shadow: inset 0 0 0 2px var(--primary); }
.entry-table td.calc { background: #f2f6f7; font-weight: 800; color: #32424e; }
.entry-table td.na { background: var(--disabled) !important; }
.entry-table td.na input { visibility: hidden; }
.entry-table .sticky-col { position: sticky; left: 0; z-index: 4; box-shadow: 2px 0 0 #cfd7dc; }
.entry-table thead .sticky-col { z-index: 8; }
.antigen-col { min-width: 150px; }
.stock-name-col { min-width: 180px; }
.vaccine-table { min-width: 1660px; }
.stock-table { min-width: 1220px; }
.stock-table td.negative { background: #ffe7e7; color: #a52020; }
.sessions-table input { min-width: 90px; }
.choice-fieldset { margin: 14px 21px; border: 1px solid var(--line); border-radius: 11px; padding: 13px; }
.choice-fieldset legend { padding: 0 7px; color: #3d4a55; font-weight: 800; }
.choice-fieldset label { display: inline-flex; align-items: center; gap: 7px; margin: 5px 18px 5px 0; font-weight: 500; }
.choice-fieldset input { width: auto; margin: 0; }
.temperature-alert { margin: 15px 21px 0; padding: 11px 12px; border-radius: 10px; background: #eff7f4; color: var(--success); font-weight: 700; }
.temperature-alert.warn { background: #fff3d8; color: var(--warning); }
.temperature-alert.danger { background: #ffe9e9; color: var(--danger); }
.surveillance-grid { grid-template-columns: .72fr 1.28fr; }

.report-view.active { display: block; padding: 24px 28px 50px; }
.report-actions { max-width: 1180px; margin: 0 auto 14px; display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.report-actions h2 { margin: 0; }
.report-actions p { margin: 6px 0 0; color: var(--muted); }
.validation-summary { max-width: 1180px; margin: 0 auto 15px; padding: 12px 14px; border: 1px solid #dce4e7; border-radius: 12px; background: #fff; }
.validation-summary.ok { border-color: #b9dfce; background: #edf8f3; color: #25634c; }
.validation-summary.warn { border-color: #ecd49d; background: #fff8e9; color: #76500d; }
.validation-summary ul { margin: 7px 0 0 18px; padding: 0; }
.report-pages { display: grid; gap: 24px; justify-items: center; }
.official-page {
  position: relative;
  width: 210mm;
  min-height: 297mm;
  padding: 5mm 5mm 6mm;
  background: #fff;
  color: #000;
  box-shadow: 0 12px 40px rgba(20,36,42,.15);
  font-family: Arial, Helvetica, sans-serif;
  overflow: hidden;
}
.official-page * { box-sizing: border-box; }
.official-header { display: grid; grid-template-columns: 1fr 1fr; font-size: 5.8px; min-height: 12mm; }
.official-header strong, .official-header b, .official-header span { display: block; }
.official-header b { margin-top: 1.2mm; }
.official-header span { margin-top: .8mm; }
.republic { text-align: center; justify-self: end; min-width: 70mm; }
.official-meta-grid { display: grid; grid-template-columns: 33% 19% 48%; align-items: end; gap: 0; margin-bottom: 2mm; }
.official-report-title { text-align: center; font-size: 7px; font-weight: 900; padding: 0 1mm 1.3mm; text-decoration: underline; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 5.9px; }
.mini-table th, .mini-table td { border: .25mm solid #000; padding: .55mm .8mm; text-align: left; height: 3.6mm; }
.mini-table th { white-space: nowrap; width: 37%; }
.top-section-grid { display: grid; grid-template-columns: 31% 31% 28%; gap: 4%; align-items: start; margin-bottom: 1.5mm; }
.official-section { width: 100%; }
.official-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 5.3px; }
.official-table th, .official-table td { border: .25mm solid #000; padding: .28mm .4mm; height: 3.15mm; line-height: 1.05; text-align: center; vertical-align: middle; overflow-wrap: anywhere; }
.official-table th { font-weight: 800; }
.official-table td:first-child, .official-table th:first-child { text-align: left; }
.official-table .section-head { background: #aaa; text-align: left !important; font-weight: 900; }
.official-table .gray { background: #bdbdbd; }
.official-table .left { text-align: left; }
.official-table .center { text-align: center !important; }
.main-official-table { font-size: 4.65px; }
.main-official-table th, .main-official-table td { height: 3.4mm; padding: .18mm .25mm; }
.main-official-table .antigen { width: 9.7%; }
.bottom-section-grid { display: grid; grid-template-columns: 56% 18% 26%; align-items: start; margin-top: 1.3mm; }
.bottom-left-stack { display: grid; gap: 1.2mm; }
.bottom-section-grid > * { min-width: 0; }
.receipt-box { position: absolute; right: 5mm; bottom: 12mm; width: 39mm; font-size: 5.2px; text-align: center; font-weight: 700; }
.official-footer { position: absolute; bottom: 3.3mm; left: 5mm; right: 5mm; display: flex; justify-content: space-between; font-size: 4.5px; }
.page-two { padding-top: 4.2mm; }
.page-two .official-table { font-size: 5.2px; }
.page-two .official-table th, .page-two .official-table td { height: 5.05mm; }
.page-two .stock-report-table th, .page-two .stock-report-table td { height: 5.2mm; }
.cold-report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.waste-report-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 0; }
.report-remarks { border: .25mm solid #000; min-height: 25mm; padding: 1.2mm; font-size: 5.6px; margin-top: 1.2mm; }
.report-remarks > div { white-space: pre-wrap; margin-top: 1mm; }
.signature-row { display: grid; grid-template-columns: 1fr 2fr; gap: 20mm; margin: 6mm 8mm 0; font-size: 5.4px; }
.signature-row > div { min-height: 11mm; border-bottom: .25mm solid #000; text-align: center; }
.signature-row span, .signature-row strong, .signature-row b { display: block; }
.signature-row b { margin-top: 3mm; min-height: 3mm; }

.toast {
  position: fixed; right: 22px; bottom: 22px; z-index: 150;
  max-width: min(390px, calc(100vw - 28px)); padding: 13px 16px 13px 44px; border-radius: 13px;
  border: 1px solid rgba(255,255,255,.12); background: #153d38; color: #fff;
  box-shadow: 0 18px 46px rgba(0,0,0,.25); line-height: 1.45; font-weight: 700;
  transform: translateY(120px) scale(.98); opacity: 0; transition: .22s;
}
.toast::before { content: "✓"; position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.16); font-size: 12px; }
.toast.show { transform: translateY(0) scale(1); opacity: 1; }
.modal-backdrop { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; background: rgba(14,25,31,.52); }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(430px,100%); background: #fff; border-radius: 16px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal h3 { margin: 0; }
.modal p { color: var(--muted); line-height: 1.5; }
.modal .button-row { justify-content: flex-end; margin-top: 18px; }

@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-grid, .split-grid { grid-template-columns: 1fr; }
  .surveillance-grid { grid-template-columns: 1fr; }
  .report-pages { justify-items: start; overflow-x: auto; padding-bottom: 10px; }
  .official-page { transform-origin: top left; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-105%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; place-items: center; }
  .topbar { padding: 13px 16px; }
  .content, .report-view.active { padding: 18px 15px 40px; }
  .report-actions { align-items: flex-start; flex-direction: column; }
  .hero { align-items: flex-start; flex-direction: column; padding: 25px; }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; }
  .topbar-title { min-width: 0; flex: 1; }
  .topbar-actions { width: 100%; margin: 0; }
  .month-control { flex: 1; }
  .stats-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .coverage-item { grid-template-columns: 115px 1fr 55px; }
  .completion-panel { grid-template-columns: 1fr; }
  .form-grid.two { grid-template-columns: 1fr; }
  .section-title { align-items: flex-start; flex-direction: column; }
  .section-title > div { grid-template-columns: 40px 1fr; }
  .section-number { width: 40px; height: 40px; }
  .button-row { width: 100%; }
  .button-row > * { flex: 1 1 auto; justify-content: center; }
}

@page { size: A4 portrait; margin: 0; }
@media print {
  html, body { width: 210mm; background: #fff; }
  body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sidebar, .topbar, .content, .report-actions, .validation-summary, .toast, .modal-backdrop, .no-print { display: none !important; }
  .main { margin: 0; }
  #view-rapport { display: block !important; padding: 0 !important; }
  .report-pages { display: block; }
  .official-page {
    width: 210mm; height: 297mm; min-height: 297mm;
    box-shadow: none; margin: 0; page-break-after: always; break-after: page;
  }
  .official-page:last-child { page-break-after: auto; break-after: auto; }
}

/* Ajustement fin du canevas officiel pour tenir exactement sur deux pages A4 */
.official-page { padding-top: 3.6mm; padding-bottom: 4.8mm; }
.official-header { min-height: 8mm; font-size: 5.1px; }
.official-header b { margin-top: .7mm; }
.official-header span { margin-top: .4mm; }
.official-meta-grid { margin-bottom: 1mm; }
.official-report-title { font-size: 6.2px; padding-bottom: .7mm; }
.mini-table { font-size: 5.1px; }
.mini-table th, .mini-table td { height: 3mm; padding: .35mm .55mm; }
.top-section-grid { margin-bottom: .8mm; }
.official-table { font-size: 4.75px; }
.official-table th, .official-table td { height: 2.62mm; padding: .12mm .28mm; line-height: 1; }
.main-official-table { font-size: 4.05px; }
.main-official-table th, .main-official-table td { height: 2.72mm; padding: .08mm .18mm; line-height: .98; }
.bottom-section-grid { margin-top: .7mm; }
.bottom-left-stack { gap: .6mm; }
.receipt-box { bottom: 8.5mm; font-size: 4.6px; }
.official-footer { bottom: 2mm; font-size: 4px; }
.page-two { padding-top: 3mm; }
.page-two .official-table { font-size: 4.75px; }
.page-two .official-table th, .page-two .official-table td { height: 3.85mm; padding: .12mm .3mm; }
.page-two .stock-report-table th, .page-two .stock-report-table td { height: 3.9mm; }
.report-remarks { min-height: 18mm; margin-top: .7mm; font-size: 5px; padding: .8mm; }
.signature-row { margin: 3.5mm 8mm 0; font-size: 4.9px; }
.signature-row > div { min-height: 8mm; }
.signature-row b { margin-top: 1.5mm; }

/* Impression A4 en orientation portrait */
@media print {
  html, body {
    width: 210mm !important;
    min-width: 210mm !important;
    height: auto !important;
  }
  .official-page {
    width: 210mm !important;
    height: 297mm !important;
    min-height: 297mm !important;
    max-height: 297mm !important;
    page-break-after: always;
    break-after: page;
  }
  .official-page:last-child {
    page-break-after: auto;
    break-after: auto;
  }
  #reportPage2 {
    page-break-before: always;
    break-before: page;
  }
}


/* Mise en page portrait : largeur réduite, hauteur augmentée */
.official-page {
  width: 210mm;
  min-height: 297mm;
  padding-left: 4mm;
  padding-right: 4mm;
}
.official-header { font-size: 4.8px; }
.republic { min-width: 48mm; }
.official-meta-grid { grid-template-columns: 34% 22% 44%; }
.top-section-grid { grid-template-columns: 32% 32% 30%; gap: 3%; }
.mini-table { font-size: 4.8px; }
.mini-table th, .mini-table td { height: 3.5mm; padding: .35mm .45mm; }
.official-table { font-size: 4.35px; }
.official-table th, .official-table td { height: 3.25mm; padding: .12mm .18mm; }
.main-official-table { font-size: 3.55px; }
.main-official-table th, .main-official-table td { height: 3.35mm; padding: .08mm .10mm; }
.main-official-table .antigen { width: 10.5%; }
.bottom-section-grid { grid-template-columns: 55% 19% 26%; }
.page-two .official-table { font-size: 4.35px; }
.page-two .official-table th, .page-two .official-table td { height: 6.2mm; }
.page-two .stock-report-table th, .page-two .stock-report-table td { height: 6.35mm; }
.report-remarks { min-height: 28mm; }
.signature-row { margin-top: 7mm; }

@media print {
  @page { size: A4 portrait; margin: 0; }
  .official-page {
    width: 210mm !important;
    height: 297mm !important;
    min-height: 297mm !important;
    max-height: 297mm !important;
    overflow: hidden !important;
  }
}

/* Optimisation de la première feuille portrait : occupation complète de la hauteur */
.page-one .official-header {
  min-height: 9.5mm;
  font-size: 5.2px;
}
.page-one .official-report-title { font-size: 6.5px; }
.page-one .mini-table { font-size: 5px; }
.page-one .mini-table th,
.page-one .mini-table td {
  height: 3.9mm;
  padding: .45mm .5mm;
}
.page-one .top-section-grid .official-table { font-size: 4.65px; }
.page-one .top-section-grid .official-table th,
.page-one .top-section-grid .official-table td {
  height: 4.15mm;
  padding: .18mm .22mm;
}
.page-one .main-official-table { font-size: 3.75px; }
.page-one .main-official-table th,
.page-one .main-official-table td {
  height: 4.15mm;
  padding: .11mm .12mm;
  line-height: 1.02;
}
.page-one .bottom-section-grid .official-table { font-size: 4.55px; }
.page-one .bottom-section-grid .official-table th,
.page-one .bottom-section-grid .official-table td {
  height: 4.15mm;
  padding: .16mm .2mm;
}
.page-one .bottom-left-stack { gap: .9mm; }

/* Remplissage final de la zone basse de la première feuille */
.page-one .top-section-grid .official-table th,
.page-one .top-section-grid .official-table td {
  height: 4.25mm;
}
.page-one .main-official-table th,
.page-one .main-official-table td {
  height: 4.30mm;
}
.page-one .bottom-section-grid .official-table th,
.page-one .bottom-section-grid .official-table td {
  height: 4.60mm;
}

/* Correctif impression : exactement deux pages A4 portrait, sans page blanche */
@media print {
  html, body {
    width: 210mm !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #view-rapport,
  .report-pages {
    margin: 0 !important;
    padding: 0 !important;
  }

  .report-pages {
    display: block !important;
    gap: 0 !important;
  }

  .official-page {
    width: 210mm !important;
    height: 296mm !important;
    min-height: 296mm !important;
    max-height: 296mm !important;
    margin: 0 !important;
    overflow: hidden !important;
    page-break-inside: avoid !important;
    break-inside: avoid-page !important;
  }

  #reportPage1 {
    page-break-after: always !important;
    break-after: page !important;
  }

  #reportPage2 {
    page-break-before: auto !important;
    break-before: auto !important;
    page-break-after: auto !important;
    break-after: auto !important;
  }
}

/* Paramètres annuels : identification et démographie saisies une seule fois */
.annual-settings-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 17px 19px;
  border: 1px solid #ead39d;
  border-radius: 14px;
  background: #fff8e8;
}
.annual-settings-banner.is-locked {
  border-color: #acd6c5;
  background: #edf8f3;
}
.annual-settings-banner > div:first-child { min-width: 0; }
.annual-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.annual-settings-banner strong { display: block; font-size: 19px; color: var(--text); }
.annual-settings-banner p { margin: 5px 0 0; color: #53616b; line-height: 1.45; }
.annual-settings-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.annual-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.annual-status.pending { background: #f5dfae; color: #704b00; }
.annual-status.locked { background: #cceada; color: #1f6349; }
.annual-parameters-card input:disabled,
#demographicForm input:disabled {
  cursor: not-allowed;
  border-color: #d5dde1;
  background: #eef2f4;
  color: #52606a;
  opacity: 1;
}
.annual-parameters-card input:disabled::placeholder { color: transparent; }

@media (max-width: 760px) {
  .annual-settings-banner { align-items: flex-start; flex-direction: column; }
  .annual-settings-actions { width: 100%; flex-wrap: wrap; }
  .annual-settings-actions .primary-btn { flex: 1 1 240px; }
}

/* Version 1.3 : quantité utilisée calculée depuis les doses ouvertes */
.entry-table td.auto-used {
  position: relative;
  min-width: 74px;
  background: #e8f5f2;
  color: #145f55;
  font-weight: 900;
  text-align: center;
}
.entry-table td.auto-used small {
  display: block;
  margin-top: 2px;
  font-size: 8px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #4d756f;
}


/* =========================================================
   VERSION 1.4 — RAPPORT IMPRIMÉ PLUS LISIBLE
   Police agrandie sans modifier les formulaires de saisie.
   ========================================================= */
.official-page {
  padding: 3.5mm 3.5mm 5mm;
}
.official-header {
  font-size: 7.2px;
  min-height: 11mm;
  line-height: 1.08;
}
.official-report-title {
  font-size: 8.8px;
  padding-bottom: 1mm;
}
.official-meta-grid {
  grid-template-columns: 34% 20% 46%;
  margin-bottom: 1.3mm;
}
.mini-table {
  font-size: 7.4px;
}
.mini-table th,
.mini-table td {
  padding: .38mm .55mm;
  height: 3.4mm;
  line-height: 1.02;
}
.top-section-grid {
  grid-template-columns: 32% 32% 32%;
  gap: 2%;
  margin-bottom: 1mm;
}
.official-table {
  font-size: 6.8px;
}
.official-table th,
.official-table td {
  padding: .18mm .28mm;
  height: 3mm;
  line-height: 1;
}
.main-official-table {
  font-size: 6.2px;
}
.main-official-table th,
.main-official-table td {
  height: 3.15mm;
  padding: .10mm .14mm;
  line-height: .98;
}
.main-official-table .antigen {
  width: 10.4%;
}
.bottom-section-grid {
  margin-top: .8mm;
}
.bottom-left-stack {
  gap: .7mm;
}
.receipt-box {
  right: 3.5mm;
  bottom: 5.5mm;
  width: 42mm;
  font-size: 6.4px;
  line-height: 1.08;
}
.official-footer {
  left: 3.5mm;
  right: 3.5mm;
  bottom: 2.7mm;
  font-size: 5.3px;
}
.page-two {
  padding-top: 3.2mm;
}
.page-two .official-table {
  font-size: 7.8px;
}
.page-two .official-table th,
.page-two .official-table td,
.page-two .stock-report-table th,
.page-two .stock-report-table td {
  height: 5.55mm;
  padding: .22mm .3mm;
  line-height: 1.02;
}
.report-remarks {
  min-height: 23mm;
  padding: 1mm;
  font-size: 7.6px;
  margin-top: .8mm;
}
.signature-row {
  gap: 15mm;
  margin: 4mm 6mm 0;
  font-size: 7.2px;
}
.signature-row > div {
  min-height: 10mm;
}

@media print {
  .official-page {
    padding: 3.5mm 3.5mm 5mm;
  }
}

/* =========================================================
   VERSION 1.5 — TYPOGRAPHIE DU RAPPORT
   Textes : 14 px | Chiffres et pourcentages : 18 px
   Ces règles concernent uniquement les deux feuilles générées.
   ========================================================= */
.official-page,
.official-page .official-header,
.official-page .official-report-title,
.official-page .mini-table,
.official-page .official-table,
.official-page .main-official-table,
.official-page .receipt-box,
.official-page .official-footer,
.official-page .report-remarks,
.official-page .signature-row,
.official-page th,
.official-page td,
.official-page strong,
.official-page span,
.official-page b,
.official-page div {
  font-size: 14px !important;
}

.official-page td.report-number,
.official-page b.report-number {
  font-size: 18px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
}

/* Lignes légèrement adaptées pour éviter que les chiffres de 18 px soient coupés. */
.official-page .mini-table th,
.official-page .mini-table td,
.official-page .official-table th,
.official-page .official-table td,
.official-page .main-official-table th,
.official-page .main-official-table td,
.page-two .official-table th,
.page-two .official-table td,
.page-two .stock-report-table th,
.page-two .stock-report-table td {
  min-height: 5mm;
  line-height: 1.02;
}

@media print {
  .official-page,
  .official-page .official-header,
  .official-page .official-report-title,
  .official-page .mini-table,
  .official-page .official-table,
  .official-page .main-official-table,
  .official-page .receipt-box,
  .official-page .official-footer,
  .official-page .report-remarks,
  .official-page .signature-row,
  .official-page th,
  .official-page td,
  .official-page strong,
  .official-page span,
  .official-page b,
  .official-page div {
    font-size: 14px !important;
  }
  .official-page td.report-number,
  .official-page b.report-number {
    font-size: 18px !important;
  }
}

/* =========================================================
   VERSION 1.6 — TYPOGRAPHIE ÉQUILIBRÉE ET LISIBLE
   Les tailles sont adaptées à chaque zone du canevas portrait.
   Les nombres restent normaux ; seules les couvertures sont en gras.
   ========================================================= */
.official-page,
.official-page * {
  font-family: Arial, Helvetica, sans-serif !important;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  word-break: normal !important;
  overflow-wrap: normal !important;
  hyphens: none !important;
}

/* Les titres et en-têtes gardent leur hiérarchie visuelle. */
.official-page strong,
.official-page b,
.official-page th,
.official-page .section-head,
.official-page .official-report-title {
  font-weight: 700 !important;
}
.official-page .section-head,
.official-page .official-report-title {
  font-weight: 800 !important;
}

/* En-tête institutionnel et identification. */
.official-page .official-header {
  font-size: 9.2px !important;
  line-height: 1.12 !important;
}
.official-page .official-report-title {
  font-size: 10.5px !important;
  line-height: 1.12 !important;
}
.official-page .mini-table {
  font-size: 8.8px !important;
}
.official-page .mini-table th,
.official-page .mini-table td {
  font-size: 8.8px !important;
  line-height: 1.08 !important;
  padding: .35mm .48mm !important;
}
.official-page .mini-table th {
  white-space: nowrap;
}

/* Trois petits tableaux du haut. */
.page-one .top-section-grid .official-table,
.page-one .top-section-grid .official-table th,
.page-one .top-section-grid .official-table td {
  font-size: 8.2px !important;
  line-height: 1.08 !important;
}
.page-one .top-section-grid .official-table th,
.page-one .top-section-grid .official-table td {
  padding: .20mm .30mm !important;
}

/* Grand tableau des vaccinations : compact mais lisible. */
.page-one .main-official-table {
  font-size: 7.2px !important;
}
.page-one .main-official-table th {
  font-size: 6.8px !important;
  line-height: 1.02 !important;
  padding: .12mm .10mm !important;
}
.page-one .main-official-table td {
  font-size: 8px !important;
  line-height: 1.05 !important;
  padding: .10mm .12mm !important;
  font-weight: 400 !important;
}
.page-one .main-official-table td:first-child {
  font-size: 7.4px !important;
  line-height: 1.02 !important;
}
.page-one .main-official-table .antigen {
  width: 10.8% !important;
}

/* Tableaux Td, HPV, MAPI et surveillance. */
.page-one .bottom-section-grid .official-table,
.page-one .bottom-section-grid .official-table th,
.page-one .bottom-section-grid .official-table td {
  font-size: 7.4px !important;
  line-height: 1.05 !important;
}
.page-one .bottom-section-grid .official-table th,
.page-one .bottom-section-grid .official-table td {
  padding: .16mm .20mm !important;
  font-weight: 400 !important;
}
.page-one .bottom-section-grid .official-table th,
.page-one .bottom-section-grid .official-table .section-head {
  font-weight: 700 !important;
}

/* Deuxième feuille : stocks et rubriques de fin. */
.page-two .official-table,
.page-two .official-table th,
.page-two .official-table td,
.page-two .stock-report-table th,
.page-two .stock-report-table td {
  font-size: 8.5px !important;
  line-height: 1.08 !important;
}
.page-two .official-table td,
.page-two .stock-report-table td {
  font-weight: 400 !important;
}
.page-two .official-table th,
.page-two .stock-report-table th,
.page-two .section-head {
  font-weight: 700 !important;
}
.official-page .report-remarks,
.official-page .report-remarks * {
  font-size: 8.7px !important;
  line-height: 1.15 !important;
}
.official-page .signature-row,
.official-page .signature-row * {
  font-size: 8.4px !important;
  line-height: 1.12 !important;
}
.official-page .receipt-box,
.official-page .receipt-box * {
  font-size: 7.6px !important;
  line-height: 1.12 !important;
}
.official-page .official-footer,
.official-page .official-footer * {
  font-size: 6.2px !important;
}

/* Nombres ordinaires : ni agrandis ni en gras. */
.official-page td.report-number,
.official-page b.report-number,
.official-page td:not(.report-coverage) {
  font-weight: 400 !important;
}

/* Seules les couvertures vaccinales ressortent. */
.official-page td.report-coverage {
  font-size: 8.8px !important;
  font-weight: 800 !important;
  white-space: nowrap !important;
  line-height: 1 !important;
}
.page-one .bottom-section-grid td.report-coverage {
  font-size: 8.2px !important;
}

/* Affichage écran légèrement plus confortable, sans modifier l'impression. */
@media screen and (min-width: 1201px) {
  .report-pages {
    overflow-x: auto;
    padding: 8px 20px 26px;
  }
  .official-page {
    zoom: 1.08;
  }
}

@media print {
  .official-page {
    zoom: 1 !important;
  }
  .official-page td.report-coverage {
    font-weight: 800 !important;
  }
}

/* Ajustement vertical : la première feuille reste complète, sans couper le HPV. */
.page-one .main-official-table th,
.page-one .main-official-table td {
  height: 3.45mm !important;
  min-height: 0 !important;
}

/* =========================================================
   VERSION 1.7 — ANTIGÈNES ET EN-TÊTE INSTITUTIONNEL
   Coupures propres, sans débordement ni mots cassés.
   ========================================================= */

/* Mentions institutionnelles : plus discrètes et moins épaisses. */
.official-page .official-header {
  font-size: 7.7px !important;
  line-height: 1.06 !important;
  min-height: 9.5mm !important;
}
.official-page .official-header .ministry strong,
.official-page .official-header .republic strong {
  font-size: 7.7px !important;
  font-weight: 500 !important;
  line-height: 1.06 !important;
  letter-spacing: 0 !important;
}
.official-page .official-header .ministry b,
.official-page .official-header .republic b {
  font-size: 7px !important;
  font-weight: 500 !important;
  line-height: 1.05 !important;
}
.official-page .official-header .ministry span,
.official-page .official-header .republic span {
  font-size: 6.2px !important;
  font-weight: 400 !important;
  line-height: 1 !important;
}

/* Colonne des antigènes : largeur suffisante et coupures naturelles. */
.page-one .main-official-table .antigen {
  width: 12.6% !important;
}
.page-one .main-official-table td.antigen-name {
  font-size: 6.9px !important;
  line-height: 1.02 !important;
  text-align: left !important;
  padding-left: .28mm !important;
  padding-right: .18mm !important;
  white-space: normal !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  hyphens: none !important;
  font-weight: 400 !important;
}
.page-one .main-official-table td.antigen-name wbr {
  display: inline;
}

@media print {
  .official-page .official-header {
    font-size: 7.7px !important;
  }
  .page-one .main-official-table td.antigen-name {
    font-size: 6.9px !important;
  }
}


/* =========================================================
   VERSION 1.8 — COLONNE ANTIGÈNES ET EN-TÊTE GAUCHE
   Largeur réelle de la première colonne + centrage de la DCPEV.
   ========================================================= */

/* Le colgroup impose réellement la largeur de la colonne Antigènes.
   Sans lui, le colspan de l'en-tête répartissait les 20 colonnes à parts égales. */
.page-one .main-official-table col.antigen-col-report {
  width: 12.8% !important;
}
.page-one .main-official-table col.data-col-report {
  width: 4.589% !important;
}
.page-one .main-official-table th.antigen,
.page-one .main-official-table td.antigen-name {
  width: 12.8% !important;
}
.page-one .main-official-table td.antigen-name {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: clip !important;
  font-size: 6.7px !important;
  letter-spacing: -0.08px !important;
  line-height: 1 !important;
  padding-left: .24mm !important;
  padding-right: .12mm !important;
}

/* Direction et pointillés centrés sous le bloc du ministère. */
.official-page .official-header .ministry {
  width: 100% !important;
}
.official-page .official-header .ministry b {
  display: block !important;
  width: 100% !important;
  text-align: center !important;
  font-weight: 800 !important;
}
.official-page .official-header .ministry span {
  display: block !important;
  width: 100% !important;
  text-align: center !important;
}

@media print {
  .page-one .main-official-table td.antigen-name {
    font-size: 6.7px !important;
  }
}


/* =========================================================
   VERSION 1.9 — OCCUPATION VERTICALE DES DEUX FEUILLES
   Répartition des tableaux sur presque toute la hauteur A4,
   sans créer de troisième page.
   ========================================================= */

/* RECTO : on utilise l’espace libre avant la zone du District. */
.page-one .top-section-grid .official-table th,
.page-one .top-section-grid .official-table td {
  height: 4.5mm !important;
  min-height: 4.5mm !important;
}
.page-one .main-official-table th,
.page-one .main-official-table td {
  height: 3.95mm !important;
  min-height: 3.95mm !important;
}
.page-one .bottom-section-grid .official-table th,
.page-one .bottom-section-grid .official-table td {
  height: 5.2mm !important;
  min-height: 5.2mm !important;
}
.page-one .bottom-left-stack {
  gap: 1.1mm !important;
}
.page-one .bottom-section-grid {
  margin-top: 1mm !important;
}

/* VERSO : stocks et rubriques de fin mieux étalés. */
.page-two .stock-report-table th,
.page-two .stock-report-table td {
  height: 6.4mm !important;
  min-height: 6.4mm !important;
}
.page-two #reportCold .official-table th,
.page-two #reportCold .official-table td,
.page-two #reportWaste .official-table th,
.page-two #reportWaste .official-table td {
  height: 6.1mm !important;
  min-height: 6.1mm !important;
}
.page-two .report-remarks {
  min-height: 30mm !important;
  margin-top: 1.2mm !important;
  padding: 1.2mm !important;
}
.page-two .signature-row {
  margin: 5mm 8mm 0 !important;
}
.page-two .signature-row > div {
  min-height: 13mm !important;
}
.page-two .signature-row b {
  margin-top: 2.5mm !important;
}

@media print {
  .page-one .top-section-grid .official-table th,
  .page-one .top-section-grid .official-table td {
    height: 4.5mm !important;
    min-height: 4.5mm !important;
  }
  .page-one .main-official-table th,
  .page-one .main-official-table td {
    height: 3.95mm !important;
    min-height: 3.95mm !important;
  }
  .page-one .bottom-section-grid .official-table th,
  .page-one .bottom-section-grid .official-table td {
    height: 5.2mm !important;
    min-height: 5.2mm !important;
  }
  .page-two .stock-report-table th,
  .page-two .stock-report-table td {
    height: 6.4mm !important;
    min-height: 6.4mm !important;
  }
  .page-two #reportCold .official-table th,
  .page-two #reportCold .official-table td,
  .page-two #reportWaste .official-table th,
  .page-two #reportWaste .official-table td {
    height: 6.1mm !important;
    min-height: 6.1mm !important;
  }
}


/* Version 2.1 — données démographiques officielles, aucune population déduite */
.derived-demographic { grid-column: span 1; }
.derived-demographic .derived-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.derived-demographic .derived-label em {
  flex: 0 0 auto; padding: 3px 7px; border-radius: 999px; font-size: 9px;
  font-style: normal; font-weight: 900; letter-spacing: .03em; text-transform: uppercase;
}
.derived-demographic.is-auto .derived-label em { background: #dff2ec; color: #176653; }
.derived-demographic.is-manual .derived-label em { background: #fff0ca; color: #765100; }
.derived-control { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px; align-items: center; }
.derived-control input:disabled { background: #e8f5f2 !important; color: #155f54 !important; font-weight: 800; }
.mini-action-btn {
  min-height: 38px; padding: 7px 9px; border: 1px solid #bfd2cd; border-radius: 9px;
  background: #fff; color: #175e55; font-size: 10px; font-weight: 800; cursor: pointer; white-space: nowrap;
}
.mini-action-btn:hover { background: #eef8f5; }
.derived-demographic small { display: block; margin-top: 4px; color: #617078; font-size: 10px; line-height: 1.25; }
@media (max-width: 760px) {
  .derived-control { grid-template-columns: 1fr; }
  .mini-action-btn { width: 100%; }
}


/* =========================================================
   VERSION 2.5 — DOSES OUVERTES VISIBLES ET CALCULÉES
   Rouge = 1/3, jaune = 2/3, vert = 3/3.
   ========================================================= */
.coverage-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid #dce4e8;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(22, 51, 62, .06);
}
.coverage-legend > strong { margin-right: 2px; }
.coverage-legend small { flex-basis: 100%; color: #53646b; }
.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid transparent;
}

.entry-table td.coverage-red,
.official-page td.coverage-red,
.coverage-item em.coverage-red,
.legend-chip.coverage-red {
  background: #f8d7da !important;
  color: #842029 !important;
  border-color: #f1aeb5 !important;
}
.entry-table td.coverage-yellow,
.official-page td.coverage-yellow,
.coverage-item em.coverage-yellow,
.legend-chip.coverage-yellow {
  background: #fff3cd !important;
  color: #664d03 !important;
  border-color: #ffe69c !important;
}
.entry-table td.coverage-green,
.official-page td.coverage-green,
.coverage-item em.coverage-green,
.legend-chip.coverage-green {
  background: #d1e7dd !important;
  color: #0f5132 !important;
  border-color: #a3cfbb !important;
}
.entry-table td.coverage-neutral,
.official-page td.coverage-neutral,
.coverage-item em.coverage-neutral {
  background: #eef1f3 !important;
  color: #66747a !important;
}
.entry-table td.coverage-red,
.entry-table td.coverage-yellow,
.entry-table td.coverage-green,
.entry-table td.coverage-neutral,
.official-page td.report-coverage {
  font-weight: 800 !important;
}
.coverage-item em.coverage-red,
.coverage-item em.coverage-yellow,
.coverage-item em.coverage-green,
.coverage-item em.coverage-neutral {
  padding: 3px 6px;
  border-radius: 7px;
  border: 1px solid transparent;
}
.coverage-track span.coverage-red { background: #dc3545 !important; }
.coverage-track span.coverage-yellow { background: #e6a700 !important; }
.coverage-track span.coverage-green { background: #198754 !important; }
.coverage-track span.coverage-neutral { background: #adb5bd !important; }

.official-page td.coverage-red,
.official-page td.coverage-yellow,
.official-page td.coverage-green,
.official-page td.coverage-neutral {
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}
@media print {
  .official-page td.coverage-red,
  .official-page td.coverage-yellow,
  .official-page td.coverage-green,
  .official-page td.coverage-neutral {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}


/* Version 2.5 : saisie séparée des flacons/ampoules et résultat automatique visible */
.entry-table td.opened-vial-cell {
  min-width: 104px;
  background: #f7fbfc;
  padding: 4px 5px;
}
.entry-table td.opened-vial-cell input.opened-vials-input {
  min-width: 72px;
  width: 100%;
  font-weight: 700;
  background: #fff;
  border: 1px solid #c6d2d8;
  border-radius: 6px;
}
.entry-table td.opened-vial-cell small {
  display: block;
  margin-top: 3px;
  color: #3d5863;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
}
.vial-banner span { line-height: 1.45; }


/* Version 2.5 : résultat des doses ouvertes clairement séparé de la saisie */
.entry-table td.opened-dose-cell {
  min-width: 92px;
  background: #eaf6f2;
  color: #123f34;
  text-align: center;
  vertical-align: middle;
  padding: 4px 6px;
}
.entry-table td.opened-dose-cell strong {
  display: block;
  font-size: 15px;
  line-height: 1.05;
  font-weight: 800;
}
.entry-table td.opened-dose-cell small {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  line-height: 1.1;
  font-weight: 600;
  color: #47675f;
  white-space: nowrap;
}
.entry-table td.opened-manual-cell {
  min-width: 88px;
  background: #fff9e8;
}
.entry-table td.opened-manual-cell input { width: 100%; }
.entry-table td.opened-vial-cell small { display: none; }


/* Version 2.6 : doses ouvertes automatiques et cellules fusionnées par vaccin */
.entry-table td.merged-opened-cell {
  min-width: 140px;
  border-left: 2px solid #7fb6a7;
  border-right: 2px solid #7fb6a7;
  vertical-align: middle;
  background: #eaf6f2;
}
.entry-table td.merged-opened-cell strong {
  display: block;
  font-size: 17px;
  line-height: 1.05;
  font-weight: 800;
}
.entry-table td.merged-opened-cell small {
  display: block;
  margin-top: 5px;
  font-size: 10px;
  line-height: 1.25;
  font-weight: 600;
  color: #365d53;
  white-space: normal;
}
.entry-table td.opened-manual-cell {
  min-width: 110px;
  vertical-align: middle;
}
.entry-table td.opened-manual-cell input {
  min-width: 80px;
  text-align: center;
}

/* =========================================================
   VERSION COMMERCIALE 3.0 — MOBILE, INSTALLATION ET LICENCE
   ========================================================= */
.license-sidebar-info {
  display: block;
  margin-top: 6px;
  max-width: 200px;
  color: rgba(255,255,255,.72);
  font-size: 9px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.mobile-vaccine-cards { display: none; }
.license-read-only input:not([type="month"]),
.license-read-only textarea,
.license-read-only select,
.license-read-only .primary-btn:not(#printBtn),
.license-read-only .danger-btn {
  cursor: not-allowed;
}

@media (max-width: 760px) {
  body { background: #eef3f2; }
  .main { min-width: 0; }
  .content { padding: 14px 10px 90px; }
  .topbar { padding: 10px 11px; align-items: flex-start; gap: 8px; }
  .topbar-title h1 { font-size: 17px; }
  .topbar-title p { font-size: 11px; max-width: 155px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-actions { display: grid; grid-template-columns: 1fr auto; gap: 7px; width: 100%; }
  .month-control { grid-column: 1 / -1; width: 100%; }
  .month-control input { width: 100%; min-height: 44px; font-size: 16px; }
  .topbar-actions button { min-height: 42px; }
  .section-title { align-items: flex-start; gap: 10px; }
  .section-title h2 { font-size: 21px; }
  .section-title p { font-size: 12px; }
  .panel, .form-card, .info-banner, .coverage-legend { border-radius: 14px; }
  .form-grid.two, .form-grid.three { grid-template-columns: 1fr !important; }
  input, select, textarea { font-size: 16px !important; }
  input[type="number"] { min-height: 45px; }
  .desktop-vaccine-table { display: none !important; }
  .mobile-vaccine-cards { display: grid; gap: 13px; }
  .mobile-vaccine-card {
    overflow: hidden;
    border: 1px solid #d5e1df;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 5px 18px rgba(30,62,66,.07);
  }
  .mobile-vaccine-card > header {
    padding: 13px 15px;
    background: linear-gradient(135deg,#e7f4f1,#f8fbfa);
    border-bottom: 1px solid #d8e7e3;
  }
  .mobile-vaccine-card > header h3 { margin: 0; color: #164f47; font-size: 16px; overflow-wrap: anywhere; }
  .mobile-age-block { padding: 13px 14px; border-bottom: 1px solid #edf1f0; }
  .mobile-age-block h4 { margin: 0 0 10px; font-size: 13px; color: #405b58; }
  .mobile-age-block.is-disabled { padding-block: 10px; background: #f2f4f4; color: #84908e; }
  .mobile-age-block.is-disabled p { margin: 0; font-size: 12px; }
  .mobile-dose-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
  .mobile-dose-grid label { display: grid; gap: 5px; color: #526965; font-size: 10px; font-weight: 800; line-height: 1.2; }
  .mobile-dose-grid input { width: 100%; box-sizing: border-box; text-align: center; border: 1px solid #bfd0cd; border-radius: 10px; background: #fff; font-weight: 700; }
  .mobile-results { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
  .mobile-results > span { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 38px; padding: 7px 9px; border: 1px solid #dce5e3; border-radius: 10px; background: #f7f9f9; font-size: 11px; }
  .mobile-results b { font-size: 14px; }
  .mobile-opened { padding: 12px 14px; background: #eaf6f2; color: #164d43; }
  .mobile-opened strong { display: inline-block; margin-right: 8px; font-size: 18px; }
  .mobile-opened small { font-size: 11px; }
  .coverage-legend { align-items: stretch; }
  .legend-chip { flex: 1 1 100%; justify-content: center; }
  .vial-banner { font-size: 11px; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .entry-table input { min-width: 58px; }
  .report-pages { transform-origin: top left; }
}

@media (max-width: 420px) {
  .mobile-dose-grid { grid-template-columns: 1fr; }
  .mobile-results { grid-template-columns: 1fr; }
}

@media print {
  .license-badge-fixed { display: none !important; }
}
.quit-app-btn{margin-top:8px;width:100%;border:1px solid rgba(255,255,255,.25);background:rgba(255,255,255,.08);color:#fff;border-radius:9px;padding:8px 9px;font-size:10px;font-weight:800;cursor:pointer}.quit-app-btn:hover{background:rgba(255,255,255,.15)}


/* CS RAPPORT PEV 4.3 */
.sidebar-bottom .offline-chip[data-status="online"] { border-color: rgba(85,225,150,.35); }
.sidebar-bottom .offline-chip[data-status="syncing"] { border-color: rgba(255,210,95,.35); }
.sidebar-bottom .offline-chip[data-status="error"] { border-color: rgba(255,120,105,.35); }
@media (max-width:760px) {
  .sidebar-bottom { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .connect-account-btn { min-height: 40px; font-size: 12px; }
}
