:root { --ink:#223d35; --muted:#64736b; --paper:#f6f5f0; --line:#dce2d9; --accent:#285744; --white:#fff; }
textarea { font:inherit; width:100%; border:1px solid #b8c4bb; border-radius:6px; padding:10px 12px; color:var(--ink); resize:vertical; }
.master-group { margin-top:36px; }
.master-group>h2 { font-size:18px; }
.master-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:18px; }
.master-card { display:block; padding:24px; color:var(--ink); text-decoration:none; transition:border-color .15s,box-shadow .15s; }
.master-card:hover { border-color:#729480; box-shadow:0 3px 14px #223d3510; }
.master-card-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.master-card h3 { font-size:17px; font-weight:650; margin:0 0 12px; }
.master-card p { min-height:60px; }
.master-card .badge { margin-right:10px; }
.breadcrumb { display:inline-block; font-size:13px; margin-bottom:22px; }
.filter-bar { display:flex; flex-wrap:wrap; gap:16px; align-items:flex-end; margin-bottom:24px; }
.filter-bar>div:first-child { flex:1; min-width:180px; }
.filter-bar>div { min-width:150px; }
.filter-bar>a { padding-bottom:10px; font-size:14px; }
.row-actions { white-space:nowrap; }
.row-actions a+a { margin-left:18px; }
.table-note { margin:6px 0 0; }
.code-label { font:13px ui-monospace,monospace; background:#f1f3ed; border-radius:4px; padding:3px 7px; }
.empty-state { padding:30px 0; }
.empty-state h2 { font-size:20px; }
.form-actions { display:flex; flex-wrap:wrap; align-items:center; gap:24px; }
.checkbox-label { display:flex; gap:12px; align-items:flex-start; font-weight:400; }
.checkbox-label input { width:20px; min-height:20px; height:20px; flex-shrink:0; margin-top:3px; }
.history-panel { margin-top:28px; }
.history-event { padding:15px 0; border-top:1px solid var(--line); font-size:13px; }
.history-event summary { cursor:pointer; }
.history-values { display:grid; grid-template-columns:1fr 1fr; gap:20px; }
.history-values h3 { margin-bottom:8px; font-size:13px; }
.history-event pre { overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere; max-height:350px; background:var(--paper); padding:16px; border-radius:6px; font:12px/1.5 ui-monospace,monospace; }
@media(max-width:900px) { .master-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:640px) { .master-grid,.history-values { grid-template-columns:1fr; } .master-card p { min-height:0; } .filter-bar { align-items:stretch; } .filter-bar>div { width:100%; } .page-heading>.button { max-width:100%; white-space:normal; } }
* { box-sizing:border-box; }
body { margin:0; color:var(--ink); background:var(--paper); font:16px/1.6 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
a { color:var(--accent); text-underline-offset:4px; }
a:hover { color:#122c20; }
button,input,select { font:inherit; }
button,a,input,select { -webkit-tap-highlight-color:transparent; }
:focus-visible { outline:3px solid #b17534; outline-offset:4px; }
h1,h2,p { margin:0 0 16px; }
h1 { font-family:Georgia,serif; font-size:clamp(30px,4vw,46px); font-weight:400; line-height:1.2; letter-spacing:-1px; }
h2 { font-size:23px; line-height:1.35; font-weight:550; letter-spacing:-.4px; }
.site-header { min-height:100px; padding:20px max(24px,calc((100vw - 1200px)/2)); background:var(--white); border-bottom:1px solid var(--line); display:flex; align-items:center; justify-content:space-between; gap:24px; }
.brand { display:flex; align-items:center; gap:13px; color:var(--ink); text-decoration:none; font-size:18px; font-weight:650; line-height:1.4; white-space:nowrap; }
.brand small { display:block; font-size:9px; font-weight:600; letter-spacing:2px; color:var(--muted); margin-top:4px; }
.brand-mark { width:44px; height:48px; background:var(--accent); color:white; border-radius:4px 14px 4px 4px; display:grid; place-items:center; font:30px Georgia,serif; }
.site-header nav { display:flex; align-items:center; flex-wrap:wrap; gap:24px; font-size:14px; }
.site-header nav a { text-decoration:none; color:var(--muted); }
.site-header nav a[aria-current] { color:var(--accent); font-weight:650; }
.site-header form { margin:0; }
.button-link { background:none; border:0; padding:0; cursor:pointer; color:var(--accent); }
.page { max-width:1200px; margin:0 auto; padding:48px 24px 72px; min-height:calc(100vh - 179px); }
.page-heading { display:flex; justify-content:space-between; align-items:center; gap:24px; margin-bottom:32px; }
.page-heading h1 { margin-bottom:10px; }
.page-heading p:last-child { margin-bottom:0; }
.eyebrow { font-size:10px; letter-spacing:2px; font-weight:750; color:var(--accent); margin-bottom:14px; }
.muted { color:var(--muted); }
.small { font-size:13px; }
.panel { border:1px solid var(--line); border-radius:12px; padding:32px; background:var(--white);margin-top: 15px; }
.narrow { max-width:620px; }
.button { display:inline-flex; justify-content:center; align-items:center; gap:22px; padding:12px 20px; border:1px solid var(--accent); border-radius:6px; color:white; background:var(--accent); text-decoration:none; font-size:14px; font-weight:600; cursor:pointer; }
.button:hover { background:#1b402f; color:white; }
.button.secondary { background:transparent; color:var(--accent); }
.text-link { display:inline-block; font-size:14px; margin-top:16px; }
.badge { display:inline-block; padding:5px 12px; border-radius:20px; background:#eaf0e9; color:#285744; font-size:12px; white-space:nowrap; }
.badge.inactive { background:#f1eeeb; color:#735c4e; }
.form-stack { display:grid; gap:20px; }
label { display:block; font-size:14px; font-weight:600; margin-bottom:7px; }
input,select { display:block; width:100%; min-height:46px; border:1px solid #b8c4bb; border-radius:6px; background:#fff; padding:10px 12px; color:var(--ink); }
input[aria-invalid=true] { border-color:#a73f39; }
.field-error { color:#843b31; font-size:13px; margin-top:6px; }
.field-error p { margin:0; }
select[aria-invalid=true],textarea[aria-invalid=true],fieldset[aria-invalid=true] { border-color:#a73f39; }
.form-stack .small { margin:7px 0 0; }
.notice { padding:16px 20px; border:1px solid #bacfbd; border-radius:6px; background:#eef5ed; margin-bottom:24px; overflow-wrap:anywhere; }
.notice.error { background:#fcf0ed; border-color:#e5b9b0; color:#843b31; }
.notice ul { margin:6px 0 0; padding-left:20px; }
.login-page { display:grid; grid-template-columns:1.1fr 1fr; gap:80px; align-items:center; padding-top:64px; padding-bottom:64px; }
.login-page>.notice { grid-column:1/-1; margin:0; }
.login-intro { max-width:470px; }
.login-intro h1 { font-size:clamp(36px,4vw,51px); margin-bottom:24px; }
.login-intro>p:not(.eyebrow) { max-width:420px; color:var(--muted); }
.login-panel { padding:40px; }
.login-panel h2 { font-size:25px; }
.login-panel>.small { margin:24px 0 0; }
.login-panel .form-stack { margin-top:28px; }
.fabric-mosaic { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; max-width:340px; margin-top:36px; }
.fabric-mosaic span { display:block; height:88px; border-radius:5px; box-shadow:0 3px 5px #213b3412; background-color:#d0bf9d; background-image:repeating-linear-gradient(0deg,transparent 0 2px,#ffffff38 2px 3px),repeating-linear-gradient(90deg,transparent 0 2px,#4a433019 2px 3px); }
.fabric-mosaic span:nth-child(2) { background-color:#637564; transform:rotate(-5deg); }
.fabric-mosaic span:nth-child(3) { background-color:#ba8368; transform:rotate(4deg); }
.fabric-mosaic span:nth-child(4) { background-color:#d4cbb9; }
.workspace-hero { display:grid; grid-template-columns:1fr 320px; align-items:center; gap:40px; background:#eaf0e7; border-color:#d8e1d3; margin-bottom:28px; padding:40px; }
.workspace-hero h2 { font:34px/1.2 Georgia,serif; }
.workspace-hero p:last-child { color:#586d5e; max-width:530px; margin-bottom:0; }
.workspace-hero .fabric-mosaic { margin:0; }
.workspace-hero .fabric-mosaic span { height:120px; }
.workspace-grid { display:grid; grid-template-columns:1fr 1fr; gap:24px; }
.step { color:#84948a; font-size:12px; display:block; margin-bottom:16px; }
.access-list { padding-left:20px; font-size:14px; }
.access-list li { margin:6px 0; }
.workspace-grid .text-link { display:block; }
.table-scroll { overflow-x:auto; }
table { width:100%; border-collapse:collapse; text-align:left; font-size:14px; }
th { font-weight:650; font-size:12px; color:var(--muted); }
th,td { padding:15px 12px; border-bottom:1px solid var(--line); overflow-wrap:anywhere; }
th:first-child,td:first-child { padding-left:0; }
.pagination { display:flex; align-items:center; justify-content:space-between; gap:16px; font-size:14px; margin-top:24px; }
.site-footer { max-width:1200px; margin:0 auto; padding:22px 24px; border-top:1px solid var(--line); color:var(--muted); font-size:12px; display:flex; justify-content:space-between; gap:16px; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.skip-link { position:absolute; left:16px; top:-100px; padding:8px; background:white; z-index:10; }
.skip-link:focus { top:10px; }
@media(max-width:900px) { .site-header { flex-wrap:wrap; padding:20px 24px; } .login-page { gap:40px; } .workspace-hero { grid-template-columns:1fr; } .workspace-hero .fabric-mosaic { max-width:300px; } }
@media(max-width:640px) { .page { padding:32px 20px 48px; } .site-header { gap:18px; padding:18px 20px; } .site-header nav { width:100%; gap:16px; font-size:13px; } .brand { font-size:16px; } .login-page { grid-template-columns:1fr; gap:28px; } .login-intro h1 { font-size:36px; } .login-intro .fabric-mosaic { display:none; } .login-panel,.panel { padding:24px; } .workspace-grid { grid-template-columns:1fr; } .page-heading { align-items:flex-start; flex-wrap:wrap; } .workspace-hero h2 { font-size:29px; } .site-footer { flex-wrap:wrap; } th,td { min-width:110px; } }
/* Source role and confirmation checkboxes must not inherit text-input sizing. */
.source-checkbox { display:flex; align-items:flex-start; gap:8px; min-height:32px; padding:5px 0; margin:0; font-weight:400; line-height:22px; cursor:pointer; }
.source-checkbox input[type="checkbox"] { display:inline-block; flex:0 0 16px; width:16px; height:16px; min-height:16px; padding:0; margin:3px 0 0; accent-color:var(--accent); cursor:pointer; }
.family-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:18px; }
.family-form fieldset { min-width:0; border:1px solid var(--line); border-radius:8px; padding:18px; }
.family-form legend { font-weight:600; padding:0 8px; }
.family-row { margin:16px 0; padding:16px; border:1px solid var(--line); border-radius:8px; }
.family-reference-tools { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-top:8px; }
.family-reference-tools input { width:auto; min-width:120px; flex:1; }
.family-reference-tools [hidden] { display:none; }
.family-reference-tools p { flex-basis:100%; }
.family-note,.family-history { white-space:pre-wrap; overflow-wrap:anywhere; }
.family-history { max-height:400px; overflow:auto; }
@media(max-width:640px) { .family-grid { grid-template-columns:1fr; } }
.family-lookup-controls { display:flex; flex-wrap:wrap; align-items:center; gap:12px; }
.family-lookup-controls input { flex:1; min-width:180px; width:auto; }
.family-lookup-controls .button { flex-shrink:0; margin-left:auto; }
.directory-search { margin-bottom:24px; }
.directory-search>label,.swatch-form>.family-lookup-controls>label { flex-basis:100%; margin:0; }
.directory-search>select { width:auto; min-width:180px; flex:0 1 220px; }
.swatch-form fieldset { display:grid; gap:14px; }
.swatch-form fieldset>label,.swatch-form fieldset>p { margin-bottom:0; }
.swatch-form fieldset>.family-grid { margin-bottom:4px; }
.swatch-form .family-field { min-width:0; }
.swatch-form fieldset>.button { justify-self:start; }
.swatch-form .family-reference-tools>p:empty { display:none; }
@media(max-width:640px) {
    .directory-search>input,.directory-search>select { width:100%; min-width:0; flex-basis:100%; }
    .swatch-form>.family-lookup-controls>input { min-width:0; flex-basis:100%; }
    .swatch-form>.family-lookup-controls>.button { max-width:100%; white-space:normal; }
}
/* Stage 6: local photo panel only; preserve the existing entry/navigation styles. */
.swatch-primary-photo { margin:20px 0; }
.swatch-primary-photo img { display:block; max-width:100%; max-height:600px; height:auto; object-fit:contain; background:white; }
.photo-upload-panel,.photo-archive-panel { margin:24px 0; padding:16px; border:1px solid var(--line); border-radius:8px; }
.photo-upload-panel form,.photo-upload-panel details { margin-top:16px; }
.swatch-photo-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(100%,260px),1fr)); gap:20px; margin-top:24px; }
.swatch-photo-card { min-width:0; padding:16px; border:1px solid var(--line); border-radius:8px; }
.swatch-photo-card img { display:block; width:100%; height:220px; object-fit:contain; background:white; }
.swatch-photo-card form,.swatch-photo-card details { margin-top:16px; }
.photo-caption { white-space:pre-wrap; overflow-wrap:anywhere; }
.photo-actions { display:flex; flex-wrap:wrap; gap:10px; }
.swatch-photographs input[type=file] { max-width:100%; min-width:0; }
/* Multiple-choice Swatch references use compact, individually labelled checkboxes. */
.multiple-checkboxes { min-width:0; }
.multiple-checkbox-options { max-height:260px; overflow-y:auto; padding:4px 8px; }
.multiple-checkbox-options .source-checkbox span { overflow-wrap:anywhere; }
/* Shared form/detail spacing: keep sections and their actions visually separate. */
.page > a:first-child:not(.button) { display:inline-block; margin-bottom:20px; }
.page > .panel + .panel,
.page > .button + .panel,
.panel > .panel + .panel { margin-top:24px; }
.panel > .button + .panel { margin-top:20px; }
.panel:not(.family-lookup-controls):not(.form-actions) > .button { margin-bottom:16px; }
.panel > h3,.panel > h4 { margin-top:24px; margin-bottom:12px; }
.panel > h3:first-child,.panel > h4:first-child { margin-top:0; }
.panel dl { margin:16px 0; }
.panel dt { font-weight:600; margin-top:16px; }
.panel dt:first-child { margin-top:0; }
.panel dd { margin:4px 0 0; overflow-wrap:anywhere; }
details.panel > summary { cursor:pointer; font-weight:600; }
details.panel[open] > summary { margin-bottom:16px; }
.panel > form { margin-top:15px; }
.family-form fieldset { display:grid; gap:14px; }
.family-form fieldset > label,.family-form fieldset > p { margin-bottom:0; }
.panel > p:last-child,.panel > dl:last-child { margin-bottom:0; }
@media(max-width:640px) {
    .page > .panel + .panel,.page > .button + .panel,.panel > .panel + .panel { margin-top:20px; }
}

/* Stage 7 guided entry: compact controls, bounded previews and wrapped action rows. */
.entry-progress,.entry-actions { display:flex; flex-wrap:wrap; gap:12px; margin:20px 0; align-items:center; }
.entry-progress a { padding:6px 10px; border:1px solid var(--line); border-radius:6px; background:var(--white); color:var(--accent); text-decoration:none; }
.entry-progress a:hover,.entry-progress a:focus { text-decoration:none; }
.entry-progress a[aria-current] { font-weight:650; background:var(--accent); border-color:var(--accent); color:var(--white); }
.entry-family-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,250px),1fr)); gap:18px; }
.entry-family-card { display:flex; gap:12px; border:1px solid var(--line); border-radius:8px; padding:16px; font-weight:400; }
.entry-start input[type=radio],.entry-family-card input[type=radio] { width:16px; height:16px; min-height:16px; padding:0; margin-top:4px; flex:0 0 16px; }
.entry-family-card img,.entry-preview { display:block; width:100%; max-width:360px; height:180px; object-fit:contain; margin-top:12px; }
.entry-resume-row { display:flex; flex-wrap:wrap; align-items:center; gap:16px; margin:16px 0; }
.entry-optional,.entry-source-card { margin:20px 0; padding:18px; border:1px solid var(--line); border-radius:8px; }
.entry-optional > summary { cursor:pointer; font-weight:600; margin-bottom:12px; }
.entry-optional > .family-field,.entry-optional > form { margin-top:16px; }
.entry-form [hidden] { display:none; }
/* Stage 8: visual library and independent, aligned read-only search controls. */
.visual-library-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:24px; }
.visual-library-card { min-width:0; padding:20px; }
.visual-card-link { display:block; text-decoration:none; color:var(--ink); overflow-wrap:anywhere; }
.visual-card-link h2 { font-size:22px; margin:16px 0 8px; }
.visual-card-link p { margin-bottom:10px; }
.visual-composition { font-size:14px; }
.visual-thumbnail { min-height:220px; background:var(--paper); border-radius:8px; display:flex; align-items:center; justify-content:center; text-align:center; overflow:hidden; }
.visual-thumbnail img { display:block; width:100%; height:240px; object-fit:contain; }
.visual-thumbnail img[hidden],.thumbnail-error[hidden] { display:none; }
.visual-thumbnail > span { padding:24px; color:var(--muted); }
.visual-card-action { margin:18px 0 0; }
.search-form { margin-bottom:24px; }
.search-filters { margin:20px 0; }
.search-filters > summary { cursor:pointer; font-weight:600; margin-bottom:16px; }
.search-filter-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; }
.search-filter-grid > div,.search-filter-grid > label { min-width:0; }
.search-choice-group,.choice-finder { min-width:0; border:1px solid var(--line); border-radius:8px; padding:16px; }
.search-choice-group legend,.choice-finder legend { font-weight:600; padding:0 6px; }
.search-choice-list { max-height:200px; overflow-y:auto; }
.search-choice-list span { overflow-wrap:anywhere; }
.choice-finder { margin-bottom:24px; }
.search-actions { display:flex; flex-wrap:wrap; gap:12px; align-items:center; margin-top:20px; }
.search-actions [hidden] { display:none; }
.search-display-options { margin-top:20px; }
.active-search-filters { margin:24px 0; padding:16px; border:1px solid var(--line); border-radius:8px; }
.active-search-filters ul { display:flex; flex-wrap:wrap; gap:8px 24px; padding-left:20px; }
@media(max-width:900px) { .visual-library-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:640px) { .visual-library-grid,.search-filter-grid { grid-template-columns:1fr; } .search-form .directory-search input { flex-basis:100%; width:100%; min-width:0; } }
/* Stage 9: scope detail layout to preserve directory/filter and entry alignment. */
.swatch-detail > .panel,.swatch-detail > #detail-photographs { margin-bottom:28px; }
.swatch-detail .detail-hero { display:grid; grid-template-columns:minmax(0,1.2fr) minmax(0,1fr); gap:32px; align-items:start; }
.detail-hero-photo { min-width:0; background:var(--paper); border-radius:8px; padding:16px; }
.detail-hero-photo img { display:block; width:100%; height:auto; max-height:640px; object-fit:contain; }
.detail-hero-photo img[hidden],.detail-related-photo img[hidden],.swatch-detail .swatch-photo-card img[hidden],.swatch-detail [data-image-fallback][hidden] { display:none; }
.detail-hero h1 { margin-bottom:12px; }
.detail-actions,.detail-section-links { display:flex; flex-wrap:wrap; align-items:center; gap:12px; margin:20px 0; }
.detail-section-links { padding:16px 0; }
.detail-related-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:20px; }
.detail-related-link { display:flex; flex-direction:column; gap:6px; color:var(--ink); text-decoration:none; overflow-wrap:anywhere; }
.detail-related-photo { min-height:180px; background:var(--paper); display:flex; align-items:center; justify-content:center; text-align:center; border-radius:8px; }
.detail-related-photo img { display:block; width:100%; height:180px; object-fit:contain; }
.detail-related-photo span { padding:16px; }
.swatch-detail .detail-facts dt { margin-top:18px; }
.swatch-detail .detail-facts dd { margin:4px 0 12px; }
.detail-claim,.detail-source,.detail-history { padding:20px; border:1px solid var(--line); border-radius:8px; margin:20px 0; min-width:0; overflow-wrap:anywhere; }
.swatch-detail .preserve-lines { white-space:pre-wrap; overflow-wrap:anywhere; }
.swatch-detail details.panel > summary { cursor:pointer; font-weight:600; }
.swatch-detail details.panel[open] > summary { margin-bottom:16px; }
@media(max-width:900px) { .detail-related-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:640px) { .swatch-detail .detail-hero { grid-template-columns:1fr; gap:24px; } .detail-related-grid { grid-template-columns:1fr; } .detail-hero-photo { padding:12px; } .detail-claim,.detail-source,.detail-history { padding:16px; } }

/* Stage 10 selection and Collection presentation */
.selection-tray,.collection-actions { display:flex; flex-wrap:wrap; align-items:center; gap:16px; margin:20px 0; }
.selection-control { margin:5px 0; }
.collection-notes { white-space:pre-wrap; overflow-wrap:anywhere; }
.collection-photo { min-height:160px; background:var(--paper); display:flex; align-items:center; justify-content:center; }
.collection-photo img { display:block; width:100%; height:200px; object-fit:contain; }
.comparison-region { overflow-x:auto; margin:24px 0; border:1px solid var(--line); }
.comparison-table { width:100%; border-collapse:collapse; }
.comparison-table td,.comparison-table th { min-width:220px; max-width:340px; padding:20px; vertical-align:top; border:1px solid var(--line); overflow-wrap:anywhere; }
.comparison-table th { background:var(--paper); text-align:left; }
.collection-drag { display:block; padding:10px; border:1px dashed var(--line); margin-bottom:16px; cursor:grab; }
.collection-member { min-width:0; overflow-wrap:anywhere; }
@media(max-width:640px) { .comparison-table td,.comparison-table th { padding:12px; min-width:180px; } }
.collection-photo img[hidden] { display:none; }
/* Approved Stage 14 header. All rules stay inside the shared header. */
.library-header { min-height:88px; padding:16px max(24px,calc((100vw - 1320px)/2)); gap:24px; flex-wrap:nowrap; }
.library-header .brand { font-size:17px; flex-shrink:0; }
.library-header .brand-mark { width:38px; height:44px; }
.library-header .header-menu { margin-left:auto; min-width:0; }
.library-header .header-mobile-toggle { display:none; }
.library-header .header-navigation { display:flex; flex-wrap:nowrap; gap:6px; width:auto; font-size:14px; }
.library-header .header-navigation > a,.library-header summary { min-height:44px; padding:10px 12px; display:flex; align-items:center; gap:10px; border-radius:6px; white-space:nowrap; text-decoration:none; color:var(--muted); font-size:14px; cursor:pointer; }
.library-header summary { list-style:none; }
.library-header summary::-webkit-details-marker { display:none; }
.library-header .header-mobile-toggle { display:none; }
.library-header .header-navigation a:hover,.library-header summary:hover,.library-header .header-panel button:hover { background:#f0f3ee; color:var(--accent); }
.library-header [aria-current],.library-header summary.section-active { color:var(--accent); background:#eaf0e9; font-weight:650; }
.library-header .header-disclosure { position:relative; }
.library-header .header-account { margin-left:4px; }
.library-header .header-panel { position:absolute; top:calc(100% + 8px); left:0; z-index:20; width:240px; max-width:calc(100vw - 40px); padding:8px; background:var(--white); border:1px solid var(--line); border-radius:10px; box-shadow:0 12px 30px #213b341a; }
.library-header .header-account .header-panel { right:0; left:auto; }
.library-header .header-panel a,.library-header .header-panel button { display:flex; align-items:center; width:100%; min-height:44px; padding:10px 12px; border:0; border-radius:6px; background:transparent; color:var(--muted); text-decoration:none; text-align:left; font:inherit; cursor:pointer; }
.library-header .header-panel a[aria-current] { color:var(--accent); background:#eaf0e9; font-weight:650; }
.library-header .header-identity { padding:10px 12px; border-bottom:1px solid var(--line); margin-bottom:6px; overflow-wrap:anywhere; font-size:14px; }
.library-header .header-identity small { display:block; color:var(--muted); font-size:12px; }
/* Fixed geometry avoids baseline/font differences in disclosure icons. */
.library-header .header-chevron { display:block; flex:0 0 8px; width:8px; height:8px; border-right:1.5px solid currentColor; border-bottom:1.5px solid currentColor; transform:translateY(-2px) rotate(45deg); margin-left:2px; }
.library-header details[open] > summary .header-chevron { transform:translateY(2px) rotate(225deg); }
@media(max-width:1150px) {
    .library-header { position:relative; display:grid; grid-template-columns:minmax(0,1fr) 80px; column-gap:12px; row-gap:0; min-height:0; padding:12px 16px; }
    .library-header .brand { grid-column:1; grid-row:1; min-width:0; white-space:normal; font-size:16px; }
    .library-header .brand small { display:none; }
    .library-header .header-menu { display:block; grid-column:1/-1; grid-row:2; margin:0; }
    .library-header .header-mobile-toggle { display:flex; position:absolute; top:12px; right:16px; width:80px; height:44px; justify-content:center; border:1px solid var(--line); gap:8px; }
    .library-header .header-navigation { flex-direction:column; align-items:stretch; gap:4px; margin-top:12px; padding-top:12px; border-top:1px solid var(--line); width:100%; }
    .library-header .header-account { margin-left:0; }
    .library-header .header-panel { position:static; width:auto; max-width:100%; box-shadow:none; margin:4px 0 8px; }
    .library-header .header-navigation > a,.library-header summary { white-space:normal; }
    .library-header .header-navigation summary { justify-content:space-between; }
}
@media(max-width:540px) {
    .library-header .header-brand-text { display:none; }
    .library-header .brand-mark { flex:0 0 34px; width:34px; height:40px; font-size:26px; }
    .library-header { column-gap:8px; }
}
/* Swatch detail actions: consistent columns and no inherited panel/form offsets. */
.swatch-detail .detail-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:stretch; }
.swatch-detail .detail-actions > .button { min-width:0; width:100%; text-align:center; white-space:normal; }
.swatch-detail .detail-actions > a:not(.button) { grid-column:1/-1; }
.swatch-detail .selection-tray > .selection-control,
.swatch-detail .panel.selection-tray > .button { margin:0; }
@media(max-width:480px) {
    .swatch-detail .detail-actions { grid-template-columns:minmax(0,1fr); }
    .swatch-detail .selection-tray { align-items:stretch; }
    .swatch-detail .selection-tray > .selection-control,
    .swatch-detail .selection-tray > .button { flex:1 1 100%; }
    .swatch-detail .selection-tray .button { width:100%; }
}

/* Family identity and origin only; Composition retains its existing presentation. */
.panel dl.family-detail-facts { display:grid; grid-template-columns:minmax(160px,30%) minmax(0,1fr); column-gap:24px; }
.panel dl.family-detail-facts > dt,.panel dl.family-detail-facts > dd { margin:0; padding:12px 0; border-bottom:1px solid var(--line); overflow-wrap:anywhere; }
.panel dl.family-detail-facts > dt::after { content:':'; }
.panel dl.family-detail-facts > dd > p { margin:6px 0 0; }
@media(max-width:640px) {
    .panel dl.family-detail-facts { grid-template-columns:minmax(0,42%) minmax(0,1fr); column-gap:14px; font-size:14px; }
}
/* Enclosed table treatment for Family identity/origin grids only. */
.panel dl.family-detail-facts { border:1px solid #bcc7bd; column-gap:0; }
.panel dl.family-detail-facts > dt,.panel dl.family-detail-facts > dd { padding:12px 16px; border-bottom:1px solid #bcc7bd; }
.panel dl.family-detail-facts > dt { background:#f3f5f0; border-right:1px solid #bcc7bd; }
.panel dl.family-detail-facts > dt:nth-last-child(2),.panel dl.family-detail-facts > dd:last-child { border-bottom:0; }
@media(max-width:640px) {
    .panel dl.family-detail-facts > dt,.panel dl.family-detail-facts > dd { padding:10px; }
}
/* Guided entry choice emphasis only. */
.entry-start > fieldset > legend { font-size:20px; font-weight:700; }
.entry-start > fieldset > label.source-checkbox { font-weight:700; }
/* Directory record names should visibly invite opening their details. */
.record-link { display:inline-block; padding:7px 11px; border:1px solid #ccdacd; border-radius:6px; background:#edf3eb; color:var(--accent); font-weight:600; line-height:1.5; text-decoration:underline; text-underline-offset:3px; overflow-wrap:anywhere; }
.record-link:hover { background:#dfeadd; border-color:#a5bba8; color:#173d2b; }
.record-link:focus-visible { background:#dfeadd; }
/* Saved Swatch identity remains visible throughout guided entry. */
.entry-step-heading { justify-content:flex-start; align-items:flex-start; gap:16px; margin-bottom:12px; }
.entry-step-heading h1 { margin-bottom:6px; }
.entry-step-heading + .entry-progress { margin-top:0; margin-bottom:12px; }
.entry-step-heading > div:not(.entry-step-photo) { flex:1; min-width:0; }
.entry-step-heading > .entry-step-photo { order:1; margin-left:auto; }
.entry-step-photo { flex:0 0 112px; width:112px; height:112px; display:flex; align-items:center; justify-content:center; border:1px solid var(--line); border-radius:8px; background:var(--white); overflow:hidden; }
.entry-step-photo img { display:block; width:100%; height:100%; object-fit:contain; }
.entry-step-photo span { padding:8px; text-align:center; font-size:12px; color:var(--muted); }
@media(max-width:640px) {
    .entry-step-heading { flex-wrap:nowrap; gap:14px; }
    .entry-step-photo { flex-basis:80px; width:80px; height:80px; }
}
/* One guided creation entry, clearly separated from saved Drafts. */
.entry-start-choices > label.source-checkbox { padding:18px; margin:12px 0; border:1px solid var(--line); border-radius:8px; min-height:72px; background:var(--white); }
.entry-start-choices > label.source-checkbox:has(input:checked) { border-color:var(--accent); background:#edf3eb; }
.entry-start-choices small { display:block; margin-top:6px; color:var(--muted); font-weight:400; }
.entry-family-switch { margin:24px 0; }
.entry-family-switch summary { cursor:pointer; display:list-item; color:var(--accent); font-weight:600; }
.entry-family-search { display:flex; flex-wrap:wrap; gap:12px; margin:20px 0; }
.entry-family-search label { flex-basis:100%; }
.entry-family-search input { flex:1; min-width:180px; width:auto; }
.entry-family-result { display:flex; flex-wrap:wrap; gap:16px; justify-content:space-between; align-items:center; padding:16px 0; border-bottom:1px solid var(--line); }
.entry-family-result > div { min-width:0; flex:1 1 260px; overflow-wrap:anywhere; }
.entry-family-result p { margin:5px 0 0; }
.entry-family-review { margin-top:24px; padding:20px; border:1px solid var(--line); border-radius:8px; background:#f3f5f0; }
.entry-family-review form { margin-top:20px; }
@media(max-width:640px) { .entry-family-review { padding:14px; } .entry-family-search input { min-width:0; flex-basis:100%; } }

.entry-start [data-existing-family-choices][hidden] { display:none; }
/* Shared validation feedback: controls, confirmation labels and grouped inputs. */
[aria-invalid="true"]{border:2px solid #b42318!important;outline-offset:3px;scroll-margin-block:7rem}
.validation-invalid-group{border:2px solid #b42318!important;border-radius:6px;padding:10px;scroll-margin-block:7rem}
.field-error{color:#b42318;scroll-margin-block:7rem}
.notice.error a{color:inherit;text-decoration:underline}
.reference-results { flex-basis:100%; display:flex; flex-wrap:wrap; gap:8px; }
.reference-results .reference-result { margin-left:0; white-space:normal; text-align:left; overflow-wrap:anywhere; }
.family-reference-tools[aria-busy="true"] .reference-feedback { font-style:italic; }

.reference-results[hidden] { display:none; }

#collection-search-status.collection-search-empty { color:#b42318; font-weight:700; }

#directory-search-status.directory-search-empty { color:#b42318; font-weight:700; }
.reference-results .reference-result-swatch { padding:5px; display:inline-flex; align-items:center; gap:12px; max-width:100%; }
.suggestion-photo { display:grid; place-items:center; flex:0 0 52px; width:52px; height:52px; overflow:hidden; border:1px solid var(--line); border-radius:5px; background:#f3f5f0; }
.suggestion-photo img { display:block; width:52px; height:52px; object-fit:cover; }
.suggestion-photo [hidden] { display:none; }
.suggestion-photo-empty { font-size:10px; line-height:1.2; color:var(--muted); text-align:center; }
.suggestion-label { min-width:0; overflow-wrap:anywhere; }
/* Compact metadata in Visual Library photo cards. */
.visual-library-card, .visual-library-card h2, .visual-library-card .button, .visual-library-card .source-checkbox, .visual-library-card .visual-composition { font-size:13px; }
.panel.visual-library-card dl.family-detail-facts { grid-template-columns:minmax(0,40%) minmax(0,60%); font-size:13px; }
.panel.visual-library-card dl.family-detail-facts > dt, .panel.visual-library-card dl.family-detail-facts > dd { padding:6px 8px; }
/* Collections search: bounded input and content-width button on one row. */
form[data-collection-search] { display:grid; grid-template-columns:minmax(0,400px) max-content; justify-content:start; align-items:center; gap:10px; }
form[data-collection-search] > label, form[data-collection-search] > [role="status"], form[data-collection-search] > [data-collection-suggestions] { grid-column:1 / -1; }
form[data-collection-search] > input[name="q"] { min-width:0; width:100%; }
form.panel.form-stack[data-collection-search] > .button { width:auto; margin:0; justify-self:start; white-space:nowrap; }
form[data-collection-search] > [role="status"] { margin:0; }
form[data-collection-search] > [role="status"]:empty { display:none; }
@media(max-width:600px) { form[data-collection-search] { grid-template-columns:minmax(0,1fr) max-content; } }
/* Physical Storage: wider dropdown, adjacent search button and descendants option below. */
form.storage-search-row { display:grid; grid-template-columns:minmax(0,520px) max-content; align-items:center; justify-content:start; gap:10px 16px; }
form.storage-search-row > label[for="browse-location"] { grid-column:1 / -1; margin:0; }
form.storage-search-row > select { grid-column:1; grid-row:2; min-width:0; width:100%; }
form.storage-search-row > .source-checkbox { grid-column:1 / -1; grid-row:3; margin:0; }
form.panel.form-stack.storage-search-row > .button { grid-column:2; grid-row:2; width:auto; margin:0; white-space:nowrap; justify-self:start; }
@media(max-width:900px) {
    form.storage-search-row { grid-template-columns:minmax(0,520px) max-content; }
    form.panel.form-stack.storage-search-row > .button { grid-column:2; }
    form.storage-search-row > .source-checkbox { grid-column:1 / -1; grid-row:3; }
}
@media(max-width:480px) {
    form.storage-search-row { column-gap:8px; grid-template-columns:minmax(0,1fr) max-content; }
    form.panel.form-stack.storage-search-row > .button { padding:12px 8px; font-size:13px; }
}
/* Medium-weight inactive navigation; preserve existing active-page emphasis. */
.library-header .header-navigation a:not([aria-current]), .library-header summary:not(.section-active), .library-header .header-panel button { font-weight:500; }
/* Administration hub: grouped, readable navigation tables. */
.admin-hub { max-width:1080px; }
.admin-hub-panel { margin-top:24px; padding:24px; }
.admin-group-heading h2 { margin:0 0 4px; font-size:19px; }
.admin-group-heading p { margin:0 0 20px; color:var(--muted); font-size:13px; }
.admin-hub-table { table-layout:fixed; border:1px solid var(--line); }
.admin-hub-table th,.admin-hub-table td { min-width:0; padding:14px 16px; vertical-align:middle; }
.admin-hub-table thead th { background:#304b42; color:#fff; font-size:11px; letter-spacing:.05em; text-transform:uppercase; }
.admin-hub-table th:first-child { width:30%; padding-left:16px; }
.admin-hub-table th:last-child { width:96px; }
.admin-hub-table tbody th { background:#f8f9f5; color:var(--ink); font-size:14px; font-weight:600; }
.admin-hub-table .admin-tool-description { font-size:13px; color:var(--muted); }
.admin-tool-action { text-align:right; }
.admin-tool-link { display:inline-flex; align-items:center; gap:8px; min-height:40px; font-size:13px; font-weight:600; text-decoration:none; }
.admin-tool-link:hover { text-decoration:underline; }
@media(max-width:640px) {
    .admin-hub-panel { padding:16px; }
    .admin-hub-table,.admin-hub-table tbody { display:block; width:100%; }
    .admin-hub-table thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); }
    .admin-hub-table tbody tr { display:grid; grid-template-columns:minmax(0,1fr) auto; }
    .admin-hub-table tbody th:first-child { grid-column:1; grid-row:1; width:auto; padding:12px; border-bottom:0; }
    .admin-hub-table .admin-tool-action { grid-column:2; grid-row:1; padding:4px 12px; background:#f8f9f5; border-bottom:0; }
    .admin-hub-table .admin-tool-description { grid-column:1 / -1; padding:8px 12px 14px; }
    .admin-hub-table tbody tr:last-child td { border-bottom:0; }
}

.required-indicator { color:#b42318; font-weight:700; }

/* Compact guided-entry start spacing. */
.entry-start.panel { padding:20px; gap:12px; }
.entry-start .entry-start-choices { margin:0; padding:12px; }
.entry-start-choices > label.source-checkbox { padding:12px; margin:8px 0; min-height:0; }
.entry-start > .notice { margin:0; padding:12px 14px; }
.entry-start > .button { justify-self:start; width:auto; margin:0; }
.entry-start + .panel { padding:20px; }
.entry-start + .panel h2 { margin:0 0 12px; }
.entry-start + .panel .entry-resume-row { margin:8px 0 0; }

/* Add Swatch start: compact outer layout and choice groups. */
.page:has(> .entry-start) { padding-top:24px; padding-bottom:28px; }
.page:has(> .entry-start) > .page-heading { margin-bottom:16px; }
.entry-start.panel { padding:14px; gap:10px; }
.entry-start .entry-start-choices { border:0; padding:0; }
.entry-start > fieldset > legend { font-size:16px; padding:0; margin-bottom:4px; }
.entry-start-choices > label.source-checkbox { padding:10px; margin:6px 0; }
.entry-start-choices > label.source-checkbox > span > strong { font-size:20px; font-weight:600; }
.entry-start-choices small { margin-top:2px!important; }
.entry-start > .notice { padding:10px 12px; font-size:13px; }
.entry-start.panel > .button { margin:0; }
.entry-start + .panel { padding:14px; margin-top:12px; }
.entry-start + .panel h2 { font-size:18px; margin-bottom:8px; }
.entry-start + .panel .entry-resume-row { margin:0; gap:12px; }
.entry-start .source-checkbox > .required-indicator { display:none; }
.entry-start .source-checkbox:has(> .required-indicator) strong::after { content:' *'; color:#b42318; font-weight:700; }

.sources-directory-table thead th { background:#304b42; color:#fff; padding-left:16px; padding-right:16px; }


/* Form controls show keyboard focus through a darkened border. */
input:focus-visible, select:focus-visible, textarea:focus-visible, [role=combobox]:focus-visible, [role=listbox]:focus-visible { outline:none; outline-offset:0; border-color:#244f40; }

/* Button-style links retain their button appearance without underlines. */
a.button, a.button:hover, a.button:focus, a.button:focus-visible, a.record-link, a.record-link:hover, a.record-link:focus, a.record-link:focus-visible { text-decoration:none; }

/* Consistent guided-entry action sizes and wrapping. */
.entry-actions { display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin-top:16px; }
.entry-actions > .button { display:inline-flex; align-items:center; justify-content:center; min-height:42px; padding:10px 16px; margin:0!important; width:auto; font-size:13px; line-height:20px; white-space:normal; text-align:center; }
#simple-entry-form > .entry-actions { padding-top:16px; border-top:1px solid var(--line); }
@media(max-width:480px) { .entry-actions > .button { flex:1 1 140px; } }

/* Match step navigation to guided action controls. */
.entry-progress { gap:10px; margin:16px 0; }
.entry-progress > a { display:inline-flex; align-items:center; justify-content:center; min-height:42px; padding:10px 16px; margin:0; font-size:13px; line-height:20px; text-align:center; }
@media(max-width:600px) { .entry-progress > a { flex:1 1 calc(50% - 10px); } }

/* Saved Draft rows on Add Swatch start. */
.entry-start + .panel .entry-resume-row { display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-start; gap:10px; margin:0; padding:10px 0; }
.entry-start + .panel .entry-resume-row + .entry-resume-row { border-top:1px solid var(--line); }
.entry-start + .panel .entry-resume-row > a { min-width:90px; margin:0; font-size:14px; }
.entry-start + .panel .entry-resume-row > .button { flex:0 0 auto; width:auto; min-height:38px; padding:8px 14px; margin:0; font-size:13px; line-height:20px; }

.entry-format-switch { margin-top:20px; }
.entry-simple-format-switch { margin-top:15px; }
.panel:not(.family-lookup-controls):not(.form-actions) > .button {
    margin-bottom: 0;
}
/* Existing recoverable deletion actions. */
a.delete-action, summary.delete-action, .button.delete-action { color: #b91c1c; }
.button.delete-action { background: #fff; border: 1px solid #b91c1c; }
a.delete-action:hover, .button.delete-action:hover { color: #991b1b; background: #fef2f2; }

.delete-action { color: #b91c1c; }

/* Master actions share one baseline and consistent control sizes. */
.master-row-actions { display:flex; align-items:center; gap:8px; }
.master-row-actions > a,
.master-row-actions .button { display:inline-flex; align-items:center; justify-content:center; box-sizing:border-box; min-height:34px; padding:7px 12px; margin:0; font-size:13px; font-weight:600; line-height:18px; border-radius:5px; text-decoration:none; white-space:nowrap; }
.master-row-actions > a { border:1px solid var(--line); background:#fff; color:var(--accent); }
.master-row-actions > a:hover { background:#f1f4ef; }
.row-actions .master-row-actions > a + a { margin-left:0; }
.master-delete-form { margin:0; }
.master-row-actions .master-delete-form { display:inline-flex; flex:0 0 auto; }
