:root {
  --green: #0f6e62;
  --green-dark: #0f3a36;
  --green-soft: #e3f3ee;
  --amber: #e8a33d;
  --amber-soft: #fdf2dd;
  --red: #c2452f;
  --red-soft: #fdeae6;
  --ink: #1d2b2f;
  --muted: #6b7a7d;
  --line: #e3e7e6;
  --bg: #f4f6f5;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--ink); }
body {
  font-family: Inter, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.45;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
.hidden { display: none !important; }

.top {
  background: var(--green-dark); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 18px 12px;
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.mk {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, #3fbfa5, var(--green));
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}
.link { background: none; border: 0; color: #cfe3df; font: inherit; font-size: 14px; cursor: pointer; }

main { max-width: 520px; margin: 0 auto; padding: 18px 16px 40px; }
.view { display: flex; flex-direction: column; gap: 14px; }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; display: flex; flex-direction: column; gap: 10px;
}
.card.center { align-items: center; text-align: center; padding: 32px 22px; margin-top: 8vh; }
.center-text { text-align: center; }
h1 { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; }
.hello h1 { font-size: 24px; }
.label { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.big { font-size: 19px; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.error { color: var(--red); font-size: 14px; }
.code { font-family: ui-monospace, Menlo, monospace; background: var(--bg); padding: 6px 12px; border-radius: 8px; font-size: 18px; letter-spacing: .1em; }
.consent { background: var(--bg); border-radius: 10px; padding: 14px; font-size: 14px; }

.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.pill { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 20px; background: #eef1f0; color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--green-soft); color: #16744f; }
.pill.late { background: var(--amber-soft); color: #94600f; }
.pill.done { background: #e6eefb; color: #2f5fb8; }

.btn {
  font: inherit; font-weight: 600; font-size: 15px;
  border: 1px solid #d5dbda; background: #fff; color: var(--ink);
  border-radius: 10px; padding: 12px 16px; cursor: pointer;
}
.btn.block { width: 100%; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { background: #fff; border-color: var(--red); color: var(--red); }
.btn:disabled { opacity: .55; cursor: wait; }
.big-btn { padding: 16px; font-size: 17px; margin-top: 4px; }

select, input[type=text] {
  font: inherit; width: 100%; padding: 11px 12px; border: 1px solid #d5dbda;
  border-radius: 10px; background: #fff; margin-bottom: 6px;
}

.history { list-style: none; display: flex; flex-direction: column; }
.history li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid #eef1f0; font-size: 14px; }
.history li:last-child { border-bottom: 0; }

.spinner { width: 28px; height: 28px; border: 3px solid var(--green-soft); border-top-color: var(--green); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px;
  font-size: 14px; max-width: 90vw; box-shadow: 0 6px 20px rgba(0,0,0,.18); z-index: 20;
}
.toast.err { background: var(--red); }
