@font-face {
  font-family: "Syne";
  src: url("/static/fonts/syne-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: optional;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: optional;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: optional;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: optional;
}

:root,
html[data-theme="dark"] {
  --bg: #0e1012;
  --wash: #14181c;
  --raised: #15181c;
  --panel: #1a1f25;
  --fg: #eef1f4;
  --muted: #8b939c;
  --border: #2c333b;
  --control-edge: #3d4650;
  --brand: #c4a35a;
  --brand-hover: #d4b36a;
  --brand-ink: #161310;
  --ok: #3f8f6b;
  --err: #c45c4a;
  --space: 8px;
  --focus: #e4c57a;
  --auth-glow: #2a2418;
  --notice-ok-bg: #1a2e26;
  --notice-ok-fg: #cde8d9;
  --notice-info-bg: #243044;
  --notice-info-fg: #d5e4ff;
  --notice-err-bg: #3a201c;
  --notice-err-fg: #f3cfc8;
  --notice-warn-bg: #3a2e16;
  --notice-warn-fg: #f0e0b0;
  --drop-line: #8a7544;
  --drop-fill: #12161a;
  --control-face: #101317;
  --control-focus: #1a1f26;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="light"] {
  --bg: #f3efe6;
  --wash: #ebe6db;
  --raised: #e7e1d4;
  --panel: #faf7f0;
  --fg: #1c1914;
  --muted: #5c574e;
  --border: #d4cdc0;
  --control-edge: #b8ae9c;
  --brand: #8a6a28;
  --brand-hover: #755820;
  --brand-ink: #faf7f0;
  --ok: #2c6b4f;
  --err: #b24738;
  --focus: #8a6a28;
  --auth-glow: #d9c9a0;
  --notice-ok-bg: #dceae2;
  --notice-ok-fg: #1d4334;
  --notice-info-bg: #dce4ef;
  --notice-info-fg: #243044;
  --notice-err-bg: #f6d9d4;
  --notice-err-fg: #6b2218;
  --notice-warn-bg: #f3e6c6;
  --notice-warn-fg: #5c4310;
  --drop-line: #8a6a28;
  --drop-fill: #efe9dc;
  --control-face: #fffdf8;
  --control-focus: #ffffff;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  overflow-x: clip;
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
}

html.fonts-pending .type-display,
html.fonts-pending .brand {
  opacity: 0;
}

html.fonts-ready .type-display,
html.fonts-ready .brand {
  opacity: 1;
  transition: opacity 0.45s ease;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, var(--wash) 0%, var(--bg) 28%),
    var(--bg);
  color: var(--fg);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  overflow-x: clip;
}

.type-display,
.brand {
  font-family: Syne, "Segoe UI", sans-serif;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.data {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--brand);
}

.is-auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px 16px;
  background:
    radial-gradient(900px 420px at 80% -10%, var(--auth-glow) 0%, transparent 55%),
    var(--bg);
}

.auth-card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-top: 2px solid var(--brand);
  border-radius: 12px;
  padding: 32px;
}

.auth-card h1 {
  margin: 8px 0 0;
  font-size: 32px;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--fg);
  text-decoration: none;
  font-size: 22px;
  line-height: 1.1;
}

.brand span {
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 10px;
  color: var(--brand);
}

.lede {
  color: var(--muted);
  margin: 8px 0 0;
  line-height: 1.5;
  max-width: 52ch;
}

.is-auth .lede {
  margin-bottom: 24px;
}

.shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 20px;
  background: var(--raised);
  border-right: 1px solid var(--border);
  box-shadow: inset -1px 0 0 color-mix(in srgb, var(--brand) 28%, transparent);
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rail-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
}

.rail-nav a.is-on,
.rail-nav a:hover {
  color: var(--fg);
  background: var(--panel);
}

.rail-nav a.is-on {
  box-shadow: inset 2px 0 0 var(--brand);
}

.rail-foot {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
}

.rail-head {
  display: contents;
}

.nav-toggle,
.nav-scrim,
.rail-close {
  display: none;
}

