:root {
  --bg: #f7faf7;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --brand: #14532d;
  --brand-2: #166534;
  --line: #e2e8f0;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

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

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.brand {
  font-weight: 700;
  color: var(--brand);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  width: 40px;
  height: 36px;
  padding: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
}

.nav-toggle__bar {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--brand);
  border-radius: 1px;
}

.nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.nav a {
  text-decoration: none;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
}

.nav a:hover {
  background: rgba(20, 83, 45, 0.08);
  color: var(--brand);
}

.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  border-radius: 8px;
  padding-right: 0.15rem;
}

.nav-dropdown__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  text-decoration: none;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
}

.nav-dropdown__caret {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1rem;
  height: 1rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1;
  transform: translateY(0);
  user-select: none;
  pointer-events: none;
}

.nav-dropdown__toggle:hover {
  background: rgba(20, 83, 45, 0.08);
  color: var(--brand);
}

.nav-dropdown:hover .nav-dropdown__toggle {
  background: rgba(20, 83, 45, 0.08);
  color: var(--brand);
}

.nav-dropdown__menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 0.35rem;
  z-index: 50;
}

.nav-dropdown__menu a {
  display: block;
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
}

.nav-dropdown:hover .nav-dropdown__menu,
.nav-dropdown.is-open .nav-dropdown__menu,
.nav-dropdown:focus-within .nav-dropdown__menu {
  display: block;
}

/* Extra fallback: keep menu open while hovering trigger/menu directly */
.nav-dropdown__toggle:hover + .nav-dropdown__caret + .nav-dropdown__menu,
.nav-dropdown__menu:hover {
  display: block;
}

.userbox {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.userbox__name {
  font-size: 0.9rem;
  color: var(--muted);
}

.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1rem 2.5rem;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.85rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.breadcrumbs__sep {
  color: #94a3b8;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.page-head h1 {
  margin: 0;
  font-size: 1.35rem;
  color: var(--brand);
}

.page-head--mobile h1 {
  font-size: 1.2rem;
}

.page-head__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.date-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: nowrap;
}

.date-nav__btn {
  min-width: 2.25rem;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
  font-size: 1.2rem;
  line-height: 1;
  font-weight: 700;
}

.date-nav--range .filter-sep {
  margin: 0 0.1rem;
}

main.main--date-nav-loading {
  opacity: 0.55;
  pointer-events: none;
}

[data-live-results].is-live-loading {
  position: relative;
  transition: opacity 120ms ease-out;
  opacity: 0.65;
}

[data-live-results].is-live-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: transparent;
  pointer-events: none;
}

.form-stack .card {
  margin-bottom: 1rem;
}

.form-stack .card h2 {
  margin-top: 0;
}

.pre-block {
  background: #f1f5f9;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.4;
  border: 1px solid var(--line);
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  margin-bottom: 1rem;
}

.card h2 {
  margin-top: 0;
  font-size: 1.05rem;
  color: var(--brand);
}

.report-card__title {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.report-card__title::after {
  content: '▾';
  font-size: 0.92rem;
  color: var(--muted);
}

.report-card.is-collapsed > :not(.report-card__title) {
  display: none;
}

.report-card.is-collapsed .report-card__title {
  margin-bottom: 0;
}

.report-card.is-collapsed .report-card__title::after {
  content: '▸';
}

.card--danger {
  border: 1px solid rgba(185, 28, 28, 0.35);
  background: #fff5f5;
}
.card--danger h2 { color: var(--danger); }

.card--courier-close {
  border-color: rgba(20, 83, 45, 0.22);
  background: rgba(20, 83, 45, 0.04);
}

.card--courier-defer {
  border: 1px solid rgba(180, 83, 9, 0.35);
  background: rgba(180, 83, 9, 0.07);
}

.card--courier-defer h2 {
  color: #b45309;
}

.card--narrow {
  max-width: 420px;
  margin: 2rem auto;
}

.card--detail .detail-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0.35rem 0.75rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line);
}

.card--detail .detail-row:last-child {
  border-bottom: 0;
}

