@font-face {
  font-family: Alexandria;
  src: url("fonts/alexandria-arabic.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
  unicode-range: U+0600-06FF,U+0750-077F,U+0870-089F,U+08A0-08FF,U+200C-200F,U+FB50-FDFF,U+FE70-FEFC;
}
@font-face {
  font-family: Alexandria;
  src: url("fonts/alexandria-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

:root {
  color-scheme: light;
  --paper: #eff3ef;
  --surface: #fcfdfa;
  --ink: #172f26;
  --muted: #4a6255;
  --line: #d6e2d7;
  --control-line: #b3c7b7;
  --deep: #102a24;
  --on-deep: #f2f9f2;
  --chrome-muted: #c6dbcf;
  --chrome-active: #2b493d;
  --action: #215840;
  --action-hover: #194932;
  --on-action: #f7fff5;
  --link: #184b35;
  --accent: #c5efaa;
  --accent-hover: #d9f9c5;
  --accent-ink: #152c21;
  --wash: #e5efe5;
  --wash-hover: #edf5eb;
  --hover-line: #8baa98;
  --focus: #197447;
  --danger: #9a243d;
  --on-danger: #fff5f6;
  --paper-shadow: #112b2314;
  --hero-edge: #0b211b;
  --hero-fade: #0b211bcc;
  --hero-mobile: url("fleet-mobile.webp");
  --hero-wide: url("fleet.webp");
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23215840' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --radius: 18px;
  --dock: 72px;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  font: 400 100%/1.65 Alexandria, "Segoe UI", Tahoma, sans-serif;
}
:root[data-theme="gold"] {
  color-scheme: dark;
  --paper: #13120f;
  --surface: #1e1a15;
  --ink: #faf1df;
  --muted: #ccbea6;
  --line: #3e3528;
  --control-line: #756248;
  --deep: #17140f;
  --on-deep: #fcf1d9;
  --chrome-muted: #decba5;
  --chrome-active: #362c1d;
  --action: #e7bd70;
  --action-hover: #f4d28d;
  --on-action: #27190b;
  --link: #efca81;
  --accent: #edc87c;
  --accent-hover: #ffdc93;
  --accent-ink: #2b1c0e;
  --wash: #32291c;
  --wash-hover: #2b251a;
  --hover-line: #8c754b;
  --focus: #f0bd60;
  --danger: #ffb1bc;
  --on-danger: #35121c;
  --paper-shadow: #06050470;
  --hero-edge: #15120e;
  --hero-fade: #15120edb;
  --hero-mobile: url("fleet-gold-mobile.webp");
  --hero-wide: url("fleet-gold.webp");
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23efca81' stroke-width='1.7' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); }
h1, h2, p { margin: 0; }
h1, h2 { line-height: 1.4; }
h1 { font-size: 1.65rem; font-weight: 750; }
h2 { font-size: 1.175rem; font-weight: 700; }
a { color: var(--link); }
button, input, select { font: inherit; }
button, summary { cursor: pointer; }
button { color: inherit; }
button:disabled { cursor: default; opacity: .5; }
button, input, select, a, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.icon-library { position: absolute; inline-size: 0; block-size: 0; pointer-events: none; }
.icon { display: block; width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; inline-size: 1px; block-size: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.top { background: var(--deep); color: var(--on-deep); border-bottom: 1px solid var(--chrome-active); }
.top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 65px;
  max-width: 1248px;
  margin-inline: auto;
  padding: env(safe-area-inset-top) clamp(16px, 4vw, 40px) 0;
}
.brand { display: flex; gap: 10px; align-items: center; flex: none; }
.brand strong { font-weight: 750; font-size: .985rem; }
.brand-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); }
.identity { color: var(--chrome-muted); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid var(--chrome-active); border-radius: 999px; padding: 4px 10px; }
.nav {
  position: fixed;
  z-index: 10;
  inset: auto 0 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  justify-content: center;
  min-height: calc(var(--dock) + env(safe-area-inset-bottom));
  padding: 7px max(12px, env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 20px var(--paper-shadow);
}
.nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 54px;
  min-width: 0;
  padding: 4px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: .73rem;
  font-weight: 650;
}
.nav button[aria-current="page"] { background: var(--wash); color: var(--link); }
.nav button[aria-current="page"] .icon { transform: translateY(-2px); }

.main { max-width: 1248px; margin-inline: auto; padding: 18px clamp(14px, 4vw, 40px) 32px; }
body.signed-in .main { padding-bottom: calc(var(--dock) + env(safe-area-inset-bottom) + 26px); }
.boot {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 20px;
  min-height: min(62svh, 420px);
  color: var(--muted);
  font-weight: 650;
}
.boot-art { position: relative; display: grid; place-items: center; width: 112px; height: 112px; perspective: 360px; }
.boot-ring { position: absolute; inset: 0; border: 1px solid var(--control-line); border-block-start: 2px solid var(--link); border-radius: 50%; }
.boot-emblem { display: grid; place-items: center; width: 78px; height: 78px; border-radius: 21px; background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 20px var(--paper-shadow); }
.boot-emblem .icon { width: 44px; height: 44px; stroke-width: 1.35; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-size: .875rem;
  font-weight: 650;
  text-decoration: none;
}
.button .icon { width: 19px; height: 19px; }
.primary { background: var(--action); color: var(--on-action); }
.secondary { background: var(--surface); border-color: var(--line); color: var(--link); }
.hero-button { background: var(--accent); color: var(--accent-ink); }
.hero-button:focus-visible { outline-color: var(--accent); }
.back { padding-inline: 0 6px; background: transparent; color: var(--link); }
label { display: block; font-size: .875rem; font-weight: 650; }
label small { display: block; margin-top: 2px; color: var(--muted); font-size: .8rem; font-weight: 400; }
input, select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 9px 12px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--control-line);
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 450;
}
input::placeholder { color: var(--muted); opacity: 1; }
label > input, label > select { margin-block-start: 5px; }
select {
  appearance: none;
  padding-inline-end: 34px;
  background-image: var(--chevron);
  background-repeat: no-repeat;
  background-position: left 10px center;
}

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: end;
  min-height: 232px;
  overflow: hidden;
  border: 1px solid var(--chrome-active);
  border-radius: 23px;
  background: var(--hero-edge);
  color: var(--on-deep);
}
.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background-image: linear-gradient(to top, var(--hero-edge) 2%, var(--hero-fade) 28%, transparent 72%), var(--hero-mobile);
  background-position: center, left 46%;
  background-size: cover;
  background-repeat: no-repeat;
}
.hero-copy { display: grid; align-items: end; justify-items: start; gap: 8px 12px; width: 100%; padding: 16px; }
.hero h1 { font-size: 1.67rem; letter-spacing: -.04em; }
.hero-button { white-space: nowrap; }

