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

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #0f172a;
  color: #f5f7ff;
}

body.menu-open {
  overflow: hidden;
}

a {
  color: inherit;
}

.is-hidden {
  display: none !important;
}

.top-bar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: #020617;
  color: #e2e8f0;
  padding: 0.55rem 0.85rem;
  box-shadow: 0 5px 20px rgba(2, 6, 23, 0.8);
}

.burger-btn {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #0b1220;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 0 10px;
  cursor: pointer;
}

.burger-btn span {
  height: 2px;
  width: 100%;
  background: #cbd5f5;
  border-radius: 2px;
}

.top-title-block {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.main-nav-drawer {
  position: fixed;
  top: 0;
  left: -320px;
  width: min(300px, 85vw);
  height: 100vh;
  background: #020b1a;
  border-right: 1px solid rgba(148, 163, 184, 0.28);
  z-index: 60;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: left 0.18s ease;
}

.main-nav-drawer.is-open {
  left: 0;
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.55);
  z-index: 50;
}

.nav-link {
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  color: #cbd5f5;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.nav-link:hover {
  border-color: rgba(148, 163, 184, 0.5);
}

.nav-link.is-active {
  background: rgba(94, 234, 212, 0.12);
  border-color: rgba(94, 234, 212, 0.6);
  color: #5eead4;
  box-shadow: 0 0 12px rgba(94, 234, 212, 0.25);
}

.app-title {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.1;
}

.active-section {
  font-size: 0.82rem;
  color: #93c5fd;
  margin-top: 0.1rem;
}

.session-info {
  margin-right: auto;
  margin-left: 0.3rem;
  font-size: 0.82rem;
}

.logout {
  text-decoration: none;
  font-size: 0.9rem;
  border: 1px solid #fff;
  padding: 0.3rem 0.75rem;
  border-radius: 4px;
}

.flash-messages {
  max-width: 640px;
  margin: 1rem auto;
}

.flash {
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  border-radius: 6px;
  font-size: 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.flash-success {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
}

.flash-danger {
  background: rgba(248, 113, 113, 0.15);
  color: #fca5a5;
}

.flash-warning {
  background: rgba(250, 204, 21, 0.18);
  color: #fde047;
}

.flash-info {
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
}

main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 52px);
  padding: 0.9rem;
}

.page-main-intake main,
.page-main-scan main,
.page-main-print_labels main,
.page-main-courier_delivery_page main,
.page-main-courier_routes_page main {
  align-items: flex-start;
  padding-top: 0.5rem;
}

.page-main-courier_delivery_page .top-bar,
.page-main-courier_routes_page .top-bar {
  position: relative;
}

.page-main-courier_delivery_page .top-title-block,
.page-main-courier_routes_page .top-title-block {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  align-items: center;
  text-align: center;
  pointer-events: none;
}

.page-main-courier_delivery_page .app-title,
.page-main-courier_routes_page .app-title {
  display: none;
}

.route-barcodes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.route-barcode-pill {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.auth-container {
  width: 100%;
  max-width: 420px;
}

.card {
  background: #111827;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.card h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  text-align: center;
}

.form-grid {
  display: grid;
  gap: 0.75rem;
}

.form-grid label {
  font-size: 0.85rem;
  color: #cbd5f5;
}

.form-grid input {
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(226, 232, 240, 0.25);
  border-radius: 6px;
  background: #0b1220;
  color: #f8fafc;
}

.form-grid input:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
}

.form-grid button {
  margin-top: 0.5rem;
  padding: 0.75rem;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  color: #0f172a;
  background: linear-gradient(120deg, #facc15, #f97316);
  cursor: pointer;
  font-weight: 600;
}

.form-grid button:hover {
  filter: brightness(1.05);
}

.hint {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-top: 1rem;
  text-align: center;
}

.scan-container {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  width: 100%;
  max-width: 640px;
}

.scan-input label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1rem;
  color: #e2e8f0;
}

.scan-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
  align-items: stretch;
}

.scan-input-field {
  position: relative;
}

.scan-input input,
.print-size-select {
  width: 100%;
  padding: 1rem;
  font-size: 1.25rem;
  border: 2px solid rgba(148, 163, 184, 0.4);
  border-radius: 8px;
  background: #020b1a;
  color: #f8fafc;
}

.scan-input-field input {
  padding-right: 3.35rem;
}

