@import url('https://fonts.googleapis.com/css2?family=PT+Sans+Narrow:wght@400;700&display=swap');
*{box-sizing:border-box}body{margin:0;background:#e8e8e8;color:#111;font-family:'PT Sans Narrow',sans-serif;font-size:10.6667px}.toolbar{background:#fff;border-bottom:1px solid #ccc;position:sticky;top:0;z-index:4;padding:10px 18px;display:flex;gap:16px;align-items:center;flex-wrap:wrap}.toolbar strong{font-size:15px}.toolbar small{font-size:10px;font-weight:normal;color:#666}.toolbar select,.toolbar button{font:inherit;padding:5px 7px}.toolbar #viewCount{margin-left:auto}main{width:816px;min-height:1056px;margin:16px auto;background:#fff;padding:70px 24px 25px;box-shadow:0 1px 8px #0002}.legend{text-align:center;margin-bottom:17px}.section{margin-bottom:9px}.heading{font-size:13.333px;font-weight:700;background:#d9d9d9;padding:1px 3px;line-height:17px;display:flex;gap:12px;justify-content:space-between}.sectionCount{font-size:10.6667px;font-weight:400;white-space:nowrap}.grid{width:100%;table-layout:fixed;border-collapse:collapse}.grid td{padding:0;height:20px;max-height:20px;overflow:hidden}.grid td.card{width:calc((100% - 40px)/5)}.grid td.gutter{width:10px;min-width:10px;max-width:10px;background:#fff}.entry{height:20px;max-height:20px;padding:1px 3px;display:flex;align-items:center;gap:4px;overflow:hidden}.num{flex:0 0 4ch;width:4ch;white-space:nowrap;overflow:hidden;text-align:right;font-variant-numeric:tabular-nums}.slot{width:29px;min-width:29px;display:flex;gap:3px;align-items:center;justify-content:flex-end}.check{appearance:none;border:1px solid #111;border-radius:0;background:white;flex:0 0 10px;width:10px;height:10px;padding:0;margin:0;cursor:pointer}.slot.three{gap:2px}.slot.three .check{flex-basis:8px;width:8px;height:8px}.check[data-state="1"]{background:#111!important;border-color:#111!important}.check[data-state="2"]{background:#1672d4!important;border-color:#1672d4!important}.check:focus-visible{outline:2px solid #1672d4;outline-offset:2px}.name{flex:1 1 0;min-width:0;max-height:18px;line-height:1;white-space:nowrap;overflow:hidden;font-size:10.6667px}#totalCount{margin-top:22px;border-top:1px solid #bbb;padding:6px 3px;text-align:right}dialog{width:min(650px,95vw);max-height:85vh;overflow:auto;border:1px solid #999;padding:22px;font-family:Arial,sans-serif;font-size:13px;line-height:1.5}dialog button{padding:6px 10px;margin:4px}dialog .close{float:right}dialog input{max-width:100%}.warning{color:#8b3500}#preview{white-space:pre-wrap;margin:8px 0}@media(max-width:850px){body{overflow-x:auto}main{margin:0}.toolbar{min-width:816px}}@media print{.toolbar{display:none}main{margin:0;box-shadow:none}}

#editor{margin:18px 0;padding:12px;background:#f6f7fa;border:1px solid #ccc}#editor p{margin:9px 0}#editor input,#editor select{max-width:100%;padding:4px}#editor button{margin:3px}#admin{max-width:min(860px,94vw);max-height:85vh;overflow:auto}#editor label{display:inline-block;margin:3px 8px 3px 0}

#cardForm{border:2px solid #245a86;background:white;padding:14px;margin-top:12px}#cardFormTitle{font-size:17px;color:#174a72}#cardSelectorRow{background:#fff5db;padding:8px;margin:10px 0}#confirmDelete{background:#9d2323;color:white}#editor [hidden]{display:none!important}

.legend-item{display:inline-flex;align-items:center;gap:4px;margin:0 7px}.legend-item i{display:inline-block;width:10px;height:10px;border:1px solid;background:white}#batchSave:disabled{opacity:.45;cursor:not-allowed}#batchMessage{font-weight:600}

/* Batch editor: aligned grid and true visual preview */
.batch-actions{display:flex;gap:8px;align-items:center;margin:10px 0;flex-wrap:wrap}
#batchGridWrap{overflow-x:auto;max-width:100%;border:1px solid #d9dee6;border-radius:8px}
#batchGrid{width:100%;border-collapse:collapse;min-width:630px;font:13px system-ui,sans-serif}
#batchGrid th{background:#f3f5f9;color:#303744;text-align:left;padding:9px 6px;border-bottom:1px solid #d9dee6}
#batchGrid td{padding:5px 6px;border-bottom:1px solid #e8ebef;text-align:center}
#batchGrid td:nth-child(2),#batchGrid td:nth-child(3){text-align:left}
#batchGrid input[type=text]{box-sizing:border-box;width:100%;padding:7px;border:1px solid #d5dbe4;border-radius:5px;font:13px system-ui,sans-serif}
#batchGrid td:nth-child(2){width:110px}#batchGrid td:nth-child(3){width:42%}
#batchGrid input[type=checkbox]{width:16px;height:16px;cursor:pointer}
#batchGrid input:focus-visible{outline:2px solid #4779c9;outline-offset:1px}
.batch-remove{font-size:18px;background:transparent;border:0;color:#6c7380;cursor:pointer}
#batchReview{width:min(540px,calc(100vw - 42px));max-height:80vh;border:1px solid #cbd3df;border-radius:12px;padding:22px;box-shadow:0 20px 70px #0004}
#batchReview::backdrop{background:#10182790}
.review-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.review-head h3{margin:0}
#batchReviewClose{font-size:24px;border:0;background:transparent;cursor:pointer}
.batch-preview-card{display:flex;align-items:center;justify-content:space-between;gap:14px;min-height:30px;padding:5px 10px;border-bottom:1px solid #e3e7ed;font-family:'PT Sans Narrow',sans-serif;font-size:14px}
.batch-preview-name{min-width:0;overflow-wrap:anywhere}.batch-preview-boxes{display:inline-flex;align-items:center;gap:4px;flex-shrink:0}
.batch-preview-checkbox{display:inline-block;width:10px;height:10px;border:1.5px solid #000;background:white;box-sizing:border-box}
.review-foot{display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap;margin-top:18px}

/* v17.7.4: compact no-horizontal-scroll editor */
#batchPanel{min-width:0;width:100%}
#batchGridWrap{overflow-x:hidden;width:100%}
#batchGrid{min-width:0;width:100%;table-layout:fixed;font-size:11px}
#batchGrid th,#batchGrid td{padding:5px 2px;overflow:hidden}
#batchGrid th:nth-child(1){width:24px}
#batchGrid th:nth-child(2){width:91px}
#batchGrid th:nth-child(3){width:auto}
#batchGrid th:nth-child(n+4):nth-child(-n+7){width:39px;text-align:center;font-size:10px}
#batchGrid th:nth-child(8){width:31px}
#batchGrid td:nth-child(2){width:91px}
#batchGrid td:nth-child(3){width:auto}
#batchGrid input[type=text]{min-width:0;width:100%;padding:6px 3px;font-size:12px}
#batchGrid input[type=checkbox]{width:14px;height:14px}
#batchGrid .batch-remove{margin:0;padding:1px 3px;font-size:17px}
@media(max-width:570px){#admin{padding:10px}#editor{padding:7px}#batchGrid th:nth-child(2){width:70px}#batchGrid th:nth-child(n+4):nth-child(-n+7){width:30px;font-size:9px}#batchGrid th:nth-child(8){width:24px}}

/* v17.7.5: distinct manual grid and spreadsheet-paste flows */
#batchGrid th:nth-child(4){width:58px;font-size:10px}
#batchGrid th:nth-child(n+5):nth-child(-n+8){width:36px;text-align:center;font-size:10px}
#batchGrid th:nth-child(9){width:26px}
#batchGrid input.batch-position{box-sizing:border-box;width:100%;min-width:0;padding:6px 2px;border:1px solid #d5dbe4;border-radius:5px;font-size:11px}
#batchGrid th:nth-child(8){width:36px}
#batchGrid td:nth-child(4){width:58px}
#batchGrid td:nth-child(3){width:auto}
#batchPasteArea textarea{box-sizing:border-box;max-width:100%;font:13px ui-monospace,monospace}

/* PDF asterisk explanations, visually separate from fixed-height card rows */
.pdf-footnotes{font-size:10.6667px;line-height:1.2;margin:3px 3px 5px;color:#222;}
.pdf-footnotes>div{margin:1px 0;}

/* v17.7.18: alternate readable list layout; classic PDF grid remains untouched */
.toolbar select,.toolbar button{border:1px solid #cbd3de;border-radius:7px;background:#fff;color:#243044;padding:6px 9px}
.toolbar button:hover{background:#f3f6fa}
.card-list{display:grid;grid-template-columns:1fr;gap:1px;border:1px solid #e2e7ed;border-radius:9px;overflow:hidden;background:#e2e7ed}
.list-card{min-height:36px;background:#fff;padding:5px 12px}
.list-card:nth-child(even){background:#f7f9fc}
.list-card .entry{height:26px;max-height:none;gap:12px;padding:0;overflow:visible}
.list-card .num{font-size:13px;flex-basis:48px;width:48px;color:#627084;text-align:left}
.list-card .slot{order:3;width:auto;min-width:38px;margin-left:auto;gap:7px}
.list-card .slot.three{gap:7px}
.list-card .check,.list-card .slot.three .check{width:14px;height:14px;flex:0 0 14px}
.list-card .name{font-size:14px!important;max-height:none;white-space:normal!important;line-height:1.2;overflow:visible}
.list-card .check:focus-visible{outline-offset:3px}
@media(max-width:850px){.card-list{width:100%}}
@media print{.card-list{break-inside:auto}.list-card{break-inside:avoid}}

/* 17.7.19 — set overview and collection-focused list view; classic stays untouched */
body:has(#displayMode option[value="list"]:checked){background:#f3f5f9}
body:has(#displayMode option[value="list"]:checked) main{width:min(1160px,calc(100% - 36px));min-height:0;padding:28px 30px 42px;border-radius:14px;box-shadow:0 3px 22px #23304412}
body:has(#displayMode option[value="list"]:checked) .section{margin-bottom:30px}
body:has(#displayMode option[value="list"]:checked) .heading{background:transparent;font-family:Arial,sans-serif;font-size:22px;line-height:1.3;padding:10px 0 16px;align-items:baseline;border-bottom:1px solid #e4e9f0}
body:has(#displayMode option[value="list"]:checked) .sectionCount{font-size:13px;color:#657187}
.set-info-bar{display:flex;gap:18px;justify-content:space-between;align-items:stretch;padding:18px 0 22px;font-family:Arial,sans-serif}
.set-meta,.set-progress{border:1px solid #e1e7f0;border-radius:11px;background:#fafbfe;padding:16px 18px;flex:1;min-width:0}
.set-meta-label,.set-progress>span:first-child{display:block;color:#69778e;font-size:10px;font-weight:700;letter-spacing:.09em;margin-bottom:12px}
.set-facts{display:flex;gap:18px;flex-wrap:wrap;font-size:13px;color:#27344b}
.set-facts span+span{border-left:1px solid #d5dce7;padding-left:18px}
.set-progress{max-width:280px}.set-progress-number{display:block;font-size:20px;color:#23314b;margin-bottom:10px}
.progress-track{height:7px;background:#e2e8f1;border-radius:12px;overflow:hidden}.progress-fill{height:100%;background:#4d6fa7;width:0;transition:width .2s}
.list-title{display:flex;align-items:baseline;justify-content:space-between;gap:10px;margin:0 0 10px;font-family:Arial,sans-serif}.list-title strong{font-size:15px}.list-title span{font-size:11px;color:#69778e}
.card-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;border:0;background:transparent;border-radius:0;overflow:visible}
.list-card,.list-card:nth-child(even){background:#fff;border:1px solid #e1e7ef;border-radius:9px;padding:8px 12px;min-height:47px;box-shadow:0 1px 2px #25345009}
.list-card:hover{border-color:#b9c9df;background:#f9fbff}
.list-card .entry{height:auto;min-height:28px;gap:12px}
.list-card .num{flex:0 0 42px;width:42px;font-size:12px;color:#738198}
.list-card .name{font-family:Arial,sans-serif;font-size:13px!important;font-weight:500;line-height:1.3}
.list-card .slot{gap:6px;min-width:36px}.list-card .check{width:15px;height:15px;flex-basis:15px}
body:has(#displayMode option[value="list"]:checked) .pdf-footnotes{margin:12px 0 0;font-size:12px}
@media(max-width:900px){body:has(#displayMode option[value="list"]:checked) main{width:calc(100% - 24px);padding:20px 16px}.card-list{grid-template-columns:1fr}.set-info-bar{flex-direction:column}.set-progress{max-width:none}.list-title{flex-wrap:wrap}}
@media print{body:has(#displayMode option[value="list"]:checked) main{width:100%;box-shadow:none}}

/* 17.7.20: compact paired overview cards; set name inside left card */
body:has(#displayMode option[value="list"]:checked) .set-info-bar{gap:12px;padding:7px 0 15px}
body:has(#displayMode option[value="list"]:checked) .set-meta,
body:has(#displayMode option[value="list"]:checked) .set-progress{padding:12px 15px;border-radius:10px}
body:has(#displayMode option[value="list"]:checked) .set-meta .heading{font-size:20px;padding:0 0 9px;margin:0 0 9px;border-bottom:1px solid #e4e9f0;line-height:1.2}
body:has(#displayMode option[value="list"]:checked) .set-meta-label,
body:has(#displayMode option[value="list"]:checked) .set-progress>span:first-child{margin-bottom:8px}
body:has(#displayMode option[value="list"]:checked) .set-progress-number{font-size:19px;margin-bottom:8px}
body:has(#displayMode option[value="list"]:checked) .set-facts{gap:12px;font-size:12px}
body:has(#displayMode option[value="list"]:checked) .set-facts span+span{padding-left:12px}
body:has(#displayMode option[value="list"]:checked) .set-progress{max-width:255px}
@media(max-width:900px){body:has(#displayMode option[value="list"]:checked) .set-progress{max-width:none}}

/* Task-focused admin UI */
.task-menu,.task-active,.task-backup{margin:14px 0;padding:16px;border:1px solid #d6dbe1;border-radius:12px;background:#f9fafb}
.task-choices{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:10px}
.task-choice{min-height:46px;text-align:left;padding:10px 14px;border:1px solid #bfc9d4;border-radius:8px;background:white;cursor:pointer}
.task-choice:hover{background:#edf3f9}
.task-heading{display:flex;align-items:center;gap:18px;flex-wrap:wrap}.task-heading h3{margin:0}
.task-set-picker{margin:14px 0}.task-back{margin-bottom:12px}
[hidden]{display:none!important}

/* Set forms now live inside the task panel, not directly under #editor.
   Do not hide the task panel when entering Add Set or Edit Set. */
#admin.set-edit-screen #taskActive { display:block; }
/* Keep the four-digit column fixed; fit long numbers inside it. */
.num-text{white-space:nowrap;display:inline-block;max-width:100%;vertical-align:baseline}

.grid .name { overflow-wrap:anywhere; }

/* 17.7.52: adjustable compact width; retain original Letter geometry. */
@media screen {
 body[data-page-width="responsive"]:has(#displayMode option[value="classic"]:checked) main{width:calc(100% - 32px);min-width:816px;margin:16px auto}
 body[data-page-width="wide"]:has(#displayMode option[value="classic"]:checked) main{width:min(1200px,calc(100% - 32px));min-width:816px;margin:16px auto}
 body:has(#displayMode option[value="classic"]:checked) .toolbar{min-width:0}
}
body.printing-letter:has(#displayMode option[value="classic"]:checked) main{width:816px!important;min-width:816px!important;margin:0!important;box-shadow:none!important}
@page{size:letter;margin:0}
@media print{
 body{background:#fff;print-color-adjust:exact;-webkit-print-color-adjust:exact}
 body:has(#displayMode option[value="classic"]:checked) main{width:816px!important;min-width:816px!important;margin:0!important;box-shadow:none!important}
 .grid tr{break-inside:avoid}.heading{break-after:avoid}
}

/* Native, synchronous responsive text sizing. No resize listeners or deferred refitting. */
.grid .name{container-type:inline-size;white-space:normal;line-height:1;overflow:hidden;max-height:18px;}
.grid .name-label{display:block;font-size:clamp(4pt,max(min(6pt,var(--double,6pt)),var(--single,8pt)),8pt);line-height:1;overflow-wrap:anywhere;white-space:normal;}
@media screen{.section:has(.grid){content-visibility:auto;contain-intrinsic-size:auto var(--section-estimate,100px);}}
@media print{.section{content-visibility:visible!important;contain-intrinsic-size:none!important;}}

.startup-sync .check { pointer-events:none; }
.startup-sync #sets { cursor:progress; }

.startup-sync.early-interaction .check { pointer-events:auto; }
.startup-sync.early-interaction #sets { cursor:default; }

.deferred-section{margin-bottom:9px;overflow:hidden}
@media screen{.section:has(.card-list){content-visibility:auto;contain-intrinsic-size:auto 300px;}}

/* Manage Set Notes */
.set-notes-list{display:grid;gap:8px;margin:12px 0}.set-note-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:10px;padding:10px;border:1px solid #d6dbe1;border-radius:8px;background:#fff}.set-note-row small{color:#596574}.set-note-editor{margin:12px 0}.set-note-editor textarea{box-sizing:border-box;min-height:76px;padding:9px;border:1px solid #aeb8c3;border-radius:7px;font:inherit}.set-note-row button,.task-content button{cursor:pointer}

/* v17.7.69: clearly separated Backup / Restore actions */
.backup-navigation{display:flex;justify-content:flex-start;margin-bottom:12px}
.backup-navigation .task-back{margin:0}
.backup-page-title{margin:10px 0 16px}
.backup-operation{border:1px solid #d5dce5;border-radius:10px;padding:16px;margin:14px 0;background:#fff}
.backup-operation h4{margin:0 0 6px;font-size:1.05em}
.backup-operation-help{margin:0 0 14px;color:#526071;line-height:1.45}
.backup-operation #backup{display:block;margin:0}
.backup-file-picker{display:flex;flex-direction:column;align-items:flex-start;gap:9px;font-weight:600}
.backup-file-picker input[type=file]{display:block;max-width:100%;font-weight:normal}
.backup-operation #backupCheckResult{margin:12px 0 0;white-space:pre-wrap}
#backupCompare{margin-top:18px!important;background:#fff}

/* v17.7.71: non-invasive Admin visual refresh. No structural/JS changes. */
#admin{box-sizing:border-box;width:min(920px,96vw);max-width:96vw;border:1px solid #cbd5e1;border-radius:16px;padding:clamp(14px,2.5vw,26px);box-shadow:0 22px 65px rgba(15,23,42,.20);background:#f8fafc;color:#172337}
#admin::backdrop{background:rgba(15,23,42,.42)}
#admin>h2{margin:4px 0 10px;letter-spacing:-.025em;font-size:1.45rem}
#admin>p{line-height:1.5;color:#526174}
#admin .task-menu,#admin .task-active,#admin .task-backup{background:#fff;border:1px solid #dbe2eb;border-radius:13px;padding:clamp(12px,2vw,20px);box-shadow:0 2px 8px rgba(15,23,42,.035)}
#admin .task-choices{grid-template-columns:repeat(auto-fit,minmax(min(100%,210px),1fr));gap:10px}
#admin .task-choice{font:inherit;font-weight:600;line-height:1.3;min-height:54px;padding:12px 14px;border:1px solid #d2dce8;border-radius:9px;color:#1d3553;background:#fff;transition:background .15s,border-color .15s,box-shadow .15s}
#admin .task-choice:hover{background:#eff6ff;border-color:#9ebbd9;box-shadow:0 2px 6px rgba(20,64,110,.08)}
#admin .task-choice:focus-visible,#admin button:focus-visible,#admin input:focus-visible,#admin select:focus-visible,#admin textarea:focus-visible{outline:3px solid #7bb6ed;outline-offset:2px}
#admin .task-heading{padding-bottom:14px;margin-bottom:16px;border-bottom:1px solid #e2e8f0;gap:12px}
#admin .task-heading h3{font-size:1.25rem;letter-spacing:-.02em}
#admin .task-back{background:#eef3f8;border:1px solid #cad6e3;color:#284b6a;border-radius:8px;padding:9px 12px;font-weight:600;cursor:pointer}
#admin .task-set-picker{background:#f5f8fc;border:1px solid #e1e8f0;border-radius:10px;padding:12px 14px;margin:12px 0 18px}
#admin .task-set-picker select{max-width:100%;min-height:36px}
#admin .task-content{line-height:1.5}
#admin .task-content input:not([type=checkbox]),#admin .task-content select,#admin .task-content textarea{border:1px solid #bdc9d7;border-radius:7px;min-height:34px;box-sizing:border-box}
#admin .task-content button,#admin .backup-operation button{border-radius:8px;min-height:36px;padding:7px 12px}
#admin #cardForm,#admin #setEditorFields{border:1px solid #ccdbea;border-radius:10px;background:#fff;padding:16px}
#admin #cardSelectorRow{background:#f0f6fd;border:1px solid #d6e5f5;border-radius:9px;padding:12px}
#admin .backup-operation{border-color:#dbe2eb;box-shadow:0 1px 4px rgba(15,23,42,.035)}
#admin .set-note-row{border-color:#dce4ed;border-radius:9px}
#admin .warning{line-height:1.5}
@media(max-width:600px){#admin{padding:12px}#admin .task-choices{grid-template-columns:1fr}#admin .task-heading{align-items:flex-start}#admin .task-menu,#admin .task-active,#admin .task-backup{padding:12px}}