.listing { margin-block-start: 24px; }
.list-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; min-height: 32px; }
.list-heading-copy { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; }
.list-meta { padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: .73rem; white-space: nowrap; }
.search-wrap { position: relative; margin-block: 12px 14px; }
.search-wrap > .icon { position: absolute; inset-inline-start: 13px; inset-block-start: 50%; transform: translateY(-50%); color: var(--link); pointer-events: none; }
.search-wrap input { min-height: 50px; padding-inline-start: 45px; border-radius: 14px; }
.items { display: grid; gap: 8px; align-items: stretch; }
.item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 72px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  text-align: start;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.item-icon { display: grid; place-items: center; inline-size: 39px; block-size: 39px; border-radius: 12px; color: var(--link); background: var(--wash); }
.item-icon .icon { width: 21px; height: 21px; }
.item-text { display: grid; gap: 5px; min-width: 0; }
.item-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 9px; font-size: .94rem; line-height: 1.38; }
.item-name strong { font-weight: 750; font-variant-numeric: tabular-nums; }
.item-name small { font-size: .79rem; color: var(--muted); }
.item-meta, .item-action { display: flex; align-items: center; gap: 6px; }
.item-meta { flex-wrap: wrap; }
.item-detail { color: var(--muted); font-size: .77rem; line-height: 1.5; }
.item-code { padding: 2px 6px; border-radius: 5px; background: var(--wash); color: var(--link); font-size: .71rem; font-weight: 700; }
.item-format { color: var(--link); direction: ltr; font-size: .65rem; font-weight: 750; letter-spacing: .08em; }
.item-action .icon, .tail { color: var(--link); width: 17px; height: 17px; }
#workspace[data-view="register"] .list-heading-copy { flex: 1; justify-content: space-between; }
#workspace[data-view="register"] .items { gap: 10px; }
.record-card {
  min-height: 88px;
  gap: 8px 10px;
  border-radius: 16px;
  background: linear-gradient(to left, color-mix(in srgb, var(--wash) 35%, var(--surface)), var(--surface) 54%);
}
.record-icon {
  display: grid;
  place-items: center;
  inline-size: 39px;
  block-size: 39px;
  border-radius: 12px;
  background: var(--wash);
  color: var(--link);
}
.record-content { display: grid; gap: 7px; min-width: 0; }
.record-name { color: var(--ink); font-size: .96rem; line-height: 1.42; font-weight: 750; }
.record-metadata { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 7px; }
.record-detail {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 5px;
  min-width: 0;
  max-width: 100%;
  font-size: .73rem;
  line-height: 1.4;
}
.record-detail > span { color: var(--muted); font-size: .69rem; }
.record-detail bdi { min-width: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.record-plate { padding: 3px 6px; border: 1px solid var(--control-line); border-radius: 6px; background: var(--surface); color: var(--link); }
.record-model { padding: 3px 1px; color: var(--muted); }
.record-arrow { display: grid; place-items: center; width: 21px; height: 23px; color: var(--link); }
.record-arrow .icon { width: 17px; height: 17px; }
#workspace[data-view="catalog"] .item { min-height: 78px; }

.list-loading { grid-column: 1 / -1; display: grid; gap: 10px; }
.skeleton-row { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 12px; align-items: center; min-height: 68px; border-radius: 14px; border: 1px solid var(--line); padding: 12px; background: var(--surface); }
.skeleton-row > span { display: block; block-size: 36px; border-radius: 12px; background: var(--wash); }
.skeleton-row > span + span { inline-size: 68%; block-size: 10px; border-radius: 999px; }
.empty { padding: 24px 16px; color: var(--muted); border: 1px dashed var(--control-line); border-radius: 13px; grid-column: 1 / -1; }
.empty .button { display: flex; width: fit-content; margin-block-start: 12px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-block-start: 16px; }
.pager span { color: var(--muted); font-size: .82rem; text-align: center; }

.settings, .detail { padding-block-start: 6px; }
.settings > h1 { margin-block-end: 14px; }
.directory-heading { display: grid; gap: 14px; padding: 4px 0 14px; border-bottom: 1px solid var(--line); }
.directory-heading h1 { font-size: 1.8rem; }
.segments { display: grid; grid-template-columns: minmax(0, 1.16fr) minmax(0, 1fr); gap: 4px; padding: 4px; background: var(--wash); border: 1px solid var(--line); border-radius: 15px; }
.segments button { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 48px; padding: 7px 5px; border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--muted); font-size: .79rem; font-weight: 650; }
.segments .icon { width: 18px; height: 18px; }
.segments button[aria-pressed="true"] { background: var(--surface); border-color: var(--control-line); color: var(--link); }
.print-tools { display: grid; gap: 10px; }
.print-banner {
  position: relative;
  display: grid;
  gap: 14px;
  isolation: isolate;
  overflow: hidden;
  padding: 17px;
  border: 1px solid var(--chrome-active);
  border-radius: 21px;
  background: linear-gradient(125deg, var(--chrome-active), var(--deep) 74%);
  color: var(--on-deep);
}
.print-banner h1 { font-size: 1.7rem; }
.print-watermark { position: absolute; z-index: -1; inset-block-start: -15px; inset-inline-end: -4px; inline-size: 128px; block-size: 128px; stroke-width: .65; color: var(--accent); opacity: .29; transform: rotate(-13deg); }
.form-pick { color: var(--chrome-muted); }
.form-pick select { max-width: 440px; }
.batch-disclosure summary { min-height: 52px; }
.batch-disclosure summary .icon { color: var(--link); }
.stack { display: grid; gap: 12px; }
.disclosure { border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.disclosure summary { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 9px 12px; font-size: .875rem; font-weight: 650; list-style: none; }
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::after { content: ""; width: 8px; height: 8px; margin-inline-start: auto; margin-inline-end: 3px; border: solid currentColor; border-width: 0 0 1.5px 1.5px; transform: rotate(-45deg); }
.disclosure[open] summary::after { transform: rotate(135deg); }
.batch-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 0 12px 12px; }
.batch-form p, .batch-form button { grid-column: 1 / -1; }
.batch-form p { color: var(--muted); font-size: .835rem; }

