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

.container {
  max-width: 1200px;
  margin: 30px auto;
  padding: 20px;
}

h1 {
  margin-bottom: 20px;
}

.panel {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  flex-wrap: wrap;
  align-items: center;
}

button {
  border: none;
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 15px;
  cursor: pointer;
  background: #ef4444;
  color: white;
}

select {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 15px;
  background: white;
  min-width: 220px;
}

button:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

.status {
  margin-bottom: 15px;
  padding: 12px;
  background: white;
  border-radius: 8px;
}

.app-message {
  margin: 0 0 16px 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
  font-weight: 700;
  line-height: 1.35;
}

.app-message[hidden] {
  display: none;
}

.app-message.info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}

.app-message.success {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: #166534;
}

.app-message.warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.app-message.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
}

th, td {
  padding: 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  font-size: 14px;
}

th {
  background: #111827;
  color: white;
}

.secondary {
  background: #374151;
}

.settings-section {
  background: white;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.courier-admin-section {
  background: white;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.form-row label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: #374151;
}

.form-row input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
}

.settings-section[hidden] {
  display: none;
}

.settings-section h2 {
  margin-top: 0;
}

.small-note {
  color: #4b5563;
  font-size: 14px;
}

.settings-table {
  margin-bottom: 15px;
}

.settings-table input {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 9px;
  font-size: 14px;
}

.settings-table .token-input {
  font-family: Consolas, monospace;
}

.remove-shop-btn {
  background: #6b7280;
  padding: 8px 10px;
}

.order-item {
  font-size: 13px;
  margin-bottom: 4px;
  line-height: 1.2;
}

.order-item-name {
  color: #111827;
}

.order-item-qty {
  color: #dc2626;
  font-weight: bold;
}

.select-col {
  width: 42px;
  text-align: center;
}

.select-col input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.overdue-row td {
  background: #fee2e2;
}

.overdue-date {
  color: #b91c1c;
  font-weight: bold;
}

.current-cutoff-row td {
  background: #e8f8ee;
}

.current-cutoff-row:hover td {
  background: #d9f3e3;
}

.shop-cutoff-input {
  min-width: 110px;
}

.order-item-name {
  color: #111827;
}

.order-item-qty {
  color: #dc2626;
  font-weight: bold;
  white-space: nowrap;
}

.success {
  background: #16a34a;
}

.success:hover:not(:disabled) {
  background: #15803d;
}

.success:disabled {
  background: #86efac;
  color: #ffffff;
  cursor: not-allowed;
  opacity: 1;
}

