/* Kolorystyka zbliżona do www.framex.pl */
:root {
  --navy: #212e6a;
  --cyan: #2fb5e2;
  --cyan-dark: #1a9bc4;
  --orange: #f7941e;
  --bg: #e8f8ff;
  --card: #ffffff;
  --text: #323439;
  --muted: #666666;
  --ok: #15da52;
  --warn: #f7941e;
  --bad: #cf2e2e;
  --neutral: #7b7b7b;
  --line: #d8d8d8;
  --key-bg: #f1f1f1;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: linear-gradient(180deg, #e8f8ff 0%, #f5f5f5 45%, #f5f5f5 100%);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: var(--safe-bottom);
}

.topbar {
  background: var(--navy);
  color: #fff;
  padding: calc(0.65rem + var(--safe-top)) 1rem 0.7rem;
  text-align: center;
}

.brand {
  font-weight: 800;
  letter-spacing: 0.12em;
  font-size: 0.95rem;
}

.brand span {
  font-weight: 500;
  letter-spacing: 0.04em;
  opacity: 0.85;
  margin-left: 0.35rem;
}

.wrap {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 1rem 1rem 1.75rem;
}

.screen.hidden { display: none !important; }

h1 {
  margin: 0 0 0.25rem;
  font-size: clamp(1.35rem, 5vw, 1.7rem);
  color: var(--navy);
  word-break: break-word;
}

.odometer-title {
  margin: 0.35rem 0 0.35rem;
  font-size: 1.15rem;
  color: var(--navy);
}

.sub, .msg, .odometer-hint {
  color: var(--muted);
}

.msg {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.msg.error { color: var(--bad); font-weight: 600; }
.msg.ok { color: var(--ok); font-weight: 600; }

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 1rem 1rem 1.15rem;
  box-shadow: 0 2px 10px rgba(33, 46, 106, 0.08);
  border-top: 3px solid var(--cyan);
}

.card-head { margin-bottom: 0.45rem; }

.rows {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.rows li {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
}

.rows li.hidden { display: none !important; }

.label {
  color: var(--muted);
  font-size: 0.92rem;
  flex: 1 1 auto;
}

.value {
  font-weight: 600;
  text-align: right;
  max-width: 58%;
  word-break: break-word;
}

.value.ok { color: var(--ok); }
.value.wkrotce { color: var(--warn); }
.value.po_terminie,
.value.brak { color: var(--bad); }
.value.neutral { color: var(--neutral); }
.value.nieaktualny { color: var(--orange); }

.btn-primary,
.btn-back,
.key,
.odo-slot {
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
  touch-action: manipulation;
}

.btn-primary {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 12px;
  min-height: 52px;
  font-size: 1.05rem;
  font-weight: 700;
  background: var(--cyan);
  color: #fff;
  cursor: pointer;
}

.btn-primary:active:not(:disabled) {
  background: var(--cyan-dark);
}

.btn-primary:disabled {
  background: #c5c9d1;
  color: #f8fafc;
  cursor: not-allowed;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  border: 0;
  background: transparent;
  color: var(--navy);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.25rem 0;
  margin: 0 0 0.35rem;
  cursor: pointer;
  min-height: 40px;
}

.odo-card {
  padding-bottom: 1.25rem;
}

.odometer-hint {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
}

.odo-slot {
  display: block;
  width: 100%;
  text-align: left;
  margin: 0 0 0.55rem;
  padding: 0.7rem 0.8rem;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fafafa;
  cursor: pointer;
  color: inherit;
}

.odo-slot.active {
  border-color: var(--cyan);
  background: #e8f8ff;
  box-shadow: 0 0 0 3px rgba(47, 181, 226, 0.2);
}

.odo-slot.match-ok { border-color: var(--ok); }
.odo-slot.match-bad { border-color: var(--bad); }

.odo-slot-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.odo-digits {
  display: block;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: clamp(1.35rem, 6.5vw, 1.75rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--navy);
  min-height: 1.4em;
}

.match-hint {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 1.2em;
}

.match-hint.ok { color: var(--ok); font-weight: 600; }
.match-hint.bad { color: var(--bad); font-weight: 600; }

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
  margin-bottom: 0.85rem;
  user-select: none;
  -webkit-user-select: none;
}

.key {
  border: 0;
  border-radius: 12px;
  background: var(--key-bg);
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 600;
  min-height: 52px;
  cursor: pointer;
}

.key:active { background: #dbe1ea; transform: scale(0.97); }

.key-muted {
  background: #e8ebf0;
  color: #374151;
  font-size: 1.1rem;
}

.btn-save { margin-top: 0.15rem; }

.przebieg-msg {
  margin: 0.65rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  min-height: 1.25em;
  text-align: center;
}

.przebieg-msg.error { color: var(--bad); font-weight: 600; }
.przebieg-msg.ok { color: var(--ok); font-weight: 600; }

@media (max-width: 360px) {
  .wrap { padding: 0.75rem 0.75rem 1.4rem; }
  .key { min-height: 48px; font-size: 1.2rem; }
  .odo-digits { font-size: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  .key:active { transform: none; }
}