.card--detail .detail-row--stack .detail-v {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.hint-inline {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 400;
}

.js-save-status.is-error {
  color: var(--danger);
}

.detail-k { color: var(--muted); font-size: 0.9rem; }
.detail-v { font-weight: 500; }

.courier-detail-emphasis {
  margin: 0.45rem 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(20, 83, 45, 0.18);
  border-radius: var(--radius);
  background: rgba(20, 83, 45, 0.06);
}

.courier-detail-emphasis .detail-row {
  padding-left: 0;
  padding-right: 0;
}

.courier-detail-emphasis .detail-row:last-child {
  border-bottom: 0;
}

.courier-detail-emphasis--packages {
  border-color: rgba(180, 83, 9, 0.22);
  background: rgba(180, 83, 9, 0.08);
}

.grid--stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat {
  background: var(--card);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.stat__label { font-size: 0.85rem; color: var(--muted); }
.stat__value { font-size: 1.6rem; font-weight: 700; color: var(--brand); }

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

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.table th, .table td {
  text-align: left;
  padding: 0.55rem 0.45rem;
  border-bottom: 1px solid var(--line);
}

.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cell-muted { color: var(--muted); font-size: 0.9rem; }

.col-money {
  text-align: right;
  white-space: nowrap;
}

.col-narrow {
  width: 1%;
  white-space: nowrap;
}

.table--courier-report tbody tr:hover td {
  background: rgba(22, 101, 52, 0.07);
}

.table--courier-report tbody td a {
  color: inherit;
  text-decoration: none;
  display: inline;
}

.table--courier-report tbody td a:hover {
  text-decoration: underline;
  color: var(--brand-2);
}

.courier-report-row__addr a {
  font-weight: 500;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge--accent {
  background: rgba(22, 101, 52, 0.12);
  color: var(--brand);
}

.badge--muted {
  background: #f1f5f9;
  color: var(--muted);
}

.badge--overdue {
  background: #dc2626;
  color: #fff;
}

.btn {
  display: inline-block;
  border: 0;
  border-radius: 10px;
  padding: 0.55rem 0.95rem;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.95rem;
}

.btn:hover { filter: brightness(1.05); }

.btn--secondary {
  background: #fff;
  color: var(--brand);
  border: 1px solid rgba(20, 83, 45, 0.35);
}

.btn--ghost {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--line);
}

.btn--small { font-size: 0.85rem; padding: 0.35rem 0.65rem; }
.btn--block { width: 100%; text-align: center; }

.btn--danger {
  background: var(--danger);
  color: #fff;
}
.btn--danger:hover { filter: brightness(1.05); }

.form .label {
  display: block;
  margin: 0.75rem 0 0.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.form > .btn {
  margin-top: 1rem;
}

.form > .inline-form {
  margin-top: 0.35rem;
}

.label--inline { margin: 0; }

.label__optional {
  font-weight: normal;
  color: var(--muted);
  font-size: 0.88em;
}

.page-head__hint {
  flex-basis: 100%;
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.4;
}

.input {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  font: inherit;
}

.input--date { max-width: 200px; }
.input--client-search { min-width: 240px; }
.input--status { width: 180px; }
.input--filter-query { min-width: 260px; }

.deliveries-filter {
  align-items: flex-end;
  gap: 0.65rem;
}

.deliveries-filter .label {
  margin-bottom: 0.4rem;
}

.filter-sep {
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.bulk-toolbar {
  margin-bottom: 0.75rem;
}

.main--bulk {
  max-width: none;
  width: 100%;
  padding: 0.75rem 1rem 1rem;
}

.body--bulk .topbar__inner {
  max-width: none;
  width: 100%;
}

.bulk-page-head {
  margin-bottom: 0.6rem;
}

.bulk-card {
  border-radius: 10px;
  padding: 0.7rem 0.75rem;
}

.bulk-table-wrap {
  max-height: calc(100vh - 290px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.bulk-table thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 2;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.bulk-table td {
  vertical-align: top;
  min-width: 110px;
  border-right: 1px solid var(--line);
  padding: 0.3rem;
  background: #fff;
}

.bulk-table td:last-child,
.bulk-table th:last-child {
  border-right: 0;
}

.bulk-table tbody tr:nth-child(even) td {
  background: #fcfdfc;
}

.bulk-table .input {
  border-radius: 6px;
  padding: 0.35rem 0.45rem;
  font-size: 0.88rem;
}

.bulk-table td:nth-child(1),
.bulk-table td:last-child {
  min-width: 56px;
}

.bulk-table td:nth-child(10) {
  min-width: 90px;
}

.bulk-table .select2-container {
  min-width: 160px;
}

.bulk-table .select2-results__option {
  white-space: normal;
}

.bulk-select2-dropdown {
  width: auto !important;
  min-width: 360px !important;
  max-width: min(640px, 85vw);
}

.bulk-table .select2-container--default .select2-selection--single {
  height: 34px;
  border-radius: 6px;
}

.bulk-table .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 32px;
  font-size: 0.88rem;
}

.bulk-table .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 32px;
}

.bulk-summary {
  margin: 0.5rem 0 0.85rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.bulk-summary.is-error {
  color: #991b1b;
  font-weight: 600;
}

.bulk-errors {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  color: #991b1b;
}

.courier-dialog.bulk-repeat-dialog {
  width: min(100vw - 2rem, 460px);
  max-width: min(100vw - 2rem, 460px);
}

.bulk-repeat-status {
  margin: 0.5rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.bulk-repeat-status.is-error {
  color: #991b1b;
  font-weight: 600;
}

.bulk-repeat-list {
  display: grid;
  gap: 0.35rem;
  max-height: min(48vh, 360px);
  overflow: auto;
  margin: 0.75rem 0;
}

.bulk-repeat-option {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  cursor: pointer;
}

.bulk-repeat-option:hover {
  background: rgba(20, 83, 45, 0.06);
}

.bulk-repeat-actions {
  justify-content: flex-end;
}

.js-change-result {
  display: inline-block;
  margin-top: 0.55rem;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

.js-change-result.is-error {
  color: #991b1b;
  font-weight: 600;
}

.select2-container {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  width: 100% !important;
}

.select2-container .selection {
  display: block;
}

.select2-container--default .select2-selection--single {
  display: block;
  height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
  box-sizing: border-box;
  cursor: pointer;
  user-select: none;
}

.select2-container--default .select2-selection--single:focus,
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
  border-color: rgba(20, 83, 45, 0.45);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 38px;
  color: #0f172a;
  padding-left: 0.65rem;
  padding-right: 2rem;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  position: absolute;
  top: 1px;
  height: 38px;
  right: 6px;
  width: 20px;
}

.select2-dropdown {
  z-index: 1051;
  width: 100%;
  display: block;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  box-sizing: border-box;
}

.select2-container--open .select2-dropdown--below {
  margin-top: 4px;
}

.select2-container--open .select2-dropdown--above {
  margin-bottom: 4px;
}

.select2-search--dropdown {
  display: block;
  box-sizing: border-box;
  padding: 0.45rem;
  border-bottom: 1px solid #e2e8f0;
}

.select2-search--dropdown .select2-search__field {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  font: inherit;
}

.select2-results__option {
  list-style: none;
  padding: 0.5rem 0.65rem;
  margin: 0;
  cursor: pointer;
  user-select: none;
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
  background: #14532d;
  color: #fff;
}

.select2-results {
  display: block;
}

.select2-results > .select2-results__options {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 240px;
  overflow-y: auto;
}

.select2-results__option[aria-disabled='true'] {
  color: #94a3b8;
  cursor: default;
}

.select2-results__option[aria-selected='true'] {
  background: #f1f5f9;
}

.select2-hidden-accessible {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
}

textarea.input { min-height: 72px; resize: vertical; }

.user-phone-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}

.user-phone-row__input {
  flex: 1 1 14rem;
  min-width: 0;
}

.user-phone-row__compact {
  font-size: 0.88rem;
  color: var(--muted);
  white-space: nowrap;
}

.user-phone-row__compact-label {
  margin-right: 0.25rem;
}

.user-phone-compact-digits {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

.password-field {
  position: relative;
}

.password-field .input {
  padding-right: 5.8rem;
}

.password-toggle {
  position: absolute;
  right: 0.5rem;
  top: 0.38rem;
  bottom: 0.38rem;
  min-width: 4.6rem;
  padding: 0 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.password-toggle:hover {
  background: rgba(20, 83, 45, 0.06);
  color: var(--brand);
  border-color: rgba(20, 83, 45, 0.35);
}

.check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.5rem;
  font-size: 0.92rem;
}

.check--block { margin-top: 0.75rem; }

.form--row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.form--row .input { flex: 1 1 180px; max-width: 320px; }

.login {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login__title {
  margin-top: 0;
  color: var(--brand);
}

.login__submit {
  margin-top: 0.6rem;
}

.alert {
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  margin-bottom: 0.75rem;
  font-size: 0.92rem;
}

.alert--error {
  background: var(--danger-bg);
  color: var(--danger);
}

.alert--ok {
  background: #ecfdf5;
  color: #14532d;
}

.alert--warn {
  background: #fffbeb;
  color: #92400e;
}

.hint-block {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
  line-height: 1.4;
}

.suggest-wrap { position: relative; }

.suggest-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 30;
  max-height: 240px;
  overflow-y: auto;
}

.suggest-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.65rem;
  border: 0;
  background: #fff;
  cursor: pointer;
  font: inherit;
  border-bottom: 1px solid var(--line);
}

.suggest-item:hover {
  background: rgba(20, 83, 45, 0.06);
}

.address-confirm {
  margin: 1rem 0;
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid rgba(20, 83, 45, 0.25);
  background: rgba(20, 83, 45, 0.04);
}

.address-confirm__title {
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 0.35rem;
}

.address-confirm__text {
  margin: 0 0 0.75rem;
  color: var(--text);
}

.address-confirm__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.courier-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.courier-date-nav-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.85rem;
}

.impersonation-bar {
  background: #fef3c7;
  border-bottom: 1px solid #f59e0b;
  padding: 0.45rem 0.75rem;
}

.impersonation-bar__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.impersonation-bar__text {
  font-size: 0.88rem;
  color: #92400e;
}

.impersonation-bar__form {
  margin: 0;
}

.courier-shift-status {
  margin: 0;
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand);
  white-space: nowrap;
}

.courier-order-status {
  margin: 0 0 0.65rem;
}

.courier-order-status--ok {
  color: var(--brand);
}

.courier-order-status--error {
  color: #b91c1c;
}

.courier-dashboard-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 0.85rem;
}

.courier-filter-btn.is-active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.courier-card-row[hidden] {
  display: none !important;
}

.courier-day-summary {
  margin: 0 0 0.65rem;
  padding: 0;
  overflow: hidden;
}

.courier-day-summary__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.65rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--brand);
  cursor: pointer;
  list-style: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.courier-day-summary__head::-webkit-details-marker {
  display: none;
}

.courier-day-summary__head::after {
  content: '▼';
  font-size: 0.62rem;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.courier-day-summary:not([open]) .courier-day-summary__head::after {
  transform: rotate(-90deg);
}

.courier-day-summary__body {
  padding: 0 0.65rem 0.55rem;
  border-top: 1px solid var(--line);
}

.courier-day-summary__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem 0.5rem;
  padding-top: 0.45rem;
}

.courier-day-summary__item {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.courier-day-summary__item--earn {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.15rem;
  margin-top: 0.1rem;
  border-top: 1px dashed var(--line);
}

.courier-day-summary__k {
  font-size: 0.68rem;
  line-height: 1.2;
  color: var(--muted);
}

.courier-day-summary__v {
  font-size: 1rem;
  line-height: 1.15;
  font-weight: 700;
  color: var(--brand);
}

.courier-day-summary__item--earn .courier-day-summary__v {
  font-size: 1.05rem;
}

.courier-day-summary__hint {
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--muted);
}

@media (min-width: 420px) {
  .courier-day-summary__grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .courier-day-summary__item--earn {
    grid-column: auto;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding-top: 0;
    margin-top: 0;
    border-top: none;
  }
}

.stat--accent .stat__value {
  font-size: 1.35rem;
}

.courier-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.courier-card:active { transform: scale(0.99); }

.courier-card__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.courier-card__name {
  font-weight: 700;
}

.courier-card__addr {
  font-size: 0.92rem;
  color: var(--muted);
}

.courier-card__meta {
  margin-top: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand);
}

