:root {
  --navy: #0f2f4f;
  --navy-2: #163f67;
  --orange: #d46b19;
  --bg: #eef2f6;
  --paper: #ffffff;
  --text: #15202b;
  --muted: #657485;
  --line: #b9c3cc;
  --line-dark: #6f7d8a;
  --danger: #a72a2a;
  --success: #1f6e43;
  --shadow: 0 10px 28px rgba(14, 32, 48, .09);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Arial, Helvetica, sans-serif; color: var(--text); background: var(--bg); }
body { min-height: 100vh; }
button, input, textarea, select { font: inherit; }
button, .file-button { min-height: 44px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 72px; padding: 10px 20px;
  background: var(--navy); color: white; box-shadow: 0 2px 10px rgba(0,0,0,.16);
}
.brand-wrap { display: flex; align-items: center; gap: 12px; }
.brand { font-size: 1.25rem; font-weight: 800; letter-spacing: .2px; }
.subtitle { font-size: .78rem; opacity: .82; margin-top: 2px; }
.status-wrap { display: flex; align-items: center; gap: 10px; font-size: .83rem; }
.connection-badge, .save-status { border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: 6px 10px; }
.connection-badge.offline { background: #6f2b2b; }

.workspace { display: grid; grid-template-columns: 320px minmax(0, 1fr); min-height: calc(100vh - 72px); }
.sidebar { background: #f7f9fb; border-right: 1px solid #d5dde4; padding: 18px 16px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 72px; height: calc(100vh - 72px); overflow-y: auto; align-self: start; }
.sidebar-section label { display: block; font-size: .79rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .05em; }
.sidebar select { width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: white; }
.sidebar-heading { font-size: .78rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin: 4px 2px 10px; padding-bottom: 8px; border-bottom: 1px solid #dce3e9; }
.form-nav { display: flex; flex-direction: column; gap: 7px; }
.form-nav button { width: 100%; display: grid; grid-template-columns: 70px minmax(0, 1fr); align-items: center; gap: 10px; text-align: left; border: 1px solid #d9e1e7; background: #fff; border-radius: 10px; padding: 9px 10px; cursor: pointer; min-height: 52px; color: #243442; box-shadow: 0 1px 2px rgba(15,47,79,.04); transition: background .15s, border-color .15s, box-shadow .15s, transform .15s; }
.form-nav button:hover { background: #eef3f7; border-color: #b9c8d4; box-shadow: 0 3px 8px rgba(15,47,79,.08); }
.form-nav button:focus-visible { outline: 3px solid rgba(212,107,25,.22); outline-offset: 1px; }
.form-nav button.active { background: var(--navy); border-color: var(--navy); color: white; box-shadow: inset 4px 0 0 var(--orange), 0 4px 10px rgba(15,47,79,.16); }
.form-code { display: inline-flex; align-items: center; justify-content: center; min-height: 30px; padding: 4px 6px; border-radius: 7px; background: #e9eff5; color: var(--navy); font-size: .74rem; line-height: 1; font-weight: 800; letter-spacing: .02em; white-space: nowrap; }
.form-menu-title { min-width: 0; font-size: .89rem; line-height: 1.22; font-weight: 700; overflow-wrap: anywhere; }
.form-nav button.active .form-code { background: rgba(255,255,255,.14); color: white; }
.form-nav button.active .form-menu-title { font-weight: 800; }
.sidebar-footer { margin-top: auto; padding: 10px 4px; }
.small-note { font-size: .78rem; line-height: 1.4; color: var(--muted); }

.main { padding: 22px; min-width: 0; }
.incident-card, .toolbar, .form-container { max-width: 1150px; margin: 0 auto 16px; }
.incident-card { background: white; border: 1px solid #d6dee5; box-shadow: var(--shadow); border-radius: var(--radius); padding: 16px; }
.grid { display: grid; gap: 14px; }
.meta-grid { grid-template-columns: 2fr 1.1fr 1.1fr 1.2fr; }
label span { display: block; font-size: .78rem; font-weight: 700; color: #475767; margin: 0 0 6px; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; background: white; color: var(--text); }
input:focus, textarea:focus, select:focus { outline: 3px solid rgba(212,107,25,.16); border-color: var(--orange); }
textarea { min-height: 95px; resize: vertical; }

.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; }
.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; gap: 8px; }
button, .file-button { border: 1px solid transparent; border-radius: 9px; padding: 9px 13px; cursor: pointer; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.primary { background: var(--navy); color: white; }
.primary:hover { background: var(--navy-2); }
.secondary { background: white; color: var(--navy); border-color: #bcc7d0; }
.secondary:hover { background: #f1f5f8; }
.danger-ghost { background: white; color: var(--danger); border-color: #ddb9b9; }
.full { width: 100%; margin-top: 8px; }
.file-button input { display: none; }
.icon-btn { background: rgba(255,255,255,.1); color: white; border: 1px solid rgba(255,255,255,.25); width: 44px; padding: 0; }
.mobile-only { display: none; }

.form-container { background: var(--paper); border: 1px solid #cfd7df; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.form-titlebar { border-bottom: 4px solid var(--navy); padding: 18px 22px 14px; }
.form-number { font-size: .82rem; font-weight: 800; color: var(--orange); text-transform: uppercase; letter-spacing: .06em; }
.form-title { font-size: 1.55rem; font-weight: 800; margin-top: 3px; }
.form-description { color: var(--muted); margin-top: 6px; font-size: .9rem; }
.form-body { padding: 22px; }
.form-section { margin-bottom: 22px; }
.form-section:last-child { margin-bottom: 0; }
.section-title { font-size: 1rem; font-weight: 800; color: var(--navy); border-bottom: 2px solid #d8e0e6; padding-bottom: 7px; margin-bottom: 12px; }
.fields-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fields-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field.full-span { grid-column: 1 / -1; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line-dark); }
table.ics-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.ics-table th, .ics-table td { border: 1px solid var(--line-dark); padding: 7px; vertical-align: top; }
.ics-table th { background: #eef2f5; color: #162737; font-weight: 800; text-align: left; }
.ics-table td input, .ics-table td textarea { border: 0; border-radius: 0; padding: 6px; min-width: 110px; background: transparent; }
.ics-table td textarea { min-height: 64px; }
.add-row-wrap { display: flex; justify-content: flex-end; margin-top: 8px; }
.add-row-btn { background: white; border: 1px solid #bdc8d1; color: var(--navy); }
.remove-row { border: 0; background: transparent; color: var(--danger); min-height: 34px; padding: 4px 6px; font-size: 1.05rem; }
.form-footer-note { margin-top: 24px; padding-top: 12px; border-top: 1px solid #dde4e9; color: var(--muted); font-size: .75rem; }

.toast { position: fixed; right: 18px; bottom: 18px; z-index: 100; background: #162737; color: white; padding: 11px 15px; border-radius: 9px; box-shadow: 0 8px 24px rgba(0,0,0,.2); opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 980px) {
  .meta-grid { grid-template-columns: 1fr 1fr; }
  .fields-4 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .mobile-only { display: inline-flex; }
  .workspace { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 72px; left: 0; bottom: 0; width: min(86vw, 320px); z-index: 40; transform: translateX(-105%); transition: transform .2s; box-shadow: 8px 0 24px rgba(0,0,0,.18); }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 12px; }
  .meta-grid, .fields-2, .fields-3, .fields-4 { grid-template-columns: 1fr; }
  .toolbar, .toolbar-left, .toolbar-right { width: 100%; }
  .toolbar-left > *, .toolbar-right > * { flex: 1 1 45%; }
  .status-wrap .save-status { display: none; }
  .form-title { font-size: 1.25rem; }
  .form-body, .form-titlebar { padding-left: 14px; padding-right: 14px; }
}

@media print {
  @page { size: letter; margin: .45in; }
  body { background: white; }
  .topbar, .sidebar, .no-print, .toast { display: none !important; }
  .workspace, .main { display: block; padding: 0; }
  .form-container { max-width: none; margin: 0; border: 0; box-shadow: none; border-radius: 0; }
  .form-titlebar { padding: 0 0 10px; }
  .form-body { padding: 10px 0 0; }
  .table-wrap { overflow: visible; }
  table.ics-table { min-width: 0; font-size: 9pt; }
  .ics-table th, .ics-table td { padding: 4px; }
  input, textarea { border: 0 !important; padding: 2px !important; background: transparent !important; }
  textarea { min-height: 40px; }
  .add-row-wrap, .remove-row { display: none !important; }
  .form-footer-note { font-size: 7.5pt; }
  .page-break-before { break-before: page; }
}

/* ICS 215 - Operational Planning Worksheet */
.ics215-sheet { border: 1px solid #7a858f; background: #fff; border-radius: 8px; padding: 14px; }
.ics215-official-title { text-align: center; font-size: 1.15rem; font-weight: 900; margin: 0 0 10px; letter-spacing: .01em; }
.ics215-top { display: grid; grid-template-columns: 1fr 1.3fr; border: 2px solid #1f2a33; border-bottom: 0; }
.ics215-top-box { min-height: 74px; padding: 8px 10px; border-right: 2px solid #1f2a33; margin: 0; }
.ics215-top-box:last-child { border-right: 0; }
.ics215-top-box > span, .ics215-op-title { display: block; margin: 0 0 4px; font-size: .88rem; color: #17232e; }
.ics215-op-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 12px; }
.ics215-op-grid label, .ics215-prep-line { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 8px; margin: 0; }
.ics215-op-grid label span, .ics215-prep-line span { margin: 0; white-space: nowrap; color: #202a33; font-size: .82rem; }
.ics215-line-input { min-height: 34px; border: 0; border-bottom: 1px solid #58636c; border-radius: 0; padding: 4px 5px; background: transparent; }
.ics215-line-input:focus { outline: 2px solid rgba(212,107,25,.18); outline-offset: 0; border-color: var(--orange); }

.ics215-table-scroll { overflow-x: auto; border: 2px solid #1f2a33; -webkit-overflow-scrolling: touch; }
.ics215-table { width: 100%; min-width: 1680px; border-collapse: collapse; table-layout: fixed; font-size: .78rem; }
.ics215-table th, .ics215-table td { border: 1px solid #53606b; padding: 0; vertical-align: middle; background: #fff; }
.ics215-table thead th { height: 158px; padding: 7px 5px; background: #f7f8f9; color: #18242f; font-weight: 800; text-align: center; vertical-align: bottom; }
.ics215-table .branch-col { width: 72px; }
.ics215-table .division-col { width: 112px; }
.ics215-table .assignment-col { width: 190px; }
.ics215-table .resource-status-col { width: 60px; }
.ics215-table .resource-heading { width: 70px; padding: 4px; vertical-align: bottom; }
.ics215-table .overhead-col { width: 155px; }
.ics215-table .equipment-col { width: 150px; }
.ics215-table .reporting-col { width: 135px; }
.ics215-table .arrival-col { width: 130px; }
.resource-heading-input { min-height: 92px; border: 1px dashed #9aa4ad; border-radius: 5px; padding: 5px; text-align: center; font-size: .72rem; background: #fff; }
.ics215-cell-input, .ics215-resource-input, .ics215-cell-textarea { width: 100%; border: 0; border-radius: 0; padding: 6px; background: transparent; }
.ics215-cell-input { min-height: 48px; }
.ics215-resource-input { min-width: 0; min-height: 38px; text-align: center; padding: 3px; }
.ics215-cell-textarea { min-height: 114px; resize: none; line-height: 1.25; }
.ics215-cell-input:focus, .ics215-resource-input:focus, .ics215-cell-textarea:focus, .resource-heading-input:focus { outline: 3px solid rgba(212,107,25,.18); outline-offset: -3px; border-color: var(--orange); }
.ics215-table tr:nth-child(3n) td { border-bottom-color: #1f2a33; border-bottom-width: 2px; }
.ics215-table .resource-status { width: 60px; padding: 0 7px; font-weight: 700; background: #fafbfc; }
.ics215-total-row td { height: 48px; border-top-width: 2px; }
.ics215-total-label { text-align: right; padding: 6px 9px !important; font-weight: 800; line-height: 1.2; background: #f7f8f9 !important; }
.ics215-mark { padding: 8px !important; font-weight: 900; vertical-align: bottom !important; }
.ics215-prepared-cell { padding: 10px 12px !important; vertical-align: top !important; }
.ics215-prepared-title { font-weight: 900; margin-bottom: 8px; font-size: .88rem; }
.ics215-prep-line { margin: 5px 0; }
.ics215-signature-wrap { display: grid; grid-template-columns: auto minmax(260px,1fr); gap: 8px; align-items: start; margin: 7px 0; }
.ics215-signature-label { font-size: .82rem; padding-top: 8px; }
.signature-pad { width: 100%; height: 86px; border: 1px solid #7c8790; border-radius: 4px; background: #fff; touch-action: none; cursor: crosshair; grid-column: 2; }
.signature-clear { grid-column: 2; justify-self: end; min-height: 32px; padding: 4px 8px; border: 1px solid #c5cdd4; background: #fff; color: var(--danger); font-size: .72rem; }
.ics215-scroll-hint { margin-top: 8px; font-size: .76rem; color: var(--muted); }
.ics215-instructions { margin-top: 16px; border: 1px solid #ced7de; border-radius: 9px; background: #f8fafb; }
.ics215-instructions summary { cursor: pointer; font-weight: 800; color: var(--navy); padding: 11px 13px; }
.ics215-instruction-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1px; background: #dbe2e8; border-top: 1px solid #dbe2e8; }
.ics215-instruction-grid > div { background: #fff; padding: 9px 11px; line-height: 1.35; }
.ics215-instruction-grid b { display: block; margin-bottom: 3px; color: #213445; }
.ics215-instruction-grid span { display: block; font-size: .8rem; color: #475767; }

@media (max-width: 980px) {
  .ics215-top { grid-template-columns: 1fr; }
  .ics215-top-box { border-right: 0; border-bottom: 2px solid #1f2a33; }
  .ics215-top-box:last-child { border-bottom: 0; }
  .ics215-instruction-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .ics215-sheet { padding: 8px; }
  .ics215-official-title { font-size: 1rem; }
  .ics215-op-grid { grid-template-columns: 1fr; }
}

@media print {
  .ics215-sheet { border: 0; border-radius: 0; padding: 0; }
  .ics215-official-title { font-size: 11pt; margin-bottom: 5px; }
  .ics215-top { grid-template-columns: 1fr 1.3fr; }
  .ics215-top-box { min-height: 45px; padding: 4px 6px; border-bottom: 0; border-right: 1px solid #000; }
  .ics215-top-box:last-child { border-right: 0; }
  .ics215-op-grid { grid-template-columns: 1fr 1fr; gap: 1px 5px; }
  .ics215-table-scroll { overflow: visible; border-color: #000; }
  .ics215-table { min-width: 0; table-layout: fixed; font-size: 5.8pt; }
  .ics215-table thead th { height: 78px; padding: 2px; }
  .ics215-table .branch-col { width: 3.5%; }
  .ics215-table .division-col { width: 5.5%; }
  .ics215-table .assignment-col { width: 10%; }
  .ics215-table .resource-status-col { width: 3.6%; }
  .ics215-table .resource-heading { width: 3.35%; }
  .ics215-table .overhead-col { width: 7.5%; }
  .ics215-table .equipment-col { width: 7.5%; }
  .ics215-table .reporting-col { width: 6.5%; }
  .ics215-table .arrival-col { width: 6%; }
  .resource-heading-input { min-height: 48px !important; font-size: 5.6pt; }
  .ics215-cell-input, .ics215-resource-input { min-height: 18px !important; font-size: 5.8pt; }
  .ics215-cell-textarea { min-height: 55px !important; font-size: 5.8pt; }
  .ics215-total-row td { height: 22px; }
  .ics215-prepared-cell { padding: 4px 5px !important; }
  .ics215-prepared-title { font-size: 6.5pt; margin-bottom: 2px; }
  .ics215-prep-line { margin: 1px 0; }
  .ics215-prep-line span, .ics215-signature-label { font-size: 5.8pt; }
  .signature-pad { height: 32px; min-width: 0; }
  .ics215-signature-wrap { grid-template-columns: auto 1fr; gap: 3px; margin: 2px 0; }
  .ics215-line-input { min-height: 18px !important; font-size: 6pt; }
}

/* Tablet / iPad portrait: give the form the full screen and move Forms into the menu drawer. */
@media screen and (min-width: 761px) and (max-width: 1100px) {
  .mobile-only { display: inline-flex; }
  .workspace { grid-template-columns: 1fr; }
  .sidebar { position: fixed; top: 72px; left: 0; bottom: 0; width: min(88vw, 340px); z-index: 40; transform: translateX(-105%); transition: transform .2s; box-shadow: 8px 0 24px rgba(0,0,0,.18); }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 14px; }
  .meta-grid { grid-template-columns: 1fr 1fr; }
}

/* ICS 203 - live command/general staff organization chart */
.org-chart-section { margin-top: 28px; }
.ics-org-chart { overflow-x: auto; padding: 6px 4px 18px; -webkit-overflow-scrolling: touch; }
.org-command-zone { position: relative; width: min(760px, 100%); min-width: 690px; margin: 0 auto; padding: 16px 22px 20px; border: 2px dashed #59636c; background: #fbfcfd; }
.org-zone-heading, .org-general-heading { text-align: center; font-weight: 900; letter-spacing: .035em; color: #202a33; }
.org-zone-heading { margin-bottom: 14px; font-size: 1rem; }
.org-general-heading { width: max-content; margin: 4px auto 10px; padding: 3px 9px; background: #fff; position: relative; z-index: 2; font-size: .86rem; }
.org-ic-wrap { position: relative; display: grid; grid-template-columns: minmax(250px, 330px); justify-content: center; gap: 10px; }
.org-ic-wrap::after { content: ''; position: absolute; left: 50%; bottom: -17px; height: 17px; border-left: 2px solid #30373d; }
.org-command-row { position: relative; display: grid; grid-template-columns: repeat(3, minmax(170px, 1fr)); gap: 26px; margin-top: 32px; }
.org-command-row::before { content: ''; position: absolute; top: -16px; left: 16.67%; right: 16.67%; border-top: 2px solid #30373d; }
.org-command-row > .org-node::before { content: ''; position: absolute; top: -17px; left: 50%; height: 17px; border-left: 2px solid #30373d; }
.org-node { position: relative; min-height: 66px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 9px 11px; border: 2px solid #30373d; background: #fff; box-shadow: 3px 3px 0 rgba(48,55,61,.22); }
.org-node-primary { min-height: 72px; }
.org-node-deputy { min-height: 60px; border-style: solid; }
.org-node-title { font-weight: 900; line-height: 1.15; font-size: .84rem; color: #1d2730; }
.org-node-name { margin-top: 5px; min-height: 1.05em; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .86rem; line-height: 1.2; color: var(--navy); font-weight: 700; }
.org-node-agency { width: min(520px, 82%); min-height: 58px; margin: 26px auto 0; }
.org-main-stem { width: 0; height: 31px; margin: 0 auto; border-left: 2px solid #30373d; }
.org-general-row { position: relative; min-width: 900px; display: grid; grid-template-columns: repeat(4, minmax(190px, 1fr)); gap: 24px; padding-top: 17px; }
.org-general-row::before { content: ''; position: absolute; top: 0; left: 12.5%; right: 12.5%; border-top: 2px solid #30373d; }
.org-general-row > .org-node::before { content: ''; position: absolute; top: -19px; left: 50%; height: 19px; border-left: 2px solid #30373d; }
.org-node-section { min-height: 74px; }
.org-chart-note { margin-top: 9px; text-align: center; color: var(--muted); font-size: .76rem; }

/* Print packet - the Print / PDF button builds every listed form, including blank forms. */
.print-packet { display: none; }
.print-meta-grid { display: grid; grid-template-columns: 2fr 1.15fr 1.15fr 1.2fr; border: 1px solid #53606b; border-top: 0; }
.print-meta-item { min-height: 44px; padding: 5px 7px; border-right: 1px solid #53606b; }
.print-meta-item:last-child { border-right: 0; }
.print-meta-label { font-size: 7.5pt; font-weight: 800; color: #344554; }
.print-meta-value { margin-top: 4px; min-height: 12px; font-size: 9pt; white-space: pre-wrap; overflow-wrap: anywhere; }
.print-field-label { font-size: 8pt; font-weight: 800; color: #344554; margin-bottom: 3px; }
.print-value { min-height: 28px; padding: 5px 6px; border: 1px solid #7f8a93; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.25; }
.print-value-multiline { min-height: 58px; }
.print-ics-table td { min-height: 28px; height: 28px; white-space: pre-wrap; overflow-wrap: anywhere; }
.print-ics-table td.print-multiline-cell { min-height: 44px; height: 44px; }
.ics215-print-op-grid .ics215-print-op-item { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 4px; }
.ics215-print-op-grid .print-value { border: 0; border-bottom: 1px solid #58636c; min-height: 20px; padding: 2px 3px; }
.ics215-top-box > .print-value { border: 0; border-bottom: 1px solid #58636c; border-radius: 0; min-height: 25px; padding: 3px 4px; }
.ics215-static-table td { white-space: pre-wrap; overflow-wrap: anywhere; padding: 2px 3px; }
.ics215-print-prep-line { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 5px; align-items: center; min-height: 19px; border-bottom: 1px solid #8a939b; }
.ics215-print-prep-line > span:first-child { font-weight: 700; white-space: nowrap; }
.ics215-signature-image { display: block; max-width: 100%; max-height: 42px; object-fit: contain; object-position: left center; }

@media screen and (max-width: 760px) {
  .org-command-zone { min-width: 650px; }
  .org-general-row { min-width: 820px; }
}

@media print {
  .app-shell { display: none !important; }
  .print-packet { display: block !important; }
  .print-form-sheet { width: 100%; break-after: page; page-break-after: always; }
  .print-form-sheet:last-child { break-after: auto; page-break-after: auto; }
  .print-titlebar { border-bottom-width: 2px; }
  .print-form-body { padding-top: 10px; }
  .print-meta-grid { grid-template-columns: 2fr 1.15fr 1.15fr 1.2fr; }
  .print-field { break-inside: avoid; }
  .print-value { min-height: 24px; font-size: 8.5pt; }
  .print-value-multiline { min-height: 50px; }
  .print-ics-table { table-layout: fixed; }
  .print-ics-table th { font-size: 7.5pt; }
  .print-ics-table td { height: 26px; font-size: 8pt; padding: 4px !important; }
  .print-ics-table td.print-multiline-cell { height: 40px; }

  .org-chart-section { margin-top: 16px; break-inside: avoid; }
  .ics-org-chart { overflow: visible; padding: 2px 0 8px; }
  .org-command-zone { width: 68%; min-width: 0; padding: 8px 10px 10px; border-width: 1px; }
  .org-zone-heading { font-size: 8pt; margin-bottom: 7px; }
  .org-ic-wrap { grid-template-columns: minmax(130px, 200px); gap: 5px; }
  .org-ic-wrap::after { bottom: -9px; height: 9px; border-left-width: 1px; }
  .org-command-row { grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 17px; }
  .org-command-row::before { top: -9px; border-top-width: 1px; }
  .org-command-row > .org-node::before { top: -10px; height: 10px; border-left-width: 1px; }
  .org-node { min-height: 38px; padding: 4px 5px; border-width: 1px; box-shadow: 1px 1px 0 rgba(48,55,61,.18); }
  .org-node-primary { min-height: 42px; }
  .org-node-deputy { min-height: 34px; }
  .org-node-title { font-size: 6.4pt; }
  .org-node-name { margin-top: 2px; font-size: 6.6pt; }
  .org-node-agency { min-height: 34px; margin-top: 13px; }
  .org-main-stem { height: 16px; border-left-width: 1px; }
  .org-general-heading { font-size: 7pt; margin: 1px auto 4px; padding: 1px 4px; }
  .org-general-row { min-width: 0; grid-template-columns: repeat(4, 1fr); gap: 8px; padding-top: 9px; }
  .org-general-row::before { border-top-width: 1px; }
  .org-general-row > .org-node::before { top: -10px; height: 10px; border-left-width: 1px; }
  .org-node-section { min-height: 42px; }

  .ics215-static-table tbody tr:not(.ics215-total-row) td { height: 18px; }
  .ics215-static-table td { font-size: 5.4pt; line-height: 1.1; padding: 1px !important; }
  .ics215-static-table .resource-status { padding: 1px 2px !important; }
  .ics215-print-prep-line { min-height: 12px; font-size: 5.6pt; gap: 2px; }
  .ics215-signature-image { max-height: 26px; }
}

/* v7: reference guide, touch/stylus signature fields, expanded ICS 205 */
.reference-menu-section { margin-top: -4px; }
.reference-nav .form-code { min-width: 70px; }
.reference-titlebar { border-left-color: #4f6f8f; }
.reference-guide { max-width: 1180px; margin: 0 auto; }
.reference-callout, .reference-note {
  border: 1px solid #c7d4df; background: #eef5fb; border-radius: 12px;
  padding: 14px 16px; line-height: 1.45; margin-bottom: 16px;
}
.reference-note { background: #fff8ee; border-color: #ead0aa; margin-top: 16px; }
.reference-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.reference-card { border:1px solid #d7e0e7; border-radius:12px; background:white; padding:16px; box-shadow:0 3px 10px rgba(15,47,79,.05); }
.reference-card h3 { margin:0 0 8px; color:var(--navy); font-size:1rem; }
.reference-card p { margin:0 0 10px; line-height:1.5; }
.reference-card p:last-child { margin-bottom:0; }
.signature-field-wrap { width:100%; }
.generic-signature-pad { display:block; width:100%; min-height:120px; height:120px; background:#fff; border:1px dashed #7b8792; border-radius:8px; touch-action:none; }
.signature-clear { margin-top:8px; min-height:38px; padding:7px 12px; border:1px solid #c9d2da; background:#fff; border-radius:8px; cursor:pointer; }
.print-signature-value { min-height:72px; border-bottom:1px solid #777; display:flex; align-items:flex-end; }
.print-signature-value img { display:block; max-width:320px; max-height:70px; object-fit:contain; }

/* ICS 205 is intentionally wide; preserve fields and allow horizontal swipe on tablets. */
.form-container .ics-table { min-width: 100%; }
.form-container .form-section:nth-of-type(2) .table-wrap { -webkit-overflow-scrolling:touch; }

@media (max-width: 760px) {
  .reference-grid { grid-template-columns:1fr; }
  .reference-card { padding:14px; }
}


/* v8: Planning P reference page */
.planning-p-reference { max-width: 1050px; }
.reference-image-wrap {
  display: flex; justify-content: center; align-items: flex-start;
  width: 100%; padding: 12px; border: 1px solid #d6dfe6; border-radius: 12px;
  background: #f8fafc; overflow: auto; -webkit-overflow-scrolling: touch;
}
.planning-p-image {
  display: block; width: min(100%, 760px); height: auto; max-width: 100%;
  border-radius: 6px; background: #fff;
}
@media (max-width: 760px) {
  .reference-image-wrap { padding: 6px; }
  .planning-p-image { width: 100%; min-width: 0; }
}