.seg {
  --seg-inset: 3px;
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  isolation: isolate;
  margin: 0;
  padding: var(--seg-inset);
  min-width: 168px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, var(--control-edge));
  border-radius: 999px;
  background: color-mix(in srgb, var(--control-face) 88%, var(--panel));
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.28);
}

.seg-thumb {
  position: absolute;
  top: var(--seg-inset);
  bottom: var(--seg-inset);
  left: var(--seg-inset);
  width: calc((100% - var(--seg-inset) * 2) / 2);
  border-radius: 999px;
  background: var(--brand);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 color-mix(in srgb, #fff 32%, transparent);
  transform: translateX(0);
  transition: transform 0.48s var(--ease-out);
  z-index: 0;
  pointer-events: none;
}

.seg[data-pos="1"] .seg-thumb {
  transform: translateX(100%);
}

.seg > a,
.seg > button {
  position: relative;
  z-index: 1;
  appearance: none;
  border: 0;
  background: transparent;
  color: color-mix(in srgb, var(--fg) 72%, var(--muted));
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
  padding: 8px 14px;
  cursor: pointer;
  transition: color 0.35s var(--ease-out);
}

.seg > a[lang="ja"],
.seg > button[lang="ja"] {
  letter-spacing: 0.04em;
  text-transform: none;
  font-weight: 600;
}

.seg > a.is-on,
.seg > button.is-on,
.seg > button[aria-pressed="true"] {
  color: var(--brand-ink);
}

.seg > a:focus-visible,
.seg > button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 999px;
}

.auth-tools {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  justify-content: flex-end;
}

.lang-switch {
  margin: 0;
}

.topbar-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.header-icons {
  display: none;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--border) 80%, var(--control-edge));
  border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  color: var(--fg);
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 10%, transparent);
  cursor: pointer;
}

.icon-btn-text {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.icon-theme {
  display: none;
  width: 20px;
  height: 20px;
  overflow: visible;
}

html[data-theme="dark"] .icon-moon,
html[data-theme="light"] .icon-sun {
  display: block;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.btn-compact {
  padding: 8px 14px;
  font-size: 12px;
  letter-spacing: 0.03em;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.muted-cell {
  color: var(--muted);
}

.yard-edit {
  display: grid;
  gap: 12px;
}

.yard-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.who {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.workspace {
  min-width: 0;
  padding: 24px 28px 48px;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px 24px;
  margin-bottom: 24px;
  width: 100%;
}

.topbar-lead {
  min-width: 0;
  flex: 1 1 12rem;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar h1 {
  margin: 0;
  font-size: 36px;
}

.canvas {
  display: grid;
  gap: 16px;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.kpi,
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  min-width: 0;
}

.kpi {
  border-top: 2px solid var(--brand);
}

.panel > h2,
.panel-head h2 {
  font-family: Syne, "Segoe UI", sans-serif;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 20px;
}

.panel > h2 {
  margin: 0 0 16px;
}

.kpi p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.kpi-n {
  margin-top: 8px !important;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 32px;
  line-height: 1.1;
  color: var(--fg);
}

.kpi-sub {
  margin-top: 10px !important;
  color: var(--fg) !important;
  font-size: 14px !important;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 16px;
  margin-bottom: 16px;
}

.panel-head h2 {
  margin: 0;
}

.diff {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 12px;
  color: var(--muted);
}

.diff li {
  margin: 0 0 4px;
}

.pager-meta {
  margin: 0 0 12px;
}

.split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 1080px) {
  .split {
    grid-template-columns: 1fr 1fr;
  }
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.toolbar label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 12px;
}

.stack.two {
  grid-template-columns: 1fr;
}

@media (min-width: 800px) {
  .stack.two {
    grid-template-columns: 1fr 1fr;
  }
}

.stack label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

::selection {
  background: var(--brand);
  color: var(--brand-ink);
}

.stack label:focus-within,
.toolbar label:focus-within {
  color: var(--brand);
}

.field-control {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  color: var(--fg);
  background-color: var(--control-face);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 11px 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--fg) 8%, transparent);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.field-control:hover {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--border));
}

.field-control:focus,
.field-control:focus-visible {
  outline: none;
  background-color: var(--control-focus);
  border-color: var(--brand);
  box-shadow:
    inset 4px 0 0 var(--brand),
    inset 0 1px 0 color-mix(in srgb, var(--brand) 22%, transparent);
}

select.field-control {
  padding-inline-end: 2.5rem;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--brand) 50%),
    linear-gradient(135deg, var(--brand) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) calc(50% - 2px),
    calc(100% - 14px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

select.field-control:focus,
select.field-control:focus-visible,
select.field-control:hover {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--brand) 50%),
    linear-gradient(135deg, var(--brand) 50%, transparent 50%);
}