.scan-keyboard-btn {
  position: absolute;
  top: 50%;
  right: 0.45rem;
  transform: translateY(-50%);
  width: 34px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.55);
  background: linear-gradient(180deg, #475569, #334155);
  color: #e2e8f0;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.scan-keyboard-btn:active {
  transform: translateY(-50%) scale(0.98);
}

.scan-submit-btn {
  min-width: 52px;
  height: 36px;
  align-self: center;
  padding: 0 0.55rem;
  border-radius: 9px;
  border: 1px solid rgba(94, 234, 212, 0.5);
  background: linear-gradient(180deg, #0f766e, #0d9488);
  color: #ecfeff;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
}

.scan-submit-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.intake-options {
  margin-top: 0.85rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  background: rgba(2, 11, 26, 0.55);
}

.intake-toggle {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 0.8rem;
  min-height: 52px;
}

.intake-toggle-switch {
  justify-self: end;
  position: relative;
  width: 68px;
  height: 38px;
  border: 0;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

.intake-toggle-control {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #64748b, #475569);
  border: 2px solid #cbd5e1;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.45), 0 1px 4px rgba(15, 23, 42, 0.35);
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.intake-toggle-control::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.7);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease;
}

.intake-toggle-switch[aria-checked="true"] .intake-toggle-control {
  background: linear-gradient(180deg, #22c55e, #16a34a);
  border-color: #86efac;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.28);
}

.intake-toggle-switch[aria-checked="true"] .intake-toggle-control::after {
  transform: translateX(30px);
}

.intake-toggle-switch:focus-visible .intake-toggle-control {
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.35);
}

.intake-toggle-text {
  font-size: 1.05rem;
  line-height: 1.3;
  color: #e2e8f0;
}

.intake-toggle-hint {
  margin: 0.35rem 0 0;
  color: #94a3b8;
  font-size: 0.86rem;
}

.scan-display {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  background: #0b1220;
  border-radius: 12px;
  padding: 1.2rem;
  min-height: 220px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 20px 45px rgba(0, 0, 0, 0.6);
  color: #f8fafc;
  border: 2px solid transparent;
}

.scan-display[data-state="idle"] {
  border-color: rgba(148, 163, 184, 0.2);
}

.scan-display[data-state="loading"] {
  border-color: #38bdf8;
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.25);
}

.scan-display[data-state="success"] {
  border-color: #22c55e;
  box-shadow: 0 0 20px rgba(34, 197, 94, 0.25);
}

.scan-display[data-state="warning"] {
  border-color: #facc15;
  box-shadow: 0 0 18px rgba(250, 204, 21, 0.25);
}

.scan-display[data-state="error"] {
  border-color: #f97316;
  box-shadow: 0 0 18px rgba(249, 115, 22, 0.25);
}

.scan-message {
  font-size: 1.2rem;
  color: #cbd5f5;
}

.scan-meta {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-top: -0.75rem;
}

.parcel-details {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.parcel-details[hidden] {
  display: none;
}

.detail-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.delivery-block {
  position: relative;
  border-radius: 10px;
  padding: 0.65rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.delivery-block-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.delivery-block-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.delivery-block-selected {
  border: 2px solid rgba(34, 197, 94, 0.8);
  background: rgba(34, 197, 94, 0.1);
  box-shadow: 0 0 0 1px rgba(134, 239, 172, 0.35), 0 0 18px rgba(34, 197, 94, 0.2);
}

.delivery-block-done {
  background: rgba(20, 60, 38, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.08);
  box-shadow: inset 0 0 0 1px rgba(21, 128, 61, 0.08);
}

.block-select-btn,
.block-menu-btn,
.block-map-btn {
  width: 32px;
  min-width: 32px;
  max-width: 32px;
  height: 32px;
  min-height: 32px;
  max-height: 32px;
  padding: 0;
  flex: 0 0 32px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.9);
  color: #cbd5e1;
  font-size: 16px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.block-map-btn {
  border-color: rgba(56, 189, 248, 0.45);
  color: #7dd3fc;
}

.block-select-btn.is-selected {
  border-color: rgba(34, 197, 94, 0.85);
  background: rgba(22, 163, 74, 0.28);
  color: #86efac;
  font-weight: 700;
}

.delivery-block-menu-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin-top: 8px;
}

.block-menu-wrap {
  position: relative;
}

.block-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 6px);
  display: flex;
  flex-direction: column;
  min-width: 190px;
  background: #020b1a;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  padding: 4px;
  z-index: 20;
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.65);
}

.block-menu[hidden] {
  display: none !important;
}

.block-menu button {
  text-align: left;
  border: 0;
  background: transparent;
  color: #e2e8f0;
  padding: 8px 10px;
  border-radius: 8px;
}

