/* ============================================================
   Coleta — Design System "Campo & Leite"
   App de coleta de leite · iOS + Android · público não-técnico
   Verde-pasto + branco-leite · Bricolage Grotesque + Inter
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,500;12..96,600;12..96,700;12..96,800&family=Inter:wght@400;450;500;600;700&display=swap');

:root {
  /* — Neutros (70–90% dos pixels) — */
  --bg:        oklch(97.5% 0.009 110);   /* branco-leite quente */
  --surface:   oklch(100% 0 0);          /* card branco */
  --surface-2: oklch(98% 0.01 120);      /* card afundado */
  --fg:        oklch(23% 0.018 155);     /* tinta quase-preta, leve verde */
  --muted:     oklch(52% 0.018 152);     /* texto secundário */
  --faint:     oklch(66% 0.015 150);     /* legendas */
  --border:    oklch(91% 0.012 135);     /* hairline */
  --border-2:  oklch(87% 0.015 135);

  /* — Marca / ação (1 acento, no máx. 2 usos por tela) — */
  --brand:        oklch(48% 0.108 158);  /* verde-pasto profundo */
  --brand-press:  oklch(42% 0.10 158);
  --brand-bright: oklch(62% 0.15 150);   /* verde vivo p/ realces */
  --brand-wash:   oklch(95% 0.03 150);   /* fundo suave de seleção */
  --brand-ink:    oklch(34% 0.09 158);   /* texto sobre wash */

  /* — Dourado-leite: 1 momento quente por tela, só no "total coletado" — */
  --milk:      oklch(82% 0.115 85);
  --milk-deep: oklch(58% 0.10 80);

  /* — Status — */
  --ok:      oklch(58% 0.13 150);
  --ok-wash: oklch(95% 0.04 150);
  --warn:    oklch(70% 0.155 70);
  --warn-wash: oklch(95% 0.05 80);
  --danger:  oklch(57% 0.19 25);
  --danger-wash: oklch(95% 0.04 25);

  /* — Tipografia — */
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

  /* — Forma — */
  --r-sm: 12px;
  --r:    18px;
  --r-lg: 26px;
  --r-pill: 999px;

  --shadow-1: 0 1px 2px oklch(30% 0.03 150 / 0.05), 0 2px 8px oklch(30% 0.03 150 / 0.05);
  --shadow-2: 0 4px 14px oklch(30% 0.04 150 / 0.08), 0 1px 3px oklch(30% 0.04 150 / 0.06);
  --shadow-up: 0 -6px 22px oklch(30% 0.04 150 / 0.07);

  --tap: 56px;            /* alvo de toque mínimo (público não-técnico) */
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  width: 390px;
  margin: 0 auto;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 844px;
  position: relative;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}

img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }
input, select { font-family: inherit; font-size: 16px; }
::selection { background: var(--brand-wash); }

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ============================================================
   Status bar (iOS) — desenhada, não placeholder
   ============================================================ */
.statusbar {
  height: 54px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 26px 8px;
  font-family: var(--body);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.01em;
  color: var(--fg);
  position: relative;
  z-index: 5;
  flex: 0 0 auto;
}
.statusbar.on-brand { color: #fff; }
.statusbar .sb-time { font-variant-numeric: tabular-nums; }
.statusbar .sb-icons { display: flex; align-items: center; gap: 7px; }
.statusbar svg { display: block; }

/* Android variant */
.statusbar.android { padding: 0 18px 6px; height: 44px; font-size: 14px; align-items: center; }

/* ============================================================
   App bar (cabeçalho da tela)
   ============================================================ */
.appbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 20px 14px;
  flex: 0 0 auto;
}
.appbar .ab-back {
  width: 44px; height: 44px; margin-left: -10px;
  display: grid; place-items: center;
  border-radius: var(--r-pill);
  color: var(--fg);
}
.appbar .ab-back:active { background: var(--surface-2); }
.appbar .ab-titles { flex: 1; min-width: 0; }
.appbar .ab-kicker {
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--brand); margin-bottom: 2px;
}
.appbar h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 26px;
  line-height: 1.08;
  letter-spacing: -0.02em;
}
.appbar .ab-action {
  position: relative;
  width: 44px; height: 44px; border-radius: var(--r-pill);
  display: grid; place-items: center; color: var(--fg);
  background: var(--surface); box-shadow: var(--shadow-1);
}

