/* The overview keeps the identifiers and results together; details use the same inputs. */
:root{--surface:#fff;--line:#d8e3eb;--ink:#18374f;--soft:#f4f8fb;--muted:#61798b;--accent:#08768f}
body.dark{--surface:#192c40;--line:#345069;--ink:#e9f2f9;--soft:#14283b;--muted:#afc8d7;--accent:#74d4e7}
header{padding:16px 24px}header>div{display:flex;align-items:center;gap:15px;flex-wrap:wrap}.private-tag{border:1px solid #6f9caf66;border-radius:30px;padding:3px 9px;font-size:.7rem!important;color:#bde6dd!important}
main{padding:24px 24px 88px}aside{padding:22px 14px}.panel{box-shadow:0 3px 15px #112b4510}.save-status{font-size:.76rem;color:#26745d;margin:18px 0 0}.save-error{color:#d9523f}body.dark .save-status{color:#9be1cb}body.dark .save-error{color:#ffb7a8}
button:focus-visible,a:focus-visible{outline:3px solid #57bed1;outline-offset:2px}button:disabled{opacity:.45;cursor:default}.stat{min-width:132px}.stat-button{min-width:140px}.stat b{font-variant-numeric:tabular-nums}.section-head{scroll-margin-top:20px}
.sheet-toolbar{display:flex;align-items:end;gap:14px;flex-wrap:wrap;margin-bottom:15px}.sheet-toolbar label{font-size:.76rem;font-weight:600;color:var(--muted)}.sheet-toolbar label:first-child{flex:1;min-width:180px}.sheet-toolbar input,.sheet-toolbar select{display:block;background:var(--surface);border:1px solid var(--line);color:var(--ink);padding:9px 11px;border-radius:7px;margin-top:5px;width:100%}.sheet-toolbar .muted{flex-basis:100%;font-size:.75rem}.pagination{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;padding:10px 0 14px;color:var(--muted);font-size:.77rem}.pagination:last-child{padding:18px 0 0}.pagination>div{display:flex;align-items:center;gap:10px}.pagination button{font-size:.76rem;padding:6px 10px}
#panel .focused{overflow:visible}#panel .focused table{display:block;width:100%;min-width:0!important;table-layout:auto}#panel .focused thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}#panel .focused tbody{display:grid;gap:9px}#panel .focused tr:not(.group){display:grid;grid-template-columns:46px minmax(0,2.6fr) repeat(2,minmax(0,1.15fr)) minmax(0,1fr) minmax(0,.9fr) minmax(0,.9fr) 82px;gap:10px;align-items:start;border:1px solid var(--line);border-radius:10px;padding:14px;background:var(--surface)}#panel .focused .record-summary tr:not(.group){grid-template-columns:46px minmax(0,2.2fr) minmax(0,1.4fr) minmax(0,2fr) 82px}#panel .focused .overdue-summary tr:not(.group){grid-template-columns:repeat(4,minmax(0,1fr))}#panel .focused tr.group{display:block;margin:7px 0}#panel .focused tr.group td{display:block;width:100%!important;padding:9px 12px}
#panel .focused td{display:block;min-width:0!important;width:auto!important;border:0;padding:0!important;overflow-wrap:anywhere;align-self:start}#panel .focused td[data-label]::before{content:attr(data-label);display:block;margin-bottom:5px;color:var(--muted);font-size:.64rem;font-weight:700;letter-spacing:.04em;text-transform:uppercase}#panel .focused td input,#panel .focused td textarea{min-width:0!important;max-width:100%;width:100%;background:var(--soft);border:1px solid var(--line);padding:6px;font-size:.78rem;border-radius:5px}#panel .focused td textarea{min-height:34px;field-sizing:content;overflow-wrap:anywhere}#panel .focused .identity-cell textarea{min-height:58px;line-height:1.4}#panel .focused .item-order{width:100%!important}#panel .focused td.detail-cell{display:none}#panel .focused .expanded{grid-template-columns:repeat(4,minmax(0,1fr))!important;box-shadow:inset 3px 0 var(--accent)}#panel .focused .expanded td.detail-cell{display:block}#panel .focused .expanded .identity-cell{grid-column:span 2}#panel .focused td.remove{display:flex;flex-direction:column;gap:5px;align-items:stretch}#panel .focused td.remove::before{display:none}#panel .focused .remove button{font-size:.73rem;padding:6px 8px}#panel .focused .remove button[data-remove]{align-self:end;font-size:1rem;line-height:1;padding:3px 8px}#panel .focused .badge{font-size:.68rem;white-space:normal}#panel .focused tr:has(.badge.danger){border-color:#da9685}#panel .focused tr:has(.badge.warn){border-color:#c7aa6b}#panel .focused tr:has(.empty){display:block}#panel .focused .empty{padding:20px!important}.row-details{display:none}#panel .focused .row-details{display:block}
/* Full spreadsheet mode keeps item and description attached to the row while scrolling. */
#panel .tablewrap:not(.focused){max-height:74vh;position:relative;border:1px solid var(--line);border-radius:8px;isolation:isolate}#panel .tablewrap:not(.focused) th{z-index:3;top:0}#panel .tablewrap:not(.focused) td:first-child,#panel .tablewrap:not(.focused) th:first-child{position:sticky;left:0;min-width:64px;width:64px;background:var(--surface);z-index:2}#panel .tablewrap:not(.focused) th:first-child{z-index:5}#panel .tablewrap:not(.focused) td:nth-child(2),#panel .tablewrap:not(.focused) th:nth-child(2){position:sticky;left:64px;min-width:250px;width:250px;background:var(--surface);z-index:2;box-shadow:3px 0 3px #102a4515}#panel .tablewrap:not(.focused) th:nth-child(2){z-index:5}#panel .tablewrap:not(.focused) tr.group td{position:static}#panel .tablewrap:not(.focused) tr.group td:nth-child(2){box-shadow:none}
@media(max-width:1200px){#panel .focused tr:not(.group){grid-template-columns:repeat(4,minmax(0,1fr))}#panel .focused .identity-cell{grid-column:span 2}#panel .focused .record-summary tr:not(.group){grid-template-columns:repeat(3,minmax(0,1fr))}#panel .focused .record-summary .identity-cell{grid-column:span 2}#panel .focused .record-summary td:nth-last-child(2){grid-column:span 2}.heading h1{font-size:1.7rem}.stat{padding:11px 14px}}
@media(max-width:800px){main{padding:18px 12px 78px}header{padding:14px 16px}header>div{gap:6px 12px}header span:not(.private-tag){font-size:.72rem}.meta label:has(input[data-field="operations"]),.meta label:has(input[data-field="airframeManual"]),.meta label:has(input[data-field="engineManual"]){grid-column:auto}.panel{padding:14px}.stats{gap:8px}.tabs{margin-top:14px}.stat,.stat-button{min-width:130px}.scroll-dock{left:12px;right:12px}#panel .tablewrap:not(.focused) td:nth-child(2),#panel .tablewrap:not(.focused) th:nth-child(2){min-width:180px;width:180px}}
@media(max-width:560px){.private-tag{display:none}.actions button{font-size:.75rem;padding:8px 10px}.sheet-toolbar .muted{line-height:1.4}.pagination>div{gap:7px;width:100%;justify-content:space-between}#panel .focused tr:not(.group),#panel .focused .record-summary tr:not(.group),#panel .focused .overdue-summary tr:not(.group),#panel .focused .expanded{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:12px}#panel .focused .identity-cell{grid-column:1/-1;order:-1!important}#panel .focused td:has(textarea),#panel .focused .record-summary td:nth-last-child(2){grid-column:1/-1}#panel .focused td.remove{flex-direction:row;align-items:center;justify-content:flex-end;grid-column:1/-1}#panel .focused td input,#panel .focused td textarea{font-size:16px;padding:8px}.meta{grid-template-columns:minmax(0,1fr)}.stat b{font-size:1.2rem}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}
@media print{.private-tag,.sheet-toolbar,.pagination,.save-status,.row-details{display:none!important}#panel .tablewrap{max-height:none!important;overflow:visible!important}#panel .focused table{display:table;min-width:0!important}#panel .focused thead{position:static;width:auto;height:auto;clip-path:none}#panel .focused tbody{display:table-row-group}#panel .focused tr:not(.group),#panel .focused tr.group{display:table-row;background:transparent;border:0;padding:0}#panel .focused td,#panel .focused td.detail-cell,#panel .focused tr.group td{display:table-cell!important;width:auto!important;border:1px solid #bbc8d0;padding:4px 3px!important}#panel .focused td[data-label]::before{display:none}#panel .tablewrap:not(.focused) td,#panel .tablewrap:not(.focused) th{position:static!important;box-shadow:none!important}}
#panel .tablewrap:not(.focused) td:first-child,#panel .tablewrap:not(.focused) th:first-child{width:64px!important;min-width:64px!important;max-width:64px!important;padding:10px 6px}#panel .tablewrap:not(.focused) .item-order{width:40px!important;min-width:40px!important}#panel .tablewrap:not(.focused) td:nth-child(2),#panel .tablewrap:not(.focused) th:nth-child(2){min-width:250px!important;width:250px!important}
@media(max-width:800px){#panel .tablewrap:not(.focused) td:nth-child(2),#panel .tablewrap:not(.focused) th:nth-child(2){min-width:180px!important;width:180px!important}}
.source-overview{padding:16px 18px;border:1px solid var(--line);border-left:3px solid var(--accent);border-radius:8px;background:var(--soft);margin-bottom:20px;font-size:.82rem;line-height:1.5}.source-overview p{margin:8px 0}.source-overview a,.source-requirement a{color:var(--accent);text-underline-offset:3px}.source-summary{display:block;color:var(--muted);font-size:.7rem;line-height:1.45;margin-top:7px;overflow-wrap:anywhere}.source-requirement{min-width:340px}.source-requirement p{font-size:.78rem;line-height:1.5;margin:7px 0}.source-requirement summary{cursor:pointer;font-size:.78rem;margin-top:10px;color:var(--accent)}.source-requirement pre{white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;background:var(--soft);padding:12px;border-radius:6px;font-size:.73rem;line-height:1.55;max-height:360px;overflow:auto}#panel .focused .expanded td.source-requirement{grid-column:1/-1;min-width:0!important;border-top:1px solid var(--line);padding-top:12px!important}#panel td select{background:var(--soft);color:var(--ink);border:1px solid var(--line);border-radius:5px;min-width:120px;padding:7px;font:inherit;max-width:100%}#panel .focused td select{width:100%;min-width:0;font-size:.78rem}select:focus-visible{outline:3px solid #57bed1;outline-offset:2px}
@media(max-width:560px){#panel .focused td select{font-size:16px;padding:8px}.source-overview{padding:13px}.source-requirement pre{font-size:.7rem}}

.record-page-link{display:inline-block;color:var(--accent);font-size:.74rem;line-height:1.45;margin:5px 10px 3px 0;overflow-wrap:anywhere;max-width:100%;text-underline-offset:3px}.record-note{padding:9px 11px;background:var(--soft);border-left:2px solid var(--accent);border-radius:4px}.source-overview summary{cursor:pointer;color:var(--accent);margin-top:12px}.source-overview button{margin:8px 0}.source-overview details .record-page-link{display:block}#panel .focused td .record-page-link{font-size:.72rem}

.chapter-navigation{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:14px 0;padding:12px;background:var(--soft);border:1px solid var(--line);border-radius:8px}.chapter-navigation strong{font-size:.8rem}.chapter-navigation button{font-size:.72rem;text-align:left;white-space:normal;max-width:100%;padding:8px 10px}#panel tr.group:has([aria-label="Section heading"]){border-left:4px solid var(--accent)}#panel .focused tr.group td:empty{display:none}#panel .focused tr.group td.remove{width:auto!important;text-align:right}.chapter-navigation button:focus-visible{outline:3px solid var(--accent);outline-offset:2px}@media(max-width:560px){.chapter-navigation{align-items:stretch}.chapter-navigation strong{width:100%}.chapter-navigation button{width:100%;min-height:44px}}

#pdfDialog{width:min(620px,calc(100% - 24px));max-height:90vh;overflow:auto}#pdfDialog p{line-height:1.5}#pdfSectionChoices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;max-height:50vh;overflow:auto;border:1px solid var(--line);border-radius:7px;padding:12px;margin-top:14px}#pdfSectionChoices .pdf-choice{display:flex;align-items:center;gap:10px;min-height:44px;margin:0;padding:8px;border-radius:5px;cursor:pointer;color:var(--ink);background:var(--soft)}#pdfSectionChoices input{width:18px;min-width:18px;height:18px;margin:0;accent-color:var(--accent)}#pdfSelectionError{color:#e99b9b}.recurringtable select{max-width:100%;background:var(--soft);color:var(--ink);padding:7px;border:1px solid var(--line);border-radius:5px}#pdfDialog .dialog-actions{display:flex;gap:9px;flex-wrap:wrap}@media(max-width:560px){#pdfSectionChoices{grid-template-columns:1fr}#pdfDialog .dialog-actions button{min-height:44px}}

/* Keep wide sheets inside the workspace; small screens pin only the item. */
.heading>div,.actions,.sheet-toolbar>label,.pagination>div{min-width:0}
#panel .tablewrap:not(.focused){overscroll-behavior:contain;scroll-padding:42px 12px 12px 330px}
#panel tr.group td{font-size:.85rem;letter-spacing:.02em}
#panel .focused tr.group{border-left:4px solid var(--accent);border-radius:5px;background:var(--soft)}
@media(max-width:560px){
 header{align-items:flex-start;flex-wrap:wrap}.account-controls{max-width:100%;flex-wrap:wrap}.account-controls span{overflow-wrap:anywhere;white-space:normal}
 .fleet{min-width:0;max-width:100%}.aircraft{flex:0 0 150px}.heading,.heading .actions{max-width:100%}
 #panel .tablewrap:not(.focused) td:nth-child(2),#panel .tablewrap:not(.focused) th:nth-child(2){position:static;box-shadow:none}
 #panel .tablewrap:not(.focused) th:nth-child(2){position:sticky;left:auto;top:0}
 #panel .tablewrap:not(.focused){scroll-padding-left:76px}
 #panel .focused .expanded .identity-cell{grid-column:1/-1}
 .sheet-toolbar input,.sheet-toolbar select{font-size:16px}
}

/* Status fills the whole row in Pinned overview. */
@media screen {
 #panel .tablewrap tbody tr:not(.group):has(.badge.warn){--row-status-bg:#fff0bf}
 #panel .tablewrap tbody tr:not(.group):has(.badge.danger){--row-status-bg:#ffe4df}
 body.dark #panel .tablewrap tbody tr:not(.group):has(.badge.warn){--row-status-bg:#494024}
 body.dark #panel .tablewrap tbody tr:not(.group):has(.badge.danger){--row-status-bg:#4a2630}
 #panel .tablewrap tbody tr:not(.group):has(.badge:is(.danger,.warn)),
 #panel .tablewrap tbody tr:not(.group):has(.badge:is(.danger,.warn))>td{background:var(--row-status-bg)}
 #panel .tablewrap tbody tr:not(.group):has(.badge:is(.danger,.warn))>td input:not(:focus),
 #panel .tablewrap tbody tr:not(.group):has(.badge:is(.danger,.warn))>td textarea:not(:focus){background:transparent}
 #panel .tablewrap tbody tr:not(.group):has(.badge:is(.danger,.warn))>td select:not(:focus){background:var(--row-status-bg)}
 /* Alert lists start with Section, not an item number. Pin at matching widths. */
 #panel .tablewrap:not(.focused) .overdue-table :is(th,td):first-child{
  width:144px!important;min-width:144px!important;max-width:144px!important;
  padding-left:12px;white-space:normal;overflow-wrap:anywhere
 }
 #panel .tablewrap:not(.focused) .overdue-table :is(th,td):nth-child(2){
  left:144px;width:64px!important;min-width:64px!important;max-width:64px!important
 }
 #panel .tablewrap:not(.focused):has(.overdue-table){scroll-padding-left:220px}
 @media(max-width:560px){
  #panel .tablewrap:not(.focused) .overdue-table :is(th,td):first-child{width:112px!important;min-width:112px!important;max-width:112px!important}
  #panel .tablewrap:not(.focused) .overdue-table :is(th,td):nth-child(2){left:112px}
  #panel .tablewrap:not(.focused):has(.overdue-table){scroll-padding-left:124px}
 }
}

/* Review status remains readable on narrow notice cards. */
.ad-review-status{white-space:normal;overflow-wrap:anywhere;max-width:100%}

/* Column choices keep the workbook readable without shrinking its editable fields. */
/* The column selector is removed from both table layouts. */
.column-picker{display:none!important}
.column-picker summary{cursor:pointer;font-weight:600;min-height:24px}
.column-options{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:7px 14px;margin-top:10px}
.column-options label{display:flex!important;align-items:center;gap:8px;min-height:36px;margin:0;font-weight:400;min-width:0!important}
.column-options input[type=checkbox]{display:inline-block;width:18px;min-width:18px;height:18px;margin:0;accent-color:var(--accent)}
.column-options small{font-size:.64rem;font-weight:400;color:var(--muted)}
.column-presets{grid-column:1/-1;display:flex;gap:8px;flex-wrap:wrap}
.column-presets button{font-size:.76rem;padding:7px 10px}
#panel .focused .extra-columns tr:not(.group){grid-template-columns:repeat(4,minmax(0,1fr))}
#panel .focused .extra-columns .identity-cell{grid-column:span 2}
@media(max-width:560px){#panel .focused .extra-columns tr:not(.group){grid-template-columns:repeat(2,minmax(0,1fr))}#panel .focused .extra-columns .identity-cell{grid-column:1/-1}}
@media screen{
 #panel .tablewrap:not(.focused) .column-hidden{display:none!important}
 #panel .tablewrap:not(.focused) table.selected-columns{min-width:0!important;width:100%}
}
@media print{.column-picker{display:none!important}}

/* Task identifiers remain readable in the H160 full table. */
@media screen {#panel .tablewrap:not(.focused) table:has(input[data-key="taskNumber"]) :is(th,td):nth-child(3){min-width:250px;width:250px}}

/* Model accordion groups only the aircraft returned by the signed-in user's grants. */
#fleet{display:grid;gap:8px;overflow:visible;align-items:start}
.fleet-group{min-width:0}
.fleet-model{display:flex;align-items:center;gap:8px;width:100%;min-height:44px;text-align:left;padding:11px 10px;border-radius:8px;background:var(--surface);color:var(--ink);border:1px solid var(--line)}
.fleet-model.current-model{border-color:var(--accent)}
.fleet-model-name{flex:1;min-width:0;overflow-wrap:anywhere;font-weight:700;font-size:.86rem}
.fleet-chevron{width:10px;color:var(--muted);flex-shrink:0}
.fleet-count{font-size:.72rem;min-width:23px;padding:3px 6px;text-align:center;border-radius:20px;background:var(--soft);color:var(--muted);font-variant-numeric:tabular-nums}
.fleet-aircraft-list{display:grid;gap:6px;padding:8px 0 2px 12px;border-left:2px solid var(--line);margin-left:10px}
.fleet-aircraft-list[hidden]{display:none}
#fleet .aircraft{width:100%;min-width:0;margin:0;flex:auto;overflow-wrap:anywhere}
.fleet-empty{margin:0;padding:9px 6px;font-size:.76rem;color:var(--muted)}
@media(max-width:800px){#fleet{grid-template-columns:repeat(auto-fit,minmax(155px,1fr));gap:8px}.fleet-aircraft-list{padding-left:8px;margin-left:5px}}
@media print{#fleet{display:none}}

/* An explicit grip avoids dragging while selecting text in editable cells. */
#panel .row-drag-handle{display:block;width:100%;min-height:26px;padding:0 3px;margin:0 0 4px;border:1px solid var(--line);border-radius:5px;background:var(--soft);color:var(--muted);font-size:20px;line-height:1.1;cursor:grab;touch-action:none;user-select:none}
#panel .row-drag-handle:active{cursor:grabbing}
#panel tr.row-dragging{opacity:.55}
#panel tr.row-drop-before{outline:3px solid var(--accent);outline-offset:-3px;border-top:4px solid var(--accent)}
#panel tr.row-drop-after{outline:3px solid var(--accent);outline-offset:-3px;border-bottom:4px solid var(--accent)}
#panel tr.row-drop-chapter{outline:3px solid var(--accent);outline-offset:-3px;box-shadow:0 0 0 3px var(--accent)}
.row-move-dialog{width:min(480px,calc(100% - 24px));max-height:85vh;overflow:auto}
.row-move-dialog p{font-size:.88rem;line-height:1.5;color:var(--muted)}
.row-move-dialog label{display:block}.row-move-dialog select{display:block;width:100%;margin:8px 0 20px;padding:10px;background:var(--surface);color:var(--ink);border:1px solid var(--line);border-radius:6px;font:inherit}
.row-move-dialog .dialog-actions{display:flex;gap:9px;justify-content:flex-end}
body.viewer-mode .row-drag-handle{display:none!important}
@media(max-width:560px){#panel .row-drag-handle{min-height:34px}.row-move-dialog select{font-size:16px}}
@media print{#panel .row-drag-handle{display:none!important}}

#panel .log-group-label{display:block;min-width:0;font-size:.65rem;color:var(--muted);margin-bottom:5px}
#panel .log-group-select{display:block;width:100%;min-width:0;padding:5px;font-size:.72rem;margin-top:4px}
@media(max-width:560px){#panel .log-group-select{font-size:16px;max-width:170px}.log-group-label{flex:1}}
@media print{.log-group-label{display:none!important}}

/* Pending AD applicability analysis: both table layouts, with opaque sticky cells. */
@media screen {
 #panel .tablewrap .adtable tr.ad-pending-review{--ad-review-bg:#fff0bf;border-color:#c7aa6b}
 body.dark #panel .tablewrap .adtable tr.ad-pending-review{--ad-review-bg:#494024}
 #panel .tablewrap .adtable tbody tr.ad-pending-review:not(.group),
 #panel .tablewrap .adtable tbody tr.ad-pending-review:not(.group)>td{background:var(--ad-review-bg)}
 #panel .tablewrap .adtable tr.ad-pending-review>td :is(input,textarea):not(:focus){background:transparent}
}

#panel .focused .embodiedtable tr:not(.group){grid-template-columns:46px minmax(160px,.7fr) minmax(0,2fr) 82px}
#panel .tablewrap:not(.focused) .embodiedtable{min-width:640px;width:100%}
#panel .embodiedtable td:nth-child(2) textarea{font-variant-numeric:tabular-nums}

#panel .tablewrap tbody tr.row-selected{outline:2px solid var(--accent);outline-offset:-2px}

/* Keep workbook actions within reach while editing long sheets. */
.floating-add-row{position:fixed;right:20px;bottom:110px;z-index:8;min-height:44px;padding:11px 16px;font-size:1rem;box-shadow:0 4px 16px #102a4540}
.floating-add-row[hidden],body.viewer-mode .floating-add-row{display:none!important}
@media(max-width:560px){.floating-add-row{right:14px;bottom:calc(96px + env(safe-area-inset-bottom,0px))}}
@media print{.floating-add-row{display:none!important}}
