:root {
  --background: #181818;
  --surface: #222222;
  --surface-soft: #1e1e1e;
  --ink: #e6e6e6;
  --muted: #a5a5a5;
  --muted-strong: #c3c3c3;
  --line: #383838;
  --line-strong: #5b5b5b;
  --nav: #181818;
  --accent: #c5c5c5;
  --accent-hover: #d3d3d3;
  --accent-ink: #181818;
  --accent-soft: #292929;
  --warning: #cfb88c;
  --warning-soft: #27241e;
  --danger: #d5a8a3;
  --danger-soft: #2d2423;
  --success: #a6bdad;
  --shadow: none;
  --page-gutter: clamp(20px, 4vw, 64px);
  color-scheme: dark;
  color: var(--ink);
  background: var(--background);
  font: 350 14px/1.55 "Onest", "Onest Fallback", "Segoe UI", sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--background); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-underline-offset: 4px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
::selection { background: var(--accent); color: var(--accent-ink); }
[hidden], .hidden { display: none !important; }
.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: fixed; top: 12px; left: 12px; z-index: 20; padding: 12px; transform: translateY(-160%); background: var(--ink); color: var(--background); }
.skip-link:focus { transform: none; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3, b, strong { font-weight: 400; }
p { margin: 0; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 10px; font-size: 12px; color: var(--muted); font-weight: 350; }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; max-width: 100%; padding: 10px 16px; border: 1px solid var(--line); border-radius: 4px; background: transparent; color: var(--ink); font-size: 13px; line-height: 1.4; font-weight: 400; text-decoration: none; transition: background-color 160ms ease, border-color 160ms ease; }
.button:hover { background: var(--surface); border-color: var(--line-strong); }
.button:disabled { cursor: default; opacity: .5; }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.button.quiet { border-color: transparent; }
.button.quiet:hover { background: var(--surface); }
.button.danger { color: var(--danger); }
.button.wide { width: 100%; }
.button.compact { padding: 8px 12px; font-size: 12px; }
.icon-button, .close-button { display: grid; place-items: center; flex-shrink: 0; width: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 4px; color: var(--muted-strong); background: transparent; font-size: 25px; font-weight: 350; }
.icon-button:hover, .close-button:hover { color: var(--ink); background: var(--accent-soft); }
.field { display: grid; gap: 9px; min-width: 0; margin: 0 0 22px; font-size: 13px; font-weight: 350; }
.field > span { color: var(--muted-strong); }
.field input, .field select, .field textarea, .search input { width: 100%; min-width: 0; min-height: 46px; padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface-soft); color: var(--ink); font-weight: 350; }
.field textarea { resize: vertical; }
.field small { color: var(--muted); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.form-error { min-height: 0; margin: 12px 0; color: var(--danger); font-size: 13px; overflow-wrap: anywhere; }
.form-error:empty { margin: 0; }
.form-error.success { color: var(--success); }
.login { min-height: 100dvh; display: grid; place-items: center; padding: 40px 24px; }
.login-card { width: min(420px,100%); padding: 0; }
.login-brand { display: flex; align-items: center; gap: 12px; padding-bottom: 28px; border-bottom: 1px solid var(--line); font-size: 17px; }
.login-card h1 { margin: 42px 0 30px; font-size: clamp(30px,5vw,42px); line-height: 1.15; letter-spacing: -.045em; font-weight: 330; }
.login-card .button { margin-top: 16px; }
.app { width: min(100%,1440px); margin-inline: auto; padding-inline: var(--page-gutter); }
.topbar { min-height: 104px; display: flex; align-items: center; justify-content: space-between; gap: 28px; border-bottom: 1px solid var(--line); }
.brand { min-width: 0; display: inline-flex; align-items: center; gap: 14px; color: var(--ink); text-decoration: none; }
.brand > span:last-child { min-width: 0; display: grid; gap: 2px; }
.brand b { font-size: 20px; font-weight: 400; letter-spacing: -.035em; }
.brand small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.brand-mark { position: relative; display: inline-block; width: 23px; height: 23px; flex-shrink: 0; border: 1px solid var(--accent); border-radius: 3px; }
.brand-mark::before { content: ""; position: absolute; inset: 4px; border: 1px solid var(--accent); border-right: 0; }
.account { min-width: 0; display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 12px; }
.account-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--muted); }
.account .button { padding-inline: 10px; }
.role-badge { display: none; }
.layout { display: grid; grid-template-columns: 232px minmax(0,1fr); gap: clamp(28px,3vw,44px); padding-block: 40px 72px; min-height: calc(100vh - 104px); }
.objects-panel { min-width: 0; align-self: start; padding: 20px 12px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.panel-heading { padding: 0 12px 16px; }
.panel-heading h2 { margin: 0; color: var(--muted); font-size: 13px; font-weight: 350; }
.objects-list { display: grid; gap: 10px; align-content: start; }
.object-button { display: flex; width: 100%; min-width: 0; min-height: 56px; align-items: center; gap: 10px; border: 1px solid transparent; border-radius: 4px; padding: 12px; text-align: left; color: var(--muted); background: transparent; transition: background-color 160ms ease, color 160ms ease; }
.object-button:hover { background: var(--surface-soft); color: var(--ink); }
.object-button.active { background: var(--accent-soft); border-color: var(--line); color: var(--ink); }
.object-avatar { display: none; }
.object-copy { display: grid; gap: 8px; min-width: 0; }
.object-copy b { font-size: 13px; font-weight: 400; overflow-wrap: anywhere; }
.object-copy small { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.workspace { min-width: 0; }
.workspace-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; margin-bottom: 24px; }
.workspace-heading > div:first-child { min-width: 0; }
.workspace-heading .eyebrow { display: none; }
.workspace-heading h1 { max-width: 32ch; margin: 0; font-size: clamp(28px,2.5vw,34px); line-height: 1.25; letter-spacing: -.035em; font-weight: 330; }
.workspace-heading .muted { margin-top: 12px; font-size: 13px; }
.workspace-heading .muted:empty { display: none; }
.workspace-actions { display: flex; align-items: center; flex-shrink: 0; gap: 12px; padding-top: 3px; }
.document-overview { display: flex; flex-wrap: wrap; gap: 10px 24px; padding-bottom: 24px; font-size: 12px; color: var(--muted); }
.document-overview strong { margin-left: 6px; color: var(--ink); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.search { flex: 1 1 240px; max-width: 360px; min-width: 0; }
.search input { border-color: var(--line); background: var(--surface-soft); padding-inline: 14px; font-size: 13px; border-radius: 6px; }
.search input:focus { border-color: var(--line-strong); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter { min-height: 44px; padding: 9px 12px; border: 1px solid transparent; border-radius: 6px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 350; }
.filter:hover { color: var(--ink); }
.filter.active { color: var(--ink); background: var(--surface); border-color: var(--line); }
.notice { margin-bottom: 20px; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface-soft); color: var(--ink); font-size: 13px; }
.documents-list { display: grid; gap: 20px; }
.document-card { min-width: 0; display: grid; grid-template-columns: 38px minmax(0,1fr); align-items: start; gap: 12px 18px; padding: 24px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.document-filemark { grid-row: 1 / span 2; display: grid; place-items: center; width: 38px; height: 46px; border: 1px solid var(--line-strong); border-radius: 3px; color: var(--muted-strong); font-size: 10px; font-weight: 400; }
.document-main { min-width: 0; }
.document-topline { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; }
.document-card h3 { margin: 0; font-size: 18px; font-weight: 400; letter-spacing: -.02em; line-height: 1.45; }
.document-summary { margin-top: 8px; color: var(--muted); font-size: 13px; white-space: pre-wrap; }
.document-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; color: var(--muted); font-size: 12px; }
.document-card > .document-meta { grid-column: 2; grid-row: 2; }
.document-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.document-card > .document-actions { grid-column: 1 / -1; grid-row: 4; justify-content: flex-start; }
.document-actions .button { min-height: 44px; padding: 10px 14px; font-size: 12px; text-align: center; }
.document-actions > .button:first-child { border-color: var(--line-strong); background: var(--surface); min-width: 100px; }
.document-actions > .button:first-child:hover { background: var(--accent-soft); }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 0; color: var(--muted); font-size: 11px; font-weight: 350; }
.status::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.status.review { color: var(--warning); }
.status.published { color: var(--success); }
.status.withdrawn { color: var(--danger); }
.current-publication { grid-column: 1 / -1; grid-row: 3; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.current-publication > span:first-child { font-weight: 350; }
.document-history { grid-column: 1 / -1; margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.document-history > summary { min-height: 44px; width: fit-content; max-width: 100%; padding-block: 12px; color: var(--muted); font-size: 12px; cursor: pointer; }
.history-list { display: grid; }
.history-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px 20px; border-top: 1px solid var(--line); padding-block: 20px; }
.history-title { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 13px; }
.history-row > .document-meta { grid-column: 1; }
.history-row > .document-actions { grid-column: 2; grid-row: 1 / span 2; }
.history-row > .document-summary, .history-row > .cad-preview-details { grid-column: 1 / -1; }
.revision-delivery { min-width: 0; max-width: 100%; font-size: 12px; }
.revision-delivery > summary { min-height: 44px; padding: 12px 0; color: var(--muted-strong); font-weight: 350; cursor: pointer; }
.revision-delivery[data-delivery-state="delivered"] > summary { color: var(--success); }
.revision-delivery[data-delivery-state="partial"] > summary { color: var(--warning); }
.revision-delivery[open] { flex-basis: 100%; }
.delivery-body { padding: 14px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-soft); }
.delivery-body p { margin-bottom: 12px; }
.delivery-device { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding-block: 10px; border-top: 1px solid var(--line); }
.delivery-body .button { margin-top: 8px; font-size: 12px; }
.cad-preview-details { font-size: 11px; overflow-wrap: anywhere; }
.cad-preview-details > p { margin-top: 6px; }
.cad-warnings { color: var(--warning); }
.cad-info { color: var(--muted); }
.cad-warning-details > summary { min-height: 44px; padding-block: 12px; width: fit-content; cursor: pointer; }
.cad-warning-details[open] { margin-top: 8px; padding: 0 14px 14px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-soft); }
.cad-warnings ul { padding-left: 18px; margin: 0; }
.cad-warnings li + li { margin-top: 8px; }
.cad-technical-details { margin-top: 16px; color: var(--muted); }
.cad-technical-details > summary { min-height: 44px; padding-block: 12px; cursor: pointer; }
.empty-state, .empty-list { padding: 64px 20px; color: var(--muted); text-align: center; }
.empty-state h2 { margin: 0 0 12px; color: var(--ink); font-size: 26px; font-weight: 330; }
.empty-state p, .empty-list p { max-width: 460px; margin: 12px auto 0; font-size: 13px; }
.empty-list.compact { padding: 24px 0; text-align: left; font-size: 13px; }
.empty-list > .button { margin-top: 16px; }
.dialog { width: min(560px,calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow: auto; border: 1px solid var(--line-strong); border-radius: 6px; padding: 0; color: var(--ink); background: var(--surface); box-shadow: none; }
.dialog[open] { animation: dialog-open 180ms cubic-bezier(.22,1,.36,1); }
.dialog::backdrop { background: #0009; }
.dialog > form, .token-card, .access-shell { padding: 32px; }
.wide-dialog { width: min(600px,calc(100% - 32px)); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.dialog-heading h2 { margin: 5px 0 0; font-size: 28px; font-weight: 330; letter-spacing: -.035em; line-height: 1.25; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.form-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 16px; }
.upload-destination { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 16px; padding-bottom: 24px; font-size: 13px; }
.upload-destination > span { color: var(--muted); }
.upload-destination > strong { font-weight: 350; overflow-wrap: anywhere; }
.dropzone { position: relative; display: grid; place-items: center; align-content: center; gap: 10px; min-height: 180px; padding: 24px; margin-bottom: 20px; border: 1px dashed var(--line-strong); border-radius: 4px; background: var(--surface-soft); text-align: center; cursor: pointer; transition: border-color 160ms,background-color 160ms; }
.dropzone:hover, .dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); }
.dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 4px; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone b { max-width: 100%; overflow-wrap: anywhere; font-weight: 400; }
.dropzone small { color: var(--muted); font-size: 12px; }
.drop-icon { color: var(--muted-strong); font-size: 27px; line-height: 1; }
.additional-fields { border-top: 1px solid var(--line); }
.additional-fields > summary { min-height: 48px; padding-block: 14px; color: var(--muted); font-size: 13px; cursor: pointer; }
.additional-content { padding-top: 14px; }
.upload-help { margin: 8px 0 16px; font-size: 12px; color: var(--muted); }
.upload-help:empty { display: none; }
#upload-dialog { scroll-padding-bottom: 100px; }
#upload-dialog .dialog-actions { position: sticky; bottom: 0; z-index: 1; padding-block: 16px 4px; margin-top: 20px; border-top: 1px solid var(--line); background: var(--surface); }
.upload-progress { display: grid; gap: 10px; margin-top: 20px; color: var(--muted-strong); font-size: 13px; }
.upload-progress progress { width: 100%; height: 3px; accent-color: var(--accent); }
@keyframes dialog-open { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 1180px) {
  .layout { grid-template-columns: 204px minmax(0,1fr); gap: 28px; }
  .workspace-heading { flex-wrap: wrap; gap: 20px; }
  .workspace-actions { flex-shrink: 1; }
  .toolbar { flex-wrap: wrap; gap: 12px 16px; }
  .search { flex-basis: 100%; max-width: none; }
}
@media (max-width: 760px) {
  .topbar { min-height: 80px; align-content: center; flex-wrap: wrap; gap: 8px; padding-block: 16px; }
  .brand b { font-size: 18px; }
  .brand small { display: none; }
  .account { gap: 4px; }
  .account-name { display: none; }
  .account .button { font-size: 12px; padding-inline: 8px; }
  .layout { grid-template-columns: minmax(0,1fr); gap: 24px; padding-top: 24px; }
  .objects-panel { padding: 0; border: 0; background: transparent; }
  .panel-heading { padding: 0 0 12px; }
  .objects-list { display: flex; overflow-x: auto; gap: 8px; padding: 4px; margin-inline: -4px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
  .object-button { width: auto; flex: 0 0 auto; max-width: 240px; min-height: 48px; padding: 10px 12px; }
  .object-copy b { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .object-copy small { display: none; }
  .workspace-heading { gap: 16px; margin-bottom: 24px; }
  .workspace-heading h1 { font-size: 26px; }
  .workspace-actions { width: 100%; justify-content: space-between; gap: 8px; padding-top: 0; }
  .workspace-actions .primary { min-width: 158px; }
  .toolbar { gap: 12px; margin-bottom: 20px; }
  .filters { gap: 4px; }
  .filter { font-size: 12px; padding-inline: 10px; }
  .document-overview { display: none; }
  .document-card { grid-template-columns: 32px minmax(0,1fr); gap: 12px; padding: 18px; }
  .document-filemark { grid-row: 1; width: 32px; height: 40px; font-size: 9px; }
  .document-card h3 { font-size: 17px; }
  .document-card > .document-meta { grid-column: 1 / -1; }
  .document-card > .document-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .document-actions .button { min-width: 0; padding-inline: 8px; }
  .current-publication { gap: 0 12px; }
  .history-row { grid-template-columns: minmax(0,1fr); }
  .history-row > .document-actions { grid-column: 1; grid-row: auto; justify-content: flex-start; }
  .form-grid { grid-template-columns: minmax(0,1fr); gap: 0; }
  .dialog > form, .token-card, .access-shell { padding: 22px; }
  .dialog-actions .button { flex: 1; }
  .dialog-heading h2 { font-size: 26px; }
  .upload-destination { grid-template-columns: minmax(0,1fr); gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
