/* Ambulance Call Report – editable HTML clone.
   Header colours are CSS variables: tweak them here to match the original. */
:root {
  --hdr-bg: #222;
  --hdr-fg: #fff;
  --line: #8a8a8a;
  --lbl: #444;
  --ink: #111;
  --paper: #fff;
  --desk: #e6e6e6;
  --focus: #0b5cad;
  --focus-bg: #fff9c9;
  --flash: #c8f2d0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font: 13px/1.25 Arial, Helvetica, sans-serif;
}

.sheet {
  width: min(1100px, 100% - 24px);
  margin: 16px auto;
  padding: 20px 24px 14px;
  background: var(--paper);
  border: 1px solid #c4c4c4;
}

/* ---------- page header (logos removed, text kept) ---------- */
.top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 3px solid var(--hdr-bg);
}
.top .org { font-size: 11px; line-height: 1.2; min-width: 170px; }
.top h1 { margin: 0; font-size: 28px; letter-spacing: .3px; text-align: center; flex: 1; }
.top .conf { font-size: 11px; text-align: right; min-width: 170px; }
.top .conf b { font-size: 12px; }

/* ---------- section header bars ---------- */
h2.bar, h3.bar {
  margin: 10px 0 0;
  padding: 3px 8px;
  background: var(--hdr-bg);
  color: var(--hdr-fg);
  font-size: 13px;
  letter-spacing: .6px;
  text-transform: uppercase;
}
h3.bar { font-size: 12px; margin-top: 14px; }
.section-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; padding: 0; border: 0; background: transparent; color: inherit;
  font: inherit; letter-spacing: inherit; text-align: left; text-transform: inherit; cursor: pointer;
}
.section-heading { display: flex; align-items: center; gap: 8px; }
.section-heading .section-toggle { flex: 1; width: auto; }
.section-toggle:focus-visible { outline: 2px solid #8fb0ff; outline-offset: 2px; }
.section-toggle-label { flex: none; font-size: 10px; font-weight: normal; letter-spacing: .3px; text-transform: none; }
.section-clear {
  flex: none; padding: 4px 7px; border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 5px; background: transparent; color: inherit;
  font: inherit; font-size: 9px; letter-spacing: .2px; text-transform: none; cursor: pointer;
}
.section-clear:hover { background: rgba(255, 255, 255, .16); }
.acr-toggle-content[hidden] { display: none; }
.section-record {
  display: inline-flex; flex: none; align-items: center; justify-content: center;
  width: 27px; height: 27px; padding: 0; border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 6px; background: transparent; color: inherit; cursor: pointer;
}
.section-record:hover { background: rgba(255, 255, 255, .16); }
.section-record[data-state="recording"] { color: #fff; background: #c52c3b; border-color: #c52c3b; }
.section-record:disabled { opacity: .55; cursor: progress; }
.section-audio-upload { display: inline-flex; flex: none; }
.section-upload-button {
  display: inline-flex; align-items: center; gap: 4px; height: 27px; padding: 0 7px;
  border: 1px solid rgba(255, 255, 255, .55); border-radius: 6px;
  background: transparent; color: inherit; font: inherit; font-size: 9px;
  letter-spacing: .2px; text-transform: none; cursor: pointer;
}
.section-upload-button:hover { background: rgba(255, 255, 255, .16); }
.section-upload-button:disabled { opacity: .55; cursor: progress; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- grid of boxed cells ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.cell {
  display: block;
  min-height: 36px;
  padding: 2px 5px 3px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.s1 { grid-column: span 1; } .s2 { grid-column: span 2; } .s3 { grid-column: span 3; }
.s4 { grid-column: span 4; } .s5 { grid-column: span 5; } .s6 { grid-column: span 6; }
.s7 { grid-column: span 7; } .s8 { grid-column: span 8; } .s9 { grid-column: span 9; }
.s10 { grid-column: span 10; } .s11 { grid-column: span 11; } .s12 { grid-column: span 12; }

.lbl {
  display: block;
  margin-bottom: 1px;
  color: var(--lbl);
  font-size: 9.5px;
  line-height: 1.1;
}
.cell:focus-within { background: var(--focus-bg); outline: 2px solid var(--focus); outline-offset: -2px; }
.cell.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--flash); } to { background: transparent; } }

.cell input[type=text], .cell textarea, td input[type=text] {
  display: block;
  width: 100%;
  padding: 2px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
}
textarea { resize: vertical; min-height: 2.6em; }

/* ---------- segmented date / time ---------- */
.seg { display: inline-flex; align-items: center; gap: 2px; }
.seg input[data-part] {
  width: 2.4em; padding: 2px 0; border: 0; border-bottom: 1px solid #bbb;
  outline: 0; background: transparent; font: inherit; text-align: center;
}
.seg input[data-part]:first-child { width: 3.4em; }
.seg.time input[data-part]:first-child { width: 2.4em; }
.seg input[data-part]:focus { border-bottom-color: var(--focus); }
.seg i { color: #777; font-style: normal; }

/* ---------- checkbox / radio groups ---------- */
.grp .opts { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; padding-top: 2px; }
.chk { display: inline-flex; align-items: center; gap: 4px; margin: 2px 10px 2px 0; cursor: pointer; white-space: nowrap; }
.chk input { margin: 0; accent-color: var(--hdr-bg); cursor: pointer; }
.opts .sep { color: #777; margin: 0 4px 0 2px; }
.opts .inline-label { color: var(--lbl); font-size: 11px; margin-right: 4px; }
.opts input[type=text] { width: 12em; border-bottom: 1px solid #bbb; }
.chkcell { display: flex; align-items: center; }

/* ---------- procedures table ---------- */
.tablewrap { overflow-x: auto; border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
table.proc { border-collapse: collapse; width: 100%; min-width: 980px; }
table.proc th {
  background: #efefef; font-size: 9.5px; font-weight: normal; color: var(--lbl);
  padding: 2px 3px; text-align: left; vertical-align: bottom;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
table.proc td { padding: 0 3px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); height: 28px; }
table.proc td:focus-within { background: var(--focus-bg); outline: 2px solid var(--focus); outline-offset: -2px; }
table.proc .rownum { width: 24px; text-align: center; color: #777; font-size: 10px; background: #efefef; }
.tools { margin: 6px 0 0; font-size: 12px; }
.tools button { font: inherit; padding: 2px 10px; cursor: pointer; transition: background-color .12s; }
.tools button:hover { background: #d6d6d6; }

/* ---------- misc ---------- */
.copies { margin-top: 8px; font-size: 11px; color: var(--lbl); display: flex; flex-wrap: wrap; gap: 4px 24px; }
.footer { margin-top: 10px; padding-top: 4px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; font-size: 10px; color: var(--lbl); }
.note { font-size: 11px; color: var(--lbl); margin: 4px 0; }
.bilingual { font-size: 11px; line-height: 1.3; padding: 4px 6px; border: 1px solid var(--line); border-top: 0; }
.bilingual p { margin: 2px 0; }

/* ---------- reference pages ---------- */
.codes { column-width: 235px; column-gap: 22px; margin-top: 6px; }
.codeset { break-inside: avoid-column; margin-bottom: 14px; }
.codeset h4 {
  margin: 0 0 3px; padding: 2px 6px; background: var(--hdr-bg); color: var(--hdr-fg);
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
}
.codeset h5 { margin: 6px 0 2px; font-size: 11px; border-bottom: 1px solid var(--line); }
.codeset .pair { display: grid; grid-template-columns: 3.4em 1fr; gap: 0 4px; font-size: 11px; padding: 0 2px; }
.codeset .pair b { text-align: right; }

table.ref { border-collapse: collapse; margin: 6px 0; font-size: 11px; width: 100%; }
table.ref th, table.ref td { border: 1px solid var(--line); padding: 2px 6px; text-align: left; vertical-align: top; }
table.ref th { background: #efefef; }
.refgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 20px; }
.pain { display: flex; text-align: center; border: 1px solid var(--line); margin: 6px 0; }
.pain div { flex: 1; padding: 3px 0; border-right: 1px solid var(--line); font-size: 11px; }
.pain div:last-child { border-right: 0; }

@media (max-width: 820px) {
  .sheet { padding: 12px; }
  .grid .cell { grid-column: span 6; }
  .grid .cell.s12, .grid .cell.s8, .grid .cell.s9, .grid .cell.s10, .grid .cell.s11 { grid-column: span 12; }
  .top h1 { font-size: 20px; }
  .top .org, .top .conf { min-width: 0; }
}

@media print {
  body { background: #fff; }
  .sheet { width: auto; margin: 0; padding: 0; border: 0; break-after: page; }
  .cell:focus-within, table.proc td:focus-within { background: none; outline: none; }
  .tools, .noprint { display: none !important; }
  .section-toggle { cursor: default; }
  .section-toggle-label { display: none; }
  .acr-toggle-content[hidden] { display: block !important; }
}
