:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --faint: #86868b;
  --line: #e8e8ed;
  --line-strong: #d2d2d7;
  --sidebar: #fbfbfd;
  --sidebar-line: #e8e8ed;
  --nav: #1d1d1f;
  --accent: #8d2a32;
  --accent-deep: #6e1e25;
  --ok: #1c6840;
  --warn: #8a5a12;
  --bad: #9d2c2c;
  --info: #1d4e78;
  --head: #f5f5f7;
  --tint: #f5f5f7;
  --row: #fafafa;
  --hover: #f2f2f4;
  --sel: #f7eeee;
  --font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

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

html,
body {
  height: 100%;
  margin: 0;
}

html {
  color-scheme: light;
}

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
  font-feature-settings: "ss01" on;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  border-radius: 0;
}

button,
a,
summary {
  transition: none;
}

:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

button {
  height: 34px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  cursor: pointer;
  font-weight: 500;
}

button:hover {
  background: var(--hover);
  border-color: #c7c7cc;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent-deep);
  color: #fff;
}

button.primary:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

button.danger {
  color: var(--bad);
  border-color: #c98a8a;
  background: var(--surface);
}

button.danger:hover {
  background: #f8f1f1;
  border-color: var(--bad);
}

button:disabled {
  color: var(--faint);
  background: var(--head);
  border-color: var(--line);
  cursor: default;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]),
select,
textarea {
  appearance: none;
  width: 100%;
  height: 34px;
  border: 1px solid var(--line-strong);
  background: #fff;
  padding: 0 10px;
}

textarea {
  height: auto;
  min-height: 76px;
  padding: 8px 10px;
  resize: vertical;
  line-height: 1.45;
}

input::placeholder,
textarea::placeholder {
  color: #aeaeb2;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):hover,
select:hover,
textarea:hover {
  border-color: #c7c7cc;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--accent);
  outline: none;
  background: #fff;
}

select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%231a1814' stroke-width='1.4' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

input[type="number"] {
  font-variant-numeric: tabular-nums;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}

input[type="checkbox"] {
  appearance: none;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 1px solid var(--line-strong);
  background: #fff;
  display: inline-grid;
  place-content: center;
  flex: 0 0 auto;
}

input[type="checkbox"]:checked {
  background-color: var(--accent);
  border-color: var(--accent-deep);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='8' viewBox='0 0 10 8'%3E%3Cpath d='M1 4.2 3.8 7 9 1' fill='none' stroke='%23fff' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

input[type="checkbox"]:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}

input[type="checkbox"]:disabled {
  background: var(--head);
  border-color: var(--line);
}

.picker {
  position: relative;
  width: 100%;
  min-width: 0;
}

.native-field {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.picker-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 34px;
  padding: 0 10px;
  background: #fff;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-weight: 400;
  text-align: left;
}

.picker-btn:hover,
.picker-btn.is-open {
  border-color: #c7c7cc;
  background: #fff;
}

.picker-btn:focus-visible,
.picker-btn.is-open {
  border-color: var(--accent);
  outline: none;
  background: #fff;
}

.picker.is-invalid .picker-btn {
  border-color: var(--bad);
}

.picker-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-btn.is-empty .picker-value {
  color: #aeaeb2;
}

.picker-ico {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  background-repeat: no-repeat;
  background-position: center;
}

.picker.is-select .picker-ico {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%231a1814' stroke-width='1.4' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
}

.picker.is-date .picker-ico {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Crect x='1.5' y='2.5' width='11' height='10' fill='none' stroke='%231a1814' stroke-width='1.2'/%3E%3Cpath d='M1.5 5.5h11M4.5 1.2v2.2M9.5 1.2v2.2' fill='none' stroke='%231a1814' stroke-width='1.2'/%3E%3C/svg%3E");
}

.picker-menu,
.cal {
  position: fixed;
  z-index: 100;
  background: var(--surface);
  border: 1px solid var(--line-strong);
}

.picker-menu {
  max-height: 240px;
  overflow: auto;
  padding: 4px 0;
}

.picker-opt {
  display: block;
  width: 100%;
  height: auto;
  min-height: 32px;
  padding: 7px 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 400;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.picker-opt:hover,
.picker-opt:focus-visible {
  background: var(--hover);
  outline: none;
}

.picker-opt.is-on {
  background: var(--sel);
  font-weight: 600;
}

.cal {
  width: 252px;
  padding: 10px;
}

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.cal-head strong {
  font-size: 13px;
  font-weight: 600;
}

.cal-nav {
  width: 28px;
  height: 28px;
  padding: 0;
  font-weight: 500;
}

.cal-week,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-week span {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 4px 0 6px;
}

.cal-day {
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.cal-day:hover {
  background: var(--hover);
}

.cal-day:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: -1px;
}

.cal-day.is-today {
  outline: 1px solid var(--line-strong);
  outline-offset: -1px;
}

.cal-day.is-on,
.cal-day.is-on:hover {
  background: var(--accent);
  color: #fff;
  outline: none;
}

.cal-day:disabled {
  color: #c7c7cc;
  background: transparent;
  cursor: default;
}

.cal-today {
  display: block;
  width: 100%;
  height: 30px;
  margin-top: 8px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--info);
  font-weight: 500;
  font-size: 13px;
}

.cal-today:hover {
  background: var(--tint);
}

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

.sidebar {
  grid-row: 1 / span 2;
  background: var(--sidebar);
  color: var(--nav);
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
}

.brand {
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--sidebar-line);
}