/* ============================================================
   Layout shells
   ============================================================ */
.screen {
  display: flex;
  flex-direction: column;
  min-height: 844px;
}
.screen.has-tabs .body { padding-bottom: 108px; }
.body {
  flex: 1 1 auto;
  padding: 4px 20px 28px;
  overflow-y: auto;
}
.body.flush { padding-left: 0; padding-right: 0; }

.section-label {
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--faint);
  margin: 22px 4px 12px;
}
.section-label:first-child { margin-top: 6px; }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px;
  box-shadow: var(--shadow-1);
}
.card + .card { margin-top: 12px; }

/* ============================================================
   Botões — grandes e óbvios
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--tap);
  padding: 0 24px;
  border-radius: var(--r-pill);
  font-weight: 600; font-size: 17px; letter-spacing: 0.005em;
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
}
.btn:active { transform: translateY(2px); }
.btn-block { display: flex; width: 100%; }
.btn-primary {
  background: var(--brand); color: #fff;
  box-shadow: 0 6px 16px oklch(48% 0.108 158 / 0.32);
}
.btn-primary:active { background: var(--brand-press); }
.btn-secondary { background: var(--surface); color: var(--fg); border: 1.5px solid var(--border-2); box-shadow: var(--shadow-1); }
.btn-ghost { color: var(--brand); font-weight: 600; }
.btn-lg { min-height: 64px; font-size: 18px; }
.btn svg { flex: 0 0 auto; }

/* ============================================================
   Tab bar (navegação principal) — texto + ícone p/ não-técnicos
   ============================================================ */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex;
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  background: oklch(100% 0 0 / 0.86);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
  z-index: 20;
}
.tabbar .tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 4px; color: var(--faint); border-radius: 14px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.01em;
}
.tabbar .tab svg { width: 25px; height: 25px; stroke-width: 1.9; }
.tabbar .tab.active { color: var(--brand); }
.tabbar .tab.active svg { stroke-width: 2.3; }

/* home indicator */
.home-indicator {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  width: 134px; height: 5px; border-radius: 3px; background: var(--fg); opacity: .9;
  z-index: 30; pointer-events: none;
}

/* ============================================================
   Chips / pills de status
   ============================================================ */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 12px; border-radius: var(--r-pill);
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.01em;
  background: var(--surface-2); color: var(--muted);
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.ok      { background: var(--ok-wash);     color: oklch(42% 0.12 150); }
.chip.warn    { background: var(--warn-wash);   color: oklch(48% 0.13 60); }
.chip.danger  { background: var(--danger-wash); color: oklch(48% 0.17 25); }
.chip.brand   { background: var(--brand-wash);  color: var(--brand-ink); }
.chip.milk    { background: oklch(94% 0.07 88); color: var(--milk-deep); }

/* ============================================================
   List rows (paradas, produtores, histórico)
   ============================================================ */
.row {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 18px;
  box-shadow: var(--shadow-1);
  min-height: 80px;
}
.row + .row { margin-top: 12px; }
.row:active { background: var(--surface-2); }
.row .r-lead {
  width: 46px; height: 46px; flex: 0 0 auto; border-radius: 14px;
  display: grid; place-items: center; background: var(--brand-wash); color: var(--brand);
  font-family: var(--display); font-weight: 700; font-size: 18px;
}
.row .r-main { flex: 1; min-width: 0; }
.row .r-title { display: block; font-weight: 600; font-size: 16px; line-height: 1.3; letter-spacing: -0.01em; text-wrap: pretty; }
.row .r-sub { display: block; font-size: 13.5px; line-height: 1.4; color: var(--muted); margin-top: 5px; text-wrap: pretty; }
.row .r-trail { text-align: right; flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; white-space: nowrap; padding-left: 8px; }
.row.done .r-lead { background: var(--ok-wash); color: oklch(45% 0.12 150); }
.row.pending .r-lead { background: var(--warn-wash); color: oklch(50% 0.13 60); }