.block-menu button:hover {
  background: rgba(148, 163, 184, 0.18);
}

.delivery-barcodes-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.delivery-finalize-wrap {
  margin-top: 10px;
}

.delivery-finalize-btn {
  width: 100%;
  min-height: 44px;
}

.delivery-barcode-line {
  line-height: 1.25;
  word-break: break-all;
}

.delivery-barcode-picked {
  background: rgba(56, 189, 248, 0.14);
  border: 1px dashed rgba(56, 189, 248, 0.5);
  border-radius: 6px;
  padding: 1px 6px;
}

.delivery-proof-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.delivery-proof-overlay-signature {
  padding: 0;
}

.delivery-proof-modal {
  width: min(760px, 96vw);
  background: #0b1220;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  padding: 12px;
  color: #e2e8f0;
}

.delivery-proof-modal-signature {
  width: min(980px, 100vw);
  max-width: 100vw;
  min-height: 100vh;
  border-radius: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.delivery-proof-canvas-wrap {
  flex: 1 1 auto;
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-height: 240px;
}

.delivery-proof-canvas-wrap .delivery-proof-canvas {
  flex: 1 1 auto;
}

.delivery-proof-actions-signature {
  margin-top: 12px;
}

.delivery-proof-title {
  color: #f8fafc;
  font-weight: 700;
  margin-bottom: 8px;
}

.delivery-proof-subtitle {
  color: #cbd5e1;
  margin-bottom: 8px;
}

.delivery-proof-type-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.delivery-proof-type-grid [data-recipient-type].is-selected {
  outline: 2px solid rgba(34, 197, 94, 0.85);
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.65);
  color: #dcfce7;
}

.delivery-proof-input {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #020617;
  color: #f1f5f9;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.delivery-proof-input::placeholder {
  color: #94a3b8;
}

.delivery-proof-hint {
  color: #93c5fd;
  font-size: 0.9rem;
}

.delivery-proof-statement {
  margin-bottom: 10px;
  color: #e2e8f0;
  font-size: 0.95rem;
  line-height: 1.35;
}

.delivery-proof-canvas {
  width: 100%;
  height: auto;
  border: 1px solid rgba(15, 23, 42, 0.25);
  border-radius: 8px;
  touch-action: none;
  background: #fff;
}

.delivery-proof-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.delivery-proof-actions .btn {
  min-width: 148px;
}

.delivery-district {
  font-size: 0.92rem;
  color: #93c5fd;
}

.delivery-block-flash {
  animation: deliveryBlockFlash 1.2s ease-in-out 1;
}

.delivery-block-moved-top {
  animation: deliveryBlockMovedTop 1.05s ease-out 1;
}

@keyframes deliveryBlockMovedTop {
  0% {
    transform: translateY(30px) scale(0.985);
    opacity: 0.25;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.45), 0 0 22px rgba(56, 189, 248, 0.35);
    background: rgba(56, 189, 248, 0.12);
  }
  45% {
    transform: translateY(8px) scale(0.995);
    opacity: 0.82;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.32), 0 0 16px rgba(56, 189, 248, 0.26);
    background: rgba(56, 189, 248, 0.08);
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
    box-shadow: none;
    background: transparent;
  }
}

@keyframes deliveryBlockFlash {
  0% { background: rgba(250, 204, 21, 0.1); border-color: rgba(250, 204, 21, 0.5); }
  50% { background: rgba(250, 204, 21, 0.35); border-color: rgba(250, 204, 21, 1); }
  100% { background: rgba(250, 204, 21, 0.1); border-color: rgba(250, 204, 21, 0.5); }
}

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

.detail-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}

.detail-value {
  font-size: 1rem;
  color: #f1f5f9;
}

.detail-status strong {
  font-size: 1.1rem;
  color: #bef264;
}

.detail-status small {
  display: block;
  color: #a5b4fc;
  margin-top: 0.2rem;
}

.admin-container {
  width: 100%;
  max-width: 1100px;
}

.admin-card {
  padding: 1.5rem;
}

.admin-card h2 {
  margin-top: 0;
  margin-bottom: 1rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  align-items: center;
}

.admin-grid label {
  font-size: 0.85rem;
  color: #cbd5f5;
}

.admin-grid input,
.admin-grid select,
.inline-form input,
.inline-form select {
  padding: 0.45rem 0.55rem;
  border: 1px solid rgba(226, 232, 240, 0.25);
  border-radius: 6px;
  background: #0b1220;
  color: #f8fafc;
}

