/* ---------- reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  color: #1a1a1a;
  background: #f3f4f6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: env(safe-area-inset-bottom);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

/* ---------- screens ---------- */
.screen {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: #f3f4f6;
}
.content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
}

/* ---------- topbar ---------- */
.topbar {
  background: #1f6feb;
  color: white;
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1, .topbar h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  flex: 1;
}
.topbar-left { flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.driver-name { font-size: 15px; font-weight: 600; opacity: 0.95; }
.date-today { font-size: 13px; opacity: 0.8; }

.icon-btn {
  background: rgba(255,255,255,0.12);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:active { background: rgba(255,255,255,0.25); }
.icon-btn.danger { background: rgba(255,80,80,0.25); }
.back-btn { font-weight: 700; }

/* ---------- sync status dot ---------- */
.sync-status {
  font-size: 22px;
  line-height: 1;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sync-ok { color: #4ade80; }
.sync-pending { color: #facc15; }
.sync-error { color: #f87171; }

/* ---------- day summary ---------- */
.day-summary {
  background: white;
  margin: 16px;
  padding: 18px;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: baseline;
}
.day-summary-label { font-size: 14px; color: #6b7280; grid-column: 1; }
.day-summary-value { font-size: 32px; font-weight: 700; color: #1f6feb; grid-row: 1 / span 2; grid-column: 2; }
.day-summary-count { font-size: 13px; color: #6b7280; grid-column: 1; }

/* ---------- entries list ---------- */
.entries {
  padding: 0 16px 100px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.entry {
  background: white;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
}
.entry.pending { border-left: 4px solid #facc15; padding-left: 10px; }
.entry-row1 {
  display: flex;
  align-items: baseline;
  gap: 10px;
  grid-column: 1 / span 2;
}
.entry-tons { font-size: 22px; font-weight: 700; color: #111827; }
.entry-unit { font-size: 14px; color: #6b7280; }
.entry-truck {
  margin-left: auto;
  font-size: 14px;
  color: #6b7280;
  font-variant-numeric: tabular-nums;
}
.entry-meta {
  font-size: 13px;
  color: #6b7280;
  grid-column: 1 / span 2;
}
.entry-empty {
  text-align: center;
  color: #9ca3af;
  padding: 40px 20px;
  font-size: 15px;
}

/* ---------- forms ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field > span {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
input[type="text"], input[type="url"], input[type="date"], input[type="number"], select {
  width: 100%;
  padding: 14px;
  border: 1.5px solid #d1d5db;
  border-radius: 10px;
  background: white;
  font-size: 17px;
  -webkit-appearance: none;
}
input:focus, select:focus {
  outline: none;
  border-color: #1f6feb;
  box-shadow: 0 0 0 3px rgba(31,111,235,0.15);
}
.row { display: flex; gap: 8px; }
.row > select, .row > input { flex: 1; }
.hint { font-size: 13px; color: #6b7280; margin: 4px 0 0; }
.lead { font-size: 16px; color: #374151; margin: 0; }

/* ---------- segmented control (material) ---------- */
.seg {
  display: flex;
  gap: 8px;
  background: #e5e7eb;
  padding: 4px;
  border-radius: 12px;
}
.seg-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px 10px;
  border-radius: 9px;
  font-size: 15px;
  font-weight: 500;
  color: #374151;
  transition: background 0.15s, color 0.15s;
}
.seg-btn.active {
  background: #1f6feb;
  color: white;
  box-shadow: 0 1px 3px rgba(31,111,235,0.35);
}

/* ---------- buttons ---------- */
.btn-primary {
  background: #1f6feb;
  color: white;
  border: none;
  border-radius: 12px;
  padding: 16px;
  font-size: 17px;
  font-weight: 600;
  width: 100%;
}
.btn-primary:active { background: #1857b8; }
.btn-primary.big { padding: 18px; font-size: 18px; }
.btn-secondary {
  background: white;
  color: #1f6feb;
  border: 1.5px solid #1f6feb;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
}
.btn-secondary:active { background: #e8f0fe; }
.btn-secondary.danger { color: #b91c1c; border-color: #b91c1c; }
.btn-secondary.danger:active { background: #fee2e2; }

/* ---------- FAB ---------- */
.fab-wrap {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, #f3f4f6 70%, rgba(243,244,246,0));
  display: flex;
  justify-content: center;
}
.fab {
  background: #1f6feb;
  color: white;
  border: none;
  border-radius: 999px;
  padding: 18px 32px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 14px rgba(31,111,235,0.45);
  width: 100%;
  max-width: 340px;
}
.fab:active { transform: translateY(1px); }

/* ---------- list in settings ---------- */
.list { list-style: none; padding: 0; margin: 0 0 6px; display: flex; flex-direction: column; gap: 4px; }
.list li {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  background: white;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  font-size: 15px;
}
.list .del-btn {
  margin-left: auto;
  background: transparent;
  border: none;
  color: #9ca3af;
  font-size: 18px;
  padding: 4px 8px;
}
.list .del-btn:active { color: #b91c1c; }

hr { border: none; border-top: 1px solid #e5e7eb; margin: 12px 0; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17,24,39,0.92);
  color: white;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 15px;
  z-index: 100;
  animation: toast-in 0.2s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
