/* Admin. Deliberately plain: a quiet working tool, so the brand's own
   guidelines are the only thing here with a visual opinion. */
:root { --bg: #f5f5f3; --card: #fff; --ink: #18181b; --muted: #5f5f64; --line: #e2e2de; --accent: #2f3fd0; --bad: #b3261e; --ok: #17603d; --warn: #8a5a00; --r: 7px; color-scheme: light; }
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p, ul, ol, dl, dd { margin: 0; padding: 0; } ul, ol { list-style: none; }
[hidden] { display: none !important; }
[tabindex="-1"]:focus { outline: none; }
[tabindex="-1"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1 { font-size: 26px; letter-spacing: -0.02em; } h2 { font-size: 20px; letter-spacing: -0.01em; } h3 { font-size: 14px; } h4 { font-size: 13px; margin: 14px 0 6px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); } .error { color: var(--bad); } .ok { color: var(--ok); }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.empty { color: var(--muted); padding: 18px 0; }
.loading { padding: 48px; color: var(--muted); }
.notice { background: #fff6dd; border: 1px solid #ecd9a0; padding: 10px 12px; border-radius: var(--r); margin: 12px 0; }
code { font: 12.5px ui-monospace, Menlo, monospace; background: #ecece8; padding: 5px 8px; border-radius: 5px; overflow-wrap: anywhere; }
code.wrap { flex: 1; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: #b9b9b4; }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover:not(:disabled) { background: #000; }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: none; }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.tool { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 5px; background: none; color: var(--muted); }
.tool:hover:not(:disabled) { background: #ecece8; color: var(--ink); }
.tool:disabled { opacity: 0.3; cursor: default; }
.tools { display: inline-flex; margin-left: auto; flex: none; }
.badge { display: inline-block; padding: 1px 7px; border-radius: 99px; background: #ecece8; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.badge.ok { background: #dff3e7; color: var(--ok); } .badge.bad { background: #fde4e1; color: var(--bad); } .badge.warn { background: #fff0cc; color: var(--warn); }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }
.count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 99px; background: #ecece8; font-size: 11px; text-align: center; color: var(--muted); }
.count.bad { background: var(--bad); color: #fff; }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline > input { flex: 1; min-width: 160px; }

/* Fields */
.fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.field label, .list legend { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 4px; }
input[type=text], input[type=url], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid #8a8a85; border-radius: 6px; background: #fff; }
textarea { resize: vertical; min-height: 64px; line-height: 1.45; }
input.invalid { border-color: var(--bad); background: #fff6f5; }
.field.check { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: center; }
.field.check label { margin: 0; font-weight: 500; } .field.check .hint { grid-column: 2; margin: 0; }
.colour { display: flex; gap: 6px; } .colour input[type=text] { max-width: 130px; font-family: ui-monospace, Menlo, monospace; }
.swatch-input { width: 36px; height: 34px; padding: 2px; border: 1px solid #8a8a85; border-radius: 6px; background: #fff; flex: none; }
.colours { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.colour-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 2px 2px 8px; border: 1px solid var(--line); border-radius: 99px; font: 12px ui-monospace, Menlo, monospace; background: #fff; }
.colour-chip i, .item-swatch { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.15); flex: none; }
.colour-add { display: inline-flex; gap: 4px; } .colour-add input { width: 100px; }
.rich { border: 1px solid #8a8a85; border-radius: 6px; background: #fff; }
.rich:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.rich textarea { border: 0; border-radius: 0 0 6px 6px; display: block; }
.rich textarea:focus-visible { outline: none; }
.rich-preview { margin-top: 6px; padding: 8px 12px; border: 1px dashed #c4c4be; border-radius: 6px; background: #fafaf8; font-size: 13px; }
.rich-preview .prose > * + * { margin-top: 6px; } .rich-preview ul { list-style: disc; padding-left: 18px; } .rich-preview ol { list-style: decimal; padding-left: 18px; }
.rich-preview-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.rt-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-bottom: 1px solid var(--line); background: #fafaf8; border-radius: 6px 6px 0 0; }
.rt { border: 0; background: none; padding: 3px 8px; border-radius: 4px; font-size: 12.5px; width: auto; }
.rt:hover { background: #ecece8; } .rt-b { font-weight: 700; } .rt-i { font-style: italic; font-family: Georgia, serif; }
select.rt { padding: 3px 4px; max-width: 150px; }
.asset-field { display: flex; align-items: center; gap: 10px; padding: 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.asset-thumb { width: 44px; height: 44px; border-radius: 5px; background: #ecece8 linear-gradient(45deg, #dedede 25%, transparent 25% 75%, #dedede 75%) 0 0 / 10px 10px; display: grid; place-items: center; overflow: hidden; font-size: 10px; color: var(--muted); flex: none; }
.asset-thumb img { width: 100%; height: 100%; object-fit: contain; }
.asset-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 12.5px; } .asset-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .asset-meta span { color: var(--muted); }
.focus-inputs { display: flex; gap: 10px; } .focus-inputs .field { width: 110px; }
fieldset.field-focus { border: 0; padding: 0; margin: 0; min-width: 0; } fieldset.field-focus > legend { font-weight: 600; font-size: 12.5px; margin-bottom: 4px; padding: 0; }
.focus-pad { position: relative; display: block; padding: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; max-width: 320px; cursor: crosshair; background: #eee; }
.focus-pad img { display: block; width: 100%; }
.focus-dot { position: absolute; width: 18px; height: 18px; margin: -9px; border-radius: 50%; border: 2px solid #fff; background: var(--accent); box-shadow: 0 0 0 1px rgb(0 0 0 / 0.5); pointer-events: none; }
.focus { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* Lists of repeatable items */
.list { border: 0; padding: 0; margin: 0; min-width: 0; }
.items, .blocks { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin-bottom: 8px; }
.item, .block-card, details.card, details.sub { border: 1px solid var(--line); border-radius: var(--r); background: var(--card); }
details.card > summary, details.sub > summary { display: flex; align-items: center; gap: 8px; padding: 6px 8px; cursor: pointer; list-style: none; min-height: 42px; }
.card-head { display: flex; align-items: center; gap: 6px; padding: 4px 8px 4px 4px; min-height: 42px; }
.disclosure { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px; text-align: left; border-radius: 5px; }
.disclosure > svg { flex: none; transform: rotate(-90deg); transition: transform var(--duration-quick, .15s); color: var(--muted); }
.disclosure[aria-expanded=true] > svg { transform: none; }
.card-body { padding: 12px; border-top: 1px solid var(--line); display: grid; gap: 12px; }
.field-error { color: var(--bad); font-size: 12.5px; margin-top: 4px; }
[aria-invalid=true] { border-color: var(--bad) !important; background: #fff6f5; }
.block-issues { display: grid; gap: 4px; } .block-issues li { padding: 6px 9px; border-radius: 6px; font-size: 13px; background: #fff8e6; } .block-issues li.error { background: #fdebe9; color: var(--bad); }
summary::-webkit-details-marker { display: none; }
details.card > .fields, details.sub > .fields, details.sub > .issues { padding: 12px; border-top: 1px solid var(--line); }
.card-body > .fields { padding: 0; }
.item { background: #fbfbfa; }
.item-title, .block-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.item-thumb { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; flex: none; }
.grip { display: grid; place-items: center; width: 22px; height: 28px; color: #7a7a74; cursor: grab; flex: none; touch-action: none; }
.grip svg { stroke-width: 2.6; }
.dragging { opacity: 0.4; }
.drop-before { box-shadow: 0 -3px 0 -1px var(--accent); } .drop-after { box-shadow: 0 3px 0 -1px var(--accent); }
details.sub { margin: 14px 12px 12px; background: #fafaf8; } details.sub > summary { font-weight: 600; font-size: 12.5px; gap: 10px; } details.sub > summary .muted { font-weight: 400; }
details.card > summary { font-weight: 600; gap: 12px; padding: 10px 14px; } details.card > summary .muted { font-weight: 400; font-size: 12.5px; }
details.card > h3 { padding: 0 12px; margin-top: 4px; }
section.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-top: 14px; display: grid; gap: 12px; }
.danger-zone { border-color: #f0c9c5; }

/* Pages */
.page { max-width: 820px; margin: 0 auto; padding: 40px 20px 80px; }

/* Editor */
.editor { display: flex; flex-direction: column; height: 100vh; }
.editor > .panel { flex: 1; }
.bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; }
.bar-name { font-size: 15px; letter-spacing: 0; }
.status { margin-left: auto; font-size: 12.5px; color: var(--muted); } .status.ok { color: var(--ok); } .status.warn { color: var(--warn); } .status.bad { color: var(--bad); font-weight: 600; }
.tabs { position: relative; display: flex; gap: 2px; padding: 0 12px; background: var(--card); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { position: relative; padding: 10px 12px; border-bottom: 2px solid transparent; color: var(--muted); white-space: nowrap; text-decoration: none; }
.tabs a[aria-current=page] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.tabs a:focus-visible, .seg button:focus-visible { outline-offset: -2px; }
.panel { overflow: auto; padding: 22px; min-height: 0; }
.narrow { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; padding-bottom: 60px; }
.panel-content { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; align-items: start; }
.sections { position: sticky; top: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; }
.section-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.section-list li { display: flex; align-items: center; gap: 2px; border-radius: var(--r); padding: 2px 4px; border: 1px solid transparent; }
.section-list li.is-current { background: var(--card); border-color: var(--line); }
.section-list li.is-hidden .section-pick > span:nth-child(2) { font-style: italic; }
.section-list .tools { opacity: 0; } .section-list li:hover .tools, .section-list li:focus-within .tools, .section-list li.is-current .tools { opacity: 1; }
.section-list .tool { width: 24px; }
.section-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px 2px; text-align: left; font-weight: 500; }
/* A section name may take two lines, so names that start alike ("Our Story", "Our People") stay readable beside the row's tools. */
.section-pick > span:nth-child(2) { overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow-wrap: anywhere; line-height: 1.25; }
.mini-thumb { width: 28px; height: 28px; border-radius: 4px; overflow: hidden; display: grid; place-items: center; font-size: 11px; flex: none; }
.mini-thumb img { width: 100%; height: 100%; object-fit: cover; }
.detail { max-width: 860px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding-bottom: 80px; min-width: 0; }
.detail-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.blocks-title { margin-top: 10px; }
.block-icon { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 5px; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--muted); background: #fafaf8; flex: none; }
.block-names { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.block-names > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .block-names .muted { font-size: 12px; }
.library { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.library-item { text-align: left; display: grid; gap: 2px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; }
.library-item:hover { border-color: var(--ink); } .library-item span { color: var(--muted); font-size: 12.5px; }

/* Assets */
.asset-browser { border: 2px dashed transparent; border-radius: 10px; padding: 4px; margin: 10px -6px 0; }
.asset-browser.dropping { border-color: var(--accent); background: #eef0ff; }
.asset-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; } .asset-tools input { flex: 1 1 240px; width: auto; } .asset-tools select { width: auto; }
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.asset { display: grid; gap: 3px; padding: 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); text-align: left; font-size: 12.5px; align-content: start; }
.asset:hover { border-color: #b9b9b4; } .asset strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.asset-preview, .asset-big { aspect-ratio: 4 / 3; border-radius: 5px; background: #ecece8 linear-gradient(45deg, #dedede 25%, transparent 25% 75%, #dedede 75%) 0 0 / 14px 14px; display: grid; place-items: center; overflow: hidden; color: var(--muted); font-weight: 700; }
.asset-preview img, .asset-big img, .asset-big video { width: 100%; height: 100%; object-fit: contain; }
.asset-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 20px; } .asset-detail > div:last-child { display: grid; gap: 12px; align-content: start; }
.usage { font-size: 12.5px; display: grid; gap: 2px; } .usage li::before { content: "– "; color: var(--muted); }

/* Preview */
.panel-preview { padding: 0; display: grid; grid-template-rows: auto 1fr; background: #dcdcd8; }
.preview-bar { display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--card); border-bottom: 1px solid var(--line); flex-wrap: wrap; } .preview-bar .muted { margin-right: auto; font-size: 12.5px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.seg button { display: inline-flex; align-items: center; gap: 5px; border: 0; background: #fff; padding: 6px 11px; } .seg button[aria-pressed=true] { background: var(--ink); color: #fff; }
.preview-wrap { display: grid; place-items: center; padding: 14px; min-height: 0; overflow: auto; }
.preview-frame { width: 100%; height: 100%; border: 0; border-radius: 10px; background: #000; box-shadow: 0 6px 30px rgb(0 0 0 / 0.18); }
.device-tablet .preview-frame { width: 820px; height: min(100%, 1100px); } .device-mobile .preview-frame { width: 390px; height: min(100%, 800px); border-radius: 26px; }

/* Publishing and sharing */
.facts div { display: grid; grid-template-columns: 120px 1fr; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); } .facts dt { color: var(--muted); }
.issues { display: grid; gap: 4px; } .issues li { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: start; padding: 7px 9px; border-radius: 6px; background: #fff8e6; font-size: 13px; }
.issues li.error { background: #fdebe9; } .issues li.error svg { color: var(--bad); } .issues li.warning svg { color: var(--warn); }
.versions, .links { display: grid; } .versions li, .links li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.links li.revoked s { color: var(--muted); }
.choice { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; padding: 8px 0; cursor: pointer; } .choice span { display: flex; flex-direction: column; } .choice input { margin-top: 3px; }

/* Dialogs and toasts */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 24px 80px rgb(0 0 0 / 0.3); color: var(--ink); }
dialog.wide { width: min(980px, calc(100vw - 32px)); }
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgb(20 20 20 / 0.45); }
dialog header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); } dialog header h2 { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog-body { padding: 18px; overflow: auto; display: grid; gap: 12px; }
dialog footer, .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; } dialog footer { padding: 12px 18px; border-top: 1px solid var(--line); } .dialog-actions.left { justify-content: flex-start; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 100; max-width: calc(100vw - 32px); }
.toast .tool { color: #fff; flex: none; } .toast .tool:hover { background: rgb(255 255 255 / 0.15); color: #fff; }
.dialog-toasts { display: grid; gap: 8px; padding: 0 18px; } .dialog-toasts:not(:empty) { padding-bottom: 12px; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; padding: 8px 8px 8px 14px; border-radius: var(--r); max-width: min(380px, calc(100vw - 32px)); box-shadow: 0 8px 30px rgb(0 0 0 / 0.2);
  opacity: 0; transform: translateY(var(--toast-distance)) scale(var(--toast-scale)); filter: blur(var(--toast-blur));
  transition: opacity var(--toast-close) var(--ease-smooth-out), transform var(--toast-close) var(--ease-smooth-out), filter var(--toast-close) var(--ease-smooth-out); }
.toast.is-open { opacity: 1; transform: none; filter: none; transition-duration: var(--toast-open); }
.toast.error { background: var(--bad); }

@media (max-width: 860px), (max-height: 600px) {
  .editor { display: block; height: auto; } .editor > .panel, .panel { overflow: visible; }
}
@media (max-width: 860px) {
  .panel-content { grid-template-columns: minmax(0, 1fr); }
  details.card > summary { flex-wrap: wrap; }
  .panel { padding: 16px; } .sections { position: static; } .asset-detail { grid-template-columns: 1fr; }
  .bar { flex-wrap: wrap; } .status { order: 5; width: 100%; margin: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after, ::backdrop { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* Requests inbox */
.requests { display: grid; gap: 10px; margin-top: 12px; }
.request { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 8px; }
.request.status-new { border-left: 3px solid var(--bad); } .request.status-open { border-left: 3px solid var(--warn); }
.request-head { display: flex; align-items: center; gap: 10px; } .request-head .muted { margin-left: auto; font-size: 12.5px; }
.request-msg { white-space: pre-wrap; background: #fafaf8; border-radius: 6px; padding: 10px 12px; }
.request-who { font-size: 13px; }
.inline > select { width: auto; }

/* Questions asked of the brand assistant */
.questions { margin-top: 36px; display: grid; gap: 10px; }
.questions-list { display: grid; gap: 8px; }
.questions-list .card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 6px; }
.questions-list .uncovered { border-left: 3px solid var(--warn); }
.questions-list p { margin: 0; }
.questions .small { font-size: 12.5px; }
.questions .check-row { display: flex; align-items: center; justify-content: flex-start; gap: 8px; font-size: 13px; }
.questions .check-row input { width: auto; margin: 0; }

/* Motion, on the transitions.dev recipes (timing in /shared/motion.css). */
dialog { opacity: 0; transform: scale(var(--modal-scale)); transition: opacity var(--modal-open-dur) var(--ease-smooth-out), transform var(--modal-open-dur) var(--ease-smooth-out); }
dialog.is-open { opacity: 1; transform: none; }
dialog.is-closing { opacity: 0; transform: scale(var(--modal-scale)); transition-duration: var(--modal-close-dur); }
dialog::backdrop { opacity: 0; transition: opacity var(--modal-open-dur) var(--ease-smooth-out); }
dialog.is-open::backdrop { opacity: 1; }
dialog.is-closing::backdrop { opacity: 0; transition-duration: var(--modal-close-dur); }
.btn, .tool, .rt, .section-list li .tools, .library-item, .asset, .tabs button, .badge, .pill, .chip {
  transition-property: background-color, color, border-color, opacity, box-shadow;
  transition-duration: var(--duration-quick);
  transition-timing-function: var(--ease-out);
}

/* Team safety: who is signed in, role limits, conflicts, presence */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.who { font-size: 12.5px; }
.account { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.gated { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.role-note { color: var(--warn); font-size: 12.5px; }
p.role-note { margin: 6px 0; }
.presence { font-size: 12.5px; color: var(--ink); background: #e8ebff; border-radius: 99px; padding: 2px 10px; }
.presence[hidden] { display: none; }
.banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 10px 16px; background: #fdebe9; border-bottom: 1px solid #f0c9c5; color: var(--bad); font-weight: 600; }
.banner .btn { font-weight: 400; }
.editor.read-only .panel { background: #efefec; }
.saved { color: var(--ok); font-size: 12px; font-weight: 400; }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.label-row label { margin-bottom: 4px; }
.stack { display: grid; gap: 12px; }
.notice.error { background: #fdebe9; border-color: #f0c9c5; }
.notice.warn { background: #fff6dd; }
pre.mine { white-space: pre-wrap; font: 13px/1.45 inherit; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin: 8px 0; }

/* Uploads */
.uploads { display: grid; gap: 6px; margin: 0 0 10px; }
.uploads:empty { display: none; }
.upload { display: grid; grid-template-columns: minmax(0, 1fr) 160px auto; grid-template-areas: "name bar action" "status status status"; gap: 2px 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); font-size: 12.5px; }
.upload-name { grid-area: name; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload progress { grid-area: bar; width: 100%; }
.upload .btn { grid-area: action; }
.upload-status { grid-area: status; color: var(--muted); }
.upload.failed { border-color: #f0c9c5; background: #fdf4f3; } .upload.failed .upload-status { color: var(--bad); }
.upload.note .upload-status { color: var(--warn); }
.upload.done .upload-status { color: var(--ok); }

/* People */
.people { display: grid; gap: 8px; margin: 16px 0 28px; }
.people .card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: grid; gap: 6px; }
.person { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
form.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
fieldset.roles { border: 0; padding: 0; margin: 0; display: grid; gap: 2px; }
fieldset.roles legend { font-weight: 600; font-size: 12.5px; margin-bottom: 4px; padding: 0; }
.back + h1, .page > .back { margin-bottom: 12px; }
.page > .back { display: inline-flex; }

/* Activity */
.activity { display: grid; }
.activity li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }
.activity li .muted { flex: none; font-size: 12.5px; }

/* A message with Undo stays until it is used or dismissed. */
.toast.undo { display: flex; align-items: center; gap: 10px; }
.toast.undo .btn { background: #fff; color: var(--ink); border-color: #fff; }
.toast.undo .tool { color: #fff; }
.toast.undo .tool:hover { background: rgb(255 255 255 / 0.15); color: #fff; }

/* Help */
.help-steps { list-style: decimal; padding-left: 20px; display: grid; gap: 6px; }
.help-roles { display: grid; gap: 4px; }
.howto { grid-column: 1 / -1; background: #eef0ff; border: 1px solid #c9cdf7; border-radius: var(--r); padding: 14px 16px; display: grid; gap: 10px; }
.howto-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.howto h2 { font-size: 16px; }
.section-name { font-size: 20px; }
.noscript { max-width: 520px; margin: 12vh auto; padding: 28px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 10px; }
@media (max-width: 480px) {
  .page { padding: 24px 16px 60px; }
  .bar { gap: 8px; padding: 8px 12px; } .account { max-width: 120px; }
  .upload { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name action" "bar bar" "status status"; }
  .facts div { grid-template-columns: 1fr; gap: 2px; }
  .versions li, .links li, .activity li { flex-wrap: wrap; }
  .asset-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .focus-inputs .field { width: auto; flex: 1; }
}

/* ==========================================================================
   Entry screens: sign-in, account set-up, the Brands home and the People page head.
   The rest of the admin keeps its quiet look; everything below is scoped to these screens.
   A black stage with a white sheet on it, as the guidelines themselves are shown.
   ========================================================================== */
:root {
  --stage: #0a0a0a; --stage-ink: #fff; --stage-muted: #a3a3a3; --stage-line: rgb(255 255 255 / 0.14);
  --paper: #fff;
  --display-weight: 500; --display-tracking: -0.03em; --display-leading: 1;
  --entry-h: 48px; --entry-r: 10px; --sheet-r: 14px;
  --crop-leg: 12px; --crop-gap: 6px;
}

/* The monogram. Its colours follow where it sits. */
.mark { display: block; flex: none; }
.mark rect { fill: var(--mark-bg, var(--ink)); }
.mark path { stroke: var(--mark-fg, #fff); }
.wordmark { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; line-height: 1; white-space: nowrap; }

/* Printer's crop marks: an L outside each corner, pointing at it. */
.crops { position: absolute; inset: 0; pointer-events: none; color: rgb(255 255 255 / 0.42); }
.crop { position: absolute; width: var(--crop-leg); height: var(--crop-leg); border: 0 solid currentColor; }
.crop.tl, .crop.bl { left: calc(-1 * (var(--crop-gap) + var(--crop-leg))); }
.crop.tr, .crop.br { right: calc(-1 * (var(--crop-gap) + var(--crop-leg))); }
.crop.tl, .crop.tr { top: calc(-1 * (var(--crop-gap) + var(--crop-leg))); }
.crop.bl, .crop.br { bottom: calc(-1 * (var(--crop-gap) + var(--crop-leg))); }
.crop.tl { border-right-width: 1px; border-bottom-width: 1px; }
.crop.tr { border-left-width: 1px; border-bottom-width: 1px; }
.crop.br { border-left-width: 1px; border-top-width: 1px; }
.crop.bl { border-right-width: 1px; border-top-width: 1px; }

/* Once-only entrance: rise, fade and sharpen, in turn (transitions.dev stagger). */
.rise { animation: entry-rise var(--stagger-dur) var(--ease-smooth-out) backwards; animation-delay: calc(var(--i, 0) * var(--duration-stagger)); }
@keyframes entry-rise { from { opacity: 0; transform: translateY(var(--stagger-distance)); filter: blur(var(--stagger-blur)); } }

.spinner { display: block; width: 16px; height: 16px; flex: none; border-radius: 50%; border: 1.5px solid currentColor; border-right-color: transparent; animation: entry-spin 800ms var(--ease-linear) infinite; }
@keyframes entry-spin { to { transform: rotate(360deg); } }

/* --- The stage ---------------------------------------------------------- */
body:has(> #app > .entry) { background: var(--stage); }
.entry {
  --pad: clamp(24px, 4.4vw, 64px);
  min-height: 100vh; min-height: 100dvh; padding: var(--pad);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); column-gap: clamp(40px, 6vw, 112px);
  background: var(--stage); color: var(--stage-ink); overflow-x: clip;
}
.entry-stage { display: grid; grid-template-rows: auto 1fr auto; row-gap: 40px; min-width: 0; }
.entry-brand { display: flex; align-items: center; gap: 10px; }
.entry .mark { --mark-bg: #fff; --mark-fg: var(--stage); }
.entry-hero {
  --draw: clamp(280px, 27vw, 420px);
  align-self: center; display: grid; grid-template-columns: minmax(0, 1fr) var(--draw); grid-template-rows: auto auto; column-gap: 24px;
}
.entry-drawing { grid-column: 2; grid-row: 1 / 3; align-self: center; width: var(--draw); }
.entry-display {
  grid-column: 1 / -1; grid-row: 1; align-self: end; position: relative; z-index: 1; max-width: 8.6em;
  font-size: clamp(48px, 5vw, 80px); font-weight: var(--display-weight); letter-spacing: var(--display-tracking); line-height: var(--display-leading); text-wrap: balance;
}
.entry-sub { grid-column: 1; grid-row: 2; align-self: start; margin-top: 28px; max-width: 26em; color: var(--stage-muted); font-size: 17px; line-height: 1.55; text-wrap: pretty; }
.entry-foot { color: var(--stage-muted); font-size: 13px; }

/* The construction drawing: hairlines in user units of the 58-unit drawing. */
.construct { display: block; width: 100%; height: auto; overflow: visible; fill: none; stroke: #fff; stroke-linecap: round; }
.construct .guide { stroke-opacity: 0.2; stroke-width: 0.13; }
.construct .faint { stroke-opacity: 0.14; }
.construct .clear { stroke-opacity: 0.3; stroke-width: 0.13; stroke-dasharray: 0.55 0.55; }
.construct .tick, .construct .frame, .construct .circle, .construct .dim { stroke-opacity: 0.35; stroke-width: 0.14; }
.construct .letter { stroke-opacity: 0.95; stroke-width: 0.24; stroke-linejoin: round; }
.construct .dot { fill: #fff; fill-opacity: 0.55; stroke: none; }
.construct .label { fill: #fff; fill-opacity: 0.55; stroke: none; font: 500 1.45px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.02em; }
.construct .draw { stroke-dasharray: 1 1; animation: construct-draw 700ms var(--ease-smooth-out) backwards; animation-delay: calc(100ms + var(--d, 0) * 30ms); }
.construct .fade { animation: construct-fade 600ms var(--ease-smooth-out) backwards; animation-delay: calc(100ms + var(--d, 0) * 30ms); }
@keyframes construct-draw { from { stroke-dashoffset: 1; } }
@keyframes construct-fade { from { opacity: 0; } }

/* --- The sheet ---------------------------------------------------------- */
.entry-side { display: grid; align-items: center; min-width: 0; }
.entry .sheet {
  position: relative; justify-self: center; width: 100%; max-width: 440px; padding: 40px;
  background: var(--paper); color: var(--ink); border-radius: var(--sheet-r);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 32px 80px -24px rgb(0 0 0 / 0.8);
}
.entry-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.entry-form h1 { font-size: 32px; font-weight: var(--display-weight); letter-spacing: var(--display-tracking); line-height: 1.05; }
.entry-form h1 + p { margin-top: -10px; }
.entry-form > p:not([class]) { font-size: 15px; line-height: 1.55; }
.entry-intro { color: var(--muted); font-size: 15px; line-height: 1.5; }
.entry-intro strong { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.entry .field label { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.entry .hint { font-size: 13px; margin-top: 8px; line-height: 1.45; }
.entry input:is([type=email], [type=password], [type=text]) {
  height: var(--entry-h); padding: 0 14px; font-size: 16px; border: 1px solid #8a8a85; border-radius: var(--entry-r); background: #fff;
  transition: border-color var(--duration-quick) var(--ease-out);
}
.entry input:is([type=email], [type=password], [type=text]):hover { border-color: #5f5f64; }
.entry input:is([type=email], [type=password], [type=text]):focus-visible { border-color: var(--ink); outline: 2px solid var(--accent); outline-offset: 2px; }
.reveal-wrap { position: relative; }
.reveal-wrap input { padding-right: 76px; }
.reveal {
  position: absolute; top: 2px; right: 2px; bottom: 2px; min-width: 64px; padding: 0 14px;
  border: 0; border-radius: 8px; background: none; color: var(--ink); font-size: 13px; font-weight: 600;
  transition: background-color var(--duration-quick) var(--ease-out);
}
.reveal:hover { background: #f0f0ed; }
.reveal:focus-visible { outline-offset: -2px; }
.entry .field.check { grid-template-columns: 20px 1fr; gap: 0 12px; min-height: 44px; }
.entry .field.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--ink); }
.entry .field.check label { margin: 0; padding: 12px 0; font-size: 14px; font-weight: 500; cursor: pointer; }
/* The error keeps its line, so the form doesn't jump when one appears. */
.entry .error { min-height: 1.5em; margin: -12px 0 -8px; font-size: 14px; line-height: 1.5; }
.entry-go { width: 100%; height: var(--entry-h); justify-content: center; gap: 10px; padding: 0 20px; border-radius: var(--entry-r); font-size: 15px; font-weight: 600; }
.entry-go .go-icon { display: inline-grid; place-items: center; width: 16px; height: 16px; transition: transform var(--duration-fast) var(--ease-smooth-out); }
.entry-go .go-icon > * { grid-area: 1 / 1; }
.entry-go:is(:hover, :focus-visible):not(:disabled) .go-icon { transform: translateX(3px); }
.entry-go .spinner { display: none; }
.entry-go[aria-busy=true] .go-icon svg { display: none; }
.entry-go[aria-busy=true] .spinner { display: block; }
.entry-go[aria-busy=true]:disabled { opacity: 1; cursor: progress; }
.entry-help { color: var(--muted); font-size: 13px; line-height: 1.5; margin-top: -4px; text-wrap: pretty; }
.entry-help .nowrap { white-space: nowrap; }
.entry-loading { display: flex; align-items: center; gap: 12px; min-height: 160px; color: var(--muted); font-size: 15px; }

/* Between a laptop and a tablet: the drawing sits above the headline. */
@media (max-width: 1199px) {
  .entry-hero { --draw: clamp(200px, 24vw, 260px); grid-template-columns: minmax(0, 1fr); }
  .entry-drawing { grid-column: 1; grid-row: 1; margin-bottom: 40px; }
  .entry-display { grid-row: 2; font-size: clamp(44px, 5.2vw, 60px); }
  .entry-sub { grid-row: 3; }
}
/* One column: a compact stage band, then the sheet, then the foot line on the stage. */
@media (max-width: 899px) {
  .entry { grid-template-columns: minmax(0, 1fr); column-gap: 0; padding: 0 0 32px; }
  .entry-stage { display: contents; }
  .entry-brand { padding: 24px 24px 0; }
  .entry-hero { --draw: clamp(150px, 24vw, 200px); grid-template-columns: minmax(0, 1fr) var(--draw); padding: 40px 24px 40px; column-gap: 32px; align-items: center; }
  .entry-drawing { grid-column: 2; grid-row: 1 / 3; margin: 0; }
  .entry-display { grid-column: 1; grid-row: 1; font-size: clamp(34px, 6vw, 48px); max-width: 9em; }
  .entry-sub { grid-row: 2; margin-top: 16px; font-size: 15px; }
  .entry-side { padding: 0 24px; }
  .entry-foot { order: 1; padding: 28px 24px 0; text-align: center; }
}
@media (max-width: 599px) {
  :root { --crop-leg: 8px; --crop-gap: 4px; }
  .entry-brand { padding: 20px 16px 0; }
  .entry-hero { grid-template-columns: minmax(0, 1fr); padding: 32px 16px 32px; }
  .entry-drawing { display: none; }
  .entry-display { font-size: clamp(32px, 9vw, 40px); }
  .entry-side { padding: 0 16px; }
  .entry .sheet { padding: 28px 24px; }
  .entry-form h1 { font-size: 28px; }
  .entry-foot { padding: 24px 16px 0; }
}

/* --- The top bar (Brands and People) -------------------------------------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1128px; min-height: 64px; margin: 0 auto; padding: 0 24px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; }
.home-link { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 8px; margin-left: -8px; color: var(--ink); text-decoration: none; border-radius: 8px; }
.topbar-end { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.topbar .who { margin-right: 8px; }
.topbar .btn { min-height: 36px; padding: 0 14px; border-radius: 8px; }
.topbar .btn[aria-current=page] { border-color: var(--ink); }
@media (max-width: 640px) {
  .topbar-in { padding: 10px 16px; min-height: 0; column-gap: 8px; }
  .topbar-end { display: contents; }
  .home-link { margin-right: auto; }
  .topbar .who { order: 5; flex-basis: 100%; margin: 0 0 2px; }
}

/* --- The Brands home ------------------------------------------------------ */
.home { max-width: 1128px; margin: 0 auto; padding: 56px 24px 96px; }
.home-head { display: grid; justify-items: start; gap: 12px; margin-bottom: 36px; }
.home h1, .page-top > h1 { font-size: 40px; font-weight: var(--display-weight); letter-spacing: var(--display-tracking); line-height: var(--display-leading); }
.home-summary { color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.home .brand-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
.home .brand-list > li { display: flex; min-width: 0; }
@media (min-width: 700px) { .home .brand-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1040px) { .home .brand-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; } }
.brand-card {
  flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; container-type: inline-size;
  background: var(--paper); color: var(--ink); text-decoration: none; border: 1px solid var(--line); border-radius: var(--entry-r);
  transition: transform var(--duration-fast) var(--ease-smooth-out), box-shadow var(--duration-fast) var(--ease-smooth-out), border-color var(--duration-quick) var(--ease-out);
}
.brand-card:is(:hover, :focus-visible) { transform: translateY(-2px); border-color: #d2d2cd; box-shadow: 0 2px 4px rgb(0 0 0 / 0.04), 0 18px 36px -16px rgb(0 0 0 / 0.22); }
.brand-card:focus-visible { outline-offset: 3px; }
.cover { position: relative; display: block; aspect-ratio: 16 / 9; background: var(--c-bg); color: var(--c-ink); box-shadow: inset 0 -1px 0 rgb(0 0 0 / 0.06); }
.cover-rule { position: absolute; top: 20px; left: 20px; width: 28px; height: 3px; border-radius: 2px; background: var(--c-accent); }
.cover-name {
  position: absolute; left: 20px; right: 20px; bottom: 18px;
  font-size: clamp(22px, 2.3vw, 34px); font-size: clamp(22px, 8.5cqi, 34px); font-weight: var(--display-weight); letter-spacing: var(--display-tracking); line-height: 1.04;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; text-wrap: balance;
}
.cover-go {
  position: absolute; top: 12px; right: 12px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--c-ink); color: var(--c-bg); opacity: 0; transform: translate(-4px, 4px);
  transition: opacity var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-smooth-out);
}
.brand-card:is(:hover, :focus-visible) .cover-go { opacity: 1; transform: none; }
.card-meta { display: grid; align-content: start; gap: 4px; padding: 16px 18px 18px; flex: 1; }
.card-name { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.card-slug { color: var(--muted); font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.card-meta .badges { margin-top: 8px; }
.card-edited { margin-top: 6px; color: var(--muted); font-size: 12.5px; }
.home-empty { position: relative; margin: 18px 0 8px; padding: 48px 40px; background: var(--paper); border-radius: var(--sheet-r); box-shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 16px 40px -20px rgb(0 0 0 / 0.18); }
.home-empty .crops { color: #8a8a85; }
.home-empty-title { font-size: 28px; font-weight: var(--display-weight); letter-spacing: var(--display-tracking); line-height: 1.05; margin-bottom: 10px; }
.home-empty > p:last-child { color: var(--muted); font-size: 15px; }
.home .new-brand { margin-top: 40px; padding: 24px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--sheet-r); }
.new-brand label { display: block; font-size: 15px; font-weight: 600; margin-bottom: 10px; }
.new-brand-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.new-brand-row > input[type=text] { flex: 1 1 260px; width: auto; min-width: 0; height: 44px; padding: 0 14px; font-size: 16px; border-radius: var(--entry-r); }
.new-brand-row .btn.primary { height: 44px; padding: 0 20px; border-radius: var(--entry-r); font-size: 15px; font-weight: 600; justify-content: center; }
.home .new-brand .hint { margin-top: 10px; font-size: 13px; }
.page.page-top { max-width: 1128px; padding: 48px 24px 80px; }
.page-top > * { max-width: 820px; }
.page-top > h1 { margin-bottom: 14px; width: fit-content; }
@media (max-width: 600px) {
  .home { padding: 36px 16px 72px; }
  .home h1, .page-top > h1 { font-size: 30px; }
  .page.page-top { padding: 32px 16px 60px; }
  .home-empty { padding: 36px 24px; }
  .home .new-brand { padding: 20px; }
  .new-brand-row { flex-direction: column; align-items: stretch; }
  .new-brand-row > input[type=text] { flex: none; width: 100%; }
  .new-brand-row .gated { display: grid; }
  .new-brand-row .btn.primary { width: 100%; }
}