.courier-card__meta--payment,
.courier-card__meta--payment-method,
.courier-card__meta--packages {
  display: inline-block;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
}

.courier-card__meta--payment,
.courier-card__meta--payment-method {
  background: rgba(20, 83, 45, 0.08);
}

.courier-card__meta--packages {
  color: #92400e;
  background: rgba(180, 83, 9, 0.1);
}

.courier-card-row {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.courier-reorder-col {
  flex-shrink: 0;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  width: 2.65rem;
  min-width: 2.65rem;
  max-width: 2.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius) 0 0 var(--radius);
  background: linear-gradient(180deg, #f8faf8 0%, #eef4ee 100%);
  overflow: hidden;
  position: relative;
  z-index: 0;
}

.courier-reorder-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--brand);
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

.courier-reorder-btn--up,
.courier-reorder-btn--down {
  flex: 0 0 1.65rem;
  min-height: 1.65rem;
  touch-action: manipulation;
  font-size: 0.62rem;
}

.courier-reorder-btn--up {
  border-bottom: 1px solid var(--line);
}

.courier-reorder-btn--down {
  border-top: 1px solid var(--line);
}

.courier-reorder-btn--grab {
  flex: 1 1 auto;
  min-height: 2.1rem;
  cursor: grab;
  touch-action: none;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  background: rgba(20, 83, 45, 0.05);
}