select.field-control option {
  background: var(--panel);
  color: var(--fg);
}

input[type="checkbox"].field-control {
  width: 1.15rem;
  height: 1.15rem;
  padding: 0;
  accent-color: var(--brand);
  border-bottom-width: 1px;
  box-shadow: none;
  cursor: pointer;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--brand);
}

.dropzone:focus-within {
  outline: none;
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.btn,
button.btn {
  appearance: none;
  position: relative;
  border: 0;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, #fff 22%, var(--brand)) 0%,
      var(--brand) 46%,
      color-mix(in srgb, #000 16%, var(--brand)) 100%
    );
  color: var(--brand-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.04em;
  padding: 11px 20px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  white-space: nowrap;
  box-shadow:
    0 1px 0 color-mix(in srgb, #fff 18%, transparent),
    0 10px 22px color-mix(in srgb, var(--brand) 16%, transparent),
    inset 0 1px 0 color-mix(in srgb, #fff 30%, transparent);
  transition:
    transform 0.22s var(--ease-out),
    filter 0.22s var(--ease-out),
    box-shadow 0.22s var(--ease-out);
}

.btn:hover,
button.btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow:
    0 1px 0 color-mix(in srgb, #fff 22%, transparent),
    0 14px 26px color-mix(in srgb, var(--brand) 22%, transparent),
    inset 0 1px 0 color-mix(in srgb, #fff 34%, transparent);
}

.btn:active,
button.btn:active {
  transform: translateY(1px) scale(0.985);
  filter: brightness(0.98);
}

.btn-ghost {
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  color: var(--fg);
  border: 1px solid color-mix(in srgb, var(--border) 80%, var(--control-edge));
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #fff 10%, transparent),
    0 6px 16px color-mix(in srgb, #000 8%, transparent);
}

.btn-ghost:hover {
  background: var(--raised);
  filter: none;
  border-color: color-mix(in srgb, var(--brand) 45%, var(--border));
}

.form-actions {
  margin-top: 16px;
}

.inline-form {
  display: inline;
}

.notices {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: grid;
  gap: 8px;
}

.notices li {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
}

.notices .notice-kicker {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.notices p {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
}

.notices .success {
  background: var(--notice-ok-bg);
  color: var(--notice-ok-fg);
  border-color: var(--ok);
}

.notices .info {
  background: var(--notice-info-bg);
  color: var(--notice-info-fg);
}

.notices .error,
.notices .danger {
  background: var(--notice-err-bg);
  color: var(--notice-err-fg);
  border-color: var(--err);
}

.notices .warning {
  background: var(--notice-warn-bg);
  color: var(--notice-warn-fg);
  border-color: var(--brand);
}

.auth-notes {
  width: min(440px, 100%);
  margin: 0;
  z-index: 5;
}

.field-error,
.errorlist {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  color: var(--err);
  font-size: 12px;
  font-weight: 600;
}

label.has-error .field-control,
.field-control.is-invalid {
  border-color: var(--err);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  text-align: start;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.spec {
  margin: 0;
  display: grid;
  gap: 10px;
}

.spec div {
  display: grid;
  grid-template-columns: minmax(7rem, 38%) 1fr;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.spec dt {
  color: var(--muted);
  font-size: 12px;
}

.spec dd {
  margin: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
  min-width: 0;
}

.plate {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 28px;
  letter-spacing: 0.08em;
  margin: 0 0 16px;
}

.plate-ghost {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 40px;
  letter-spacing: 0.12em;
  color: var(--border);
  margin: 0 0 16px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
}

.warn-copy {
  font-size: 18px;
  line-height: 1.5;
}

.status-mix {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.status-mix li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.pager-meta {
  margin: 0 0 12px;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 16px;
}

.pager a,
.pager span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--fg);
  font-size: 13px;
}

.pager a:hover {
  background: var(--raised);
}

.pager .is-on {
  background: var(--brand);
  color: var(--brand-ink);
  border-color: var(--brand);
  font-variant-numeric: tabular-nums;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.pager .is-off {
  color: var(--muted);
}

.photo-bay {
  margin-top: 20px;
  min-width: 0;
}

.photo-bay-head {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.photo-bay-head h2 {
  margin: 0;
  font-size: 16px;
}

.photo-bay-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.dropzone {
  display: grid;
  place-items: center;
  position: relative;
  width: 100%;
  min-height: 200px;
  height: 220px;
  border: 1px dashed var(--drop-line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, var(--drop-fill) 0%, var(--bg) 100%);
  overflow: hidden;
  cursor: pointer;
}

.dropzone-copy {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 4px;
  text-align: center;
  padding: 16px;
  pointer-events: none;
}

.dropzone-copy strong {
  font-family: Syne, "Segoe UI", sans-serif;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.dropzone-name {
  color: var(--muted);
  font-size: 13px;
}

.dropzone-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  font-size: 0;
}

.dropzone-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.dropzone.has-file .dropzone-copy {
  opacity: 0;
}

.dropzone.has-file .viewfinder {
  z-index: 3;
}

.viewfinder {
  position: absolute;
  inset: 12px;
  z-index: 1;
  pointer-events: none;
}

.viewfinder i {
  position: absolute;
  width: 16px;
  height: 16px;
  border-color: var(--brand);
  border-style: solid;
}

.viewfinder i:nth-child(1) {
  top: 0;
  left: 0;
  border-width: 2px 0 0 2px;
}

.viewfinder i:nth-child(2) {
  top: 0;
  right: 0;
  border-width: 2px 2px 0 0;
}

.viewfinder i:nth-child(3) {
  bottom: 0;
  left: 0;
  border-width: 0 0 2px 2px;
}

.viewfinder i:nth-child(4) {
  bottom: 0;
  right: 0;
  border-width: 0 2px 2px 0;
}

.gallery {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 8px;
}

.gallery li {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  min-width: 0;
}

.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-empty {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

table tbody tr:hover td {
  background: var(--raised);
}

table.compact th {
  width: 38%;
  white-space: nowrap;
}

.scan-hero {
  max-width: 40rem;
}

.scan-hero .btn {
  margin: 8px 0;
}

.toolbar.panel {
  margin: 0;
}

.label-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.qr-desk .toolbar {
  align-items: flex-end;
}

.qr-fit {
  margin: 12px 0 0;
}

.qr-pickbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 14px;
}

.qr-checkall {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.qr-modes.seg {
  width: fit-content;
  min-width: 288px;
  margin: 0 0 16px;
}

.qr-modes.seg > a {
  padding: 9px 18px;
  font-size: 12px;
  letter-spacing: 0.05em;
}

.qr-studio {
  display: grid;
  gap: 20px;
}

.qr-studio.is-batch {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  align-items: start;
}

@media (max-width: 900px) {
  .qr-studio.is-batch {
    grid-template-columns: 1fr;
  }
}

.qr-source-hide {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.sheet-column {
  display: grid;
  gap: 14px;
  justify-items: center;
}

.sheet-viewport {
  width: min(100%, 400px);
  overflow: hidden;
}

.sheet-dock {
  width: min(100%, 400px);
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: center;
  justify-content: space-between;
}

.sheet-dock .qr-fit {
  margin: 0;
  flex: 1 1 160px;
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.sheet-frame {
  transform-origin: top left;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
  padding: 10mm;
}

[data-qr-preview] {
  width: 100%;
  height: 100%;
}

[data-qr-preview] .print-page {
  display: grid;
  grid-template-columns: repeat(var(--qr-cols, 1), 1fr);
  grid-template-rows: repeat(var(--qr-rows, 1), 1fr);
  gap: 3mm;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-items: center;
}

.sheet-viewport .print-page + .print-page {
  display: none;
}

.qr-picker {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
  grid-template-rows: none !important;
  justify-items: center;
  gap: 12px;
  background: transparent;
  padding: 0;
}

.qr-picker .sticker {
  width: 140px;
  min-height: 168px;
}

.qr-picker .sticker img {
  width: 140px;
  height: 140px;
}

.sticker {
  position: relative;
  width: var(--qr-mm);
  max-width: 100%;
  min-height: var(--qr-label-h);
  background: #fffdf8;
  color: #161310;
  padding: 0 0 2mm;
  text-align: center;
  border-radius: 0;
  border: 0.3mm solid #d8d0c4;
  box-shadow: none;
  break-inside: avoid;
  page-break-inside: avoid;
}

.sticker img {
  display: block;
  width: var(--qr-mm);
  height: var(--qr-mm);
  image-rendering: pixelated;
}

.sticker .plate {
  color: #161310;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  margin: 1.2mm 0 0;
}

.sticker-sub {
  margin: 0.4mm 0 0;
  font-size: 8px;
  color: #5c574e;
  padding: 0 1.5mm;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sticker-pick {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 1;
}

.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.qr-card {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  align-items: start;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.qr-card img {
  background: #fffdf8;
  border: 1px solid var(--border);
  width: 160px;
  height: 160px;
}

.qr-card-actions {
  display: grid;
  gap: 12px;
}

@media (max-width: 720px) {
  .qr-card {
    grid-template-columns: 1fr;
  }
}

.scan-hero p:last-child {
  color: var(--muted);
  max-width: 42ch;
  line-height: 1.5;
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }

  html.nav-open,
  html.nav-open body {
    overflow: hidden;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    appearance: none;
    border: 1px solid color-mix(in srgb, var(--border) 80%, var(--control-edge));
    border-radius: 14px;
    background: color-mix(in srgb, var(--panel) 88%, transparent);
    box-shadow:
      inset 0 1px 0 color-mix(in srgb, #fff 10%, transparent),
      0 8px 18px color-mix(in srgb, #000 12%, transparent);
    cursor: pointer;
    z-index: 36;
  }

  .nav-toggle-mark,
  .nav-toggle-mark::before,
  .nav-toggle-mark::after {
    position: absolute;
    display: block;
    width: 16px;
    height: 1.5px;
    border-radius: 999px;
    background: var(--fg);
    transition: transform 0.36s var(--ease-out), opacity 0.24s ease;
  }

  .nav-toggle-mark {
    left: 50%;
    top: 50%;
    margin: -0.75px 0 0 -8px;
  }

  .nav-toggle-mark::before,
  .nav-toggle-mark::after {
    content: "";
    left: 0;
  }

  .nav-toggle-mark::before {
    transform: translateY(-5px);
  }

  .nav-toggle-mark::after {
    transform: translateY(5px);
  }

  html.nav-open .nav-toggle-mark {
    transform: rotate(45deg);
  }

  html.nav-open .nav-toggle-mark::before {
    transform: rotate(90deg);
  }

  html.nav-open .nav-toggle-mark::after {
    opacity: 0;
  }

  .nav-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 42%, transparent);
    backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.32s var(--ease-out);
  }

  html.nav-open .nav-scrim[hidden] {
    display: block;
  }

  html.nav-open .nav-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .rail {
    position: fixed;
    top: 12px;
    bottom: 12px;
    left: 12px;
    width: min(300px, calc(100vw - 36px));
    z-index: 60;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 20px;
    padding: 22px 18px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--panel);
    pointer-events: none;
    transform: translateX(calc(-100% - 36px));
    box-shadow: none;
    transition: transform 0.44s var(--ease-out);
    overflow: auto;
  }

  html.nav-open .rail {
    transform: translateX(0);
    pointer-events: auto;
    box-shadow:
      0 24px 60px color-mix(in srgb, #000 38%, transparent),
      inset 0 1px 0 color-mix(in srgb, #fff 8%, transparent);
  }

  html.nav-open .nav-toggle {
    opacity: 0;
    pointer-events: none;
  }

  .rail-head .brand {
    flex: 1 1 auto;
  }

  .rail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
  }

  .rail-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    margin: -4px -4px 0 0;
    padding: 0;
    appearance: none;
    border: 0;
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
  }

  .rail-close span,
  .rail-close span::before {
    position: absolute;
    width: 14px;
    height: 1.5px;
    border-radius: 999px;
    background: var(--muted);
  }

  .rail-close span {
    transform: rotate(45deg);
  }

  .rail-close span::before {
    content: "";
    left: 0;
    top: 0;
    transform: rotate(90deg);
  }

  .rail-close:hover span,
  .rail-close:hover span::before {
    background: var(--fg);
  }

  .rail-foot {
    width: 100%;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }

  .header-icons {
    display: flex;
    grid-column: 3;
    grid-row: 1;
  }

  .topbar {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px 12px;
    margin: 0 0 16px;
  }

  .nav-toggle {
    grid-column: 1;
    grid-row: 1;
  }

  .topbar-lead {
    grid-column: 2;
    grid-row: 1;
  }

  .topbar-tools {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: stretch;
  }

  .topbar-tools .lang-switch,
  .topbar-tools [data-theme-switch] {
    display: none;
  }

  .page-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    width: 100%;
  }

  .page-actions form,
  .page-actions .btn {
    width: 100%;
    min-width: 0;
  }

  .kpis {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .kpi {
    padding: 14px;
  }

  .kpi-n {
    font-size: 24px;
  }

  .workspace {
    padding: 12px 16px 32px;
  }

  .topbar h1 {
    font-size: 22px;
    line-height: 1.15;
  }

  .topbar .lede {
    display: none;
  }

  .spec div {
    grid-template-columns: 1fr;
  }
}

@media print {
  .rail,
  .print-hide,
  .notices,
  .topbar,
  .topbar-tools,
  .nav-toggle,
  .nav-scrim {
    display: none !important;
  }

  .shell,
  .workspace,
  .canvas {
    display: block;
    padding: 0;
    margin: 0;
    background: #fff;
    max-width: none;
  }

  body {
    background: #fff;
    color: #111;
  }

  .qr-picker {
    display: block !important;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
    padding: 0;
    background: transparent;
  }

  .qr-picker .sticker,
  .qr-picker .sticker img {
    width: var(--qr-mm);
    height: auto;
  }

  .qr-picker .sticker img {
    height: var(--qr-mm);
  }

  .sheet-viewport {
    width: auto;
    height: auto !important;
    overflow: visible;
  }

  .sheet-frame {
    transform: none !important;
    width: auto !important;
    height: auto !important;
    padding: 0;
    margin: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
  }

  .sheet-viewport .print-page + .print-page {
    display: grid;
  }

  .qr-source-hide,
  .qr-picker {
    display: none !important;
  }

  .print-page {
    display: grid;
    grid-template-columns: repeat(var(--qr-cols, 1), 1fr);
    grid-template-rows: repeat(var(--qr-rows, 1), 1fr);
    gap: 3mm;
    width: 100%;
    height: calc(var(--sheet-h, 297mm) - 20mm);
    page-break-after: always;
    break-after: page;
    align-items: center;
    justify-items: center;
  }

  .print-page:last-child {
    page-break-after: auto;
  }

  .sticker:not(.is-picked) {
    display: none;
  }

  .print-page .sticker {
    display: block;
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html.fonts-ready .type-display,
  html.fonts-ready .brand {
    transition: none;
  }

  .seg-thumb,
  .seg > a,
  .seg > button,
  .btn,
  button.btn,
  .rail,
  .nav-scrim,
  .nav-toggle-mark,
  .nav-toggle-mark::before,
  .nav-toggle-mark::after {
    transition: none;
  }
}