.admin-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.admin-tab {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #0b1220;
  color: #cbd5f5;
  padding: 0.55rem 0.9rem;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}

.admin-tab.is-active {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.65);
  color: #7dd3fc;
}

.admin-tab-panel {
  display: none;
}

.admin-tab-panel.is-active {
  display: block;
}

.btn {
  min-height: 40px;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.05s ease, filter 0.12s ease, border-color 0.12s ease;
}

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

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(120deg, #22c55e, #16a34a);
  color: #ecfdf5;
  border-color: rgba(134, 239, 172, 0.45);
}

.btn-secondary {
  background: #1e293b;
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.45);
}

.btn-danger {
  background: linear-gradient(120deg, #ef4444, #dc2626);
  color: #fff1f2;
  border-color: rgba(252, 165, 165, 0.45);
}

.admin-create-form .btn,
.inline-form .btn,
.access-form .btn {
  margin-top: 0.8rem;
}

.admin-table-wrap {
  margin-top: 1.3rem;
  overflow-x: auto;
}

.admin-separator {
  border: 0;
  border-top: 1px solid rgba(148, 163, 184, 0.24);
  margin: 1.5rem 0;
}

.admin-grid-mask {
  grid-template-columns: 120px minmax(260px, 1fr) 120px minmax(220px, 1fr);
}

.admin-grid-group {
  grid-template-columns: 120px minmax(260px, 1fr) 120px minmax(260px, 1fr);
}

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

.admin-table th,
.admin-table td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  padding: 0.55rem;
  text-align: left;
  vertical-align: top;
}

.inline-form {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  margin: 0 0.35rem 0.35rem 0;
}

.inline-form button {
  margin-top: 0;
}

.inline-block {
  display: inline-block;
}

.access-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  align-items: flex-start;
}

.access-block {
  padding: 0.4rem 0.55rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  width: 100%;
}

.access-block strong {
  display: block;
  margin-bottom: 0.35rem;
  color: #dbeafe;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.25rem 0.75rem;
  width: 100%;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.86rem;
  color: #d5ddf0;
}