.detail-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-block: 7px 17px; }
.detail-heading h1 { overflow-wrap: anywhere; }
.detail-heading .button { flex: none; }
.field-group { margin: 0 0 15px; padding: 14px 12px; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.field-group h2 { margin-block-end: 12px; }
.field-group > div { display: grid; gap: 12px; }
.field { min-width: 0; }
.field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; min-height: 24px; }
.field-head label { overflow-wrap: anywhere; }
.field-head small { color: var(--muted); font-size: .7rem; flex: none; }
.field input { margin: 0; }
.field .custom-value { margin-block-start: 6px; }
.field input:disabled { border-color: var(--line); background: var(--wash); color: var(--muted); opacity: 1; -webkit-text-fill-color: var(--muted); }
.field .kind { width: auto; min-height: 44px; margin: 6px 0 0 auto; padding-block: 5px; font-size: .85rem; }
.save-bar {
  position: sticky;
  z-index: 2;
  bottom: calc(var(--dock) + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-inline: -4px;
  padding: 8px 4px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.save-bar .button { flex: 1 0 auto; }
.save-hint { color: var(--muted); font-size: .79rem; }

.settings { max-width: 620px; }
.settings-panel { margin-block-end: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.settings-panel > h2 { padding: 13px 14px 5px; font-size: .94rem; }
.settings-panel .stack { padding: 4px 14px 14px; }
.backup-panel summary .icon { color: var(--link); }
.backup-content, .backup-fields { display: grid; gap: 12px; }
.backup-content { padding: 4px 14px 14px; }
.backup-fields { padding: 0; margin: 0; min-width: 0; border: 0; }
.backup-grid, .backup-status { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.backup-grid label { align-self: end; }
.backup-grid select[dir="ltr"] { background-position: right 10px center; }
.backup-status { padding: 10px; margin: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.backup-status dt, .backup-hint { font-size: .8rem; color: var(--muted); }
.backup-status dd { margin: 3px 0 0; font-weight: 650; font-size: .84rem; overflow-wrap: break-word; }
.backup-limit { display: flex; align-items: center; min-height: 44px; gap: 9px; cursor: pointer; }
.backup-limit input { width: 20px; height: 20px; min-height: 0; margin: 0; flex: none; accent-color: var(--action); }
.backup-actions, .backup-archives { display: grid; gap: 9px; }
.backup-archives { border-block-end: 1px solid var(--line); padding-block: 3px 13px; }
.backup-archives h3 { font-size: .87rem; margin: 0; }
.backup-files { display: grid; gap: 7px; list-style: none; margin: 0; padding: 0; }
.backup-file { display: flex; align-items: center; gap: 9px; justify-content: space-between; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.backup-file-info { display: grid; gap: 4px; min-width: 0; flex: 1; }
.backup-file-info strong { font-size: .8rem; }
.backup-file-info small { color: var(--muted); font-size: .72rem; overflow-wrap: anywhere; }
.backup-file .button { flex: none; padding-inline: 8px; font-size: .77rem; white-space: nowrap; }
.backup-file-actions { display: flex; gap: 5px; }
.backup-delete { color: var(--danger); }
.backup-dialog { max-width: min(440px, calc(100% - 26px)); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); padding: 17px; }
.backup-dialog::backdrop { background: rgb(0 0 0 / .64); }
.backup-dialog p { line-height: 1.65; overflow-wrap: anywhere; }
.backup-dialog-filename { color: var(--muted); font-size: .83rem; }
.backup-dialog-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.backup-dialog-actions button { flex: 1; }
.backup-danger { background: var(--danger); color: var(--on-danger); }
@media (max-width: 520px) {
  .backup-file { flex-direction: column; align-items: stretch; }
  .backup-file-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.install-guide { margin: 0 8px 8px; border: 0; background: transparent; }
.install-guide summary { padding-inline: 7px; }
.install-guide p { padding: 0 7px 9px; font-size: .87rem; color: var(--muted); }
.install-guide .icon, .install-complete .icon { color: var(--link); }
.install-complete { display: flex; align-items: center; gap: 9px; min-height: 48px; padding: 8px 14px 12px; font-size: .875rem; }
.action-row {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  min-height: 65px;
  padding: 11px 14px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--link);
  text-align: start;
  text-decoration: none;
  font-size: .9rem;
}
.action-row > span { display: grid; flex: 1; gap: 2px; min-width: 0; }
.action-row small { color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }

.login { display: grid; margin: 12px auto; max-width: 850px; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.login-visual { min-height: 166px; background: var(--hero-edge) var(--hero-mobile) left center / cover no-repeat; }
.login-content { padding: 20px 16px 22px; }
.login-content h1 { margin-block-end: 14px; }
.login-content .primary { margin-top: 4px; }
.toast {
  position: fixed;
  z-index: 12;
  inset-inline: max(14px, calc((100vw - 600px) / 2));
  bottom: max(18px, env(safe-area-inset-bottom));
  padding: 11px 14px;
  border: 1px solid var(--action);
  border-radius: 12px;
  background: var(--deep);
  color: var(--on-deep);
  font-size: .88rem;
  box-shadow: 0 4px 18px var(--paper-shadow);
}
body.signed-in .toast { bottom: calc(var(--dock) + env(safe-area-inset-bottom) + 10px); }
body.is-editing .toast { bottom: calc(var(--dock) + env(safe-area-inset-bottom) + 92px); }
.toast[data-error="true"] { background: #672635; border-color: #672635; color: #fff0f2; }

.theme-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 9px 14px 14px; }
.theme-option { position: relative; cursor: pointer; min-width: 0; }
.theme-tile { display: grid; gap: 8px; padding: 6px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.theme-option input:checked + .theme-tile { border-color: var(--focus); background: var(--wash); }
.theme-option input:focus-visible + .theme-tile { outline: 2px solid var(--focus); outline-offset: 3px; }
.theme-swatch {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 2.2;
  min-height: 45px;
  border: 1px solid var(--swatch-line);
  border-radius: 8px;
  background: linear-gradient(to bottom, var(--swatch-top) 22%, var(--swatch-bg) 22%);
}
.theme-swatch[data-swatch="green"] { --swatch-top: #102a24; --swatch-bg: #f0f4ec; --swatch-card: #d6e7d2; --swatch-accent: #bce5a1; --swatch-line: #4a6c55; }
.theme-swatch[data-swatch="gold"] { --swatch-top: #292319; --swatch-bg: #15130f; --swatch-card: #4b3a24; --swatch-accent: #efc777; --swatch-line: #766040; }
.theme-swatch::before { content: ""; position: absolute; inset: 40% 11% 17% 11%; border-radius: 5px; background: linear-gradient(to right, var(--swatch-card) 62%, transparent 62%); }
.theme-swatch::after { content: ""; position: absolute; inset: 40% 11% 17% auto; width: 27%; border-radius: 5px; background: var(--swatch-accent); }
.theme-caption { display: flex; align-items: center; justify-content: space-between; gap: 5px; padding-inline: 3px; min-height: 25px; font-size: .78rem; }
.theme-check { width: 19px; height: 19px; flex: none; display: grid; place-items: center; border: 1px solid var(--control-line); border-radius: 50%; }
.theme-check .icon { width: 13px; height: 13px; opacity: 0; }
.theme-option input:checked + .theme-tile .theme-check { background: var(--action); color: var(--on-action); border-color: var(--action); }
.theme-option input:checked + .theme-tile .theme-check .icon { opacity: 1; }

@media (min-width: 360px) {
  .hero-copy { grid-template-columns: minmax(0, 1fr) auto; }
}

@media (min-width: 620px) {
  .main { padding-top: 24px; }
  .hero { min-height: 250px; align-items: center; }
  .hero::before {
    background-image: linear-gradient(to left, var(--hero-edge) 0%, var(--hero-fade) 22%, transparent 65%), var(--hero-wide);
    background-position: center, left center;
    background-size: cover, auto 110%;
  }
  .hero-copy { grid-template-columns: 1fr; gap: 17px; padding: 27px 36px; }
  .hero h1 { font-size: 2.15rem; }
  .items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .item { padding: 12px 14px; }
  .directory-heading { grid-template-columns: 1fr minmax(250px, 355px); align-items: center; }
  .print-tools { grid-template-columns: minmax(0, 1.7fr) minmax(230px, 1fr); align-items: start; gap: 14px; }
  .print-banner { padding: 20px; }
  .field-group { padding: 18px; }
  .field-group > div { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .save-bar .button { flex: none; min-width: 180px; }
  .login { grid-template-columns: 1fr 1fr; margin-block: clamp(24px, 9vh, 90px); }
  .login-visual { grid-column: 2; grid-row: 1; }
  .login-content { grid-column: 1; grid-row: 1; padding: 35px; }
}

@media (min-width: 900px) {
  :root { --dock: 0px; }
  .top-inner { min-height: 74px; }
  .nav { position: static; display: flex; gap: 4px; min-height: 0; padding: 0; border: 0; background: transparent; box-shadow: none; }
  .nav button { flex-direction: row; gap: 7px; min-height: 44px; padding: 6px 13px; color: var(--chrome-muted); font-size: .825rem; }
  .nav button[aria-current="page"] { background: var(--chrome-active); color: var(--on-deep); }
  .nav button:focus-visible { outline-color: var(--accent); }
  .nav .icon { width: 18px; height: 18px; }
  .main { padding-top: 30px; }
  .hero { min-height: 278px; }
  .hero-copy { padding-inline: 46px; }
  .hero h1 { font-size: 2.65rem; }
  .search-wrap { max-width: 550px; }
  #workspace[data-view="catalog"] .items { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .field-group > div { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (hover: hover) {
  .primary:hover { background: var(--action-hover); }
  .hero-button:hover { background: var(--accent-hover); }
  .item:hover, .secondary:hover { border-color: var(--hover-line); background: var(--wash-hover); }
  .action-row:hover { background: var(--wash); }
  .nav button:not([aria-current]):hover { background: color-mix(in srgb, var(--wash) 36%, transparent); }
}

.contract-view { max-width: 960px; margin-inline: auto; }
.contract-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-block: 8px 15px; }
.contract-heading h1 { overflow-wrap: anywhere; }
.contract-links { display: flex; flex-wrap: wrap; gap: 8px; }
.contract-feedback { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.contract-spinner { width: 18px; height: 18px; flex: none; border: 2px solid var(--line); border-block-start-color: var(--action); border-radius: 50%; animation: spin .8s linear infinite; }
.contract-pages { display: grid; gap: 16px; justify-items: center; }
.contract-page { margin: 0; width: min(100%, 770px); min-width: 0; }
.contract-page :is(img,canvas) { display: block; width: 100%; max-width: 100%; height: auto; object-fit: contain; background: #fff; box-shadow: 0 0 0 1px var(--line); }
.contract-sheet { position: relative; overflow: hidden; background: #fff; color: #000; box-shadow: 0 0 0 1px var(--line); }
.contract-sheet > img, .contract-sheet-fields { position: absolute; inset: 0 auto auto 0; }
.contract-sheet > img { height: 100%; object-fit: fill; }
.contract-sheet-fields { visibility: hidden; direction: ltr; transform-origin: top left; }
.contract-sheet[data-ready] .contract-sheet-fields { visibility: visible; }
.contract-page figcaption { margin-block-start: 6px; text-align: center; color: var(--muted); font-size: .82rem; }
.contract-missing { padding: 14px; background: var(--surface); color: var(--muted); }
.dealer-panel, .dealer-credentials { display: grid; gap: 12px; padding: 14px; }
.dealer-fields { display: grid; gap: 10px; min-width: 0; padding: 0; margin: 0; border: 0; }
.dealer-storage-hint { margin-block: 10px 0; }
.dealer-token-guide { background: var(--wash); }
.dealer-token-guide ol { margin-block: 0; padding-inline: 30px 12px; font-size: .875rem; line-height: 1.65; }
.dealer-token-guide li + li { margin-block-start: 6px; }
.dealer-token-guide > a { display: block; padding: 10px 12px; font-size: .875rem; }
.dealer-credentials { background: var(--wash); border: 1px solid var(--line); border-radius: var(--radius); }
.dealer-credentials h3 { margin: 0; font-size: 1rem; }
.dealer-access { margin: 0; display: grid; gap: 6px; }
.dealer-access div { display: grid; gap: 2px; }
.dealer-access dt, .dealer-list p { color: var(--muted); font-size: .88rem; }
.dealer-access dd, .dealer-list p { margin: 0; }
.dealer-access a, .dealer-access code, .dealer-item a { display: inline-block; overflow-wrap: anywhere; }
.dealer-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dealer-list { list-style: none; display: grid; gap: 10px; margin: 0; padding: 0; }
.dealer-item { display: grid; gap: 7px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.member-list-section { display: grid; gap: 8px; padding: 4px 14px 14px; }
.member-list-section h3 { margin: 0; font-size: .95rem; }
.member-list-section .dealer-item strong { overflow-wrap: anywhere; }
.member-list-section .member-disabled { color: var(--danger); }
@media (min-width: 680px) {
  .dealer-fields { grid-template-columns: repeat(3,minmax(0,1fr)); align-items: end; }
  .dealer-fields button { justify-self: start; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes emblem-turn { to { transform: rotateY(360deg); } }
@keyframes enter { from { opacity: .55; transform: translateY(8px); } }
@keyframes placeholder-breathe { 50% { opacity: .62; } }

@media (prefers-reduced-motion: no-preference) {
  .boot-emblem { animation: emblem-turn 1.8s cubic-bezier(.55,.04,.46,.96) infinite; }
  .boot-ring { animation: spin 2.2s linear infinite; }
  .hero:not([hidden]), .print-tools:not([hidden]), .directory:not([hidden]), .contract-view:not([hidden]) { animation: enter 390ms var(--ease-out) both; }
  .item:nth-child(-n+6) { animation: enter 260ms var(--ease-out) both; }
  .item:nth-child(2) { animation-delay: 22ms; }
  .item:nth-child(3) { animation-delay: 44ms; }
  .item:nth-child(4) { animation-delay: 66ms; }
  .item:nth-child(5) { animation-delay: 88ms; }
  .item:nth-child(6) { animation-delay: 110ms; }
  .skeleton-row { animation: placeholder-breathe 1.1s ease-in-out infinite; }
  .nav .icon, .item-action .icon, .record-arrow .icon, .disclosure summary::after { transition: transform 210ms var(--ease-out); }
  .button, .item { transition: transform 150ms var(--ease-out); }
  .button:active:not(:disabled), .item:active { transform: scale(.98); }
  @media (hover: hover) {
    .item:hover .item-action .icon, .record-card:hover .record-arrow .icon { transform: translateX(-3px); }
  }
}
@media (prefers-reduced-motion: reduce) {
  .contract-spinner { animation: none; }
}
