:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --selected: #eef4ff;
  --border: #e4e9f2;
  --primary: #2f6bff;
  --primary-hover: #2457d6;
  --primary-pressed: #1e46b0;
  --primary-soft: #eaf0ff;
  --text: #172033;
  --text-2: #667085;
  --text-3: #98a2b3;
  --success: #16a36a;
  --success-soft: #e8f7f0;
  --warning: #f59e0b;
  --warning-soft: #fff5db;
  --danger: #e5484d;
  --danger-soft: #fdecec;
  --info: #0ea5e9;
  --info-soft: #eaf7fd;
  --purple: #7c5cfc;
  --purple-soft: #f0edff;
  --tap: 48px;
  --radius: 16px;
  --radius-sm: 12px;
  --nav-h: 64px;
  --shadow: 0 8px 24px rgba(23, 32, 51, 0.06);
  --shadow-hero: 0 12px 32px rgba(47, 107, 255, 0.16);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100dvh;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 16px 24px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
}

.screen.has-nav {
  padding-bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom));
}

.screen.is-busy {
  pointer-events: none;
  opacity: 0.72;
}

.login-screen {
  justify-content: center;
  padding-top: calc(24px + env(safe-area-inset-top));
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 28px 20px 24px;
}

.brand {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 750;
  font-size: 22px;
  letter-spacing: -0.03em;
}

h1 {
  margin: 16px 0 4px;
  font-size: 26px;
  font-weight: 720;
  letter-spacing: -0.03em;
}

h2,
h3,
h4 {
  margin: 0;
  font-weight: 680;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 18px;
}

h4 {
  font-size: 16px;
}

.lead {
  margin: 0 0 24px;
  color: var(--text-2);
  font-size: 16px;
}

label {
  display: block;
  margin: 0 0 6px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
  width: 100%;
  min-height: var(--tap);
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--primary-soft);
  border-color: var(--primary);
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: var(--tap);
  padding: 12px 16px;
  border: 0;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  font-weight: 680;
  font-size: 16px;
}

.btn:hover {
  background: var(--primary-hover);
}

.btn:active {
  background: var(--primary-pressed);
}

.btn:disabled {
  opacity: 0.55;
}

.btn.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn.secondary:hover,
.btn.secondary:active {
  background: var(--surface-2);
}

.btn.warn {
  background: var(--warning);
  color: #fff;
}

.btn.danger {
  background: var(--danger);
  color: #fff;
}

.btn.ghost {
  background: transparent;
  color: var(--text-2);
  font-weight: 620;
}

.btn.soft {
  background: var(--primary-soft);
  color: var(--primary);
}

.row {
  display: flex;
  gap: 10px;
}

.row .btn {
  flex: 1;
}

.error {
  min-height: 24px;
  margin: 0 0 12px;
  color: var(--danger);
  font-size: 15px;
}

.banner {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 15px;
}

.banner.warn {
  background: var(--warning-soft);
  color: #8a5a00;
}

.banner.ok {
  background: var(--success-soft);
  color: var(--success);
}

.banner.info {
  background: var(--info-soft);
  color: #0369a1;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.kicker {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.driver-name {
  margin: 4px 0 0;
  font-size: 24px;
  font-weight: 720;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.page-title {
  margin: 0;
  font-size: 26px;
  font-weight: 720;
  letter-spacing: -0.03em;
}

.icon-btn {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.topbar-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.topbar-actions .btn {
  width: auto;
  min-width: 92px;
  padding: 10px 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 0 0 12px;
}

.card.tap {
  cursor: pointer;
}

.card.tap:active {
  background: var(--selected);
}

.hero {
  padding: 20px 18px;
  border-radius: 18px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-live {
  background:
    linear-gradient(180deg, #2f6bff 0%, #2457d6 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-hero);
}

.hero-next {
  background: var(--primary-soft);
  border-color: #d7e3ff;
}

.hero-review {
  background: var(--warning-soft);
  border-color: #f3e2a8;
}

.hero-empty {
  text-align: center;
  padding: 36px 20px;
  background: var(--surface);
}

.hero-kicker {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.86;
}

.hero h2 {
  margin: 0 0 10px;
  font-size: 22px;
}

.hero p {
  margin: 0 0 6px;
  font-size: 15px;
}

.hero .btn {
  margin-top: 14px;
}

.hero-live .btn {
  background: #fff;
  color: var(--primary);
}

.hero-live .btn.secondary {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

.hero-empty .empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--text-3);
  display: grid;
  place-items: center;
}

.meta {
  color: var(--text-2);
  margin: 4px 0;
  font-size: 14px;
}

.meta strong {
  color: var(--text);
  font-weight: 650;
}

.list-reset {
  list-style: none;
  margin: 0;
  padding: 0;
}

.trip {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.trip:first-child {
  border-top: 0;
  padding-top: 0;
}

.trip h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 15px;
}

.check .mark {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.check .mark.ok {
  background: var(--success-soft);
  color: var(--success);
}

.check .mark.warn {
  background: var(--warning-soft);
  color: #b45309;
}

.check svg {
  width: 14px;
  height: 14px;
}

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 4px 6px calc(6px + env(safe-area-inset-bottom));
  z-index: 30;
}

.nav button {
  min-height: 52px;
  border: 0;
  background: transparent;
  color: #64748b;
  font-weight: 650;
  font-size: 11px;
  padding: 4px 2px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 12px;
}

.nav button svg {
  width: 22px;
  height: 22px;
}

.nav button.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.update-banner {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--primary-soft);
  color: var(--text);
  font-size: 14px;
}

.update-banner button {
  min-height: 44px;
  padding: 8px 14px;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

.hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.empty {
  padding: 28px 8px;
  text-align: center;
  color: var(--text-2);
  font-size: 16px;
}

.history-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.muted {
  color: var(--text-2);
}

.hidden {
  display: none;
}

.strong {
  font-weight: 680;
}

.fuel-item {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.fuel-item:first-of-type {
  border-top: 0;
}

.confirm {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 16px;
}

.chips {
  display: flex;
  gap: 8px;
  margin: 0 0 16px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  min-height: 44px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 0 14px;
  font-weight: 650;
  font-size: 14px;
  color: var(--text-2);
  white-space: nowrap;
}

.chip.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: #d7e3ff;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 16px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 10px;
  text-align: center;
}

.kpi-card .kpi-value {
  margin: 0;
  font-size: 26px;
  font-weight: 740;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.1;
}

.kpi-card .kpi-label {
  margin: 6px 0 0;
  color: var(--text-2);
  font-size: 13px;
}

.pay-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 16px;
}

.pay-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 10px;
}

.pay-card .kpi-value {
  margin: 0;
  font-size: 18px;
  font-weight: 740;
  letter-spacing: -0.03em;
}

.pay-card .kpi-label {
  margin: 0 0 6px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 650;
}

.pay-card.is-rest .kpi-value {
  color: var(--primary);
}

.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 16px;
}

