:root {
  --paper: #f3efe6;
  --ink: #1c1917;
  --muted: #57534e;
  --line: #d6d0c4;
  --card: #fffcf6;
  --stamp: #9a3412;
  --ok: #166534;
  --wait: #a16207;
  --new: #9f1239;
  --log: #1e3a5f;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", Tahoma, sans-serif;
  background:
    radial-gradient(circle at 0 0, rgba(154, 52, 18, 0.06), transparent 40%),
    var(--paper);
  color: var(--ink);
  padding-left: 15%;
  padding-right: 15%;
}

.top {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 18px 28px 14px;
  border-bottom: 2px solid var(--ink);
}
.top-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
}
.header-who {
  margin: 0;
  padding-top: 0;
}
.header-who .btn {
  padding: 8px 14px;
}
.header-who .who-btn {
  min-width: 120px;
}
h2 { margin: 0 0 10px; font-size: 20px; }

.roles-line {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.roles { display: flex; flex-wrap: nowrap; align-items: center; gap: 8px; }
.role, .chip, .btn {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--ink);
  background: transparent;
}
.role {
  padding: 8px 14px;
  background: var(--card);
}
.role.is-on {
  background: var(--ink);
  color: #fff;
}
.role[data-role="accountant"].is-on {
  background: var(--log);
  border-color: var(--log);
  color: #fff;
}
.who-picker { display: flex; flex-wrap: nowrap; gap: 8px; margin: 0; align-items: center; }
.who-btn { padding: 10px 14px; background: #fff; font: inherit; cursor: pointer; border: 1px solid var(--ink); }
.who-btn.is-on { background: var(--ink); color: #fff; }
.who-account {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
body.is-login .top,
body.is-login main,
body.is-login .banner {
  display: none;
}
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 0 0, rgba(154, 52, 18, 0.06), transparent 40%),
    var(--paper);
}
.login-screen[hidden] { display: none; }
.login-card {
  width: min(420px, 100%);
  margin: 0;
}
.login-error { color: #9f1239; }
.password-wrap {
  position: relative;
  display: block;
}
.password-wrap input {
  width: 100%;
  padding-right: 38px;
  margin-top: 0;
}
label > .password-wrap { margin-top: 6px; }
.password-eye {
  position: absolute;
  top: 50%;
  right: 4px;
  width: 30px;
  height: 30px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--muted);
}
.password-eye svg {
  display: block;
  width: 18px;
  height: 18px;
  margin: 5px auto 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.password-eye .eye-off { display: none; }
.password-eye.is-on .eye-on { display: none; }
.password-eye.is-on .eye-off { display: block; }
.password-eye:hover { color: var(--ink); }
.user-row .password-wrap { margin-top: 4px; }
.user-row .password-wrap input { height: 38px; margin-top: 0; }
.user-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0;
}
.user-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.25fr) 132px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}
.user-row label { margin: 0; }
.user-row input, .user-row select {
  width: 100%;
  margin-top: 4px;
  height: 38px;
}
.user-row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.user-row-actions .btn {
  height: 38px;
  padding: 0 14px;
  white-space: nowrap;
}
.admin-users {
  margin: 0 0 18px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--line);
}
.admin-users h3 { margin-top: 0; }
h3 { font-size: 16px; margin: 18px 0 8px; }

main { padding: 20px 28px 48px; }
.banner {
  margin: 0;
  padding: 10px 28px;
  background: #14532d;
  color: #ecfdf3;
  pointer-events: none;
}