.brand strong {
  display: block;
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.brand span {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 12px;
}

.nav {
  overflow: auto;
  padding: 10px 0 16px;
  flex: 1;
}

.nav-label {
  margin: 12px 16px 2px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 1px 8px;
  padding: 5px 10px;
  color: var(--ink);
  text-decoration: none;
  border-left: 2px solid transparent;
  font-size: 13px;
  font-weight: 500;
}

.nav a:hover {
  background: var(--hover);
  color: var(--ink);
}

.nav a.active {
  background: #ececef;
  color: var(--ink);
  border-left-color: var(--accent);
}

.badge {
  min-width: 18px;
  padding: 0 5px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  text-align: center;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
}

.side-foot {
  padding: 12px 16px;
  border-top: 1px solid var(--sidebar-line);
  color: var(--faint);
  font-size: 11px;
  line-height: 1.35;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 52px;
  padding: 0 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.top-meta {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.top-meta b {
  color: var(--ink);
  font-weight: 600;
}

.search {
  flex: 1;
  max-width: 480px;
}

.topbar input[type="search"] {
  background: var(--bg);
  border-color: transparent;
}

.topbar input[type="search"]:hover {
  border-color: var(--line-strong);
  background: var(--bg);
}

.topbar input[type="search"]:focus-visible {
  background: #fff;
  border-color: var(--accent);
}

.content {
  overflow: auto;
  padding: 20px 22px 48px;
  min-width: 0;
}

.pagehead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: -20px -22px 16px;
  padding: 16px 22px 12px;
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.pagehead h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.lede {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 680px;
  line-height: 1.4;
}

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

.banner {
  padding: 10px 12px 10px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink);
  background: var(--surface);
}

.banner-err {
  border-color: #e4c8c8;
  border-left-color: var(--bad);
  background: #fbf6f6;
  color: #6e2424;
}

.banner-ok {
  border-color: #c9ddd0;
  border-left-color: var(--ok);
  background: #f4f8f5;
  color: #1a4a2e;
}

.banner-warn {
  border-color: #e6d7b8;
  border-left-color: var(--warn);
  background: #fbf8f2;
  color: #6a4a12;
}

.flow {
  display: flex;
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
}

.flow li {
  flex: 1;
  min-width: 0;
  border-right: 1px solid var(--line);
}

.flow li:last-child {
  border-right: 0;
}

.flow a {
  display: block;
  padding: 12px 14px 11px;
  color: inherit;
  text-decoration: none;
}

.flow a:hover {
  background: var(--tint);
}

.flow b {
  display: block;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.flow span {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
}

.home-grid,
.cols-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.8fr);
  gap: 14px;
  align-items: start;
}

.cols-3 {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 300px;
  gap: 14px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  min-width: 0;
}

.panel > h2,
.panel > h3 {
  margin: 0;
  padding: 14px 16px 12px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-transform: none;
  color: var(--ink);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.panel > h2 > span,
.panel > h3 > span {
  min-width: 0;
}

.panel > h2 small,
.panel > h3 small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--faint);
  line-height: 1.35;
}