.courier-reorder-btn__icon {
  display: block;
  font-size: 0.7rem;
  line-height: 1;
  opacity: 0.9;
}

.courier-reorder-btn__grip {
  display: block;
  font-size: 0.95rem;
  letter-spacing: -0.12em;
  line-height: 1;
  color: var(--muted);
}

.courier-reorder-btn:not(:disabled):hover {
  background: rgba(20, 83, 45, 0.1);
}

.courier-reorder-btn:not(:disabled):active {
  background: rgba(20, 83, 45, 0.16);
}

.courier-reorder-btn--grab:not(:disabled):active {
  cursor: grabbing;
}

.courier-reorder-btn:disabled {
  opacity: 0.28;
  cursor: not-allowed;
  color: var(--muted);
}

.courier-list.is-reordering .courier-card {
  pointer-events: none;
}

.courier-list.is-reordering .courier-reorder-col {
  pointer-events: auto;
}

.courier-card-row.is-dragging {
  position: relative;
  z-index: 5;
  opacity: 0.55;
}

.courier-card-row--placeholder {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(20, 83, 45, 0.04);
  min-height: 4rem;
}

.courier-dialog[open],
.courier-dialog:modal {
  position: fixed;
  z-index: 1100;
  margin: auto;
  max-width: min(calc(100vw - 2rem), 22rem);
  width: calc(100vw - 2rem);
}