.month-nav h1 {
  margin: 0;
  font-size: 18px;
  text-align: center;
  flex: 1;
}

.day-card {
  padding: 14px 14px 14px 16px;
  position: relative;
}

.day-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 4px;
  border-radius: 4px;
  background: var(--border);
}

.day-worked::before {
  background: var(--success);
}

.day-current::before,
.day-upcoming::before {
  background: var(--primary);
}

.day-off::before {
  background: #cbd5e1;
}

.day-cancelled::before,
.day-expired::before {
  background: var(--danger);
}

.day-review::before {
  background: var(--warning);
}

.day-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.day-date {
  font-size: 17px;
  font-weight: 700;
}

.day-week {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  text-transform: capitalize;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text-2);
}

.pill.ok {
  background: var(--success-soft);
  color: var(--success);
}

.pill.info,
.pill.current,
.pill.upcoming {
  background: var(--primary-soft);
  color: var(--primary);
}

.pill.warn,
.pill.review {
  background: var(--warning-soft);
  color: #b45309;
}

.pill.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 8px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 10px;
  position: relative;
  padding: 6px 0 6px 2px;
}

.timeline-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 18px;
  bottom: -6px;
  width: 2px;
  background: var(--border);
}

.timeline-dot {
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.timeline-item.is-work .timeline-dot {
  background: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-soft);
}

.seg-title {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

.seg-kind {
  margin: 2px 0 0;
  font-size: 12px;
  font-weight: 650;
  color: var(--text-2);
}

.timeline-item.is-work .seg-kind {
  color: var(--purple);
}

.more {
  margin: 0 0 12px;
}

.more-toggle {
  width: 100%;
  min-height: 48px;
  border: 1px dashed var(--border);
  background: var(--surface-2);
  border-radius: 14px;
  color: var(--text);
  font-weight: 680;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.more-body {
  margin-top: 10px;
}

.doc-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  margin: 10px 0 0;
}

.doc-card h4 {
  margin: 0 0 4px;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 16px;
}

.quick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 0;
}

.quick-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font-weight: 650;
  text-align: left;
  width: 100%;
}

.quick-item svg {
  width: 20px;
  height: 20px;
  color: var(--primary);
}

.snackbar {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom));
  z-index: 40;
  max-width: 528px;
  margin: 0 auto;
  padding: 12px 16px;
  border-radius: 14px;
  background: #172033;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 10px 28px rgba(23, 32, 51, 0.22);
}

.snackbar.ok {
  background: #0f766e;
}

.snackbar.error {
  background: var(--danger);
}

.snackbar.warn {
  background: #b45309;
}

.screen:not(.has-nav) ~ .snackbar,
body:has(.login-screen) .snackbar {
  bottom: calc(16px + env(safe-area-inset-bottom));
}

.section-label {
  margin: 8px 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-off {
  display: inline-flex;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.04em;
}

.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #8ce7b5;
  margin-right: 6px;
  box-shadow: 0 0 0 4px rgba(140, 231, 181, 0.25);
}

.status-label {
  font-weight: 650;
}

.status-worked {
  color: var(--success);
}

.status-current,
.status-upcoming {
  color: var(--primary);
}

.status-off {
  color: var(--text-2);
}

.status-cancelled,
.status-expired {
  color: var(--danger);
}

.status-review {
  color: #b45309;
}

.ptr-hint {
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  min-height: 0;
}

@media (orientation: landscape) and (max-height: 500px) {
  .screen {
    padding-top: 12px;
  }

  h1,
  .page-title,
  .driver-name {
    font-size: 20px;
  }
}
