:root {
  --bg: #f3f5fb;
  --text: #111827;
  --muted: #6b7280;
  --card: #ffffff;
  --yellow: #facc15;
  --yellow-dark: #eab308;
  --green: #16a34a;
  --red: #dc2626;
  --border: #e5e7eb;
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

.app-shell {
  min-height: 100vh;
}

.screen.hidden,
.tab-page.hidden,
.banner.hidden,
.active-order.hidden {
  display: none;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.brand {
  position: fixed;
  top: 14px;
  left: 16px;
  font-weight: 800;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.login-card {
  width: min(430px, 100%);
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

input,
button,
textarea,
select,
.btn {
  font: inherit;
}

input,
select {
  width: 100%;
  height: 46px;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 0 12px;
  background: #fff;
}

textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 10px 12px;
  resize: vertical;
}

.btn {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 14px;
  min-height: 46px;
  padding: 0 14px;
  font-weight: 800;
  cursor: pointer;
}

.btn-primary {
  background: var(--yellow);
  border-color: var(--yellow-dark);
  color: #111827;
}

.btn-light {
  background: #fff;
  border-color: var(--border);
  color: #111827;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
}

.btn-green {
  background: var(--green);
  color: #fff;
  border-color: #15803d;
}

.btn-red {
  background: #fff1f2;
  color: var(--red);
  border-color: #fecdd3;
}

.btn-indigo {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.error {
  color: #b91c1c;
  min-height: 18px;
  margin: 0;
  font-size: 13px;
}

.test-hint {
  font-size: 12px;
  color: #4b5563;
}

.driver-screen {
  min-height: 100vh;
  padding-bottom: 80px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.driver-name {
  font-weight: 800;
  font-size: 18px;
}

.map {
  width: 100%;
  height: 42vh;
  min-height: 280px;
  background: #d1d5db;
}

.sheet {
  margin-top: -16px;
  background: #fff;
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  padding: 14px 12px 24px;
  min-height: 48vh;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.status-text {
  font-size: 28px;
  font-weight: 800;
}

.badge {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge.online {
  background: #dcfce7;
  color: #166534;
}

.badge.busy {
  background: #ffedd5;
  color: #9a3412;
}

.badge.offline {
  background: #e5e7eb;
  color: #374151;
}

.banner {
  margin-top: 10px;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
}

.banner.warning {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
}

.banner.alert {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.actions-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 12px;
}

.offers-head {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
}

.badge-count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--yellow);
}

.offers-list,
.history-list {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.offer-card,
.history-card,
.active-order {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  padding: 12px;
}

.active-order {
  margin-top: 12px;
  border-color: #bfdbfe;
  background: #eff6ff;
}

.offer-title {
  font-weight: 800;
  margin-bottom: 6px;
}

.offer-meta,
.active-meta {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: #374151;
}

.offer-actions,
.active-actions {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.offer-extra-actions {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.offer-timer {
  margin-top: 10px;
  border: 1px solid #fde68a;
  border-radius: 12px;
  background: #fffbeb;
  padding: 8px 10px;
}

.offer-timer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #92400e;
}

.offer-timer-value {
  font-size: 16px;
  font-weight: 800;
  color: #78350f;
}

.offer-timer-bar {
  margin-top: 6px;
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: #fde68a;
  overflow: hidden;
}

.offer-timer-bar-inner {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: #f59e0b;
  transition: width 0.28s linear;
}

.offer-timer.critical {
  border-color: #fca5a5;
  background: #fef2f2;
}

.offer-timer.critical .offer-timer-head,
.offer-timer.critical .offer-timer-value {
  color: #991b1b;
}

.offer-timer.critical .offer-timer-bar {
  background: #fecaca;
}

.offer-timer.critical .offer-timer-bar-inner {
  background: #ef4444;
}

.stage-list {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.stage-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  padding: 8px;
  background: #fff;
  font-size: 13px;
}

.stage-item.done {
  border-color: #86efac;
  background: #f0fdf4;
}

.stage-item.active {
  border-color: #fde68a;
  background: #fffbeb;
}

.income-card {
  margin: 12px;
}

.period-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.period-btn {
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff;
}

.period-btn.active {
  background: #fef3c7;
  border-color: #fde68a;
  font-weight: 700;
}

.income-main {
  margin-top: 12px;
  font-size: 34px;
  font-weight: 900;
}

.income-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mini-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  background: #fff;
}

.mini-card strong {
  font-size: 20px;
}

#historyTab .card,
#profileTab .card,
#supportTab .card {
  margin: 12px;
}

.profile-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed #e5e7eb;
  font-size: 14px;
}

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

.support-form {
  display: grid;
  gap: 10px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: #fff;
}

.nav-btn {
  height: 44px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: #fff;
  color: #6b7280;
  font-size: 12px;
}

.nav-btn.active {
  color: #111827;
  background: #fef9c3;
  border-color: #fde68a;
  font-weight: 700;
}

@media (max-width: 390px) {
  .offer-extra-actions {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 900px) {
  .driver-screen {
    max-width: 500px;
    margin: 0 auto;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    background: var(--bg);
  }
}
