:root {
  --bg: #EFEFEA;
  --ink: #1F2421;
  --ink-soft: #5B6560;
  --line: #DADAD2;
  --card: #FFFFFF;
  --accent: #0F6E56;
  --accent-soft: #E1F5EE;
  --amber: #B4740E;
  --amber-soft: #FAEEDA;
  --red: #A32D2D;
  --red-soft: #FCEBEB;
  --blue: #185FA5;
  --blue-soft: #E6F1FB;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--card);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(0,0,0,0.06);
}

.offline-banner {
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
  padding: 7px;
  letter-spacing: .2px;
  display: none;
}
.offline-banner.show { display: block; }

.approver-strip {
  background: var(--accent);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  text-align: center;
  padding: 6px;
  letter-spacing: .3px;
}

.topbar { padding: 14px 18px 12px; border-bottom: 1px solid var(--line); }
.title { font-size: 20px; font-weight: 700; margin: 0; }
.subtitle { font-size: 12.5px; color: var(--ink-soft); margin: 2px 0 0; }

.content { flex: 1; overflow-y: auto; padding: 14px 16px 90px; -webkit-overflow-scrolling: touch; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.card.flat { border: none; }
.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.row.center { align-items: center; }
.job-name { font-size: 14.5px; font-weight: 700; margin: 0 0 3px; }
.job-meta { font-size: 12px; color: var(--ink-soft); margin: 0; }

.badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.badge.wait, .badge.Zaplanowane, .badge.Oczekuje { background: var(--amber-soft); color: var(--amber); }
.badge.progress, .badge.WTrakcie { background: var(--blue-soft); color: var(--blue); }
.badge.done, .badge.Zakonczone, .badge.Zatwierdzone { background: var(--accent-soft); color: var(--accent); }
.badge.rejected, .badge.Odrzucone { background: var(--red-soft); color: var(--red); }

.btn { display: inline-block; border: none; border-radius: 10px; padding: 10px 14px; font-size: 13.5px; font-weight: 700; cursor: pointer; font-family: inherit; }
.btn.primary { background: var(--accent); color: #fff; width: 100%; margin-top: 10px; }
.btn.danger { background: var(--red); color: #fff; width: 100%; margin-top: 10px; }
.btn.ghost { background: #F1F1EC; color: var(--ink); width: 100%; margin-top: 8px; }
.btn.ghost.danger-text { color: var(--red); }
.btn.accept { background: var(--accent); color: #fff; padding: 6px 12px; font-size: 12.5px; }
.btn.reject { background: #fff; color: var(--red); border: 1px solid var(--red-soft); padding: 6px 12px; font-size: 12.5px; }
.btn.small { width: auto; margin-top: 0; padding: 6px 12px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:active:not(:disabled) { transform: scale(0.98); }

.timer { font-size: 42px; font-weight: 700; text-align: center; margin: 14px 0 2px; font-variant-numeric: tabular-nums; }
.timer-label { text-align: center; color: var(--ink-soft); font-size: 13px; margin-bottom: 14px; }

.field-label { font-size: 12px; color: var(--ink-soft); margin: 14px 0 4px; font-weight: 600; }
.select, .input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; background: #fff; font-family: inherit; color: var(--ink); }

.navbar { display: flex; border-top: 1px solid var(--line); background: #fff; position: sticky; bottom: 0; }
.navitem { flex: 1; text-align: center; padding: 10px 0 12px; font-size: 11px; color: var(--ink-soft); cursor: pointer; border: none; background: none; font-family: inherit; }
.navitem.active { color: var(--accent); font-weight: 700; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin: 0 auto 4px; }

.reason { font-size: 12px; color: var(--ink-soft); margin-top: 6px; font-style: italic; }

.login-wrap { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 32px 28px; }
.login-logo { width: 56px; height: 56px; border-radius: 16px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 24px; margin: 0 auto 18px; }
.login-title { text-align: center; font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.login-sub { text-align: center; color: var(--ink-soft); font-size: 13px; margin: 0 0 26px; }
.error-text { color: var(--red); font-size: 12.5px; margin-top: 8px; text-align: center; }
.hint-box { background: var(--accent-soft); border-radius: 12px; padding: 10px 12px; margin-top: 22px; font-size: 12px; color: var(--accent); line-height: 1.5; }

.spinner-wrap { display: flex; justify-content: center; padding: 40px 0; color: var(--ink-soft); font-size: 13px; }

.line-item-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 0; }
.qty-input { width: 74px; padding: 7px 8px; text-align: center; border: 1px solid var(--line); border-radius: 8px; font-size: 13.5px; font-family: inherit; }
.unit-tag { font-size: 12px; color: var(--ink-soft); margin-left: 4px; }
.remove-line { background: none; border: none; color: var(--red); font-size: 18px; cursor: pointer; padding: 0 4px; line-height: 1; }

.scan-photo-btn { border: 2px dashed var(--line); border-radius: 14px; padding: 22px 12px; text-align: center; color: var(--ink-soft); font-size: 13px; cursor: pointer; margin-top: 10px; }
.scan-photo-btn strong { display: block; color: var(--ink); font-size: 14px; margin-bottom: 2px; }
.scan-preview { width: 100%; border-radius: 12px; margin-top: 10px; max-height: 160px; object-fit: cover; }

.queued-tag { font-size: 10.5px; font-weight: 700; color: var(--amber); background: var(--amber-soft); border-radius: 8px; padding: 2px 7px; margin-left: 6px; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tab { flex: 1; text-align: center; padding: 8px 0; border-radius: 10px; background: #F1F1EC; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); cursor: pointer; }
.tab.active { background: var(--accent); color: #fff; }

.link-btn { background: none; border: none; color: var(--accent); font-weight: 700; font-size: 12.5px; cursor: pointer; padding: 4px 0; font-family: inherit; }

a { color: inherit; }

#new-order .field-label { display: block; }
#new-order textarea { resize: vertical; }
.crew-picker { margin: 18px 0 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.crew-picker legend { font-weight: 700; font-size: 14px; padding: 0 5px; }
.crew-option { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px; border-radius: 8px; cursor: pointer; overflow-wrap: anywhere; }
.crew-option:has(input:checked) { background: #e8f4ef; }
.crew-option input { width: 22px; height: 22px; flex-shrink: 0; accent-color: var(--accent); }
.crew-summary { overflow-wrap: anywhere; }
.crew-member { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; font-size: 13px; }
.crew-member button { min-height: 44px; flex-shrink: 0; }
#account-form .field-label { display: block; }
.report-filters .field-label { display: block; }
.report-heading { font-size: 18px; margin: 24px 0 12px; }
.settlement-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.settlement-filters .btn { width: auto; min-height: 44px; margin-top: 0; }
.report-metrics { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; }
.report-metrics strong { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.report-table { overflow-x: auto; margin-top: 12px; }
.report-table table { width: 100%; border-collapse: collapse; font-size: 12px; }
.report-table th, .report-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.job-name { overflow-wrap: anywhere; }
.fuel-form .field-label { display: block; }
.fuel-form { max-width: 640px; }
.fuel-form [hidden] { display: none; }
.fuel-invoice-image { display: block; max-width: 100%; max-height: 700px; object-fit: contain; margin-top: 12px; }
#fuel-history { margin-top: 16px; }
.fleet-deadlines { display: flex; gap: 24px; flex-wrap: wrap; margin: 8px 0 16px; }
.fleet-deadlines > div { flex: 1; min-width: 200px; }
.fleet-deadlines .badge { display: inline-block; margin: 5px 0; white-space: normal; }
.fleet-editor form { max-width: 560px; }
.fleet-editor label { display: block; }
.fleet-editor summary { cursor: pointer; }