.courier-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
  z-index: 1099;
}

body:has(.courier-sort-prompt-dialog[open]),
body:has(.courier-sort-prompt-dialog:modal) {
  overflow: hidden;
}

body:has(.courier-sort-prompt-dialog[open]) .courier-reorder-col,
body:has(.courier-sort-prompt-dialog:modal) .courier-reorder-col {
  z-index: 0;
  pointer-events: none;
}

.courier-sort-prompt-dialog .courier-dialog__inner {
  max-width: 22rem;
}

.courier-sort-prompt-actions {
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.courier-sort-prompt-actions form {
  margin: 0;
}

.courier-sort-suggest {
  margin-bottom: 0.75rem;
}

.courier-sort-suggest-actions {
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.courier-sort-suggest-actions form {
  margin: 0;
}

.courier-sort-table-wrap {
  margin-bottom: 1rem;
}

.courier-sort-table__rank-col {
  width: 4.5rem;
  vertical-align: top;
}

.courier-sort-rank-input {
  width: 3.5rem;
  min-height: 2.75rem;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  padding: 0.35rem 0.25rem;
}

.courier-sort-table__addr {
  font-size: 0.92rem;
  line-height: 1.35;
  word-break: break-word;
}

#courier-sort-validation.is-error {
  color: #991b1b;
}

.courier-list.is-transfer-mode .courier-reorder-col,
.courier-list.is-reorder-disabled .courier-reorder-col {
  display: none;
}

.courier-list.is-transfer-mode .courier-card-row {
  gap: 0.45rem;
}

.courier-card-row__pick {
  display: none;
  flex-shrink: 0;
  align-items: flex-start;
  padding: 0.85rem 0 0 0.25rem;
}

.courier-list.is-transfer-mode .courier-card-row__pick {
  display: flex;
}

.courier-list.is-transfer-mode .courier-card-row {
  gap: 0.45rem;
}

.courier-card-row .courier-card {
  flex: 1;
  min-width: 0;
}

.courier-card-row__pick .check {
  margin: 0;
}

.courier-transfer-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  margin: 0.75rem -0.5rem 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.courier-transfer-bar[hidden] {
  display: none !important;
}

.courier-transfer-bar .input {
  flex: 1;
  min-width: 140px;
}

.courier-dialog {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  max-width: min(100vw - 2rem, 400px);
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.25);
}