.muted {
  color: #94a3b8;
  font-size: 0.82rem;
}

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.pill-active {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

.pill-inactive {
  background: rgba(248, 113, 113, 0.2);
  color: #fca5a5;
}

.label-print-root {
  display: none;
}

@media print {
  @page {
    margin: 0;
  }

  html,
  body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    height: auto !important;
    min-height: auto !important;
  }

  .top-bar,
  .flash-messages,
  .scan-container > :not(.label-print-root):not(#dynamic-print-page-size) {
    display: none !important;
  }

  main,
  .scan-container {
    display: block !important;
    min-height: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .label-print-root {
    display: block !important;
    position: static !important;
    margin: 0;
    padding: 0;
    color: #000;
    background: #fff;
    font-family: Arial, sans-serif;
    page-break-after: avoid;
    break-after: avoid-page;
  }

  .label-sheet {
    margin: 0;
    box-sizing: border-box;
    padding: 3mm 4mm;
    line-height: 1.2;
    page-break-inside: avoid;
    break-inside: avoid;
    page-break-after: avoid;
    break-after: avoid-page;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 2.4mm;
    align-items: stretch;
  }

  .label-sheet.size-100x100 {
    width: 100mm;
    height: 100mm;
  }

  .label-sheet.size-100x150 {
    width: 100mm;
    height: 150mm;
  }

  .label-barcode-wrap {
    width: 100%;
    padding: 1mm 2mm;
  }

  .label-barcode-svg {
    width: 100%;
    height: 19mm;
    display: block;
  }

  .label-parcel-number {
    text-align: center;
    font-size: 16pt;
    font-weight: 800;
    letter-spacing: 0.4px;
    word-break: break-all;
  }

  .label-recipient {
    font-size: 13pt;
    font-weight: 600;
  }

  .label-address {
    font-size: 12pt;
    line-height: 1.22;
  }

  .label-phone {
    font-size: 17pt;
    font-weight: 900;
    letter-spacing: 0.3px;
  }

  .label-weight {
    font-size: 12pt;
    font-weight: 700;
  }

  .label-district {
    font-size: 14pt;
    font-weight: 500;
    color: #000;
  }

  .label-district-number {
    font-weight: 900;
  }

  .label-sheet.size-100x100 .label-barcode-svg {
    height: 18mm;
  }

  .label-sheet.size-100x100 .label-parcel-number {
    font-size: 14pt;
  }

  .label-sheet.size-100x100 .label-recipient {
    font-size: 12pt;
  }

  .label-sheet.size-100x100 .label-address,
  .label-sheet.size-100x100 .label-weight {
    font-size: 11pt;
  }

  .label-sheet.size-100x100 .label-district {
    font-size: 12pt;
  }

  .label-sheet.size-100x100 .label-phone {
    font-size: 15pt;
  }
}

@media (pointer: coarse) {
  .btn {
    min-height: 48px;
    padding: 0.65rem 1rem;
  }

  .admin-tab {
    min-height: 44px;
  }

  .intake-toggle {
    min-height: 62px;
  }

  .intake-toggle-switch {
    width: 74px;
    height: 44px;
  }

  .intake-toggle-control::after {
    width: 36px;
    height: 36px;
    top: 2px;
    left: 2px;
  }

  .intake-toggle-switch[aria-checked="true"] .intake-toggle-control::after {
    transform: translateX(30px);
  }

  .intake-toggle-text {
    font-size: 1.08rem;
  }
}

@media (max-width: 667px) {
  .delivery-proof-modal {
    width: 100%;
    max-width: 100%;
    padding: 12px;
  }

  .delivery-proof-modal-signature {
    min-height: 100dvh;
    padding: 12px;
  }

  .delivery-proof-title {
    font-size: 1.05rem;
  }

  .delivery-proof-statement {
    font-size: 0.9rem;
    margin-bottom: 8px;
  }

  .delivery-proof-canvas-wrap {
    min-height: 0;
  }

  .delivery-proof-actions,
  .delivery-proof-actions-signature {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .delivery-proof-actions .btn,
  .delivery-proof-actions-signature .btn {
    width: 100%;
    min-width: 0;
  }

  .top-bar {
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
    padding: 0.6rem 0.75rem;
  }

  .app-title {
    font-size: 1.05rem;
    margin-right: auto;
  }

  .page-main-courier_delivery_page .top-title-block,
  .page-main-courier_routes_page .top-title-block {
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    max-width: 72%;
  }

  .logout {
    margin-left: auto;
    padding: 0.25rem 0.6rem;
  }

  .session-info {
    order: 2;
    width: 100%;
    margin: 0;
    font-size: 0.82rem;
  }

  .main-nav {
    order: 3;
    width: 100%;
    margin: 0;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.2rem;
  }

  .nav-link {
    white-space: nowrap;
    font-size: 0.86rem;
    padding: 0.3rem 0.75rem;
  }

  main {
    padding: 0.8rem;
  }

  .page-main-intake main,
  .page-main-scan main,
  .page-main-print_labels main,
  .page-main-courier_delivery_page main,
  .page-main-courier_routes_page main {
    padding-top: 0.55rem;
  }

  .scan-container {
    gap: 1rem;
    max-width: 100%;
  }

  .scan-input-row {
    gap: 0.45rem;
  }

  .scan-input input,
  .print-size-select {
    font-size: 1.05rem;
    padding: 0.8rem;
  }

  .scan-keyboard-btn {
    width: 32px;
    height: 36px;
    right: 0.35rem;
    font-size: 0.9rem;
  }

  .scan-submit-btn {
    min-width: 48px;
    height: 34px;
    padding: 0 0.45rem;
    font-size: 0.85rem;
  }

  .intake-options {
    padding: 0.75rem;
  }

  .intake-toggle {
    min-height: 58px;
    column-gap: 0.7rem;
  }

  .intake-toggle-switch {
    width: 68px;
    height: 40px;
  }

  .intake-toggle-control::after {
    width: 32px;
    height: 32px;
    top: 2px;
    left: 2px;
  }

  .intake-toggle-switch[aria-checked="true"] .intake-toggle-control::after {
    transform: translateX(28px);
  }

  .intake-toggle-text {
    font-size: 1rem;
  }

  .scan-display {
    min-height: 200px;
    padding: 1rem;
    gap: 0.95rem;
  }

  .scan-message {
    font-size: 1rem;
  }

  .detail-value {
    font-size: 0.95rem;
  }

  .admin-card {
    padding: 1rem;
  }

  .admin-grid {
    grid-template-columns: 1fr;
    gap: 0.45rem;
  }

  .admin-create-form button {
    width: 100%;
  }

  .inline-form {
    display: flex;
    width: 100%;
    margin-right: 0;
  }

  .inline-form input,
  .inline-form select,
  .inline-form button {
    width: 100%;
  }
}