.panel > h2 button,
.panel > h3 button {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  font-weight: 500;
}

button.linkish {
  border: 0;
  background: transparent;
  padding: 0;
  height: auto;
  color: var(--info);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
}

button.linkish:hover {
  background: transparent;
  border-color: transparent;
  text-decoration: underline;
}

a.btn {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
}

a.btn:hover {
  background: var(--hover);
  border-color: #c7c7cc;
}

a.btn.primary {
  background: var(--accent);
  border-color: var(--accent-deep);
  color: #fff;
}

a.btn.primary:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  color: #fff;
}

tr.pick {
  cursor: pointer;
}

.pad {
  padding: 14px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--surface);
  max-height: calc(100vh - 220px);
}

.panel .table-wrap,
.sheet .table-wrap {
  border: 0;
  max-height: none;
}

.table-wrap.tall {
  max-height: calc(100vh - 168px);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  background: var(--surface);
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  z-index: 1;
}

.table-wrap > table > thead th {
  background: var(--head);
}

tbody tr:nth-child(even) td {
  background: var(--row);
}

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

tr.sel td {
  background: var(--sel);
}

tbody tr:last-child td {
  border-bottom: 0;
}

td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.mono {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: -0.01em;
}

a.mono,
.link {
  color: var(--info);
  text-decoration: none;
  font-weight: 500;
}

a.mono:hover,
.link:hover {
  text-decoration: underline;
}

.st {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  white-space: nowrap;
  font-size: 13px;
}

.st i {
  width: 6px;
  height: 6px;
  background: var(--c, var(--faint));
  display: block;
  flex: 0 0 auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 16px;
}

.form-grid[hidden] {
  display: none;
}

.receive {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 12px;
  align-items: start;
}

.receive-side .table-wrap {
  max-height: none;
}

