/*
 * Кабинет курьера: mobile-first, крупные цели нажатия.
 * Курьер пользуется этим на морозе, в перчатках, одной рукой — поэтому кнопки
 * не меньше 48px, шрифт крупный, никаких мелких иконок-ловушек.
 * Шрифты системные: никаких CDN (§9).
 */

:root {
  --green: #1f7a4d;
  --green-dark: #17603c;
  --red: #c0392b;
  --amber: #b8770a;
  --amber-bg: #fff5e0;
  --ink: #1a1d21;
  --ink-soft: #5b6470;
  --line: #e3e7eb;
  --bg: #f5f7f9;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }

/* Скрытие через атрибут hidden должно побеждать любой display из этого файла:
   у .sheet и .screen задан display, а он перебивает браузерное [hidden]. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

.screen {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
}

/* ---------------------------------------------------------------- баннер сети */
.net-banner {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  color: #fff;
}
.net-banner.is-offline { background: #495260; }
.net-banner.is-pending { background: var(--amber); }

/* ---------------------------------------------------------------- вход */
.login-head { text-align: center; margin: 32px 0 28px; }
.login-head .logo { font-size: 52px; line-height: 1; }
.login-head h1 { font-size: 24px; margin: 12px 0 0; }

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

select, input, textarea {
  width: 100%;
  padding: 14px;
  font-size: 18px;
  font-family: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  appearance: none;
}
select:focus, input:focus, textarea:focus {
  outline: 2px solid var(--green);
  outline-offset: -1px;
}
#pin-input { letter-spacing: .5em; text-align: center; font-size: 24px; }
textarea { resize: vertical; }

/* ---------------------------------------------------------------- кнопки */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn-lg { width: 100%; min-height: 54px; font-size: 18px; margin-top: 10px; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:active { background: var(--green-dark); }
.btn-danger { background: #fdecea; color: var(--red); border-color: #f5cfca; }
.btn-secondary { background: #eef1f5; color: var(--ink); border-color: var(--line); }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }

/* ---------------------------------------------------------------- шапка */
.app-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.head-title { font-size: 22px; font-weight: 700; }
.head-sub { font-size: 14px; color: var(--ink-soft); }

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  background: #e9edf1;
  padding: 4px;
  border-radius: var(--radius);
}
.tab {
  flex: 1;
  min-height: 42px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: var(--ink-soft);
  cursor: pointer;
}
.tab.is-active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

/* ---------------------------------------------------------------- карточка */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card.is-pending { opacity: .72; }
.card.is-current { border: 2px solid var(--green); }

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.card-number { font-size: 18px; font-weight: 700; }
.card-time {
  font-size: 16px;
  font-weight: 700;
  color: var(--green);
  white-space: nowrap;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}
.badge-warn { background: var(--amber-bg); color: var(--amber); }
.badge-money { background: #fdecea; color: var(--red); }
.badge-surprise { background: #ede7f6; color: #5b3d9e; }

.card-row {
  display: block;
  padding: 8px 0;
  font-size: 16px;
  color: var(--ink);
  text-decoration: none;
  border-top: 1px solid var(--line);
}
.card-address, .card-phone { color: #14538f; }
.card-items { color: var(--ink-soft); white-space: pre-line; }
.card-comment {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--amber-bg);
  border-radius: 10px;
  font-size: 15px;
  white-space: pre-line;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 14px;
}
.card-actions .btn:first-child { min-height: 54px; font-size: 18px; }
@media (min-width: 420px) {
  .card-actions { grid-template-columns: 1fr 1fr; }
  .card-actions .btn:first-child { grid-column: 1 / -1; }
}

.pending-note {
  margin-top: 12px;
  padding: 10px 12px;
  background: #f0f3f6;
  border-radius: 10px;
  font-size: 15px;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------- шторки */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  background: rgba(16, 24, 40, .45);
}
.sheet-body {
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
}
@media (min-width: 640px) {
  .sheet { align-items: center; justify-content: center; }
  .sheet-body { max-width: 520px; border-radius: 20px; }
}
.sheet-body h2 { margin: 0 0 14px; font-size: 20px; }

.reason-options { display: grid; gap: 8px; margin-bottom: 16px; }
.reason {
  min-height: 52px;
  padding: 12px 14px;
  text-align: left;
  font-size: 16px;
  font-family: inherit;
  background: #f2f5f8;
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}
.reason.is-active { border-color: var(--green); background: #eaf5ef; font-weight: 600; }

/* ---------------------------------------------------------------- ЗП */
.section-title { font-size: 17px; margin: 22px 0 10px; }
.payroll-title { font-size: 15px; color: var(--ink-soft); font-weight: 600; }
.payroll-total { font-size: 30px; font-weight: 700; margin: 4px 0 12px; }
.payroll-rows { display: grid; gap: 6px; }
.payroll-row { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.payroll-label { color: var(--ink-soft); }
.payroll-hint { color: #97a1ad; }
.payroll-value { font-weight: 600; white-space: nowrap; }
.payroll-detail {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink-soft);
}

.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card);
  border-radius: 10px;
  margin-bottom: 8px;
}
.history-order { font-weight: 600; }
.history-meta { font-size: 13px; color: var(--ink-soft); }
.history-value { font-weight: 600; white-space: nowrap; }
.history-value.is-muted { color: var(--ink-soft); font-weight: 500; }

/* ---------------------------------------------------------------- прочее */
.empty { text-align: center; padding: 48px 16px; color: var(--ink-soft); }
.muted { color: var(--ink-soft); }
.error { color: var(--red); font-size: 15px; font-weight: 600; margin: 8px 0 0; }
.req { color: var(--red); font-weight: 600; }

.login-hint {
  margin: 10px 0 0;
  font-size: 15px;
  color: var(--ink-soft);
}
#phone-input { font-size: 20px; text-align: center; letter-spacing: .02em; }