.top-menu {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.top-menu-btn {
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #111827;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.top-menu-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.page-section {
  display: block;
}

.page-section[hidden] {
  display: none;
}

.view-tabs {
  display: flex;
  gap: 8px;
  margin: 14px 0;
  flex-wrap: wrap;
}

.view-tab {
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #111827;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.view-tab:hover {
  background: #f3f4f6;
}

.view-tab.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.courier-table {
  margin-bottom: 20px;
}

.courier-form {
  margin-bottom: 20px;
}

.courier-form .panel {
  justify-content: flex-start;
}

.courier-form .small-note {
  margin-top: 8px;
}

.courier-action-btn {
  background: #ef4444;
  color: #ffffff;
  border: none;
  padding: 6px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 600;
}

.courier-action-btn:hover:not(:disabled) {
  background: #dc2626;
}

.archive-btn {
  background: #6b7280;
  color: #ffffff;
  border: none;
  padding: 6px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 600;
}

.archive-btn:hover {
  background: #4b5563;
}

.order-badge {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #f3f4f6;
  color: #374151;
}

.order-badge.missing {
  background: #fee2e2;
  color: #991b1b;
}

.order-badge.archive {
  background: #e5e7eb;
  color: #374151;
}

.archive-selected-btn {
  background: #6b7280;
  color: #ffffff;
  border: none;
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.archive-selected-btn:hover:not(:disabled) {
  background: #4b5563;
}

.archive-selected-btn:disabled {
  background: #d1d5db;
  cursor: not-allowed;
}

.phone-link {
  color: #2563eb;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.phone-link:hover {
  text-decoration: underline;
}

.auth-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 320px;
}

.auth-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  width: min(100%, 420px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.auth-card h2 {
  margin-top: 0;
  margin-bottom: 16px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #374151;
  font-size: 14px;
}

.auth-form input {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
}

.user-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: white;
  border-radius: 10px;
}

.user-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-meta span:first-child {
  font-weight: 700;
}

.user-meta span:last-child {
  color: #6b7280;
  font-size: 13px;
  text-transform: uppercase;
}

.courier-stub {
  background: white;
  border-radius: 12px;
  padding: 24px;
}

.courier-stub h2 {
  margin-top: 0;
}
.order-link {
  color: #2563eb;
  font-weight: 700;
  text-decoration: none;
}

.order-link:hover {
  text-decoration: underline;
}

.order-detail-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.order-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.order-detail-field {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px;
}

.order-detail-label {
  color: #6b7280;
  font-size: 13px;
  margin-bottom: 4px;
}

.order-detail-value {
  color: #111827;
  font-size: 15px;
  font-weight: 600;
  word-break: break-word;
}

.order-action-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.code-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.code-form input {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 16px;
  min-width: 220px;
}

.order-detail-items {
  margin-top: 12px;
}

@media (max-width: 760px) {
  .order-detail-grid {
    grid-template-columns: 1fr;
  }
}

.order-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.order-page-header h1 {
  margin: 0;
}

.button-link {
  display: inline-block;
  border: none;
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 15px;
  cursor: pointer;
  color: white;
  text-decoration: none;
}

.button-link.secondary {
  background: #374151;
}

.button-link.secondary:hover {
  background: #1f2937;
}

.courier-zone-btn {
  padding: 7px 10px;
  font-size: 13px;
  white-space: nowrap;
}

.courier-zone-panel {
  background: #ffffff;
  border-radius: 12px;
  padding: 18px;
  margin: 20px 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.courier-zone-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.courier-zone-header h3 {
  margin: 0 0 6px 0;
}

.zone-map {
  width: 100%;
  height: 520px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  overflow: hidden;
  margin: 12px 0;
  background: #e5e7eb;
}

.zone-actions {
  margin-top: 12px;
}

.zone-point-list {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 12px 12px 32px;
  max-height: 180px;
  overflow: auto;
}

.zone-point-list li {
  margin-bottom: 6px;
  font-family: Consolas, monospace;
  font-size: 13px;
}

.warehouse-panel {
  background: #ffffff;
  border-radius: 12px;
  padding: 18px;
  margin: 18px 0 22px 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.warehouse-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.warehouse-header h3 {
  margin: 0 0 6px 0;
}

.warehouse-map {
  width: 100%;
  height: 420px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  overflow: hidden;
  margin: 12px 0;
  background: #e5e7eb;
}

.gis-link {
  display: inline-block;
  border-radius: 8px;
  padding: 8px 12px;
  background: #2563eb;
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.gis-link:hover {
  background: #1d4ed8;
  text-decoration: none;
}

.order-map-actions {
  margin-top: 8px;
  margin-bottom: 12px;
}

.shop-warehouses-cell {
  min-width: 650px;
}

.shop-warehouses {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.warehouse-settings-row {
  display: grid;
  grid-template-columns: minmax(95px, 130px) minmax(95px, 120px) minmax(95px, 120px) auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #f9fafb;
}

.warehouse-settings-row input {
  min-width: 0;
}

.warehouse-map-btn,
.add-warehouse-btn,
.remove-warehouse-btn {
  padding: 8px 10px;
  font-size: 13px;
  white-space: nowrap;
}

.warehouse-map-btn {
  background: #2563eb;
}

.warehouse-empty-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.warehouse-empty-note {
  padding: 8px;
  background: #f9fafb;
  border: 1px dashed #d1d5db;
  border-radius: 8px;
}

.warehouse-map-modal[hidden] {
  display: none;
}

.warehouse-map-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(17, 24, 39, 0.55);
}

.warehouse-map-card {
  width: min(100%, 920px);
  max-height: 92vh;
  overflow: auto;
  background: #ffffff;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
}

.warehouse-map-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.warehouse-map-header h3 {
  margin: 0 0 6px 0;
}

.warehouse-point-map {
  width: 100%;
  height: 520px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  overflow: hidden;
  margin: 12px 0;
  background: #e5e7eb;
}

@media (max-width: 900px) {
  .shop-warehouses-cell {
    min-width: 420px;
  }

  .warehouse-settings-row,
  .warehouse-empty-row {
    grid-template-columns: 1fr;
  }

  .warehouse-map-card {
    max-height: 96vh;
  }

  .warehouse-point-map {
    height: 420px;
  }
}


.order-status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: #eef2ff;
  color: #3730a3;
  white-space: nowrap;
}

.order-status-badge.status-packed {
  background: #ecfdf5;
  color: #166534;
}

.order-status-badge.status-handed_to_courier {
  background: #eff6ff;
  color: #1d4ed8;
}

.order-status-badge.status-cancelled_after_courier_transfer {
  background: #fef2f2;
  color: #991b1b;
}

.order-status-badge.status-archive {
  background: #e5e7eb;
  color: #374151;
}


.problem-orders-warning {
  margin: 0 0 14px 0;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  font-weight: 800;
  animation: problem-warning-blink 1.2s infinite;
}

.problem-orders-warning[hidden] {
  display: none;
}

@keyframes problem-warning-blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.problem-order-row td {
  background: #fecaca !important;
  color: #7f1d1d;
  font-weight: 700;
}

.problem-order-row:hover td {
  background: #fca5a5 !important;
}
