/* AllGood — shared design system. Calm safety theme. Mobile-first. */
:root {
  --green: #16a34a;
  --green-dark: #15803d;
  --green-darker: #166534;
  --green-light: #dcfce7;
  --green-pale: #f0fdf4;
  --amber: #d97706;
  --amber-light: #fef3c7;
  --amber-pale: #fffbeb;
  --red: #dc2626;
  --red-dark: #b91c1c;
  --red-light: #fee2e2;
  --ink: #1c2420;
  --muted: #64748b;
  --line: #e5e7eb;
  --bg: #f8fafc;
  --card: #ffffff;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 4px 12px rgba(16, 24, 40, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green-dark); }
img { max-width: 100%; }

/* ---------- layout ---------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.app-wrap { max-width: 640px; margin: 0 auto; padding: 0 16px 120px; }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: var(--ink); text-decoration: none; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--green); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800;
}
.nav-links { display: flex; gap: 6px; align-items: center; }
.nav-links a { text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; padding: 8px 12px; border-radius: 10px; }
.nav-links a:hover { background: var(--green-pale); color: var(--green-darker); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 14px; cursor: pointer;
  font-family: var(--font); font-weight: 700; font-size: 16px;
  padding: 14px 22px; min-height: 52px; text-decoration: none;
  transition: transform .06s ease, background .15s ease, box-shadow .15s ease;
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: wait; transform: none; }
.btn-primary { background: var(--green); color: #fff; box-shadow: 0 4px 14px rgba(22,163,74,.35); }
.btn-primary:hover { background: var(--green-dark); }
.btn-outline { background: #fff; color: var(--green-darker); border: 2px solid var(--green); }
.btn-outline:hover { background: var(--green-pale); }
.btn-danger { background: var(--red); color: #fff; box-shadow: 0 4px 14px rgba(220,38,38,.35); }
.btn-danger:hover { background: var(--red-dark); }
.btn-ghost { background: transparent; color: var(--muted); min-height: 44px; }
.btn-ghost:hover { background: #f1f5f9; color: var(--ink); }
.btn-sm { min-height: 42px; padding: 8px 16px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }

/* giant check-in button */
.btn-checkin {
  width: 100%; min-height: 132px; border-radius: 22px;
  background: linear-gradient(180deg, var(--green) 0%, var(--green-dark) 100%);
  color: #fff; font-size: 30px; font-weight: 800; letter-spacing: .06em;
  box-shadow: 0 10px 30px rgba(22,163,74,.4);
  border: 0; cursor: pointer; font-family: var(--font);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  transition: transform .06s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn-checkin:active { transform: scale(.98); }
.btn-checkin:disabled { opacity: .6; cursor: wait; transform: none; }
.btn-checkin small { font-size: 13px; font-weight: 600; letter-spacing: .02em; opacity: .85; }

/* panic button */
.btn-panic {
  width: 100%; min-height: 76px; border-radius: 18px;
  background: #fff; color: var(--red); border: 3px solid var(--red);
  font-size: 20px; font-weight: 800; letter-spacing: .08em; cursor: pointer; font-family: var(--font);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  -webkit-tap-highlight-color: transparent;
}
.btn-panic:active { transform: scale(.98); background: var(--red-light); }

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.card h3 { margin: 0 0 6px; font-size: 17px; }
.card p.desc { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.card-green { border-left: 5px solid var(--green); }
.card-amber { border-left: 5px solid var(--amber); background: var(--amber-pale); }
.card-red { border-left: 5px solid var(--red); }

/* ---------- tier badge ---------- */
.tier-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 5px 12px; border-radius: 999px;
}
.tier-free { background: #e2e8f0; color: #475569; }
.tier-paid { background: var(--green-light); color: var(--green-darker); }

/* ---------- countdown ---------- */
.countdown { font-variant-numeric: tabular-nums; font-weight: 800; }
.countdown-big { font-size: 34px; color: var(--green-darker); }
.countdown-warn { color: var(--amber); }
.countdown-danger { color: var(--red); }
.due-line { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ---------- forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 13px; display: block; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], textarea, select {
  width: 100%; font-family: var(--font); font-size: 16px;
  border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px;
  background: #fff; color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-light); }
textarea { min-height: 120px; resize: vertical; }
input[type=range] { width: 100%; accent-color: var(--green); height: 40px; }
.field-error { color: var(--red); font-size: 13px; font-weight: 600; margin-top: 4px; display: none; }
.field.invalid input, .field.invalid textarea { border-color: var(--red); }
.field.invalid .field-error { display: block; }

/* checkbox rows */
.check-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; cursor: pointer; }
.check-row input { width: 20px; height: 20px; accent-color: var(--green); }
.check-row .nm { font-weight: 600; font-size: 15px; }
.check-row .sub { color: var(--muted); font-size: 13px; }

/* duration chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 16px; font-weight: 700; font-size: 14px; cursor: pointer; font-family: var(--font); }
.chip.active { border-color: var(--green); background: var(--green-pale); color: var(--green-darker); }

/* ---------- lists ---------- */
.list-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .body { flex: 1; min-width: 0; }
.list-item .title { font-weight: 700; font-size: 16px; margin: 0 0 2px; word-break: break-word; }
.list-item .meta { color: var(--muted); font-size: 13px; margin: 0; }
.list-item .actions { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn { border: 1px solid var(--line); background: #fff; border-radius: 10px; min-width: 42px; min-height: 42px; font-size: 16px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: #f1f5f9; }
.icon-btn.danger { color: var(--red); }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 8px; }
.empty p { margin: 0 0 14px; }

/* opt-in pill */
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.pill-yes { background: var(--green-light); color: var(--green-darker); }
.pill-no { background: var(--amber-light); color: #92400e; }

/* ---------- tabs ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: flex; padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
}
.tabbar button {
  flex: 1; border: 0; background: none; cursor: pointer; font-family: var(--font);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px; border-radius: 12px; color: var(--muted);
  font-size: 11px; font-weight: 700;
  -webkit-tap-highlight-color: transparent;
}
.tabbar button .ti { font-size: 22px; }
.tabbar button.active { color: var(--green-darker); background: var(--green-pale); }
.tabpane { display: none; }
.tabpane.active { display: block; animation: fadein .18s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* app top bar */
.appbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 0 14px; }
.appbar .hello { font-size: 20px; font-weight: 800; margin: 0; }
.appbar .sub { color: var(--muted); font-size: 13px; margin: 2px 0 0; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 100; display: none; align-items: flex-end; justify-content: center; padding: 0; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: 20px 20px 0 0; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); animation: slideup .2s ease; }
@keyframes slideup { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }
.modal h3 { margin: 0 0 4px; font-size: 19px; }
.modal .mdesc { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }
@media (min-width: 640px) { .modal-backdrop { align-items: center; padding: 20px; } .modal { border-radius: 20px; } }

/* ---------- toast ---------- */
#toasts { position: fixed; bottom: calc(96px + env(safe-area-inset-bottom)); left: 16px; right: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: 560px; margin: 0 auto; }
.toast {
  background: #1e293b; color: #fff; border-radius: 12px; padding: 13px 16px;
  font-size: 14px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.25);
  animation: toastin .22s ease; display: flex; gap: 10px; align-items: flex-start;
}
.toast.success { background: var(--green-darker); }
.toast.error { background: var(--red-dark); }
.toast.warn { background: #92400e; }
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.toast.out { opacity: 0; transform: translateY(8px); transition: all .25s ease; }

/* ---------- landing ---------- */
.hero { text-align: center; padding: 64px 0 48px; }
.hero .kicker { display: inline-block; background: var(--green-light); color: var(--green-darker); font-weight: 800; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; padding: 6px 16px; border-radius: 999px; margin-bottom: 18px; }
.hero h1 { font-size: clamp(34px, 7vw, 56px); line-height: 1.1; margin: 0 0 16px; letter-spacing: -.02em; }
.hero h1 .hl { color: var(--green); }
.hero p.lead { font-size: clamp(17px, 3.5vw, 21px); color: var(--muted); max-width: 640px; margin: 0 auto 28px; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-mock { max-width: 380px; margin: 40px auto 0; }
.section { padding: 56px 0; }
.section.alt { background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section h2 { font-size: clamp(26px, 5vw, 36px); text-align: center; margin: 0 0 10px; letter-spacing: -.01em; }
.section .sub { text-align: center; color: var(--muted); max-width: 620px; margin: 0 auto 36px; font-size: 17px; }
.grid3 { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 760px) { .grid3 { grid-template-columns: repeat(3, 1fr); } }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 760px) { .grid2 { grid-template-columns: repeat(2, 1fr); } }
.step-num { width: 44px; height: 44px; border-radius: 50%; background: var(--green); color: #fff; font-weight: 800; font-size: 20px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.mode-card .tag { display: inline-block; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 4px 12px; border-radius: 999px; margin-bottom: 10px; }
.mode-card .tag.safety { background: var(--green-light); color: var(--green-darker); }
.mode-card .tag.watch { background: #e0e7ff; color: #3730a3; }
.price-card { text-align: center; }
.price-card .pname { font-weight: 800; font-size: 18px; margin-bottom: 4px; }
.price-card .pprice { font-size: 44px; font-weight: 800; margin: 8px 0; }
.price-card .pprice small { font-size: 16px; color: var(--muted); font-weight: 600; }
.price-card ul { list-style: none; padding: 0; margin: 16px 0 22px; text-align: left; }
.price-card ul li { padding: 8px 0 8px 30px; position: relative; font-size: 15px; }
.price-card ul li::before { content: "✓"; position: absolute; left: 6px; color: var(--green); font-weight: 800; }
.price-card.featured { border: 2px solid var(--green); position: relative; }
.price-card .flag { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); background: var(--green); color: #fff; font-size: 12px; font-weight: 800; padding: 4px 14px; border-radius: 999px; letter-spacing: .04em; }
.faq-item { border-bottom: 1px solid var(--line); }
.faq-item button { width: 100%; background: none; border: 0; text-align: left; font-family: var(--font); font-size: 17px; font-weight: 700; padding: 18px 4px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--ink); }
.faq-item .fa { max-height: 0; overflow: hidden; transition: max-height .25s ease; color: var(--muted); font-size: 15px; }
.faq-item.open .fa { max-height: 300px; }
.faq-item .fa p { margin: 0 0 16px; padding: 0 4px; }
.faq-item .chev { transition: transform .2s; color: var(--green); font-weight: 800; }
.faq-item.open .chev { transform: rotate(45deg); }
.footer { background: var(--ink); color: #cbd5e1; padding: 40px 0; margin-top: 0; }
.footer .wrap { display: flex; flex-direction: column; gap: 16px; }
.footer a { color: #e2e8f0; text-decoration: none; font-size: 14px; }
.footer .flogo { display: flex; align-items: center; gap: 10px; font-weight: 800; color: #fff; font-size: 18px; }
.footer small { color: #94a3b8; }

/* auth card */
.auth-card { max-width: 440px; margin: 48px auto; }
.auth-tabs { display: flex; background: #f1f5f9; border-radius: 12px; padding: 4px; margin-bottom: 22px; }
.auth-tabs button { flex: 1; border: 0; background: none; font-family: var(--font); font-weight: 700; font-size: 15px; padding: 10px; border-radius: 9px; cursor: pointer; color: var(--muted); }
.auth-tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* spinner */
.spinner { display: inline-block; width: 18px; height: 18px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* misc */
.mt { margin-top: 16px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; }
.row .grow { flex: 1; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