.toolbar, .split, .row2, .filters {
  display: flex;
  gap: 12px;
}
.toolbar { justify-content: space-between; align-items: center; margin-bottom: 14px; }
.toolbar h2 { margin: 0; white-space: nowrap; }
.hist-head {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  min-width: 0;
}
.hist-head .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
.mgr-line {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: thin;
}
.mgr-line .chip {
  flex: 0 0 auto;
  white-space: nowrap;
}
.split { align-items: flex-start; }
.split > * { flex: 1; min-width: 0; }
.row2 > label { flex: 1; }
.filters { margin: 0 0 16px; flex-wrap: wrap; }
.wh-people {
  margin: 0 0 16px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
}
.wh-people .hint { margin: 0 0 10px; }
.wh-people-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
}
.wh-people-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.wh-people-row span {
  font-size: 13px;
  color: var(--muted);
  min-width: 5.5em;
}
.wh-people-row input {
  flex: 1 1 8em;
  min-width: 7em;
  margin: 0;
  padding: 6px 8px;
}
.wh-people .tiny {
  margin: 10px 0 0;
  color: var(--muted);
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 18px;
  margin-bottom: 18px;
}
.panel.narrow { max-width: 640px; }
.admin-form { max-width: none; width: 100%; }
.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}
.admin-head h2 { margin: 0; }
.admin-head-actions { display: flex; gap: 8px; flex-shrink: 0; }
.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px 40px;
  align-items: start;
  max-width: 640px;
}
.admin-grid h3 { margin-top: 0; }
.manager-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.manager-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.manager-label {
  flex: 0 0 7.2em;
  font-size: 13px;
  color: var(--muted);
}
.manager-row input {
  flex: 1;
  min-width: 0;
  margin: 0;
  height: 38px;
}
.manager-row .btn {
  width: auto;
  height: 38px;
  padding: 0 12px;
  flex-shrink: 0;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 24px;
  overflow: auto;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.45);
}
.modal-card {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  margin: 0 auto 40px;
}

label { display: block; margin: 0 0 12px; font-size: 13px; color: var(--muted); }
input, textarea, select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 10px;
  border: 1px solid #a8a29e;
  font: inherit;
  color: var(--ink);
  background: #fff;
}
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.check input { width: auto; margin: 0; }