.courier-dialog__inner {
  padding: 1rem 1.1rem;
}

.courier-dialog__title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.empty-hint {
  color: var(--muted);
  text-align: center;
  padding: 2rem 0;
}

.empty-hint.is-hidden {
  display: none;
}

.proof-img {
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.proof-photo-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}

.proof-thumb-trigger {
  display: block;
  padding: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  cursor: zoom-in;
  overflow: hidden;
  max-width: min(220px, 100%);
  line-height: 0;
}

.proof-thumb-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 160px;
  object-fit: cover;
  vertical-align: middle;
}

.proof-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  box-sizing: border-box;
}

.proof-lightbox[hidden] {
  display: none !important;
}

.proof-lightbox__backdrop {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(15, 23, 42, 0.82);
  cursor: pointer;
}

.proof-lightbox__frame {
  position: relative;
  z-index: 1;
  max-width: min(96vw, 1100px);
  max-height: 92vh;
}

.proof-lightbox__img {
  display: block;
  max-width: 100%;
  max-height: 88vh;
  width: auto;
  height: auto;
  margin: 0 auto;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.proof-lightbox__close {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  z-index: 2;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #0f172a;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

@media (max-width: 520px) {
  .proof-lightbox__close {
    top: 0.35rem;
    right: 0.35rem;
  }
}

.linkish {
  background: none;
  border: 0;
  color: var(--brand-2);
  cursor: pointer;
  text-decoration: underline;
  font: inherit;
  padding: 0;
}

.inline { display: inline; }

.photo-wrap { margin-top: 0.75rem; }

/* Выбор файла: нативный input скрыт, выбор только через кнопку «Обзор…» */
.file-upload {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

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

.file-upload__browse {
  flex-shrink: 0;
  cursor: pointer;
  margin: 0;
}

.file-upload__name {
  font-size: 0.9rem;
  color: var(--muted);
  word-break: break-word;
  flex: 1 1 140px;
  min-width: 0;
}

.pwa-icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.65rem;
  margin: 0.5rem 0 0.9rem;
}

.pwa-icon-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 0.55rem;
}

.pwa-icon-card--accent {
  border-color: rgba(20, 83, 45, 0.5);
  background: rgba(20, 83, 45, 0.03);
}

.pwa-icon-card__title {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.pwa-icon-card__img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f8fafc;
  display: block;
}

.pwa-icon-card__img--small {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.pwa-icon-card__path {
  margin-top: 0.35rem;
  font-size: 0.72rem;
  color: var(--muted);
  word-break: break-all;
}

.pwa-install-banner {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  z-index: 1200;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
}

.pwa-install-banner[hidden] {
  display: none !important;
}

.pwa-install-banner__title {
  margin: 0 0 0.2rem;
  color: var(--brand);
  font-weight: 700;
}

.pwa-install-banner__text {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.pwa-install-banner__hint {
  margin: 0.35rem 0 0;
  color: #6b7280;
  font-size: 0.8rem;
  line-height: 1.35;
}

.pwa-install-banner__actions {
  margin-top: 0.6rem;
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

@media (min-width: 920px) {
  .pwa-install-banner {
    left: auto;
    right: 1rem;
    width: min(360px, calc(100vw - 2rem));
  }
}

@media (max-width: 640px) {
  .topbar__inner {
    gap: 0.55rem;
  }

  .brand {
    flex: 0 0 auto;
  }

  .userbox {
    margin-left: auto;
    flex: 0 0 auto;
    gap: 0.35rem;
  }

  .userbox .btn {
    padding: 0.32rem 0.52rem;
    font-size: 0.8rem;
  }

  .nav-toggle {
    display: inline-flex;
    margin-left: auto;
    flex: 0 0 auto;
  }

  .topbar__inner.is-menu-open .nav-toggle {
    border-color: rgba(20, 83, 45, 0.35);
    background: rgba(20, 83, 45, 0.06);
  }

  .nav {
    order: 4;
    display: none;
    flex: 1 1 100%;
    width: 100%;
    flex-direction: column;
    gap: 0.25rem;
    border-top: 1px solid var(--line);
    padding-top: 0.45rem;
  }

  .topbar__inner.is-menu-open .nav {
    display: flex;
  }

  .nav a,
  .nav-dropdown__toggle {
    white-space: normal;
    font-size: 0.9rem;
    padding: 0.45rem 0.55rem;
  }

  .nav-dropdown {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-right: 0;
  }

  .nav-dropdown__menu {
    position: static;
    display: block;
    min-width: 0;
    border: 0;
    box-shadow: none;
    padding: 0.15rem 0 0.15rem 0.8rem;
  }

  .nav-dropdown__caret { display: none; }
  .nav-dropdown__menu a { padding-left: 0.4rem; }

  .userbox__name { display: none; }
  .card--detail .detail-row {
    grid-template-columns: 1fr;
  }

  .settings-tabs__nav {
    gap: 0.35rem;
  }

  .settings-tabs__tab {
    padding: 0.45rem 0.65rem;
    font-size: 0.82rem;
  }
}

.settings-tabs {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.settings-tabs__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.35rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.settings-tabs__tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.settings-tabs__tab:hover {
  color: var(--brand);
  background: rgba(20, 83, 45, 0.06);
}

.settings-tabs__tab.is-active {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.settings-tabs__tab--danger.is-active {
  background: var(--danger);
  border-color: var(--danger);
}

.settings-tabs__tab--danger:not(.is-active) {
  color: var(--danger);
}

.settings-tabs__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #fef2f2;
  color: var(--danger);
  font-size: 0.72rem;
  font-weight: 700;
}

.settings-tabs__tab.is-active .settings-tabs__badge {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.settings-tabs__panel {
  display: none;
}

.settings-tabs__panel.is-active {
  display: block;
}

.settings-tabs__actions {
  position: sticky;
  bottom: 0.75rem;
  z-index: 5;
  margin-top: 0.5rem;
  padding: 0.75rem 0 0.25rem;
  background: linear-gradient(to top, var(--bg) 70%, rgba(247, 250, 247, 0));
}

.tech-footer {
  margin-top: 2rem;
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 0.78rem;
}

.tech-footer__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1rem 1.25rem;
}

.tech-footer__details {
  margin: 0;
}

.tech-footer__summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

.tech-footer__summary::-webkit-details-marker {
  display: none;
}

.tech-footer__summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 0.35rem;
  transition: transform 0.15s ease;
}

.tech-footer__details[open] .tech-footer__summary::before {
  transform: rotate(90deg);
}

.tech-footer__summary-meta {
  font-weight: 400;
  color: #94a3b8;
}

.tech-footer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.45rem 1.25rem;
  margin: 0.75rem 0 0;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--line);
}

.tech-footer__row {
  margin: 0;
  min-width: 0;
}

.tech-footer__row dt {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
}

.tech-footer__row dd {
  margin: 0.1rem 0 0;
  color: #475569;
  word-break: break-word;
}
