/* Foundation */
:root {
  color-scheme: light;
  --ink: #212831; --muted: #566575; --subtle: #718091;
  --paper: #fff; --canvas: #fafbfc; --rail: #f1f3f5; --head: #edf1f5;
  --line: #dce2e8; --edge: #bac6d1; --selection: #eaf2fb;
  --accent: #326aa5; --accent-hover: #255789; --tint: #e2edf8;
  --green: #21684a; --red: #a83d42; --amber: #c18312;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px;
  --radius: 5px; --card-radius: 9px;
  --shadow: 0 8px 28px #192c4024, 0 1px 4px #192c4012;
  --sans: "Segoe UI", system-ui, sans-serif; --mono: Consolas, "SFMono-Regular", monospace;
  font: 14px/1.45 var(--sans); color: var(--ink); background: var(--canvas);
  font-variant-numeric: tabular-nums;
}
* { box-sizing: border-box }
[hidden] { display: none !important }
body { margin: 0 auto; width: min(100%, 1920px); height: 100dvh }
button, input, select, textarea { font: inherit; color: inherit }
button, #profile summary {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 32px; padding: 4px 11px; border: 1px solid var(--edge);
  border-radius: var(--radius); background: var(--paper); cursor: pointer; line-height: 1.25;
}
button:hover:enabled, #profile summary:hover { background: var(--head) }
button.primary { background: var(--accent); color: white; border-color: var(--accent) }
button.primary:hover:enabled { background: var(--accent-hover) }
button:disabled { opacity: .53; cursor: default }
input:not([type="checkbox"]), select, textarea {
  min-width: 0; padding: 6px 9px; border: 1px solid var(--edge);
  border-radius: var(--radius); background: var(--paper);
}
input[type="checkbox"] { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); vertical-align: middle }
textarea { resize: vertical; min-height: 60px }
:focus-visible { outline: 2px solid #3574b5; outline-offset: 2px }
h1:focus { outline: none }
h1, h2, h3, p, ol, ul { margin: 0 }
h1 { font-size: clamp(24px, 2vw, 33px); line-height: 1.2; font-weight: 620; letter-spacing: -.032em }
h2 { font-size: 16px; font-weight: 640 }
h3 { font-size: 14px }
small { font-size: 12px; color: var(--muted) }
summary { cursor: pointer }
.symbol-library { position: absolute; pointer-events: none }
.icon { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round }

/* Window and navigation */
body:has(#sidebar:not([hidden])) {
  display: grid; grid-template: 51px minmax(0, 1fr) / clamp(174px, 18vw, 336px) minmax(0, 1fr);
  border-inline: 1px solid var(--line); background: var(--paper);
}
header { grid-column: 1/-1; display: flex; align-items: center; justify-content: space-between; padding-inline: var(--s5); background: var(--canvas); border-block: 1px solid var(--line); position: relative; z-index: 4 }
.brand { display: inline-flex; align-items: center; gap: 9px; font-size: 18px; font-weight: 650; letter-spacing: -.03em }
.brand .icon { width: 24px; height: 24px; color: var(--amber) }
#profile { position: relative }
#profile summary { list-style: none; border-color: transparent; background: transparent }
#profile summary::-webkit-details-marker { display: none }
#profile .icon { width: 15px; height: 15px }
#profile[open] .icon { transform: rotate(180deg) }
#profile > div, #carActions, .diff-preview { border: 1px solid var(--edge); border-radius: var(--card-radius); background: var(--paper); box-shadow: var(--shadow) }
#profile > div { position: absolute; top: calc(100% + 4px); right: 0; width: max-content; min-width: 185px; max-width: 320px; padding: var(--s1) }
#signedAs { display: block; overflow-wrap: anywhere; padding: var(--s2) }
#profile button, #carActions button { width: 100%; border: 0; justify-content: start }
#logout { border-top: 1px solid var(--line) }
#sidebar { min-height: 0; overflow: auto; padding: var(--s4) var(--s2); background: var(--rail); border-right: 1px solid var(--line) }
#sidebar button { justify-content: start; width: 100%; background: transparent; border-color: transparent; min-height: clamp(36px, 3.8vh, 44px); text-align: left; gap: 9px; padding-inline: 9px }
#sidebar button:hover { background: #e6eaee }
#sidebar button[aria-pressed="true"], #sidebar button[aria-current="true"] { background: #dce6f0; color: #203951; box-shadow: inset 2px 0 var(--accent) }
#sidebar .icon { color: var(--muted) }
.nav-heading { display: flex; align-items: center; margin-bottom: var(--s1) }
#productsNav { font-weight: 610 }
#sidebar :is(#toggleProducts,#toggleConfig) { width: 29px; min-height: 28px; padding: 0; justify-content: center }
:is(#toggleProducts,#toggleConfig)[aria-expanded="false"] .icon { transform: rotate(-90deg) }
#sidebar #groups button { padding-left: 19px }
#groups span { min-width: 0; overflow-wrap: anywhere }
#groups small { margin-left: auto }
#sidebar hr { margin: var(--s3) var(--s2); border: 0; border-top: 1px solid var(--line) }

/* Catalog */
main { min-width: 0; min-height: 0; display: flex; flex-direction: column; padding: clamp(14px, 1.8vw, 32px); padding-bottom: 0 }
#catalog { display: flex; flex-direction: column; flex: 1; min-height: 0 }
#catalog.dragging { outline: 2px dashed var(--accent); outline-offset: -2px; background: #f5faff }
.heading, .list-heading, .tools, #batch { display: flex; align-items: center; gap: var(--s2) }
.heading { justify-content: space-between; margin-bottom: var(--s5) }
.list-heading { margin-bottom: var(--s2); min-height: 30px }
.list-heading h2 { margin-right: auto; white-space: nowrap }
#carCount { font-weight: 400 }
#drop { font-size: 12px; color: var(--muted) }
#refresh { min-height: 27px; padding: 3px 8px; font-size: 12px }
#refresh .icon { width: 14px; height: 14px }
.table-scroll { flex: 1; min-height: 0; overflow: auto; scrollbar-color: #b8c3cc transparent; scrollbar-width: thin }
table { table-layout: fixed; width: 100%; border-spacing: 0; font-size: clamp(13px, .85vw, 15px) }
th, td { text-align: left; vertical-align: middle; padding: 5px clamp(5px,.65vw,12px); border-bottom: 1px solid var(--line) }
th { position: sticky; top: 0; z-index: 1; height: 32px; background: var(--head); color: var(--muted); font-size: 12px; font-weight: 590; white-space: nowrap }
td { height: clamp(33px, 3.6vh, 40px) }
th:has(input), td:has(input[type="checkbox"]), td:last-child { width: 32px; text-align: center }
tbody tr:hover { background: #f6f8fa }
tr.selected { background: var(--selection) }
tr.selected:hover { background: #e3eef9 }
tr.selected td:first-child { box-shadow: inset 2px 0 var(--accent) }
.car-name { font: 400 clamp(13px, .85vw, 16px)/1.4 var(--mono); color: var(--ink); overflow-wrap: anywhere }
.version, td:has(.version) { color: var(--accent) }
input.version { width: 72px; padding: 3px 6px; font: 600 13px/1.35 var(--mono); color: var(--accent); border-color: #bfd0e0 }
td.working { color: var(--accent); font-family: var(--mono) }
.property, .status-pill { display: inline-block; white-space: nowrap; padding: 2px 6px; border-radius: 4px; line-height: 1.35; font-size: 11px; font-weight: 550 }
.property { margin: 1px 3px 1px 0; background: #f0edf6; color: #645080 }
.experimental { background: #f7efdf; color: #785719 }
.status-pill { background: var(--head); color: var(--muted) }
.status-pill[data-tone="published"] { background: #edf2ef; color: #496455 }
.status-pill[data-tone="active"] { background: var(--tint); color: #365d83 }
.status-pill[data-tone="warning"] { background: #fbece5; color: #944a32 }
.changes, .more { padding: 2px 5px; min-height: 25px; background: transparent; border-color: transparent }
.changes { font: 600 12px var(--mono); gap: 5px }
.added { color: var(--green) }
.modified { color: var(--accent) }
.removed { color: var(--red) }
.more { width: 27px; line-height: 1; font-size: 18px; color: var(--muted) }
#empty { color: var(--muted); padding: var(--s4) }
#carActions { inset: auto; margin: 0; min-width: 155px; padding: var(--s1) }
.diff-preview { position: fixed; width: max-content; max-width: min(480px, 92vw); overflow-wrap: anywhere; padding: var(--s2) var(--s3); pointer-events: none; z-index: 8; font: 12px/1.65 var(--mono) }
#batch { flex: none; min-height: 53px; border-block: 1px solid var(--line); background: var(--canvas); padding: var(--s2) var(--s3) }
#batchCount { margin-right: auto; font-weight: 550; white-space: nowrap }
#activity { height: 58px; flex: none; display: flex; align-items: center; gap: var(--s2); font-size: 12px; color: var(--muted) }
#steps { display: flex; gap: var(--s2); padding: 0; list-style: none; white-space: nowrap }
#steps li + li::before { content: "·"; color: var(--edge); margin-right: var(--s2) }
#steps [aria-current] { color: var(--accent); font-weight: 650 }
#steps.failed [aria-current] { color: var(--red) }
#scan, #status { min-width: 0; white-space: nowrap; text-overflow: ellipsis; overflow: hidden }
#scan:empty, #status:empty { display: none }
#readActivity { margin-left: auto }
#steps:not([hidden]) + #scan:not(:empty) { border-left: 1px solid var(--line); padding-left: var(--s2) }
#activity button { min-height: 24px; padding: 2px 7px; font-size: 12px }

/* Secondary workspaces */
#overview { flex: 1; min-height: 0; overflow: auto; scrollbar-gutter: stable; padding: 1px 8px 20px 6px }
#overview > * { max-width: 960px }
#overviewBody { display: grid; align-content: start; gap: var(--s3) }
#overviewBody > button:not(.product-link) { justify-self: start }
.operation-section, #overviewBody > details, .product-link {
  border: 1px solid var(--line); border-radius: var(--card-radius); background: var(--paper);
}
.operation-section { display: grid; gap: var(--s3); padding: var(--s4) var(--s5); align-items: start }
.operation-section > button, .operation-section form button { justify-self: start }
.operation-section h2 { border-bottom: 1px solid var(--line); padding-bottom: 9px }
.record { padding-block: 6px; overflow-wrap: anywhere }
.record strong, .record small { display: block }
.record small { margin-top: 2px; white-space: pre-line }
.record + .record { border-top: 1px solid var(--line) }
.product-link { justify-content: start; min-height: 48px; gap: var(--s3); padding-inline: var(--s4); font-weight: 600 }
.product-link small { margin-left: auto; font-weight: 400 }
.product-link span { color: var(--muted) }
#overviewBody summary { padding: var(--s3) var(--s4); font-weight: 560 }
#overviewBody details > :not(summary) { margin-inline: var(--s4) }
#overviewBody details[open] { padding-bottom: var(--s2) }
#overviewBody details details { border-top: 1px solid var(--line) }
#overviewBody details details summary { padding-block: 7px; font: 13px var(--mono) }
.operation-section form, dialog form:not([method="dialog"]) { display: grid; align-content: start; gap: 6px }
.operation-section label, dialog label { display: block; color: var(--muted); font-size: 13px; font-weight: 550 }
.operation-section label > :is(input, select, textarea), dialog label > :is(select,input:not([type="checkbox"])) { display: block; width: 100%; margin-top: var(--s1) }
.file-picker { display: flex; align-items: center; gap: var(--s3); position: relative; margin-top: var(--s1); min-height: 34px; padding-right: var(--s2); border: 1px solid var(--edge); border-radius: var(--radius); background: var(--canvas); font-weight: 400 }
.file-picker span:first-child { padding: 7px 10px; border-right: 1px solid var(--line); color: var(--ink) }
.file-picker span:nth-child(2) { overflow-wrap: anywhere }
.file-picker input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer }
.file-picker:has(:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px }
.operation-section output { font-size: 13px; color: var(--muted) }

th.col-published, th.col-working { width: clamp(72px,6vw,100px) }
th.col-properties { width: clamp(130px,11vw,175px) }
th.col-changes { width: clamp(72px,7vw,104px) }
th.col-status { width: clamp(113px,10vw,152px) }
th:last-child { width: 38px }
#sidebar .dependent { margin-inline-start: 12px }
#sidebar #groups .dependent button { font-size: 12px }
#sidebar #groups .dependent .icon { width: 14px; height: 14px }
#configLinks button { padding-inline-start: 28px }
#outside { padding: var(--s2); background: var(--tint); display:flex; gap:var(--s2); align-items:center }
#outside span { flex:1; overflow:auto; max-height:5em; overflow-wrap:anywhere }
#workBand { height:30px; flex:none; display:grid; grid-template-columns:auto minmax(48px,1fr) auto; gap:12px; align-items:center; padding-inline:10px; color:var(--accent-hover); background:#f2f6fa }
#workBand:not([hidden]) + #activity { height:28px }
#workLabel { max-width:min(54vw,720px); font-size:13px; font-weight:600; overflow:hidden; white-space:nowrap; text-overflow:ellipsis }
#workValue { min-width:4ch; text-align:right; font-variant-numeric:tabular-nums }
#workProgress { width:100%; height:8px; appearance:none; overflow:hidden; border:0; border-radius:6px; background:#dce4ec }
#workProgress::-webkit-progress-bar { background:#dce4ec }
#workProgress::-webkit-progress-value { border-radius:6px; background:var(--accent) }
#workProgress:indeterminate::-webkit-progress-bar { background:linear-gradient(90deg,#dce4ec 0 32%,#769cc2 44%,var(--accent) 50%,#769cc2 56%,#dce4ec 68%) 0 / 220% 100%; animation:work-sweep 1.8s ease-in-out infinite alternate }
@keyframes work-sweep { to { background-position:100% } }
@media (prefers-reduced-motion:reduce) { #workProgress:indeterminate::-webkit-progress-bar { animation:none; background-position:50% } }
.is-working::before { content:""; display:inline-block; width:.85em; height:.85em; border:1.5px solid currentColor; border-right-color:transparent; border-radius:50%; margin-right:.4em; animation:turn .8s linear infinite; vertical-align:-.1em }
@keyframes turn { to { transform:rotate(1turn) } }
@media(prefers-reduced-motion:reduce){ .is-working::before { animation-duration:2.5s } }
#sendBatch.is-working .icon { display:none }
#operation { width:min(700px,94vw) }
#carsPublishing { display:flex; flex:1; flex-direction:column; min-height:0 }
#productInfo { flex:1; min-height:0; overflow:auto; padding:2px 4px 10px }
#productFolders li { padding-block:2px; display:flex; justify-content:space-between; align-items:center }
#productForm .field-pair { align-items:start; gap:16px }
#productForm .field-pair label { margin:0 }
#productForm small { display:block; margin-top:4px; font-weight:400 }
#operationText { margin:0; padding:0; list-style:none }
#operationText li { display:grid; grid-template-columns:65px 95px 1fr; gap:8px; border-bottom:1px solid var(--line) }
#operationText time { font-variant-numeric:tabular-nums }
#archiveSearch { width:min(100%,520px); margin-bottom:var(--s3) }
#team { max-width:960px }
#team form { max-width:500px }
#team ul { padding:0; list-style:none }
#team h3 { margin-top:var(--s4) }
.storage-meter { display:block; width:100%; accent-color:var(--accent); margin:8px 0 }
#decisionBanner { flex:none; display:flex; align-items:flex-start; gap:10px; padding:12px 20px; border-block:1px solid #e4af84; border-left:4px solid #af511f; color:#742f10; background:#fff0df; font-weight:600 }
#decisionBanner .icon { margin-top:1px; width:20px; height:20px }
#decisionBanner.test-channel { background:#edf5fc; color:#244f77; border-color:#b3cade; border-left-color:#5184ac }
.publish-versions { margin-block:14px; border-block:1px solid var(--line) }
.publish-versions li { display:flex; align-items:baseline; justify-content:space-between; gap:10px; font:13px/1.5 var(--mono) }
.publish-versions li + li { border-top:1px solid var(--line) }
.publish-versions strong { flex:none }
.kv-list { display:grid; grid-template-columns:minmax(130px,32%) minmax(0,1fr); margin:0; align-items:baseline; font-size:13px }
.kv-list dt, .kv-list dd { align-self:stretch; margin:0; padding:8px 0; border-bottom:1px solid var(--line); overflow-wrap:anywhere }
.kv-list dt { padding-right:14px; color:var(--muted) }
.kv-list dt:last-of-type, .kv-list dd:last-child { border:0 }
.setting-pill { display:inline-block; padding:1px 8px; border-radius:20px; background:#edf1f5; color:#495a69; font-size:12px; font-weight:600 }
.setting-pill.good { background:#e3f2e9; color:#23623f }
.setting-pill.issue { background:#fae8e2; color:#8c3927 }
.certificate-pin { display:flex; align-items:baseline; gap:8px; flex-wrap:wrap; font-family:var(--mono) }
.certificate-pin .setting-pill { font-family:var(--sans) }
.operation-section .storage-profile { grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px 18px; padding-block:8px }
.storage-profile small { display:block; margin-top:4px; font-weight:400 }
.profile-mode { display:flex; align-items:baseline; flex-wrap:wrap; gap:8px }
.storage-profile button, .storage-profile .profile-prefix { grid-column:1/-1 }
#publishNotes { width:100%; min-height:4em }

.storage-toolbar,.storage-usage,.storage-path,.storage-modes { display:flex;align-items:center;gap:8px }
.storage-toolbar,.storage-usage { justify-content:space-between;gap:16px }
.storage-modes { gap:2px;padding:3px;border-radius:6px;background:var(--canvas);border:1px solid var(--line) }
.storage-modes button { border-color:transparent;background:transparent;min-height:30px }
.storage-modes [aria-pressed="true"] { background:var(--paper);border-color:var(--edge);color:var(--accent);font-weight:650 }
.storage-usage { font-variant-numeric:tabular-nums }
.storage-usage span,.storage-path > span { color:var(--muted) }
#config-retention .storage-meter { height:10px;margin:7px 0 15px }
#config-retention details { border-top:1px solid var(--line) }
#config-retention details > :not(summary) { margin-inline:0 }
#config-retention summary { padding:9px 0 }
#config-retention details > button { margin-top:8px }
.storage-table { width:100%;font-size:13px;table-layout:fixed }
.storage-table :is(th,td) { padding:6px 8px;text-align:right;vertical-align:middle;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-variant-numeric:tabular-nums }
.storage-table th { position:static }
.storage-table th:first-child { width:auto }
.storage-table :is(th,td):first-child { text-align:left }
.storage-table th:nth-child(2) { width:12% }
.storage-table th:nth-child(3) { width:12% }
.storage-table th:nth-child(4) { width:154px }
.explorer-table th:last-child { width:98px }
.storage-path { margin:14px 0 10px;flex-wrap:wrap;font-size:13px }
.storage-path button,.storage-folder,.admin-modules h2 button { min-height:0;border:0;padding:2px 0;background:transparent;color:var(--accent);font:inherit }
.storage-folder { max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle;font-weight:600 }
.storage-folder .icon { width:15px;height:15px;vertical-align:-3px;margin-right:6px }
.storage-folder:hover,.storage-path button:hover,.admin-modules h2 button:hover { text-decoration:underline }
.retention-badge { display:inline-block;padding:1px 7px;border-radius:4px;background:var(--canvas);color:var(--muted);font-size:12px }
.retention-badge[data-status="Active"] { background:#e3f2e9;color:#23623f }
.retention-badge[data-status="Removable"] { background:#fff0df;color:#794916 }
.admin-modules { border:1px solid var(--line);border-radius:var(--card-radius);background:var(--paper) }
.admin-modules section { display:flex;align-items:center;justify-content:space-between;gap:20px;padding:14px 20px }
.admin-modules section + section { border-top:1px solid var(--line) }
.admin-modules h2 { font-size:15px }
.admin-modules p { margin:3px 0 0;color:var(--muted);font-size:13px }
.admin-modules .setting-pill { flex:none }

/* Dialogs: scroll the content independently of the action row. */
dialog { width: min(520px, calc(100vw - 32px)); max-height: min(86dvh, 780px); margin: auto; padding: 0; border: 1px solid var(--edge); border-radius: 10px; color: var(--ink); box-shadow: var(--shadow); background: var(--paper) }
dialog[open] { display: flex; flex-direction: column }
dialog::backdrop { background: #16263857 }
dialog > h2 { flex: none; padding: var(--s4) var(--s5); font-size: 19px; letter-spacing: -.025em; border-bottom: 1px solid var(--line); overflow-wrap: anywhere }
.dialog-body { min-height: 0; overflow: auto; padding: var(--s4) var(--s5); overflow-wrap: anywhere }
.dialog-body > * + * { margin-top: var(--s3) }
.dialog-body label:not(:first-child) { margin-top: var(--s2) }
dialog footer, dialog footer form { display: flex; justify-content: end; align-items: center; gap: var(--s2) }
dialog footer { flex: none; padding: var(--s3) var(--s5); background: var(--canvas); border-top: 1px solid var(--line) }
dialog ul { list-style: none; padding: 0 }
dialog li { padding: 5px 0 }
dialog fieldset, #transferFolders { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s3); margin: var(--s2) 0 0 }
.field-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: end; gap: var(--s3) }
.field-pair label { margin: 0 }
#productTabs { display:flex; gap:16px; border-bottom:1px solid var(--line); margin:0 0 14px; flex:none }
#catalog > .heading { margin-bottom:10px }
#productTabs button { padding:6px 2px 9px; border:0; border-radius:0; border-bottom:2px solid transparent; color:var(--muted); background:transparent }
#productTabs button[aria-selected=true] { border-bottom-color:var(--accent); color:var(--accent); font-weight:650 }
#productTabs button:focus-visible { outline-offset:-2px }
.product-editor-heading { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:14px }
#productDirty { color:#805716 }
#productForm { display:grid; grid-template-columns:minmax(0, .92fr) minmax(0, 1.25fr); gap:16px; align-items:start }
#productForm fieldset { display:grid; gap:11px; min-width:0; margin:0; padding:12px 16px 16px; border:1px solid var(--line); border-radius:8px }
#productForm legend { padding-inline:5px; font-size:15px; font-weight:650 }
#productForm label { display:block; min-width:0; font-size:13px; font-weight:550; color:var(--muted) }
#productForm label > :is(input:not([type=checkbox]),select) { display:block; margin-top:4px; width:100% }
#productForm .field-pair { grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:12px }
#productForm #roleHint:empty, #productResult:empty { display:none }
#productForm .shared-download + small { margin-top:-8px }
#productResult { grid-column:1/-1 }
#transferFolders { padding:10px 0 0; border:0; border-top:1px solid var(--line); margin:0 }
#transferFolders summary { font-size:13px; font-weight:650 }
#transferFolders[open] > label { margin-block:8px 3px }
#productFolders { list-style:none; padding:0; margin:0; scroll-snap-type:y proximity }
#productFolders li { height:28px; min-width:0; gap:6px; font-size:12px; overflow-wrap:anywhere; scroll-snap-align:start }
#productFolders li span { white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
#productForm .folder-actions { margin: -7px 0 0 }
#sourceFolders { max-height:160px; overflow:auto }
#sourceFolders label { margin:0; padding:6px 0; font-family:var(--mono) }
#productFolders button { min-height:24px; padding:2px 7px; font:12px var(--sans); color:var(--muted); border-color:transparent }
#productFolders button:hover { color:var(--red); border-color:var(--line) }
.folder-actions { display:flex; align-items:stretch; gap:6px; margin-top:4px }
.folder-actions input { flex:1; width:0 }
dialog legend { padding-inline: var(--s1); font-weight: 600 }
#productFolders { max-height:round(down,clamp(140px,calc(100dvh - 415px),560px),28px); overflow-y: auto; font: 12px/1.3 var(--mono) }
#productForm:has(#transferFolders[open]) #productFolders { max-height:round(down,clamp(56px,calc(100dvh - 622px),560px),28px) }
#productFolders li + li, #files li + li, #keys li + li { border-top: 1px solid var(--line) }
#sourceFolders label { display: flex; gap: var(--s2); align-items: center }

#files { width: min(660px, 94vw) }
#files strong { font: 14px var(--mono) }
#files li { display: flex; align-items: baseline; gap: var(--s3); justify-content: space-between; font-family: var(--mono) }
#files li small { flex: none; font-family: var(--sans) }
#decisionBody, #operationText, #inviteCode { white-space: pre-wrap; overflow-wrap: anywhere }
#ownershipPaths label { padding-block: var(--s2) }
#profileForm button, #inviteForm button { justify-self: start }
#team { display:grid; gap:var(--s3) }
#team .operation-section form > input { max-width:28rem; width:100% }
#team .team-table { overflow-x:auto }
#team .team-table table { table-layout:auto; min-width:34rem }
#team .team-table th, #team .team-table td { padding:8px 10px; vertical-align:middle }
#team .team-table th:last-child { width:auto }
#team .key-actions button { margin-inline-end:6px; margin-block:2px }
#team .key-actions form { min-width:12rem }
#config-storage, #config-signing, #config-retention { scroll-margin-top:6px }
dialog output:not(:empty) { display: block; margin-block: 5px }

/* Pairing and authentication */
body:has(#login:not([hidden])) { display: grid; align-items:start; justify-items:center; padding-top:clamp(64px,14vh,140px); max-width: none; width: 100%; overflow: auto; background: #19232c; color: #f1f5f8 }
main:has(#login:not([hidden])) { width:min(408px,calc(100% - 32px)); padding:18px 0 }
#login { text-align:center; padding:28px 28px 20px; border:1px solid #46525d; border-radius:var(--card-radius); background:#202b35 }
.lockup span { display: block; color: #c6d2dc; margin-bottom: 14px }
.lockup img { display: block; max-width: 100%; height: 85px; object-fit: contain; margin: auto }
.lockup h1 { margin: 8px 0 26px }
.lockup h1 img { width: 132px; height: auto }
#signIn { width: 100%; height: 42px; font-weight: 650; border-color: #e4ba48; background: #f4c54b; color: #19232c }
#signIn:hover:enabled { background: #ffd76d }
#first { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid #46525d; text-align: left }
#first summary { display:list-item; text-align:center; color:#d4e0e8; padding:7px 4px; border-radius:var(--radius) }
#first summary:hover { background:#2b3844 }
@media (prefers-reduced-motion:no-preference) {
  #first { interpolate-size:allow-keywords }
  #first::details-content { block-size:0; overflow:clip; transition:block-size 160ms ease-out, content-visibility 160ms allow-discrete }
  #first[open]::details-content { block-size:auto }
}
#register { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap:8px var(--s2); margin-top:var(--s2) }
#register label { grid-column: 1/-1; color: #c8d3dd; font-size: 12px }
#register :is(input,button) { color:var(--ink); min-height:38px }
#register input { min-width:0; width:100% }
main:has(#login:not([hidden])) #activity { height: auto; justify-content: center; color: #e5ecf1; text-align: center }
main:has(#login:not([hidden])) #status { white-space: normal; padding-top: var(--s2) }

/* Keep a complete editable profile in a standard laptop window. */
@media (max-height: 860px) {
  .kv-list dt, .kv-list dd { padding-block:5px }
  .operation-section .storage-profile { row-gap:9px }
}

/* Compact desktop and narrow windows */
@media (max-width: 1100px) {
  body:has(#sidebar:not([hidden])) { grid-template-columns: 160px minmax(0,1fr) }
  main { padding-inline: 12px }
  #sidebar { padding-inline: 4px }
  th, td { padding: 2px 4px }
  #sidebar #groups button { padding-inline: 10px 6px; gap: 6px }
  .heading { margin-bottom: var(--s2) }
  main { padding-top:10px }
  #batch { min-height:45px }
  .car-name { font-size: 12px }
  input.version { width: 59px }
  #batch button { padding-inline: 8px }
}
@media (max-width: 760px) {
  body:has(#sidebar:not([hidden])) { grid-template: auto auto minmax(0,1fr) / minmax(0,1fr) }
  header { min-height: 42px }
  #sidebar { display: flex; align-items: flex-start; gap: 3px; padding: 4px; overflow: auto; border-bottom: 1px solid var(--line) }
  #sidebar button { white-space: nowrap; width: auto }
  #sidebar hr { display: none }
  #groups:not([hidden]) { display: flex }
  main { padding-top: var(--s3) }
  .heading { flex-wrap: wrap; margin-bottom: var(--s3) }
  #drop { display: none }
  #batch { flex-wrap: wrap }
  .operation-section .storage-profile, #productForm .field-pair { grid-template-columns:1fr }
  .folder-actions { flex-wrap:wrap }
  .folder-actions input { min-width:11ch }
  #activity { overflow: auto }
  .car-name { min-width: 160px }
}

#productForm label.shared-download{display:flex;align-items:center;gap:8px;margin:0}#productForm #shareDownloads{width:auto;flex:none}

@media(max-width:760px){#productForm { grid-template-columns:minmax(0,1fr) }}