.hint { color: var(--muted); font-size: 14px; line-height: 1.45; margin: 0 0 14px; }
.hint.ok { color: #14532d; }
input.from-file, textarea.from-file { background: #f0fdf4; }
input[name="remainder"],
input[data-field="remainder"] {
  background: #f5f5f4;
  cursor: default;
}

.date-field .date-line {
  display: flex;
  align-items: center;
  gap: 8px;
}
.date-box {
  position: relative;
  flex: 1;
  min-width: 0;
}
.date-line input[type="date"] {
  flex: 1;
  min-width: 0;
  color: transparent;
  caret-color: transparent;
}
.date-line input[type="date"]::-webkit-datetime-edit,
.date-line input[type="date"]::-webkit-datetime-edit-fields-wrapper,
.date-line input[type="date"]::-webkit-datetime-edit-text,
.date-line input[type="date"]::-webkit-datetime-edit-month-field,
.date-line input[type="date"]::-webkit-datetime-edit-day-field,
.date-line input[type="date"]::-webkit-datetime-edit-year-field {
  color: transparent;
}
.date-face {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: baseline;
  pointer-events: none;
  color: var(--ink);
  font: inherit;
  line-height: 1;
}
.date-day {
  font-weight: 700;
  font-size: 1.05em;
}
.date-day.is-tomorrow {
  font-weight: 800;
  font-size: 1.35em;
}
.date-rest {
  font-weight: 400;
  font-size: 1em;
}
input[type="date"]::-webkit-calendar-picker-indicator {
  width: 20px;
  height: 20px;
  padding: 2px;
  cursor: pointer;
  opacity: 1;
}
.date-tomorrow {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
}
.date-tomorrow:hover {
  color: var(--stamp);
}
.pickup { font-weight: 700; }
.pickup.is-shop { color: var(--stamp); }
.pickup.is-warehouse { color: var(--log); }
.pickup.is-mixed { color: var(--stamp); }
.pickup-line { flex-wrap: wrap; }
.pickup-line .pay-mark input {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  margin: 0;
}
.edit-grid .pickup-marks {
  justify-self: start;
}
.item-pickup-wrap {
  margin: 6px 0 4px;
}
.item-pickup-list {
  margin-top: 6px;
}
.item-pickup {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.item-pickup th,
.item-pickup td {
  border-bottom: 1px solid var(--line);
  padding: 4px 4px 4px 0;
  text-align: left;
  vertical-align: top;
}
.item-pickup th {
  font-weight: 600;
  color: var(--muted);
}
.item-pickup .item-name {
  color: var(--ink);
  word-break: break-word;
}
.item-pickup .item-qty {
  width: 3.5em;
  white-space: nowrap;
  color: var(--ink);
}
.item-pickup .item-mark {
  width: 1%;
  white-space: nowrap;
}
.item-pickup .pay-mark {
  font-size: 12px;
  gap: 4px;
}
.item-pickup input:disabled:checked {
  opacity: 1;
}
#office-items-wrap {
  margin-top: 8px;
  max-height: 16em;
  overflow: auto;
}
.field {
  display: block;
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
}
.field-cap { display: block; }
.money-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  min-width: 0;
}
.money-line > input {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  margin-top: 0;
}
.pay-marks {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.pay-mark {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.pay-mark input {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  margin: 0;
  display: inline-block;
  accent-color: var(--stamp);
  cursor: pointer;
}

#office-form {
  display: block;
  width: 100%;
  max-width: 380px;
  flex: 0 0 380px;
}
#office-form > input[type="hidden"] { display: none; }
#office-form > button {
  width: auto;
}

.btn { padding: 9px 14px; background: #fff; }
.btn.primary { background: var(--stamp); color: #fff; border-color: var(--stamp); }
.btn.huge { padding: 14px 18px; font-size: 17px; font-weight: 700; }
.btn.ghost { background: var(--card); }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.card.is-dirty [data-act=save] {
  background: var(--stamp);
  color: #fff;
  border-color: var(--stamp);
}
.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.chip { padding: 6px 12px; background: var(--card); display: inline-flex; align-items: center; gap: 8px; }
.chip.is-on { background: var(--ink); color: #fff; }
.chip-n { margin-left: 2px; font-variant-numeric: tabular-nums; }

.stack { display: flex; flex-direction: column; gap: 8px; }
.card {
  position: relative;
  container-type: inline-size;
  container-name: invoice;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 10px 12px;
}
.card.pickable { padding-left: 12px; }
.card.is-picked { border-color: var(--stamp); box-shadow: inset 4px 0 0 var(--stamp); }
.pick {
  flex: 0 0 auto;
  margin: 0;
  padding: 1px 2px 0 0;
  cursor: pointer;
}
.pick input {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  margin: 0;
  padding: 0;
  display: inline-block;
  accent-color: var(--stamp);
  cursor: pointer;
}
.print-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.card.missing { opacity: 0.65; }
.card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}
.card-title { min-width: 0; flex: 1; }
.file { font-weight: 700; font-size: 14px; word-break: break-word; margin-right: 8px; }
.mgr {
  display: inline;
  margin: 0 8px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--stamp);
}
.meta { color: var(--muted); font-size: 12px; margin: 0; }
.facts { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 6px; font-size: 13px; }
.facts b {
  display: inline;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  margin-right: 4px;
}

.badge {
  font-size: 12px;
  padding: 3px 8px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.badge.new { color: var(--new); }
.badge.printed { color: var(--wait); }
.badge.assembled { color: var(--log); }
.badge.logistics { color: var(--ok); }
.badge.issued { color: var(--stamp); }

.empty {
  padding: 28px 16px;
  border: 1px dashed var(--line);
  color: var(--muted);
}

.card-cols {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.95fr);
  gap: 8px 28px;
  align-items: start;
  margin-top: 8px;
}
.card-cols > * {
  min-width: 0;
}
.card-cols .edit-grid { margin-top: 0; }
.edit-money {
  padding-left: 16px;
  border-left: 1px solid var(--line);
}
.edit-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  margin-top: 8px;
}
.edit-grid label,
.edit-grid .edit-row {
  display: grid;
  grid-template-columns: 9em 1fr;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.edit-grid input,
.edit-grid select {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 5px 8px;
}
.edit-grid .money-line {
  margin-top: 0;
  gap: 6px;
}
.edit-grid .money-line > input {
  width: auto;
  padding: 5px 8px;
}
.edit-grid .pay-mark {
  display: flex;
  grid-template-columns: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.edit-grid .pay-mark input {
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  padding: 0;
}
.edit-money label,
.edit-money .edit-row {
  grid-template-columns: 6.5em 1fr;
}
.edit-money .money-line {
  flex-wrap: nowrap;
}
.edit-money .money-line > input {
  flex: 1 1 0;
  min-width: 5.5em;
}
.edit-money .pay-marks { flex: 0 0 auto; }
.edit-grid .wide { grid-column: auto; }
.wh-marks {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.wh-issue-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.wh-issue-row select {
  flex: 1 1 8em;
  min-width: 7em;
  width: auto;
  margin: 0;
  padding: 5px 8px;
  font: inherit;
  font-size: 13px;
}
.wh-issue-row [data-add-driver],
.wh-issue-row [data-add-assembler] {
  padding: 5px 10px;
  font-size: 13px;
}
.wh-multi {
  position: relative;
  flex: 1 1 8em;
  min-width: 7em;
}
.wh-multi-btn {
  display: block;
  width: 100%;
  margin: 0;
  padding: 5px 26px 5px 8px;
  font: inherit;
  font-size: 13px;
  line-height: 1.3;
  text-align: left;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%2357534e' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 10px 7px;
}
.wh-multi-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.wh-multi-list {
  position: absolute;
  z-index: 8;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  min-width: 100%;
  max-height: 13em;
  overflow: auto;
  padding: 4px 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 8px 20px rgba(28, 25, 23, 0.12);
}
.wh-multi-list[hidden] {
  display: none !important;
}
.wh-multi-empty {
  padding: 8px 10px;
  font-size: 13px;
  color: var(--muted);
}
.wh-multi-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.wh-multi-item:hover {
  background: #f3efe6;
}
.wh-multi-item input {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  min-width: 18px;
  min-height: 18px;
  margin: 0;
  border: 2px solid var(--ok);
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
}
.wh-multi-item input:checked {
  background-color: var(--ok);
  border-color: var(--ok);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M3 8.5l3.2 3.2L13 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 12px;
}
.wh-multi-item input:disabled:not(:checked) {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: #a8a29e;
}
.wh-add-driver {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 12em;
  min-width: 9em;
}
.wh-add-driver[hidden] {
  display: none !important;
}
.wh-add-driver input {
  flex: 1 1 auto;
  min-width: 7em;
  margin: 0;
  padding: 5px 8px;
  font: inherit;
  font-size: 13px;
}
.wh-add-driver .btn {
  padding: 5px 10px;
}
.wh-issue-row .wh-drv-name {
  font-size: 13px;
  color: var(--ink);
}
.wh-marks .driver-issue {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.wh-marks .driver-issue input {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  margin: 0;
  border: 2px solid var(--ok);
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
}
.wh-marks .driver-issue input:checked {
  background-color: var(--ok);
  border-color: var(--ok);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M3 8.5l3.2 3.2L13 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
}
.wh-marks .driver-issue input:disabled:not(:checked),
.wh-issue-row select:disabled,
.wh-issue-row [data-add-driver]:disabled,
.wh-issue-row [data-add-assembler]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.wh-marks .driver-issue input:disabled:not(:checked) {
  border-color: #a8a29e;
}
.wh-marks .driver-issue input:disabled:checked {
  opacity: 1;
  cursor: default;
}
.wh-marks.is-status .driver-issue,
.wh-marks .wh-person-label {
  cursor: default;
}
.wh-marks.is-status .driver-issue input:disabled {
  cursor: default;
}
.wh-status-note {
  margin: 0;
  font-size: 13px;
  color: var(--ink);
}
.wh-marks .wh-note,
.edit-money .wh-note {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 4px;
}
.edit-grid textarea,
.wh-marks textarea {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  margin: 0;
  padding: 5px 8px;
  resize: vertical;
  font: inherit;
}
.edit-grid .driver-issue {
  display: flex;
  align-items: center;
  gap: 8px;
  grid-template-columns: none;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}
.edit-grid .driver-issue input {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  margin: 0;
  accent-color: var(--ok);
  cursor: pointer;
}
.acc-mark.is-ro {
  cursor: default;
  pointer-events: none;
}
.acc-mark.is-ro input {
  opacity: 1;
  cursor: default;
}
.acc-driver-name {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.hist-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  align-items: start;
}
.cal-panel {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 12px;
}
.cal-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cal-title { flex: 1; text-align: center; font-weight: 700; }
.cal-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cal-actions .btn { padding: 5px 8px; font-size: 12px; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow, .cal-day {
  text-align: center;
  font-size: 12px;
  padding: 6px 0;
}
.cal-dow { color: var(--muted); font-weight: 600; }
.cal-day {
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  border-radius: 4px;
  position: relative;
}
.cal-day:hover { background: #f5f1ea; }
.cal-day.mute { color: #a8a29e; }
.cal-day.has { font-weight: 700; }
.cal-day.has::after {
  content: "";
  display: block;
  width: 5px;
  height: 5px;
  background: var(--stamp);
  border-radius: 50%;
  margin: 2px auto 0;
}
.cal-day.is-on { background: var(--ink); color: #fff; }
.cal-day.is-on.has::after { background: #fff; }
.cal-day.blocked,
.cal-day:disabled {
  opacity: 0.3;
  cursor: default;
}
.cal-day.blocked:hover,
.cal-day:disabled:hover { background: transparent; }
.cal-day.in-range { background: #e7e0d4; }
.cal-range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.cal-range label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.cal-range input {
  margin: 0;
  flex: 1;
  min-width: 0;
  width: auto;
  height: 34px;
  padding: 4px 8px;
  font-variant-numeric: tabular-nums;
}

#wh-count { margin: 0 0 10px; }

.hist-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}
.hist-bar input, .hist-bar select {
  width: auto;
  min-width: 160px;
  margin: 0;
  flex: 1;
}
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); }
.journal { width: 100%; border-collapse: collapse; font-size: 13px; }
.journal th, .journal td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.journal th { background: #f5f1ea; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; }
.journal .tiny { color: var(--muted); font-size: 12px; }
.journal .btn { padding: 5px 8px; }
.journal .hist-acts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  min-width: 11em;
}
.journal .hist-status {
  width: 100%;
  min-width: 0;
  max-width: 13em;
  margin: 0;
  padding: 5px 8px;
}
.journal td.hist-status-cell {
  min-width: 11em;
  max-width: 14em;
}
.journal .pick-cell {
  width: 32px;
  vertical-align: middle;
}
.journal tr.is-picked td { background: #f5f1ea; }
.journal tr.hist-edit td {
  background: var(--paper);
  padding: 12px;
}
.hist-admin-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}
.acc-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0 0 12px;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 14px;
}
.acc-totals b { font-variant-numeric: tabular-nums; }
.acc-mark {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}
.acc-mark input {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  margin: 0;
  accent-color: var(--ok);
  cursor: pointer;
}
.journal tr.is-acc-done { opacity: 0.62; }
.journal td.acc-cell { min-width: 120px; }

@container invoice (max-width: 780px) {
  .card-cols { grid-template-columns: 1fr; }
  .edit-money {
    padding-left: 0;
    border-left: 0;
    padding-top: 10px;
    border-top: 1px solid var(--line);
  }
}
@media (max-width: 1400px) {
  body { padding-left: 24px; padding-right: 24px; }
}
@media (max-width: 1100px) {
  .card-cols { grid-template-columns: 1fr; }
  .edit-money {
    padding-left: 0;
    border-left: 0;
    padding-top: 8px;
    border-top: 1px solid var(--line);
  }
}
@media (max-width: 900px) {
  .hist-layout, .admin-grid, .wh-people-grid { grid-template-columns: 1fr; }
  .top-row, .split, .toolbar, .admin-head { flex-direction: column; align-items: stretch; }
  main, .top { padding-left: 16px; padding-right: 16px; }
}
