* {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, Helvetica, Arial, sans-serif;
}

body {
  margin: 0;
  background: #f4f6f8;
  color: #1f2a37;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px;
}

.header {
  text-align: center;
  margin-bottom: 20px;
}

.logo {
  font-size: 22px;
  font-weight: 700;
  color: #0b3a67;
}

.subtitle {
  font-size: 14px;
  color: #6b7280;
}

/* ===== Cards ===== */
.card {
  background: #fff;
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.06);
}
.hidden {
  display: none;
}

/* ===== Form ===== */
.form-intro {
  text-align: left;
  margin-bottom: 16px;
}

.form-intro h1 {
  margin: 0 0 6px;
  font-size: 18px;
  color: #0b3a67;
}

.form-intro p {
  margin: 0;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
}

.status-form {
  display: grid;
  gap: 12px;
}

label {
  font-size: 13px;
  display: block;
  margin-bottom: 12px;
  color: #374151;
  font-weight: 600;
}

input {
  width: 100%;
  padding: 12px;
  margin-top: 6px;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  background: #f8fafc;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus {
  outline: none;
  border-color: #0b3a67;
  box-shadow: 0 0 0 3px rgba(11, 58, 103, 0.15);
}

button {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  background: #0b3a67;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(11, 58, 103, 0.2);
}

button.secondary {
  background: #e2e8f0;
  color: #1f2a37;
}

/* ===== Client type switch (segmented) ===== */
.client-switch {
  display: flex;
  background: #eef2f7;
  border-radius: 18px;
  padding: 6px;
  gap: 6px;
  margin-bottom: 18px;
}

.client-switch label {
  flex: 1;
  cursor: pointer;
}

.client-switch input {
  display: none;
}

.client-switch span {
  display: block;
  text-align: center;
  padding: 12px 0;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  color: #475569;
  transition: all 0.25s ease;
}

/* активная кнопка */
.client-switch input:checked + span {
  background: #0b3a67;
  color: #fff;
  box-shadow: 0 6px 18px rgba(11, 58, 103, 0.25);
}


/* ===== Contacts ===== */
.info-title {
  font-weight: 600;
  margin-bottom: 6px;
  color: #374151;
}

.history .info-title,
.manager strong {
  font-size: 16px;
  font-weight: 700;
  color: #0b3a67;
}

/* ===== Result actions ===== */
.result-actions {
  margin-bottom: 12px;
}

.result-actions button {
  width: auto;
  padding: 10px 16px;
}

/* ===== Delivery card ===== */
.delivery-card {
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  padding: 18px;
}

.status-error-box {
  background: #fee2e2;
  color: #991b1b;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}
.delivery-head strong {
  font-size: 16px;
}

.meta-line {
  margin-top: 4px;
  font-size: 13px;
  color: #6b7280;
}

/* ===== Timeline как WB / Ozon ===== */
.timeline {
  position: relative;
  margin-top: 24px;
  padding-left: 32px; /* единая ось */
}


.timeline-item.past .timeline-dot {
  box-shadow: 0 0 0 3px #e5e7eb;
}

/* линия ДО текущего статуса */


.timeline-item {
  position: relative;
  padding: 8px 0 26px 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #e5e7eb;
}


.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item.past::before {
  background: #cbd5e1;
}


.timeline-item:last-child::before {
  display: none;
}

.timeline-dot {
  position: absolute;
  left: 1px;
  top: 8px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #d1d5db;
  z-index: 2;
}

/* прошлые */
.timeline-item.past .timeline-dot {
  background: #6b7280;
}

.timeline-item.past .timeline-title {
  color: #6b7280;
}

.timeline-item.past .timeline-desc {
  color: #9ca3af;
}

/* текущий */
.timeline-item.current .timeline-dot {
  background: #0b3a67;
  box-shadow: 0 0 0 6px rgba(11,58,103,.18);
  animation: pulse 1.4s infinite;
}

.timeline-item.current .timeline-title {
  color: #0b3a67;
  font-weight: 700;
}


/* будущие */
.timeline-item.future .timeline-dot {
  background: #e5e7eb;
}
.timeline-item.future .timeline-title {
  color: #cbd5e1;
}

.timeline-item.future .timeline-desc {
  color: #cbd5e1;
}

/* текст */
.timeline-title {
  font-size: 14px;
  margin-left: 22px;
}

.timeline-desc {
  font-size: 13px;
  margin-left: 22px;
  margin-top: 4px;
  color: #334155;
  line-height: 1.4;
}

.timeline-date {
  font-size: 12px;
  color: #9ca3af;
  margin-left: 22px;
  margin-top: 2px;
}

/* ===== Comment ===== */
.comment {
  background: #f1f5f9;
  border-left: 4px solid #0b3a67;
  padding: 14px 16px;
  border-radius: 12px;
  margin-top: 22px;
  font-size: 14px;
  line-height: 1.5;
}

/* ===== Documents ===== */
.documents {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.documents-title {
  font-weight: 700;
  font-size: 14px;
  color: #0b3a67;
  margin-bottom: 12px;
}

.documents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
}

.document-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 10px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  text-decoration: none;
  color: #1f2a37;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  text-align: center;
}

