:root {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --border: #e2e8f0;
    --ink: #1e293b;
    --ink-soft: #64748b;
    --primary: #1d4ed8;
    --primary-dark: #1e40af;
    --primary-soft: #eff4ff;
    --danger: #dc2626;
    --success: #16a34a;
    --amber: #d97706;
    --teal: #0d9488;
    --purple: #7c3aed;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    font-size: 15px;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

/* Top bar */
.topbar { background: #0f172a; color: #e2e8f0; box-shadow: var(--shadow); position: relative; z-index: 40; }
.topbar-inner {
    max-width: 1200px; margin: 0 auto; padding: 0 20px;
    display: flex; align-items: center; gap: 16px; min-height: 60px;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark {
    background: var(--primary); color: #fff; font-weight: 800; font-size: .8rem;
    padding: 6px 8px; border-radius: 8px; letter-spacing: .5px;
}
.brand-mark-lg { font-size: 1.4rem; padding: 12px 16px; }
.brand-text { font-size: 1rem; }
.nav-toggle {
    display: none;
    margin-left: auto;
    width: 44px; height: 44px;
    border: 1px solid rgba(226,232,240,.25);
    border-radius: 10px;
    background: transparent;
    color: #fff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.nav-toggle:hover { background: rgba(255,255,255,.08); }
.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
    display: block;
    width: 18px; height: 2px;
    background: #e2e8f0;
    border-radius: 1px;
    position: relative;
    transition: transform .15s, opacity .15s;
}
.nav-toggle-bars::before,
.nav-toggle-bars::after {
    content: '';
    position: absolute;
    left: 0;
}
.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after { top: 6px; }
.topbar.is-nav-open .nav-toggle-bars { background: transparent; }
.topbar.is-nav-open .nav-toggle-bars::before { top: 0; transform: rotate(45deg); }
.topbar.is-nav-open .nav-toggle-bars::after { top: 0; transform: rotate(-45deg); }
.topbar-collapse {
    display: flex; align-items: center; gap: 16px; flex: 1; min-width: 0;
}
.mainnav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.mainnav a {
    color: #cbd5e1; padding: 8px 14px; border-radius: 8px; font-weight: 500; font-size: .92rem;
}
.mainnav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.mainnav a.active { background: var(--primary); color: #fff; }
.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.user-chip { display: flex; flex-direction: column; line-height: 1.1; font-size: .85rem; color: #e2e8f0; text-align: right; }
.user-chip small { color: #94a3b8; font-size: .72rem; text-transform: uppercase; letter-spacing: .4px; }
.inline-form { display: inline; margin: 0; }

/* Layout */
.container { max-width: 1200px; margin: 24px auto; padding: 0 20px; width: 100%; flex: 1; }
.container-auth { display: flex; align-items: center; justify-content: center; max-width: 460px; }
.appfooter {
    max-width: 1200px; margin: 12px auto; padding: 12px 20px; width: 100%;
    display: flex; justify-content: space-between; color: var(--ink-soft); font-size: .8rem;
    border-top: 1px solid var(--border);
}
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.head-actions, .form-actions, .filter-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.danger-zone { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--border); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

/* Cards */
.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px 20px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.card-title { margin: 0 0 12px; font-size: 1.05rem; display: flex; align-items: center; gap: 8px; }
.card-centered { text-align: center; max-width: 460px; margin: 60px auto; }
.subhead { margin: 16px 0 6px; color: var(--ink-soft); font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; }
.narrow { max-width: 560px; }
.lead { font-size: 1.1rem; color: var(--ink-soft); }
.muted { color: var(--ink-soft); }
.hint { color: var(--ink-soft); font-size: .82rem; margin: 8px 0 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
.text-right { text-align: right; }
.meta-line { font-size: .82rem; margin-top: 12px; }

/* Auth */
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 34px; box-shadow: var(--shadow); width: 100%; }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand h1 { font-size: 1.3rem; margin: 14px 0 4px; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: 1px solid transparent; border-radius: 8px; padding: 9px 16px;
    font-size: .9rem; font-weight: 600; cursor: pointer; font-family: inherit;
    background: #e2e8f0; color: var(--ink); transition: background .15s, border-color .15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--ink); }
.btn-ghost:hover { background: #f1f5f9; }
.btn-signout { background: #fff; border-color: #e2e8f0; color: var(--ink); }
.btn-signout:hover { background: #fff; border-color: #cbd5e1; color: var(--ink); }
.btn-danger { background: #fef2f2; border-color: #fecaca; color: var(--danger); }
.btn-danger:hover { background: #fee2e2; border-color: #f87171; }
.btn-sm { padding: 6px 12px; font-size: .82rem; }
.btn-lg { padding: 12px 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.row-actions { display: inline-flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.link-danger { color: var(--danger); }

/* Forms */
label { display: block; margin-bottom: 4px; }
label > span { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=email], input[type=search], input[type=date], input[type=time],
input[type=datetime-local], input[type=file], select, textarea {
    width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px;
    font-size: .92rem; font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea { resize: vertical; }
.stack > label, .stack > fieldset { margin-bottom: 14px; }
.block { display: block; margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin-bottom: 14px; }
.checkbox-inline { display: flex; align-items: center; gap: 8px; }
.checkbox-inline input { width: auto; }
.checkbox-inline span { margin: 0; font-weight: 500; color: var(--ink); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 18px; }
fieldset.card legend, fieldset legend { font-weight: 700; padding: 0 8px; color: var(--primary-dark); }
.subfield { background: #f8fafc; }
.field-error { display: block; color: var(--danger); font-size: .8rem; margin-top: 4px; font-weight: 600; }

/* Flash */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; border: 1px solid transparent; }
.flash-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.flash-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table thead th {
    color: var(--ink-soft); font-size: .76rem; text-transform: uppercase; letter-spacing: .5px;
    cursor: pointer; user-select: none; white-space: nowrap;
}
.table thead th:hover { color: var(--ink); }
.table thead th[data-dir="asc"]::after,
.table thead th[data-dir="desc"]::after {
    content: ''; display: inline-block; margin-left: 6px;
    border: 4px solid transparent; vertical-align: middle;
}
.table thead th[data-dir="asc"]::after { border-bottom-color: var(--primary); border-top-width: 0; }
.table thead th[data-dir="desc"]::after { border-top-color: var(--primary); border-bottom-width: 0; }
.table.table-no-sort thead th { cursor: default; user-select: auto; }
.table.table-no-sort thead th:hover { color: var(--ink-soft); }
.table tbody tr:hover { background: #f8fafc; }
.table tbody tr.row-link { cursor: pointer; }
.table tbody tr.row-link:hover { background: #eef2ff; }
.link-sm { font-size: .82rem; font-weight: 600; }

/* Breadcrumbs */
.breadcrumbs { margin: 0 0 14px; }
.breadcrumbs ol {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    font-size: .85rem; color: var(--ink-soft);
}
.breadcrumbs li { display: inline-flex; align-items: center; gap: 6px; }
.breadcrumbs li:not(:last-child)::after {
    content: '/'; color: #cbd5e1; font-weight: 400; margin-left: 2px;
}
.breadcrumbs a { color: var(--primary); font-weight: 600; text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs [aria-current="page"] { color: var(--ink); font-weight: 600; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-grid-sm { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); max-width: 420px; }
.stat-card {
    background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--primary);
    border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: 4px;
}
a.stat-card:hover { text-decoration: none; transform: translateY(-1px); transition: transform .1s; }
.stat-value { font-size: 1.9rem; font-weight: 800; line-height: 1; }
.stat-label { color: var(--ink-soft); font-size: .82rem; }
.stat-blue { border-left-color: var(--primary); }
.stat-red { border-left-color: var(--danger); }
.stat-amber { border-left-color: var(--amber); }
.stat-purple { border-left-color: var(--purple); }
.stat-teal { border-left-color: var(--teal); }

/* Badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .72rem; font-weight: 700; background: #e2e8f0; color: #334155; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-blue { background: var(--primary-soft); color: var(--primary-dark); }
.badge-teal { background: #ccfbf1; color: #115e59; }
.badge-status { background: #e0e7ff; color: #3730a3; }
.badge-sev-minor { background: #dcfce7; color: #166534; }
.badge-sev-moderate { background: #fef3c7; color: #92400e; }
.badge-sev-serious { background: #ffedd5; color: #9a3412; }
.badge-sev-emergency { background: #fee2e2; color: #991b1b; }
.count-pill { background: #e2e8f0; color: #475569; border-radius: 999px; padding: 1px 10px; font-size: .78rem; font-weight: 700; }

/* Attention list */
.attention-list { list-style: none; margin: 0; padding: 0; }
.attention-list li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px dashed var(--border); flex-wrap: wrap; }
.attention-list li:last-child { border-bottom: none; }
.attention-list .muted { flex: 1; }

/* Detail lists */
.detail-list { margin: 0; }
.detail { display: grid; grid-template-columns: 180px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px solid #f1f5f9; }
.detail dt { color: var(--ink-soft); font-weight: 600; font-size: .85rem; margin: 0; }
.detail dd { margin: 0; }
.flag-yes { color: var(--danger); font-weight: 700; }
@media (max-width: 560px) { .detail { grid-template-columns: 1fr; gap: 2px; } }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { background: var(--primary-soft); color: var(--primary-dark); border-radius: 999px; padding: 3px 12px; font-size: .8rem; font-weight: 600; }

/* Workflow */
.workflow { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.wf-step { padding: 5px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: .8rem; color: var(--ink-soft); position: relative; }
.wf-active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 4px 0 16px 18px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.timeline-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.timeline p { margin: 4px 0; }

/* File list */
.file-list { list-style: none; margin: 0; padding: 0; }
.file-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f1f5f9; flex-wrap: wrap; }

/* Add-form disclosure */
.add-form { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 12px; }
.add-form summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.add-form[open] summary { margin-bottom: 12px; }

/* Filter bar */
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 12px; }
.filter-wide { grid-column: span 2; }
@media (max-width: 640px) { .filter-wide { grid-column: span 1; } }

/* Report bars */
.bars { list-style: none; margin: 0; padding: 0; }
.bars li { display: grid; grid-template-columns: 130px 1fr 40px; align-items: center; gap: 10px; padding: 4px 0; }
.bar-label { font-size: .85rem; }
.bar-track { background: #eef2f7; border-radius: 6px; height: 14px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--primary); border-radius: 6px; }
.bar-value { text-align: right; font-weight: 700; font-size: .85rem; }

.error-code { font-size: 3rem; margin: 0; color: var(--primary); }

/* Print view */
body.print { background: #fff; display: block; }
.print-sheet { max-width: 800px; margin: 0 auto; padding: 30px; }
.print-header { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid var(--ink); padding-bottom: 12px; margin-bottom: 16px; }
.print-header h1 { font-size: 1.4rem; }
.print-ref { text-align: right; font-size: .9rem; }
.print-table { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.print-table th, .print-table td { border: 1px solid #cbd5e1; padding: 6px 10px; text-align: left; vertical-align: top; font-size: .85rem; }
.print-table th { background: #f1f5f9; width: 200px; }
.print-table-list th { width: auto; }
.print-footer { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 12px; font-size: .8rem; color: var(--ink-soft); }
@media print {
    .no-print { display: none !important; }
    .print-sheet { padding: 0; }
    a { color: #000; }
}
@page { margin: 15mm; }

/* Avatars (photos / initials placeholders) */
.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%; overflow: hidden; object-fit: cover; flex: 0 0 auto;
    background: #e2e8f0; color: #475569; font-weight: 700; text-transform: uppercase;
    border: 1px solid var(--border); vertical-align: middle;
}
img.avatar { object-fit: cover; }
.avatar-sm { width: 34px; height: 34px; font-size: .7rem; }
.avatar-md { width: 48px; height: 48px; font-size: .9rem; }
.avatar-lg { width: 84px; height: 84px; font-size: 1.5rem; }
.avatar-initials.avatar-team { background: #e0e7ff; color: #3730a3; border-radius: 12px; }
.avatar-initials.avatar-coach { background: #ccfbf1; color: #115e59; }
.avatar-initials.avatar-athlete { background: #fef3c7; color: #92400e; }
img.avatar-team { border-radius: 12px; }
.col-avatar { width: 44px; padding-right: 0 !important; }

.profile-head { display: flex; align-items: center; gap: 16px; }

/* Photo upload field */
.photo-field .photo-field-row { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.photo-current { flex: 0 0 auto; }
.photo-controls { flex: 1 1 240px; min-width: 220px; }
.photo-controls label > span { margin-bottom: 4px; }

/* Incident injury-photo gallery */
.photo-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin: 6px 0 4px; }
.photo-thumb { margin: 0; }
.photo-thumb a { display: block; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #f1f5f9; }
.photo-thumb img { display: block; width: 100%; height: 130px; object-fit: cover; transition: transform .15s; }
.photo-thumb a:hover img { transform: scale(1.03); }
.photo-thumb figcaption { font-size: .72rem; margin-top: 4px; }


/* Report compare */
.compare-controls {
  display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: end;
  margin: 12px 0 4px; padding-top: 12px; border-top: 1px solid var(--border, #e5e7eb);
}
.compare-controls .compare-label { align-self: center; margin-right: 4px; }
.compare-hint, .compare-footnote { flex-basis: 100%; margin: 0; font-size: 0.9rem; }
.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px; margin: 16px 0;
}
.stat-card {
  background: var(--card, #fff); border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px; padding: 14px 16px;
}
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--muted, #6b7280); font-size: 0.9rem; margin-top: 4px; }
.compare-card { margin-bottom: 18px; }
.compare-matrix th, .compare-matrix td { white-space: nowrap; }
.compare-cell { position: relative; background: color-mix(in srgb, var(--primary, #2563eb) calc(var(--heat) * 0.35%), transparent); }
.compare-cell .cell-pct { display: block; font-size: 0.75rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Multi-dimension compare controls */
.compare-dim-list { display: flex; flex-direction: column; gap: 8px; flex: 1 1 100%; }
.compare-dim-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; }
.compare-dim-row label { flex: 1 1 220px; }
.compare-dim-actions { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.compare-card .card-subtitle { font-size: 1.05rem; margin: 18px 0 10px; }
.compare-footnote { margin-top: 10px; }

/* Contextual live list filter */
.live-search {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  margin: 0 0 14px;
}
.live-search-input {
  flex: 1 1 220px; max-width: 420px;
  padding: 8px 12px; border: 1px solid var(--border, #d0d7de);
  border-radius: 8px; font: inherit; background: #fff;
}
.live-search-input:focus {
  outline: 2px solid color-mix(in srgb, var(--primary, #2563eb) 45%, transparent);
  outline-offset: 1px; border-color: var(--primary, #2563eb);
}
.live-search-meta { font-size: 0.9rem; }
.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;
}
tr.live-filter-hide { display: none !important; }
.live-filter-empty {
  display: none; margin: 8px 0 0; color: var(--muted, #64748b);
}
.live-filter-empty.is-visible { display: block; }

/* Incidents filter-bar search meta */
.filter-wide[data-live-filter-root] {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.filter-wide .live-search-meta {
  margin: 0;
}

.filter-wide .live-search-input {
  max-width: none;
  width: 100%;
  flex: none;
  box-sizing: border-box;
}



/* Smart-search pickers (incident form + filter bars) + Location Other */
.smart-search { position: relative; }
.smart-search-input { width: 100%; }
.smart-search-suggest {
  position: absolute;
  z-index: 30;
  left: 0; right: 0;
  top: calc(100% - 2px);
  background: #fff;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  max-height: 240px;
  overflow: auto;
}
.smart-search-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 12px;
  cursor: pointer;
  font: inherit;
}
.smart-search-item:hover,
.smart-search-item.is-active {
  background: var(--primary-soft, #e0e7ff);
}
.location-field { display: flex; flex-direction: column; gap: 8px; }
.is-hidden { display: none !important; }


/* Reports breakdown picker (one tile at a time) */
.breakdown-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 14px;
}
.breakdown-select { min-width: 220px; }
.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;
}




/* Injury: desktop side-by-side; tablet/mobile stack as own cards in flow */
.injury-layout {
    display: grid;
    grid-template-columns: minmax(240px, 320px) 1fr;
    gap: 18px;
    align-items: start;
    margin-bottom: 18px;
}
.injury-layout > .card {
    margin-bottom: 0;
}
.injury-paperdoll .paperdoll { margin: 0; }
.injury-paperdoll .paperdoll-label { display: none; } /* legend already names the section */
.injury-fields .form-grid-stacked {
    grid-template-columns: 1fr;
}
.injury-fields .block { margin-top: 12px; }
.injury-fields .hint { margin-top: 8px; }

/* Tablet + mobile: dedicated stacked incident form flow
   Basic info → Body areas (paperdoll) → Injury details → response → outcome → follow-up → status */
@media (max-width: 960px) {
    .injury-layout {
        grid-template-columns: 1fr;
        gap: 0;
        margin-bottom: 0;
    }
    .injury-layout > .card {
        margin-bottom: 18px;
    }
    .injury-paperdoll .paperdoll-figure {
        width: min(320px, 88vw);
        margin-inline: auto;
    }
    .paperdoll-stage { justify-content: center; }

    #incident-form .form-grid {
        grid-template-columns: 1fr;
    }
    #incident-form .location-field {
        display: grid;
        gap: 14px;
    }
    #incident-form .checkbox-grid {
        grid-template-columns: 1fr;
    }
    #incident-form .form-actions {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        flex-wrap: wrap;
        gap: 12px;
    }
    #incident-form .form-actions .btn {
        width: auto;
        min-width: 140px;
    }
    #incident-form .danger-zone,
    #incident-form + .danger-zone {
        display: flex;
        justify-content: center;
    }

    /* Body-part chips / special “modules” centred under the paperdoll */
    .injury-paperdoll .paperdoll-chips,
    .injury-paperdoll .paperdoll-special {
        justify-content: center;
        text-align: center;
    }
}

/* Mobile Layout: burger menu instead of horizontal scrolling nav */
@media (max-width: 960px) {
    .nav-toggle { display: inline-flex; }
    .topbar-inner {
        flex-wrap: wrap;
        min-height: 56px;
        padding: 8px 16px;
        gap: 8px;
    }
    .topbar-collapse {
        display: none;
        flex: 1 1 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 8px 0 12px;
        border-top: 1px solid rgba(226,232,240,.12);
    }
    .topbar.is-nav-open .topbar-collapse { display: flex; }
    .mainnav {
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 4px;
        width: 100%;
    }
    .mainnav a {
        display: block;
        width: 100%;
        padding: 12px 14px;
        font-size: .95rem;
    }
    .topbar-right {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
        padding: 4px 2px 0;
        border-top: 1px solid rgba(226,232,240,.08);
        padding-top: 12px;
    }
    .user-chip { text-align: left; }
}

@media (max-width: 640px) {
    .container { margin: 12px auto; padding: 0 14px; }
    .card { padding: 14px 14px; }
    .page-head h1 { font-size: 1.3rem; }
    .brand-text { font-size: .92rem; }
    .user-chip { font-size: .78rem; }
    .injury-paperdoll .paperdoll-figure {
        width: min(280px, 92vw);
    }
    .paperdoll-tab { padding: 8px 16px; min-height: 40px; }
    .paperdoll-special-btn { min-height: 40px; }
}

/* Paperdoll front/back toggle (single figure) */
.paperdoll-stage { display: flex; justify-content: center; margin: 10px 0; }
.paperdoll-view { display: none; justify-content: center; width: 100%; }
.paperdoll-view.is-active { display: flex !important; }

/* Paperdoll body-area picker */
.paperdoll { position: relative; margin: 8px 0 18px; }

.paperdoll-tooltip {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    max-width: 220px;
    padding: 5px 10px;
    border-radius: 6px;
    background: #0f172a;
    color: #fff;
    font-size: .8rem;
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(15, 23, 42, .25);
    transform: translate(-50%, -120%);
}
.paperdoll-tooltip[hidden] { display: none !important; }

.paperdoll-head {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 10px; margin-bottom: 4px;
}
.paperdoll-label { font-weight: 600; }
.paperdoll-tabs { display: inline-flex; gap: 4px; background: #f1f5f9; padding: 3px; border-radius: 8px; }
.paperdoll-tab {
    border: 0; background: transparent; padding: 6px 14px; border-radius: 6px;
    font: inherit; font-weight: 600; cursor: pointer; color: #64748b;
}
.paperdoll-tab.is-active { background: #fff; color: #0f172a; box-shadow: 0 1px 2px rgba(15,23,42,.08); }
.paperdoll-figure {
    position: relative; width: min(280px, 72vw);
    aspect-ratio: 1 / 2;
    background: #fff; border: 1px solid var(--border, #e2e8f0); border-radius: 12px; overflow: hidden;
}
.paperdoll-figure img {
    display: block; width: 100%; height: 100%; object-fit: fill;
    user-select: none; -webkit-user-drag: none; pointer-events: none;
}
.paperdoll-overlay { position: absolute; inset: 0; width: 100%; height: 100%; }
.paperdoll-region {
    fill: rgba(37, 99, 235, 0.02); stroke: rgba(37, 99, 235, 0.28); stroke-width: 0.35;
    cursor: pointer; transition: fill .12s, stroke .12s;
}
.paperdoll-region:hover, .paperdoll-region:focus {
    fill: rgba(37, 99, 235, 0.2); stroke: rgba(37, 99, 235, 0.75); outline: none;
}
.paperdoll-readonly .paperdoll-region {
    cursor: default;
}
.paperdoll-readonly .paperdoll-region:hover,
.paperdoll-readonly .paperdoll-region:focus {
    fill: rgba(37, 99, 235, 0.02); stroke: rgba(37, 99, 235, 0.28);
}
.paperdoll-readonly .paperdoll-region.is-selected:hover,
.paperdoll-readonly .paperdoll-region.is-selected:focus {
    fill: rgba(220, 38, 38, 0.45); stroke: rgba(185, 28, 28, 0.95);
}
.paperdoll-region.is-selected {
    fill: rgba(220, 38, 38, 0.45); stroke: rgba(185, 28, 28, 0.95); stroke-width: 0.55;
}
.paperdoll-special { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.paperdoll-special-btn.is-selected { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.paperdoll-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; }
.chip-removable { display: inline-flex; align-items: center; gap: 4px; }
.chip-x {
    border: 0; background: transparent; cursor: pointer; font-size: 1rem; line-height: 1;
    color: inherit; opacity: .7; padding: 0 2px;
}
.chip-x:hover { opacity: 1; }