.r-amount { font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: -0.02em; }
.r-amount small { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0; }

/* ============================================================
   Progress
   ============================================================ */
.progress { height: 10px; border-radius: var(--r-pill); background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), var(--brand-bright)); }

/* ============================================================
   Utilidades
   ============================================================ */
.stack > * + * { margin-top: 12px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.center { text-align: center; }
.flex { display: flex; }
.between { display: flex; align-items: center; justify-content: space-between; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; }
.mt4{margin-top:4px}.mt8{margin-top:8px}.mt12{margin-top:12px}.mt16{margin-top:16px}.mt20{margin-top:20px}.mt24{margin-top:24px}
.display { font-family: var(--display); letter-spacing: -0.02em; }
.lead { font-size: 16px; color: var(--muted); line-height: 1.55; }

/* Android: esconde o indicador de home do iOS (usa barra de navegação nativa) */
.plat-android .home-indicator { display: none; }
.plat-android .tabbar { padding-bottom: 12px; }

/* ============================================================
   Bottom sheet — confirmações (concluir parada / finalizar rota)
   ============================================================ */
.bsheet-scrim {
  position: absolute; inset: 0; z-index: 80;
  background: oklch(22% 0.03 160 / 0.45);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.bsheet-scrim.open { opacity: 1; pointer-events: auto; }
.bsheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 81;
  background: var(--surface); border-radius: 28px 28px 0 0;
  padding: 12px 22px calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -14px 44px oklch(20% 0.05 160 / 0.28);
  transform: translateY(101%); transition: transform .34s cubic-bezier(.2,.9,.3,1);
  max-height: 88%; overflow-y: auto;
}
.bsheet.open { transform: none; }
.bsheet .grab { width: 42px; height: 5px; border-radius: 3px; background: var(--border-2); margin: 2px auto 18px; }
.bsheet .bs-ic { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 14px; }
.bsheet h3 { font-family: var(--display); font-weight: 700; font-size: 23px; line-height: 1.14; letter-spacing: -0.02em; }
.bsheet .bs-lead { font-size: 14.5px; color: var(--muted); margin-top: 9px; line-height: 1.5; }
.bsheet .bs-list { margin: 18px 0 16px; display: flex; flex-direction: column; gap: 8px; }
.bsheet .bs-item { display: flex; align-items: center; gap: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; }
.bsheet .bs-item .bi-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: 0 0 auto; background: var(--brand-wash); color: var(--brand); font-family: var(--display); font-weight: 700; font-size: 15px; }
.bsheet .bs-item .bi-m { flex: 1; min-width: 0; }
.bsheet .bs-item .bi-t { display: block; font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.bsheet .bs-item .bi-s { display: block; font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.bsheet .bs-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.bsheet .bs-hint { font-size: 12.5px; color: var(--faint); text-align: center; margin: 10px 6px 2px; line-height: 1.45; }

/* toast */
.toast {
  position: absolute; left: 50%; bottom: 30px; transform: translate(-50%, 24px);
  background: var(--fg); color: var(--bg); font-size: 14px; font-weight: 500;
  padding: 13px 20px; border-radius: var(--r-pill); box-shadow: var(--shadow-2);
  z-index: 90; opacity: 0; pointer-events: none; transition: .3s ease;
  max-width: 86%; text-align: center; line-height: 1.35;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* safe-area top padding helper for non-frame standalone view handled by statusbar */