.document-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(11, 58, 103, 0.15);
  border-color: rgba(11, 58, 103, 0.35);
}

.document-card.is-disabled {
  cursor: default;
  opacity: 0.75;
}

.document-icon {
  width: 48px;
  height: 58px;
  border-radius: 10px;
  background: linear-gradient(145deg, #ffffff 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #ef4444;
  position: relative;
}

.document-icon::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 18px;
  height: 18px;
  background: #e2e8f0;
  clip-path: polygon(0 0, 100% 0, 100% 100%);
  border-top-right-radius: 10px;
}

.document-name {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

/* ===== Manager ===== */
.manager {
  display: none;
  justify-content: space-between;
  align-items: center;
}
.whatsapp {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #25d366;
  font-weight: 600;
  text-decoration: none;
}

.whatsapp img {
  width: 22px;
}

/* ===== History ===== */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  text-align: left;
  color: #1f2a37;
}

.history-item span {
  display: block;
}

.history-item .history-title {
  font-weight: 600;
  font-size: 14px;
}

.history-item .history-meta {
  font-size: 12px;
  color: #6b7280;
}

.history-item > span[aria-hidden] {
  color: #0b3a67;
  font-size: 16px;
  line-height: 1;
}

.history-item.active {
  border-color: #0b3a67;
  box-shadow: 0 8px 16px rgba(11, 58, 103, 0.12);
}

/* ===== Animations ===== */
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(11,58,103,.25); }
  70% { box-shadow: 0 0 0 10px rgba(11,58,103,0); }
  100% { box-shadow: 0 0 0 0 rgba(11,58,103,0); }
}
.manager-phone {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  color: #6b7280;
}
/* ===== Loader ===== */
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px;
  color: #475569;
}

.spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid #e5e7eb;
  border-top-color: #0b3a67;
  animation: spin 0.8s linear infinite;
}

.loader-text {
  font-size: 14px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Popup ===== */
.popup {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.55);
  padding: 24px;
  z-index: 100;
}

.popup.hidden {
  display: none;
}

.popup-card {
  background: #fff;
  border-radius: 18px;
  padding: 20px;
  width: min(420px, 100%);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.2);
}

.popup-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #0b3a67;
}

.popup-message {
  font-size: 14px;
  color: #334155;
  line-height: 1.5;
  margin-bottom: 16px;
}

.popup-actions {
  display: flex;
  gap: 12px;
}

.popup-actions button {
  width: auto;
  flex: 1;
}
/* ===== Loading ===== */
#loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  min-height: 180px;
  gap: 12px;
  margin-top: 40px;
}

#loading.hidden {
  display: none;
}

.loading-text {
  font-size: 14px;
  color: #6b7280;
}

/* сам спиннер */
.spinner {
  width: 42px;
  height: 42px;
  border: 3px solid #e5e7eb;
  border-top-color: #0b3a67;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