.choice {
  display: flex;
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

.choice label {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 14px 14px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.choice label:last-child {
  border-right: 0;
}

.choice label.is-on {
  background: var(--sel);
  border-bottom-color: var(--accent);
}

.choice small {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.35;
}

.choice input {
  margin-top: 3px;
  accent-color: var(--accent);
}

.recv-outcome {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
}

.recv-outcome b {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 600;
}

.recv-outcome span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.recv-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.recv-block[hidden] {
  display: none;
}

.recv-block > .form-section {
  padding-top: 0;
}

.recv-block > .field + .form-section,
.recv-block > .check-card + .form-section,
.recv-block > .recv-3 + .form-section,
.recv-block > .recv-checks + .form-section {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.recv-3 {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 16px;
}

.recv-checks {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.check-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.recv-block > .check-card {
  grid-column: 1 / -1;
}

.check-card small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.check-card:has(input:checked) {
  border-color: var(--line-strong);
  background: var(--surface);
}

.check-card input {
  margin-top: 2px;
}

.recv-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 16px -14px -14px;
  padding: 12px 14px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.recv-bar .primary {
  min-width: 196px;
}

.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > span,
.k {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0;
}

.hint,
.field > .hint {
  font-size: 12px;
  font-weight: 400;
  color: var(--faint);
  line-height: 1.35;
  letter-spacing: 0;
}

td .hint {
  margin-top: 2px;
}

.form-section {
  grid-column: 1 / -1;
  padding-top: 4px;
}

.form-section + .form-section,
.field + .form-section {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.form-section strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.form-section span {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 400;
}

.req::after {
  content: " *";
  color: var(--accent);
}

label.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 32px;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

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

.doc {
  max-width: 760px;
}

.doc h2 {
  margin: 28px 0 8px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.doc h3 {
  margin: 18px 0 6px;
  font-size: 14px;
  font-weight: 600;
}

.doc p,
.doc li {
  font-size: 14px;
  line-height: 1.5;
}

.doc p {
  margin: 0 0 10px;
}

.doc ol,
.doc ul {
  margin: 0 0 12px;
  padding-left: 1.25em;
}

.doc li {
  margin: 0 0 6px;
}

.doc a {
  color: var(--info);
  font-weight: 500;
}

.doc-path {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  border: 1px solid var(--line);
  background: #fff;
}

.doc-path li {
  margin: 0;
  padding: 10px 14px;
  border-right: 1px solid var(--line);
  font-size: 13px;
  font-weight: 500;
}

.doc-path li:last-child {
  border-right: 0;
}

.doc-path span {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kv {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr) 168px minmax(0, 1fr);
  border: 1px solid var(--line);
  background: var(--surface);
  margin-bottom: 14px;
}

.kv div {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.kv .k {
  background: var(--head);
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.cut-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cut-btns button {
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  background: var(--surface);
}

.cut-btns button.abp {
  background: var(--head);
  color: var(--muted);
}

.yield-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.yield-row b {
  font-weight: 600;
}

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.tabs button {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  height: 38px;
  margin-bottom: -1px;
  padding: 0 14px;
  color: var(--faint);
  font-weight: 500;
}

.tabs button:hover {
  color: var(--ink);
  background: transparent;
  border-bottom-color: var(--line-strong);
}

.tabs button.on {
  border-bottom-color: var(--accent);
  color: var(--ink);
  font-weight: 600;
}

.userbox {
  position: relative;
  margin-left: auto;
}

.userbox summary {
  list-style: none;
  cursor: pointer;
  padding: 0 0 0 10px;
  white-space: nowrap;
  font-weight: 600;
  color: var(--ink);
  text-align: right;
  line-height: 1.25;
}

.userbox summary .role {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--faint);
}

.userbox summary::-webkit-details-marker {
  display: none;
}

.userbox summary:hover {
  color: var(--accent);
}

.userpanel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 280px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  z-index: 5;
}

.userpanel .field {
  margin-bottom: 10px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pick {
  cursor: pointer;
}

.label {
  width: 100mm;
  min-height: 78mm;
  border: 1px solid #111;
  padding: 3mm 3.5mm;
  background: #fff;
  color: #000;
  font-size: 10.5px;
  line-height: 1.3;
}

.label-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.label h3 {
  margin: 2mm 0 1.5mm;
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  border: 0;
  padding: 0;
  letter-spacing: 0;
  text-transform: none;
  color: #000;
}

.oval {
  width: 58px;
  height: 36px;
  border: 1.5px solid #000;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
  flex: 0 0 auto;
}

.oval span {
  font-size: 9px;
}

.oval b {
  font-size: 10px;
}

.barcode {
  height: 26px;
  display: flex;
  align-items: stretch;
  gap: 1px;
  margin-top: 2mm;
}

.barcode i {
  display: block;
  background: #000;
}

.checklist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.checklist li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.checklist li:last-child {
  border-bottom: 0;
}

.sheet {
  width: min(190mm, 100%);
  background: #fff;
  border: 1px solid var(--line);
  padding: 16px 18px;
  color: #111;
}

.sheet h2 {
  margin: 0 0 4px;
  font-size: 18px;
  background: transparent;
  border: 0;
  padding: 0;
  letter-spacing: 0;
  text-transform: none;
  color: #111;
}

.sheet table td,
.sheet table th {
  border: 1px solid #1c2127;
  background: #fff;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  color: #111;
  position: static;
}

.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
}

.filters input,
.filters select,
.filters .picker {
  max-width: 280px;
  flex: 1 1 180px;
}

.grow {
  flex: 1;
}

.empty {
  padding: 22px 12px;
  color: var(--faint);
  text-align: left;
}

.two-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.warn-text {
  color: var(--bad);
  font-size: 13px;
}

button.userbtn {
  height: auto;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: right;
  line-height: 1.25;
  font-weight: 600;
}

button.userbtn:hover {
  background: transparent;
  border: 0;
  color: var(--accent);
}

button.userbtn .role {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--faint);
}

.toasts {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 10px 10px 12px;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--ink);
}

.toast p {
  margin: 0;
  flex: 1;
  font-size: 13px;
  line-height: 1.4;
}

.toast-ok { border-left-color: var(--ok); }
.toast-warn { border-left-color: var(--warn); }
.toast-err { border-left-color: var(--bad); }

.toast button {
  height: 28px;
  padding: 0 8px;
  flex: 0 0 auto;
}

.drawer-root,
.modal-root {
  position: fixed;
  inset: 0;
}

.drawer-root { z-index: 50; }
.modal-root { z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px; }

.drawer-scrim,
.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(29, 29, 31, 0.32);
  border: 0;
  padding: 0;
}

.drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(480px, 100%);
  background: #fff;
  border-left: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
}

.drawer.wide { width: min(760px, 100%); }

.drawer-head,
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h2,
.modal-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.drawer-head .lede,
.modal-body > .lede {
  margin: 4px 0 0;
}

.drawer-actions,
.modal-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.drawer-body {
  overflow: auto;
  padding: 16px 18px 32px;
}

.drawer .kv {
  grid-template-columns: 148px minmax(0, 1fr);
}

.drawer .cols-2,
.drawer .form-grid,
.modal .form-grid {
  grid-template-columns: 1fr 1fr;
}

.drawer .table-wrap {
  max-height: none;
}

.modal {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line-strong);
}

.modal-body {
  padding: 16px 18px;
}

.modal-foot {
  padding: 0 18px 16px;
}

.modal .span-2,
.modal .span-3,
.modal .span-4,
.drawer .span-2,
.drawer .span-3,
.drawer .span-4 {
  grid-column: 1 / -1;
}

td.mono,
td .mono,
td a.mono,
td.num {
  white-space: nowrap;
}

.crumb {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}

.crumb::before {
  content: "‹ ";
}

.crumb:hover {
  color: var(--accent);
}

.pad.tight {
  padding: 10px 14px 0;
}

.pad.tight .filters {
  margin-bottom: 10px;
}

button.wide,
a.btn.wide {
  width: 100%;
  justify-content: center;
}

.ok-text {
  color: var(--ok);
  font-size: 13px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-foot {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.steps {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
}

.steps li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-right: 1px solid var(--line);
  color: var(--faint);
  min-width: 0;
}

.steps li:last-child {
  border-right: 0;
}

.steps b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.steps span {
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
}

.steps small {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--faint);
}

.steps li.done {
  color: var(--ink);
}

.steps li.done b {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.steps li.now {
  color: var(--ink);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 10px;
}

.steps li.now b {
  border-color: var(--accent);
  color: var(--accent);
}

.travel {
  list-style: none;
  margin: 0;
  padding: 0;
}

.travel li {
  position: relative;
  padding: 0 0 16px 18px;
  border-left: 2px solid var(--line-strong);
}

.travel li:last-child {
  padding-bottom: 0;
  border-left-color: var(--accent);
}

.travel li::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 4px;
  width: 8px;
  height: 8px;
  background: var(--line-strong);
}

.travel li.is-now::before,
.travel li.is-out::before {
  background: var(--accent);
}

.travel li.is-block::before {
  background: var(--bad);
}

.travel-when {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.travel b {
  display: block;
  margin-top: 1px;
  font-size: 14px;
  font-weight: 600;
}

.travel-detail,
.travel-place {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
}

.travel-place {
  color: var(--faint);
}

.facts {
  display: grid;
  grid-template-columns: minmax(110px, 0.7fr) minmax(0, 1.3fr);
  gap: 0;
  margin: 0;
  font-size: 13px;
}

.facts dt,
.facts dd {
  margin: 0;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.facts dt {
  color: var(--muted);
  padding-right: 12px;
}

.facts dt:last-of-type,
.facts dd:last-of-type {
  border-bottom: 0;
}

.callout {
  padding: 11px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--info);
  background: var(--surface);
  font-size: 13px;
}

.callout.bad {
  border-color: #e4c8c8;
  border-left-color: var(--bad);
  background: #fbf6f6;
  color: #5e1f1f;
}

.trace-search {
  display: flex;
  gap: 8px;
  max-width: 720px;
  margin-bottom: 16px;
}

.trace-search input {
  height: 40px !important;
  font-size: 15px;
}

.trace-search button {
  height: 40px;
  padding: 0 20px;
}

.example-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.example-list a {
  display: block;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}

.example-list a:last-child {
  border-right: 0;
}

.example-list a:hover {
  background: var(--hover);
}

.example-list .mono {
  display: block;
  color: var(--info);
  font-size: 14px;
  font-weight: 500;
}

.example-list small {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 12px;
}

.report-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.report-bar strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.report-bar div span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.trace-chain {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.trace-chain .panel > h2 em {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: 10px;
  background: var(--ink);
  color: #fff;
  font-style: normal;
  font-size: 12px;
  vertical-align: 1px;
}

.trace-chain .panel > h2 small {
  padding-left: 32px;
}

h4.sub {
  margin: 14px 0 6px;
  color: var(--faint);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h4.sub:first-child {
  margin-top: 0;
}

table.compact th,
table.compact td {
  padding: 6px 8px 6px 0;
  font-size: 12px;
  background: transparent !important;
  position: static;
}

ul.plain {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13px;
}

ul.plain li {
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

ul.plain li:last-child {
  border-bottom: 0;
}

ul.customers {
  list-style: none;
  margin: 0;
  padding: 0;
}

ul.customers li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

ul.customers li:first-child {
  padding-top: 0;
}

ul.customers li:last-child {
  border-bottom: 0;
}

ul.customers span {
  color: var(--muted);
}

.check-cell {
  width: 40px;
}

table.selectable tbody tr {
  cursor: pointer;
}

.sticky-side {
  position: sticky;
  top: 0;
}

.crate-cell {
  width: 130px;
}

.crate-cell .picker-btn {
  height: 28px;
}

.docs {
  margin-top: 18px;
}

.doc-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.tabs.flush {
  border-bottom: 0;
  margin-bottom: -1px;
}

.sheet {
  width: min(210mm, 100%);
  padding: 22px 24px;
}

.sheet table {
  margin-top: 12px;
}

.sheet table td,
.sheet table th {
  border: 0;
  border-bottom: 1px solid #d8d8dc;
  padding: 7px 8px;
}

.sheet table th {
  border-bottom: 1px solid #111;
  color: #555;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sheet tbody tr:nth-child(even) td {
  background: #fff;
}

.sheet tfoot td {
  border-top: 1px solid #111;
  border-bottom: 0;
  font-weight: 600;
}

.ws-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid #111;
}

.ws-head p {
  margin: 2px 0 0;
  color: #555;
  font-size: 12px;
}

.ws-head .ws-draft {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border: 1px solid var(--warn);
  color: var(--warn);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ws-parties {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid #d8d8dc;
}

.ws-parties section {
  padding: 12px 12px 12px 0;
}

.ws-parties section + section {
  padding-left: 12px;
  border-left: 1px solid #d8d8dc;
}

.ws-parties h4,
.ws-meta span {
  display: block;
  margin: 0 0 4px;
  color: #666;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ws-parties p {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}

.ws-meta {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border-bottom: 1px solid #d8d8dc;
}

.ws-meta div {
  padding: 10px 10px 10px 0;
  min-width: 0;
}

.ws-meta b {
  font-size: 12px;
  font-weight: 600;
}

.ws-sign {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 28px;
}

.ws-sign span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #666;
}

.ws-sign i {
  display: block;
  height: 32px;
  border-bottom: 1px solid #111;
}

.ws-sign small {
  display: block;
  margin-top: 4px;
  color: #666;
  font-size: 11px;
}

.ws-foot {
  margin: 18px 0 0;
  color: #777;
  font-size: 11px;
}

.oval {
  width: 64px;
  height: 44px;
}

.oval span {
  font-size: 8.5px;
}

.crate-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.crate-label {
  width: 100mm;
  min-height: 100mm;
  display: flex;
  flex-direction: column;
  gap: 1.2mm;
}

.crate-no {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 2mm;
  padding: 1.5mm 0;
  border-top: 1.5px solid #000;
  border-bottom: 1.5px solid #000;
}

.crate-no span {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.crate-no b {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.crate-to span {
  display: block;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.crate-to b {
  font-size: 13px;
}

table.crate-lines {
  margin: 1mm 0;
}

table.crate-lines th,
table.crate-lines td {
  position: static;
  padding: 0.8mm 1mm 0.8mm 0;
  border-bottom: 0.5px solid #999;
  background: #fff !important;
  color: #000;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0;
  text-transform: none;
}

table.crate-lines th {
  font-family: var(--font);
  font-weight: 600;
}

.print-only {
  display: none;
}

.print-title h1 {
  margin: 0 0 4px;
  font-size: 18px;
}

.print-title p {
  margin: 0 0 12px;
  font-size: 12px;
  color: #444;
}

@media (max-width: 1100px) {
  .trace-chain,
  .ws-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .example-list {
    grid-template-columns: 1fr 1fr;
  }

  .cols-3,
  .home-grid,
  .cols-2,
  .kv,
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .receive {
    grid-template-columns: minmax(0, 1fr) 260px;
  }

  .span-2,
  .span-3,
  .span-4 {
    grid-column: span 2;
  }
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr);
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    grid-row: auto;
  }

  .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    max-height: 148px;
  }

  .nav-label {
    display: none;
  }

  .nav a {
    margin: 0;
    border-left: 0;
    border-bottom: 2px solid transparent;
  }

  .nav a.active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
  }

  .topbar {
    height: auto;
    min-height: 52px;
    flex-wrap: wrap;
    padding: 8px 12px;
  }

  .search {
    order: 3;
    max-width: none;
    flex-basis: 100%;
  }

  .receive,
  .recv-block,
  .recv-checks,
  .recv-3,
  .choice,
  .cols-3,
  .home-grid,
  .cols-2,
  .kv,
  .form-grid,
  .trace-chain,
  .ws-parties,
  .steps,
  .flow {
    grid-template-columns: 1fr;
    display: grid;
  }

  .flow {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .steps {
    grid-auto-flow: row;
  }

  .steps li {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .choice label {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .choice label:last-child {
    border-bottom: 0;
  }

  .recv-outcome,
  .recv-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .example-list,
  .ws-meta {
    grid-template-columns: 1fr 1fr;
  }

  .span-2,
  .span-3,
  .span-4 {
    grid-column: auto;
  }

  .content {
    overflow: visible;
  }
}

@media print {
  .sidebar,
  .topbar,
  .no-print {
    display: none !important;
  }

  .shell {
    display: block;
    height: auto;
  }

  .content {
    padding: 0;
    overflow: visible;
  }

  body {
    background: #fff;
  }

  .label,
  .sheet {
    border-color: #000;
  }

  .toasts,
  .modal-root,
  .drawer-scrim,
  .drawer-head,
  .drawer-actions {
    display: none !important;
  }

  body:has(.drawer-root) .shell {
    display: none !important;
  }

  .drawer-root,
  .drawer,
  .drawer-body {
    position: static !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    border: 0 !important;
  }

  .picker-menu,
  .cal {
    display: none !important;
  }

  .print-only {
    display: block;
  }

  .report-bar,
  .trace-search,
  .doc-bar {
    display: none !important;
  }

  .trace-chain {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .panel,
  .table-wrap {
    border-color: #999;
    max-height: none !important;
    overflow: visible !important;
  }

  .sheet {
    width: auto;
    border: 0;
    padding: 0;
  }

  .crate-grid {
    display: block;
  }

  .crate-label {
    break-after: page;
    margin: 0 0 6mm;
  }

  .crate-label:last-child {
    break-after: auto;
  }

  .label {
    break-inside: avoid;
  }

  .sticky-side {
    position: static;
  }

  .pagehead {
    position: static;
    margin: 0;
    padding: 0 0 8px;
    border: 0;
    background: #fff;
  }

  .travel li {
    break-inside: avoid;
  }

  body[data-print="sheet"] .drawer-body > :not(.print-only) {
    display: none !important;
  }

  body[data-print="label"] .print-only,
  body[data-print="label"] .kv,
  body[data-print="label"] .travel,
  body[data-print="label"] .panel:not(:has(.label)) {
    display: none !important;
  }
}
