@charset "UTF-8";

:root {
  color-scheme: light;
  --navy: #102737;
  --navy-soft: #193646;
  --mint: #d2f1d7;
  --accent: #2c6e5a;
  --accent-dark: #205442;
  --ink: #172e3d;
  --muted: #61727b;
  --subtle: #86949b;
  --background: #f3f5f3;
  --surface: #ffffff;
  --line: #dfe6e3;
  --line-strong: #bacac3;
  --success-bg: #e9f4ed;
  --success-ink: #235e43;
  --warning-bg: #fff2d9;
  --warning-ink: #845a15;
  --danger-bg: #fbeceb;
  --danger-ink: #a43d39;
  --info-bg: #eaf1f8;
  --info-ink: #365e82;
  --radius: 16px;
  --shadow: 0 5px 22px rgb(16 39 55 / 4%);
  --focus: #287cb3;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; scroll-padding-top: 20px; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--background); font-size: 14px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--accent); text-underline-offset: 3px; }
img { max-width: 100%; }
svg { flex-shrink: 0; }
button svg, .btn svg, .nav-button svg, .stat-icon svg { width: 19px; height: 19px; vertical-align: middle; }
button, a, input, select, textarea, summary { outline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); }
[hidden] { display: none !important; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, h4 { font-weight: 650; }
h1 { font-size: clamp(25px, 2.3vw, 32px); line-height: 1.2; letter-spacing: -.035em; }
h2 { font-size: 18px; line-height: 1.35; letter-spacing: -.02em; }
h3 { font-size: 15px; line-height: 1.4; }
p:last-child { margin-bottom: 0; }
small { font-size: 12px; line-height: 1.5; }
.muted { color: var(--muted); }
.subtle { color: var(--subtle); }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 11px; line-height: 1.5; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.stack { display: grid; gap: 16px; min-width: 0; }
.stack.compact { gap: 10px; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }

/* The narrow dark rail gives the work area a stable, recognisable frame. */
.app-shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 28px; padding: 30px 20px 20px; background: var(--navy); color: #eaf2f3; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #48606f transparent; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 0 8px; color: #fff; text-decoration: none; }
.brand img, .brand .logo { width: 46px; height: 46px; flex-shrink: 0; }
.brand strong, .brand-name { display: block; color: #fff; font-size: 26px; line-height: 1.15; font-weight: 720; letter-spacing: .04em; }
.brand small, .brand p, .brand-subtitle { display: block; margin: 3px 0 0; color: #adc2cc; font-size: 10px; font-weight: 550; letter-spacing: .1em; text-transform: uppercase; }
.nav-label { padding: 0 14px; margin: 6px 0 10px; font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: #98b0bd; }
.sidebar nav, .sidebar-nav { display: grid; gap: 6px; }
.nav-button { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 11px 14px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: #bccdd5; text-align: left; text-decoration: none; font-size: 13px; font-weight: 550; transition: background .15s, color .15s; }
.nav-button svg { width: 19px; height: 19px; opacity: .9; }
.nav-button.active, .nav-button[aria-current="page"] { background: var(--mint); color: #153d2c; font-weight: 700; }
.nav-button.active svg { opacity: 1; }
.nav-button .count, .nav-count { margin-left: auto; min-width: 23px; height: 23px; padding: 2px 7px; border-radius: 6px; background: #ffffff16; font-size: 11px; text-align: center; }
.nav-button.active .count, .nav-button.active .nav-count { background: #2c6e5a17; }
.sidebar-footer { margin-top: auto; padding: 18px 12px 0; border-top: 1px solid #ffffff17; color: #a8bec8; font-size: 12px; }
.sidebar-footer strong { display: block; color: #e3edf1; font-size: 12px; font-weight: 600; }
.sidebar-footer p { margin: 4px 0 0; font-size: 11px; line-height: 1.65; }
.sidebar-status { display: flex; align-items: center; gap: 7px; margin-bottom: 9px; }
.sidebar-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #a5d4b2; box-shadow: 0 0 0 4px #a5d4b20c; }
.main, .app-main, .main-content { min-width: 0; }
.main, .app-main { display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 82px; padding: 18px 36px; background: var(--surface); border-bottom: 1px solid var(--line); }
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 12px; }
.breadcrumb strong { color: var(--ink); font-weight: 650; }
.breadcrumb .separator { color: #a4b0b6; }
.top-actions { display: flex; align-items: center; gap: 12px; min-width: 0; }
.role-switch { display: flex; align-items: center; gap: 10px; padding-left: 18px; border-left: 1px solid var(--line); }
.role-switch label, .role-caption { color: var(--muted); font-size: 11px; font-weight: 550; }
.role-switch select, .topbar select { width: auto; max-width: 205px; min-height: 40px; background-color: #f8faf8; padding-block: 8px; font-size: 12px; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex-shrink: 0; border: 1px solid #bed9c8; border-radius: 50%; background: #e5f1e9; color: #306749; font-size: 12px; font-weight: 700; }
.test-strip { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 38px; padding: 8px 36px; border-bottom: 1px solid #e2e8df; background: #edf3e9; color: #53664a; font-size: 11px; line-height: 1.5; }
.test-strip strong { font-weight: 700; color: #395830; }
.test-strip a, .test-strip button { color: inherit; }
.test-strip .dot { display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: #708a5d; vertical-align: middle; }
.content, .page-content, #view { width: 100%; max-width: 1600px; margin: 0 auto; padding: 32px 36px 46px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-header h1 { margin: 0 0 7px; }
.page-header p { margin-bottom: 0; max-width: 680px; color: var(--muted); font-size: 13px; }
.actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 9px; }
.page-header > .actions { flex-shrink: 0; padding-bottom: 2px; }

/* Controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; color: var(--ink); font-size: 12px; line-height: 1.4; font-weight: 650; text-align: center; text-decoration: none; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 4px #244f3820; }
.btn.secondary { background: #fff; border-color: #cfdad4; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.danger { color: var(--danger-ink); background: #fff; border-color: #edc6c3; }
.btn.small { min-height: 38px; padding: 8px 12px; font-size: 11px; }
.btn.icon { width: 44px; padding: 10px; flex-shrink: 0; }
.btn.small.icon { width: 38px; padding: 8px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .48; box-shadow: none; cursor: not-allowed; }
.btn.full { width: 100%; }
.text-button { min-height: 38px; padding: 7px 0; border: 0; background: transparent; color: var(--accent); font-size: 12px; font-weight: 650; }
.field { display: grid; gap: 7px; min-width: 0; }
.field > label, label.field-label { color: #465c65; font-size: 12px; font-weight: 650; }
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea { width: 100%; min-height: 44px; min-width: 0; padding: 11px 12px; border: 1px solid #cbd7d1; border-radius: 9px; background: #fff; color: var(--ink); line-height: 1.45; box-shadow: 0 1px 2px #10273702; }
input::placeholder, textarea::placeholder { color: #8b989d; opacity: 1; }
textarea { min-height: 108px; resize: vertical; }
input:disabled, textarea:disabled, select:disabled { color: #687b83; background: #f4f6f4; cursor: not-allowed; opacity: 1; }
input[readonly], textarea[readonly] { background: #f8faf8; }
input[type="checkbox"], input[type="radio"] { width: 19px; height: 19px; margin: 0; accent-color: var(--accent); flex-shrink: 0; cursor: pointer; }
input[type="file"] { padding: 8px !important; font-size: 12px; }
input[type="file"]::file-selector-button { min-height: 32px; margin-right: 12px; padding: 6px 10px; border: 0; border-radius: 6px; background: #edf3ee; color: var(--accent-dark); font: inherit; font-weight: 600; cursor: pointer; }
.field small, .field-hint { color: var(--muted); font-size: 11px; }
.field-error { color: var(--danger-ink); font-size: 12px; }
[aria-invalid="true"] { border-color: #b24a43 !important; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid .wide { grid-column: 1 / -1; }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 13px; margin-bottom: 22px; }
.filters .field { min-width: 150px; flex: 1 1 160px; max-width: 280px; }
.filters .field.search { flex-grow: 2; max-width: 400px; }
.search-box { position: relative; }
.search-box input { padding-left: 38px !important; }
.search-box > svg { position: absolute; top: 13px; left: 12px; width: 18px; height: 18px; color: #84958c; }
.tabs, .segmented { display: flex; gap: 5px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tab { min-height: 44px; padding: 11px 15px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); white-space: nowrap; font-size: 12px; font-weight: 600; }
.tab.active, .tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }

/* Summary and cards */
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat-card { position: relative; min-width: 0; padding: 22px 23px 19px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.stat-card .stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 15px; }
.stat-icon { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; background: #edf4ef; color: var(--accent); }
.stat-icon.warning { background: #fff3de; color: #97702a; }
.stat-icon.info { background: #edf2f7; color: #537595; }
.stat-icon.neutral { background: #f1f1ee; color: #7e8477; }
.stat-value { margin: 5px 0 0; color: var(--ink); font-size: 35px; line-height: 1.15; font-weight: 650; letter-spacing: -.055em; font-variant-numeric: tabular-nums; }
.stat-label { margin: 7px 0 0; color: #4a6069; font-size: 12px; font-weight: 600; }
.stat-note { margin-top: 12px; color: var(--muted); font-size: 11px; }
.stat-card > .stat-icon { float: right; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(290px, 1fr); align-items: start; gap: 22px; }
.dashboard-grid > *, .card, .card-body { min-width: 0; }
.card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.card-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 22px 24px 18px; border-bottom: 1px solid #edf0ec; }
.card-header h2, .card-header h3 { margin: 0; }
.card-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.card-body { padding: 23px 24px; }
.card-footer { padding: 15px 24px; border-top: 1px solid #edf0ec; background: #fafbf9; }
.card > .table-wrap { border: 0; border-radius: 0; }
.card.spaced { margin-top: 22px; }
.hero-panel { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 26px; padding: 28px 30px; border: 1px solid #d8e7dd; border-radius: 17px; background: linear-gradient(112deg, #e9f2eb, #f4f7f1); overflow: hidden; }
.hero-panel h2 { margin: 0 0 8px; font-size: 22px; color: #254e3c; }
.hero-panel p { max-width: 560px; color: #54715f; font-size: 12px; }
.hero-panel .hero-icon { display: flex; align-items: center; justify-content: center; width: 75px; height: 75px; border: 1px solid #cce0d0; border-radius: 20px; color: #6e9a7c; background: #ffffff62; }
.hero-panel .hero-icon svg { width: 34px; height: 34px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.section-head h2, .section-head h3 { margin: 0; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.section-head .eyebrow { margin-bottom: 6px; }
.divider { height: 1px; margin: 23px 0; border: 0; background: var(--line); }
.inline-note { display: flex; align-items: flex-start; gap: 10px; padding: 13px 15px; border: 1px solid #dde8e0; border-radius: 10px; background: #f2f7f3; color: #526b59; font-size: 12px; }
.inline-note svg { width: 17px; height: 17px; margin-top: 1px; }
.inline-note.warning { border-color: #eddfc2; background: #fff8e9; color: #806535; }
.inline-note.danger { border-color: #f0d0cd; background: #fff3f1; color: #9b4f49; }

/* Lists and tables remain legible when records grow. */
.table-wrap { width: 100%; overflow-x: auto; overscroll-behavior-x: contain; border: 1px solid var(--line); border-radius: 12px; background: #fff; scrollbar-width: thin; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; }
th { padding: 12px 18px; border-bottom: 1px solid var(--line); background: #f7f9f6; color: #74827a; font-size: 10px; font-weight: 700; letter-spacing: .055em; text-transform: uppercase; white-space: nowrap; }
td { padding: 16px 18px; border-bottom: 1px solid #edf1ed; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
td strong { display: block; color: var(--ink); font-size: 12px; font-weight: 650; }
td small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
td .actions { flex-wrap: nowrap; }
.table-empty { padding: 35px 20px; text-align: center; color: var(--muted); }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 14px 22px; border-top: 1px solid #edf1ed; color: var(--muted); font-size: 11px; }
.badge { display: inline-flex; align-items: center; gap: 5px; width: fit-content; max-width: 100%; padding: 4px 9px; border: 1px solid transparent; border-radius: 6px; background: #eff2ee; color: #667366; font-size: 10px; line-height: 1.5; font-weight: 650; white-space: nowrap; vertical-align: middle; }
.badge.warning, .badge.pending { background: var(--warning-bg); color: var(--warning-ink); }
.badge.success, .badge.validated, .badge.confirmed { background: var(--success-bg); color: var(--success-ink); }
.badge.danger, .badge.open { background: var(--danger-bg); color: var(--danger-ink); }
.badge.info, .badge.issued { background: var(--info-bg); color: var(--info-ink); }
.badge.neutral, .badge.locked { background: #eef1f1; color: #5c727c; }
.badge.outline { background: transparent; border-color: #d4dfd7; color: #667b6d; }
.badge svg { width: 12px; height: 12px; }
.family-icon { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 1px solid #e1e8e0; border-radius: 9px; background: #f5f8f3; color: #5c7865; }
.family-icon svg { width: 17px; height: 17px; }
.record-title { display: flex; align-items: center; gap: 11px; }
.record-title > div { min-width: 0; }

/* Revision workbench */
.split-panel { display: grid; grid-template-columns: 295px minmax(0, 1fr); align-items: start; gap: 22px; }
.review-list { display: grid; gap: 10px; min-width: 0; }
.review-item { display: block; width: 100%; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); text-align: left; transition: background .15s, border-color .15s, box-shadow .15s; }
.review-item.active { border-color: #83b093; background: #f0f7f1; box-shadow: inset 3px 0 0 var(--accent); }
.review-item h3, .review-item strong { display: block; margin: 0 0 4px; font-size: 13px; font-weight: 650; }
.review-item p { margin: 3px 0 10px; color: var(--muted); font-size: 11px; }
.review-item small { color: var(--muted); font-size: 11px; }
.review-item .item-top, .review-item .item-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.review-item .item-footer { margin-top: 14px; }
.review-item .progress-track { margin-top: 13px; }
.review-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-bottom: 21px; padding: 0 0 18px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.review-summary strong { color: var(--ink); font-weight: 650; }
.review-summary .summary-divider { width: 1px; height: 15px; margin: 0 3px; background: var(--line); }
.review-workspace { display:grid; gap:22px; align-items:start; min-width:0; }
.review-catalogue { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; min-width:0; }
.review-workspace.has-selection { grid-template-columns:minmax(260px,330px) minmax(0,1fr); }
.has-selection .review-catalogue { grid-template-columns:minmax(0,1fr); }
.review-family-group { overflow:hidden; min-width:0; }
.review-family-group .card-header { background:#f4f8f5; border-bottom:1px solid var(--line); }
.review-family-group .card-header h2 { font-size:16px; }
.review-family-group .card-header p { font-size:12px; margin:8px 0 0; }
.review-periods { display:grid; gap:9px; padding:12px; }
.review-periods .review-item { padding:13px; cursor:pointer; }
.review-periods .review-cycle-date { margin:10px 0 0; font-size:12px; font-weight:650; color:var(--ink); }
.review-periods .review-item:focus-visible { outline:3px solid #84ad95; outline-offset:2px; }
.review-periods .row-between { flex-wrap:wrap; gap:9px; }
.review-open-label { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-top:14px; padding-top:10px; border-top:1px solid #dfe9e1; font-size:12px; font-weight:700; color:var(--accent); }
.review-open-label .icon { width:16px; height:16px; }
.review-detail-panel { min-width:0; scroll-margin-top:16px; overflow:visible; }
.review-detail-panel:focus { outline:none; }
.review-detail-navigation { display:flex; flex-wrap:wrap; gap:8px; padding:13px 18px; border-bottom:1px solid var(--line); border-radius:var(--radius) var(--radius) 0 0; background:#f7faf7; }
.review-selection-note { display:flex; align-items:center; flex-wrap:wrap; gap:12px; margin-bottom:18px; }
.review-selection-note span { flex:1; }
.review-load-state { min-height:230px; }
.review-load-state h2 { margin-top:0; }
.review-load-error { color:var(--danger-ink); }
@media(max-width:1000px){.review-workspace.has-selection { grid-template-columns:minmax(0,1fr); }.review-catalogue { grid-template-columns:minmax(0,1fr); }.review-detail-navigation { position:sticky; top:0; z-index:2; }}
.task-list { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.task-row { display: flex; align-items: flex-start; gap: 12px; min-height: 53px; padding: 16px; background: #fff; border-bottom: 1px solid #e9eeea; line-height: 1.5; cursor: pointer; }
.task-row:last-child { border-bottom: 0; }
.task-row input { margin-top: 1px; }
.task-row span { font-size: 12px; }
.task-row small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.task-row:has(input:checked) { background: #f6faf6; }
.task-row:has(input:disabled) { cursor: default; }
.task-row .task-number { color: #8d9c92; font-size: 11px; margin-left: auto; }
.task-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 11px; }
.task-toolbar .muted { font-size: 11px; }
.review-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; padding: 20px 24px; border-top: 1px solid var(--line); background: #fafcf9; }
.progress-track { height: 5px; border-radius: 20px; overflow: hidden; background: #e8ede8; }
.progress-fill { height: 100%; max-width: 100%; border-radius: inherit; background: #6eaa7f; transition: width .2s; }
.progress-fill.warning { background: #cca35b; }
.progress-label { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; color: var(--muted); font-size: 11px; }

/* Equipment, incidents and activity */
.incidents-grid, .equipment-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.incident-card, .equipment-card { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: 13px; background: #fff; box-shadow: var(--shadow); }
.incident-card .card-top, .equipment-card .card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.incident-card h3, .equipment-card h3 { margin-bottom: 7px; }
.incident-card p { overflow-wrap: anywhere; font-size: 13px; }
.incident-card .incident-meta, .equipment-card .equipment-meta { display: flex; flex-wrap: wrap; gap: 7px 14px; color: var(--muted); font-size: 11px; }
.incident-card .actions, .equipment-card .actions { justify-content: flex-start; margin-top: 20px; }
.incident-card.resolved { background: #fafcf9; }
.resolution { margin-top: 16px; padding: 12px 14px; border-left: 3px solid #9ebda7; border-radius: 0 7px 7px 0; background: #edf5ee; color: #496351; font-size: 12px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-top: 16px; }
.photo-grid figure { margin: 0; }
.photo-grid img { display: block; width: 100%; max-height: 230px; aspect-ratio: 4 / 3; object-fit: contain; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: #f6f8f5; }
.photo-grid figcaption { margin-top: 5px; color: var(--muted); font-size: 10px; }
.activity-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.activity-item { position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 0 0 20px; }
.activity-item:not(:last-child)::after { content: ""; position: absolute; top: 27px; left: 14px; bottom: 4px; width: 1px; background: #e4eae3; }
.activity-item:last-child { padding-bottom: 0; }
.activity-dot { display: flex; align-items: center; justify-content: center; width: 29px; height: 29px; flex-shrink: 0; border: 1px solid #e0e8e1; border-radius: 50%; background: #f4f7f2; color: #6d9278; }
.activity-dot svg { width: 13px; height: 13px; }
.activity-item strong { display: block; padding-top: 3px; font-size: 12px; line-height: 1.5; font-weight: 600; }
.activity-item p { margin: 4px 0 0; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.activity-item time { display: block; margin-top: 4px; color: #8d9990; font-size: 10px; }
.activity-item > div:last-child { min-width: 0; }
.empty-state { display: grid; justify-items: center; padding: 45px 24px; text-align: center; color: var(--muted); }
.empty-state > svg, .empty-state .empty-icon { width: 43px; height: 43px; margin-bottom: 16px; color: #9bb3a3; }
.empty-state h2, .empty-state h3 { margin: 0 0 8px; color: #486251; font-size: 15px; }
.empty-state p { max-width: 330px; margin: 0; font-size: 12px; }
.empty-state .btn { margin-top: 19px; }
.upload-area { display: grid; justify-items: center; gap: 9px; padding: 27px; border: 1px dashed #a9c5b1; border-radius: 12px; background: #f6faf5; text-align: center; }
.upload-area > svg { width: 29px; height: 29px; color: #72977c; }
.upload-area p { margin: 0; color: var(--muted); font-size: 12px; }
.upload-area input { max-width: 350px; }
.logo-preview { display: flex; align-items: center; justify-content: center; min-height: 126px; padding: 20px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.logo-preview img { max-width: 250px; max-height: 90px; object-fit: contain; }
.storage-meter { display: grid; gap: 8px; padding: 17px 0 0; }
.storage-meter p { display: flex; justify-content: space-between; gap: 12px; margin: 0; font-size: 11px; }

/* Native dialogs keep keyboard and focus behaviour predictable. */
dialog.modal { width: min(590px, calc(100vw - 32px)); max-width: none; max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); margin: auto; padding: 0; overflow: auto; border: 1px solid #dce5df; border-radius: 17px; color: var(--ink); box-shadow: 0 30px 100px #0b263449; }
dialog.modal.wide { width: min(900px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgb(9 30 39 / 53%); backdrop-filter: blur(3px); }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 23px 25px 19px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0 0 5px; }
.modal-header p { margin: 0; color: var(--muted); font-size: 12px; }
.modal-header .btn { margin: -5px -6px 0 0; }
.modal-body { padding: 24px 25px; }
.modal-footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding: 17px 25px; border-top: 1px solid var(--line); background: #fafcf9; }
.toast-area { position: fixed; z-index: 100; bottom: 22px; right: 24px; display: grid; gap: 9px; width: min(400px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 15px 18px; border: 1px solid #d0e0d3; border-radius: 11px; background: #fff; color: #284b36; box-shadow: 0 7px 40px #0e283629; font-size: 12px; line-height: 1.5; pointer-events: auto; animation: toast-in .2s ease-out; }
.toast.error { border-color: #efc9c5; color: var(--danger-ink); }
.toast.warning { border-color: #e9d5b5; color: var(--warning-ink); }
.toast button { margin-left: auto; min-width: 26px; min-height: 26px; border: 0; background: transparent; color: inherit; }
.loading { opacity: .6; pointer-events: none; }
.loading-indicator { width: 18px; height: 18px; border: 2px solid #b6cec0; border-top-color: var(--accent); border-radius: 50%; animation: spin .65s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

@media (hover: hover) {
  .nav-button:not(.active):hover { background: #ffffff0d; color: #fff; }
  .btn:not(:disabled):not([aria-disabled="true"]):hover { background: #f0f5ef; border-color: #a4bcac; }
  .btn.primary:not(:disabled):hover { background: var(--accent-dark); border-color: var(--accent-dark); }
  .btn.danger:not(:disabled):hover { background: #fff1ef; border-color: #d59b95; }
  .btn.ghost:not(:disabled):hover { border-color: transparent; background: #edf2ec; }
  .review-item:not(.active):hover { border-color: #b4cab9; background: #fafcf8; }
  .task-row:not(:has(input:disabled)):hover { background: #f2f7ef; }
  tbody tr:hover td { background: #fbfcf9; }
  .text-button:hover { color: var(--accent-dark); text-decoration: underline; }
}

@media (min-width: 1600px) {
  .content, .page-content, #view { padding-top: 40px; padding-bottom: 55px; }
  .stats-grid { gap: 21px; }
  .stat-card { padding: 25px; }
}

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 215px minmax(0, 1fr); }
  .sidebar { padding-inline: 15px; }
  .topbar { padding-inline: 26px; }
  .test-strip { padding-inline: 26px; }
  .content, .page-content, #view { padding: 27px 26px 38px; }
  .stats-grid { gap: 12px; }
  .stat-card { padding: 18px; }
  .stat-value { font-size: 30px; }
  .stat-icon { width: 32px; height: 32px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1.45fr) minmax(265px, 1fr); gap: 17px; }
  .split-panel { grid-template-columns: 250px minmax(0, 1fr); gap: 17px; }
  .card-header, .card-body { padding-inline: 20px; }
  .page-header { align-items: flex-start; }
  .page-header > .actions { max-width: 260px; }
  th, td { padding-inline: 14px; }
}

@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { position: static; display: block; height: auto; padding: 18px 22px 0; overflow: visible; }
  .sidebar .brand { padding: 0; margin-bottom: 14px; }
  .brand img, .brand .logo { width: 37px; height: 37px; }
  .brand strong, .brand-name { font-size: 23px; }
  .brand small, .brand p, .brand-subtitle { font-size: 9px; }
  .sidebar nav, .sidebar-nav { display: flex; gap: 4px; margin-inline: -7px; padding-bottom: 12px; overflow-x: auto; scrollbar-width: thin; overscroll-behavior-x: contain; }
  .nav-button { width: auto; min-height: 43px; flex: 0 0 auto; gap: 8px; padding: 10px 12px; font-size: 11px; white-space: nowrap; }
  .nav-button svg { width: 17px; height: 17px; }
  .nav-label, .sidebar-footer { display: none; }
  .nav-button .count, .nav-count { min-width: 20px; height: 20px; padding: 1px 5px; font-size: 10px; }
  .topbar { min-height: 69px; padding: 13px 24px; }
  .test-strip { padding-inline: 24px; }
  .content, .page-content, #view { padding: 26px 24px 40px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .dashboard-grid > .stack { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .stats-grid { gap: 12px; }
  .stat-card { padding: 19px 16px; }
  .stat-note { font-size: 10px; }
  .split-panel { grid-template-columns: 230px minmax(0, 1fr); }
  .page-header > .actions { max-width: 230px; }
  .card-header { padding-top: 19px; padding-bottom: 16px; }
  .top-actions { gap: 8px; }
  .role-switch { padding-left: 12px; }
}

@media (max-width: 700px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-card { padding: 21px; }
  .stat-value { font-size: 32px; }
  .dashboard-grid > .stack { grid-template-columns: minmax(0, 1fr); }
  .split-panel { grid-template-columns: minmax(0, 1fr); }
  .review-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-item { padding: 15px; }
  .incidents-grid, .equipment-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-panel { align-items: flex-start; padding: 24px; }
  .hero-panel .hero-icon { width: 55px; height: 55px; border-radius: 14px; flex-shrink: 0; }
  .hero-panel h2 { font-size: 19px; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .breadcrumb { font-size: 11px; }
  .top-actions { margin-left: auto; }
  .role-switch label, .role-caption { display: none; }
}

@media (max-width: 600px) {
  body { font-size: 13px; }
  .sidebar { padding: 15px 17px 0; }
  .topbar { min-height: 62px; padding: 12px 17px; }
  .topbar .avatar { display: none; }
  .topbar select { max-width: 170px; min-height: 40px; font-size: 11px; }
  .role-switch { padding-left: 0; border: 0; }
  .test-strip { align-items: flex-start; padding: 9px 17px; font-size: 10px; }
  .content, .page-content, #view { padding: 23px 17px 35px; }
  .page-header { display: block; margin-bottom: 21px; }
  .page-header h1 { font-size: 26px; }
  .page-header p { font-size: 12px; }
  .page-header > .actions { justify-content: flex-start; max-width: none; margin-top: 17px; }
  .page-header > .actions .btn { flex: 1 1 auto; }
  .stats-grid { gap: 11px; margin-bottom: 21px; }
  .stat-card { padding: 18px 16px; border-radius: 13px; }
  .stat-label { font-size: 11px; }
  .stat-note { margin-top: 11px; }
  .stat-icon { width: 30px; height: 30px; border-radius: 8px; }
  .stat-icon svg { width: 16px; height: 16px; }
  .stat-value { font-size: 30px; }
  .dashboard-grid { gap: 18px; }
  .card { border-radius: 13px; }
  .card-header { padding: 18px 17px 15px; }
  .card-header h2 { font-size: 16px; }
  .card-body { padding: 19px 17px; }
  .card-footer { padding: 13px 17px; }
  .card-header p { font-size: 11px; }
  .table-wrap table { min-width: 580px; }
  .table-wrap.compact table { min-width: 420px; }
  th, td { padding-inline: 14px; }
  .table-foot { padding: 13px 17px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .form-grid .wide { grid-column: auto; }
  .filters { gap: 11px; margin-bottom: 19px; }
  .filters .field { min-width: 0; flex-basis: calc(50% - 6px); max-width: none; }
  .filters .field.search { flex-basis: 100%; max-width: none; }
  .filters > .btn { width: 100%; }
  .review-list { grid-template-columns: minmax(0, 1fr); }
  .review-item { padding: 17px; }
  .review-actions { padding: 17px; }
  .review-actions .btn { flex: 1 1 125px; }
  .task-row { padding: 14px 13px; }
  .hero-panel { padding: 21px; margin-bottom: 21px; }
  .hero-panel .hero-icon { display: none; }
  .hero-panel p { font-size: 12px; }
  .incident-card, .equipment-card { padding: 19px; }
  .upload-area { padding: 22px 16px; }
  .btn.small { min-height: 42px; }
  .btn.small.icon { width: 42px; }
  dialog.modal { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); border-radius: 14px; }
  .modal-header, .modal-body { padding: 20px; }
  .modal-footer { padding: 16px 20px; }
  .modal-footer .btn { flex: 1; }
  .toast-area { bottom: 16px; right: 16px; }
}

@media (max-width: 380px) {
  .topbar { gap: 9px; }
  .top-actions { margin-left: 0; width: 100%; }
  .topbar select { max-width: none; }
  .role-switch { width: 100%; }
  .role-switch select { flex: 1; }
  .stat-card { padding: 16px 13px; }
  .stat-card > .stat-icon { float: none; margin-bottom: 8px; }
  .filters .field { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Only generated PDFs are intended for certificate printing. */
@media print {
  .app-shell, .toast-area, dialog { display: none !important; }
  body { background: #fff; }
  body::after { display: block; margin: 20mm; color: #172e3d; font: 12pt/1.5 sans-serif; content: "Descarga el PDF desde Documentos para imprimir el certificado."; }
}
.family-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.family-card { overflow: hidden; border-top: 4px solid #b54b4b; }
.family-card.family-current { border-top-color: #2c6e5a; }
.family-card.family-confirmation { border-top-color: #bc8428; }
.family-name { display: inline-flex; align-items: center; gap: 9px; min-width: 0; vertical-align: middle; }
.family-name > span { min-width: 0; overflow-wrap: anywhere; }
.family-glyph { display: block; flex: 0 0 22px; width: 22px; height: 22px; color: #2c6e5a; }
.family-name--large { gap: 12px; }
.family-name--large .family-glyph { flex-basis: 32px; width: 32px; height: 32px; }
.family-confirmation .family-glyph { color: #a57629; }
.review-family-heading { display: flex; flex-direction: column; gap: 5px; }
.review-airport-name { padding-left: 44px; color: var(--muted); font-size: 12px; font-weight: 500; }
.family-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; margin: 0 0 22px; }
.family-facts div { min-width: 0; }
.family-facts dt { color: var(--muted, #647582); font-size: 12px; margin-bottom: 5px; }
.family-facts dd { margin: 0; font-size: 14px; font-weight: 650; overflow-wrap: anywhere; }
.equipment-details, .task-details { margin-top: 22px; border: 1px solid #dce4e0; border-radius: 12px; padding: 15px; }
.equipment-details summary, .task-details summary { cursor: pointer; font-weight: 650; min-height: 28px; }
.review-equipment-list { max-height: 440px; margin-top: 14px; padding-right: 5px; overflow-y: auto; overscroll-behavior: contain; }
.review-equipment-list [hidden] { display: none; }
.review-equipment-list .equipment-change { padding: 15px; border: 1px solid var(--line); border-radius: 10px; }
.equipment-change .actions { flex-wrap: wrap; }
.equipment-note { display: block; margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.photo-picker { min-width: 0; margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.photo-picker legend { padding: 0 6px; font-weight: 650; }
.photo-picker-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.photo-picker-actions input { width: 100%; min-width: 0; }
.photo-gallery-button { position: relative; overflow: hidden; cursor: pointer; }
.photo-gallery-button input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.photo-gallery-button:focus-within { outline: 3px solid #7fb49b; outline-offset: 3px; }
.incident-camera { margin: 16px 0; padding: 14px; border: 1px solid #c9d9cf; border-radius: 12px; background: #f1f6f3; }
.incident-camera[hidden] { display: none; }
.incident-camera-video, .incident-camera-capture { display: block; width: 100%; max-height: 350px; object-fit: contain; border-radius: 8px; background: #102737; }
.incident-camera .actions { flex-wrap: wrap; margin-top: 12px; }
.incident-camera p[role="alert"] { color: var(--danger-ink); }
.photo-selection-preview:empty { display: none; }
.photo-selection-preview .photo-preview { display: block; max-width: 100%; max-height: 250px; object-fit: contain; }
@media (max-width: 600px) {
  .photo-picker-actions { grid-template-columns: 1fr; }
  .review-equipment-list { max-height: 480px; }
  .equipment-change .row-between { align-items: flex-start; flex-direction: column; }
}
.task-details .task-list { max-height: 480px; overflow: auto; margin-top: 16px; }
.task-row[hidden] { display: none !important; }
.task-choice { display: flex; align-items: flex-start; gap: 12px; flex: 1; cursor: pointer; }
.task-result { flex: 0 0 145px; font-size: 11px; margin: 0; }
.task-result select { font-size: 13px; padding: 8px; }
.historical-details { margin-top: 24px; }
.historical-details > summary { padding: 20px; cursor: pointer; font-weight: 650; }
.modal:has(.certificate-preview-image) { width: min(1100px, calc(100vw - 24px)); }
.certificate-preview-frame { max-height: 70vh; overflow: auto; background: #e8ede9; border: 1px solid #d4ddd7; border-radius: 8px; }
.certificate-preview-image { display: block; width: 100%; height: auto; }
.modal[open]:has(.device-pdf-reader) { width:min(1180px,calc(100vw - 24px)); display:flex; flex-direction:column; overflow:hidden; }
.modal:has(.device-pdf-reader) > .modal-header, .modal:has(.device-pdf-reader) > .modal-footer { flex-shrink:0; }
.modal:has(.device-pdf-reader) > .modal-body { min-height:0; display:flex; flex-direction:column; overflow:hidden; }
.device-pdf-reader { min-height:0; display:flex; flex-direction:column; gap:10px; }
.device-pdf-reader .certificate-reader-toolbar { flex-shrink:0; flex-wrap:wrap; }
.device-pdf-scroll { height:65vh; min-height:180px; overflow:auto; background:#e8ede9; border:1px solid #d4ddd7; border-radius:8px; overscroll-behavior:contain; }
.device-pdf-stack { display:flex; flex-direction:column; gap:18px; min-width:100%; width:max-content; padding:12px 16px 24px; box-sizing:border-box; }
.device-pdf-page { margin:0 auto; }
.device-pdf-page figcaption { padding:0 0 6px; color:#506457; font-size:12px; }
.device-pdf-page-frame { background:white; box-shadow:0 2px 9px #10273720; position:relative; }
.device-pdf-page-frame[aria-busy="true"]::before { content:'Preparando página…'; position:absolute; top:14px; left:14px; font-size:12px; color:#6b7b70; }
.device-pdf-page-frame:has(canvas)::before { display:none; }
.device-pdf-canvas { display:block; }
@media (max-width: 600px) { .task-row[data-task-row] { flex-wrap: wrap; } .task-result { margin-left: 28px; flex: 1 1 100%; } }
.choice-fieldset { border: 1px solid #dce4e0; border-radius: 12px; padding: 16px; min-width: 0; }
.choice-fieldset legend { padding: 0 8px; font-weight: 650; }
.review-actions { padding: 14px 0; border-top: 1px solid #e5ebe6; }
@media (max-width: 800px) { .family-grid { grid-template-columns: 1fr; } }
@media (max-width: 440px) { .family-facts { grid-template-columns: 1fr; } }

.modal:has(.retest-panel) { width: min(1160px, calc(100vw - 24px)); }
.modal[open]:has(.retest-panel), .modal[open]:has(#retest-complete-form) { display: flex; flex-direction: column; overflow: hidden; }
.modal:has(.retest-panel) > .modal-header, .modal:has(.retest-panel) > .modal-footer,
.modal:has(#retest-complete-form) > .modal-header, .modal:has(#retest-complete-form) > .modal-footer { flex-shrink: 0; }
.modal:has(.retest-panel) > .modal-body, .modal:has(#retest-complete-form) > .modal-body { min-height: 0; overflow: auto; overscroll-behavior: contain; }
.retest-filters { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(150px, 1fr) minmax(150px, 1fr) auto; gap: 13px; align-items: end; margin: 20px 0; }
.retest-filters .field { margin: 0; }
.retest-summary { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.retest-summary > span { padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: #f3f7f4; font-size: 12px; }
.retest-summary strong { font-size: 18px; padding-right: 5px; }
.retest-selection { margin: 16px 0; flex-wrap: wrap; gap: 12px; font-size: 12px; }
.retest-selection label { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.retest-table-wrap { max-height: none; overflow-x: auto; }
.retest-table { min-width: 900px; }
.retest-table th { position: sticky; top: 0; z-index: 1; background: #f3f7f4; }
.retest-table td { vertical-align: top; padding: 14px 12px; white-space: normal; }
.retest-table td:first-child { width: 44px; }
.retest-table td:nth-child(2) { min-width: 150px; }
.retest-table td:last-child { min-width: 235px; max-width: 340px; }
.retest-table small { display: block; margin-top: 5px; white-space: normal; }
.retest-action { font-weight: 650; }
.retest-family { color: var(--accent); font-weight: 650; }
.retest-reason { color: var(--muted); font-size: 11px; line-height: 1.45; }
.retest-row-details { margin-top: 6px; }
.retest-row-details summary { cursor: pointer; font-size: 12px; color: var(--accent); }
.retest-footer-status { flex: 1 0 100%; margin: 0 0 3px; font-size: 12px; line-height: 1.45; color: var(--warning-ink); }
.retest-selected-list { margin: 16px 0 24px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 10px; }
.retest-selected-list summary { cursor: pointer; font-weight: 650; }
.retest-selected-list ul { max-height: 190px; overflow: auto; padding-left: 20px; }
.retest-selected-list li { margin: 7px 0; }
.selection-summary { margin: 18px 0; }
.selection-groups { display: grid; gap: 12px; max-height: 300px; overflow: auto; }
.selection-groups article { border: 1px solid var(--line); border-radius: 10px; padding: 12px 15px; }
.selection-groups h3 { margin: 0 0 5px; font-size: 14px; }
.selection-groups p { margin: 0; font-size: 12px; }
.selection-groups ul, .signature-package-summary { margin: 10px 0 0; padding-left: 20px; font-size: 12px; line-height: 1.6; }
.modal[open]:has(.selection-summary), .modal[open]:has(#airport-output-form) { display: flex; flex-direction: column; overflow: hidden; }
.modal:has(.selection-summary) > .modal-header, .modal:has(.selection-summary) > .modal-footer,
.modal:has(#airport-output-form) > .modal-header, .modal:has(#airport-output-form) > .modal-footer { flex-shrink: 0; }
.modal:has(.selection-summary) > .modal-body, .modal:has(#airport-output-form) > .modal-body { min-height: 0; overflow: auto; }
.modal[open]:has(.signature-package-summary) { display: flex; flex-direction: column; overflow: hidden; }
.modal:has(.signature-package-summary) > .modal-header, .modal:has(.signature-package-summary) > .modal-footer { flex-shrink: 0; }
.modal:has(.signature-package-summary) > .modal-body { min-height: 0; overflow: auto; }
@media (max-width: 900px) {
  .retest-filters { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .retest-filters { grid-template-columns: 1fr; }
  .retest-summary { gap: 7px; }
  .retest-summary > span { flex: 1 1 120px; padding: 9px 11px; }
  .retest-table-wrap { border: 0; border-radius: 0; }
  .retest-table-wrap .retest-table, .retest-table tbody, .retest-table tr, .retest-table td { display: block; min-width: 0; width: 100%; }
  .retest-table thead { display: none; }
  .retest-table tr { margin-bottom: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
  .retest-table td, .retest-table td:first-child, .retest-table td:nth-child(2), .retest-table td:last-child { min-width: 0; max-width: none; width: auto; border: 0; padding: 7px 0; }
  .retest-table td::before { content: attr(data-label); display: block; margin-bottom: 3px; color: var(--muted); font-size: 11px; font-weight: 600; }
  .retest-table td:first-child { display: flex; justify-content: space-between; align-items: center; min-height: 36px; }
  .retest-table td:last-child { border-top: 1px solid var(--line); margin-top: 5px; padding-top: 12px; }
}

/* Period colour identifies the work cycle; verification remains a separate badge. */
.period-badge { display:inline-flex; align-items:center; min-height:28px; padding:5px 10px; border:1px solid; border-radius:7px; font-size:12px; font-weight:750; line-height:1.2; white-space:nowrap; }
.period-quarterly { color:#604800; background:#fff1a8; border-color:#dbb938; }
.period-half-yearly { color:#803600; background:#ffe0bc; border-color:#e79a49; }
.period-annual { color:#8d2227; background:#ffdadd; border-color:#d66f76; }
.period-other { color:#364d60; background:#e7edf2; border-color:#b9c8d3; }
.review-period-quarterly { --period-accent:#dbb938; }
.review-period-half-yearly { --period-accent:#e79a49; }
.review-period-annual { --period-accent:#d66f76; }
.review-period-other { --period-accent:#b9c8d3; }
.review-item[class*="review-period-"] { border-left:5px solid var(--period-accent); }
.review-period-line { display:flex; align-items:center; flex-wrap:wrap; gap:8px; margin:0 0 12px; font-size:12px; }
.review-item .review-period-line { margin:12px 0 0; }
.task-details { border-top:4px solid var(--period-accent,#b9c8d3); }
.task-details summary .period-badge { margin-right:6px; vertical-align:middle; }
.task-period-context { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:18px 0; font-size:13px; }
.task-period-context p { flex-basis:100%; margin:2px 0 0; color:var(--muted); font-size:12px; }
.scenario-label { padding:4px 8px; border-radius:6px; background:#ffedbd; color:#664800; }
.modal[open]:has(.certificate-reader) { display:flex; flex-direction:column; overflow:hidden; width:min(1200px,calc(100vw - 24px)); height:calc(100dvh - 32px); }
.modal:has(.certificate-reader) > .modal-header, .modal:has(.certificate-reader) > .modal-footer { flex-shrink:0; }
.modal:has(.certificate-reader) > .modal-body { display:flex; min-height:0; flex:1; padding:12px 18px; overflow:hidden; }
.certificate-reader { display:flex; flex-direction:column; min-width:0; min-height:0; width:100%; }
.certificate-reader-toolbar { display:flex; justify-content:space-between; flex-wrap:wrap; align-items:center; gap:10px; padding:4px 0 12px; flex-shrink:0; font-size:12px; }
.certificate-reader-toolbar small { display:block; margin-top:5px; color:var(--muted); }
.certificate-reader-toolbar .actions { gap:6px; }
.certificate-reader-toolbar .btn { min-height:40px; }
.certificate-reader > .help-text { margin:0 0 10px; flex-shrink:0; }
.certificate-reader .certificate-preview-frame { flex:1; min-height:0; max-height:none; overflow:auto; overscroll-behavior:contain; }
.certificate-preview-stack { width:var(--preview-zoom,100%); margin:0 auto; padding:16px; box-sizing:border-box; }
.certificate-preview-page { margin:0 0 20px; background:white; box-shadow:0 3px 12px #19312826; }
.certificate-preview-page figcaption { padding:8px 12px; background:#f4f7f4; color:var(--muted); border-bottom:1px solid var(--line); font-size:11px; }
.certificate-page-content { min-width:0; }
.certificate-page-content > p, .certificate-page-content > button { margin:16px; }
.certificate-page-loading { min-height:40vh; display:flex; align-items:center; justify-content:center; color:var(--muted); }
.certificate-preview-image { width:100%; max-width:none; height:auto; }
@media(max-width:600px) { .modal:has(.certificate-reader) > .modal-body { padding:10px 8px; } .certificate-preview-stack { padding:8px; } .certificate-reader-toolbar { gap:8px; } .certificate-reader-toolbar .actions { width:100%; justify-content:center; } }
.review-autosave-bar{display:flex;align-items:center;gap:.75rem;flex-wrap:wrap;padding:.75rem 1rem;margin-bottom:.5rem;border:1px solid #d8e5df;border-radius:12px;background:#f3faf6}
.review-autosave-bar p{margin:0;flex:1 1 220px;font-size:.9rem;color:#2c6e5a}
.review-autosave-bar [data-state="saving"],.review-autosave-bar [data-state="pending"]{color:#79601c}
.review-autosave-bar [data-state="error"]{color:#a12b2b;font-weight:600}
.review-autosave-bar [hidden]{display:none}
