/* HatchDay — bright farm-fresh theme. Always light, even in OS dark mode. */
:root {
  color-scheme: light;
  --cream: #FFF9EC;
  --cream-dark: #F5EAD0;
  --leaf: #7CB342;
  --leaf-dark: #5A8F2A;
  --leaf-pale: #E8F3D8;
  --sky: #4FA8DE;
  --sky-pale: #DFF1FB;
  --gold: #FFC93B;
  --gold-dark: #E0A800;
  --ink: #3A2E24;
  --ink-soft: #7A6A58;
  --card: #FFFFFF;
  --danger: #E05A4F;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(120,70,30,0.10);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--cream);
  color: var(--ink);
  color-scheme: light;
  padding-bottom: 76px;
}

/* Header */
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: linear-gradient(135deg, var(--leaf) 0%, #93C95E 100%);
  color: #fff;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { margin: 0; font-size: 1.5rem; letter-spacing: 0.5px; }
.tagline { margin: 0; font-size: 0.75rem; opacity: 0.92; }
.brand-chick { filter: drop-shadow(0 2px 2px rgba(0,0,0,0.15)); }
.brand-chick img { display: block; border-radius: 11px; }
.boot-logo img { border-radius: 20px; box-shadow: 0 4px 18px rgba(46,125,50,.35); }
.lp-brand { display: inline-flex; align-items: center; gap: 9px; }
.lp-brand img { border-radius: 8px; display: block; }

.pro-badge {
  background: var(--gold); color: var(--ink);
  font-weight: 800; font-size: 0.75rem; letter-spacing: 1px;
  padding: 5px 12px; border-radius: 999px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* Screens */
#app { max-width: 720px; margin: 0 auto; padding: 12px 14px 24px; }
.screen { display: none; }
.screen.active { display: block; }
h2 { font-size: 1.25rem; margin: 14px 4px 10px; color: var(--leaf-dark); }

/* Cards */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px;
  border: 1px solid #F0E6CC;
}

/* Buttons */
.btn {
  display: inline-block; border: none; border-radius: 999px;
  padding: 12px 22px; font-size: 1rem; font-weight: 700;
  cursor: pointer; text-align: center; text-decoration: none;
  transition: transform 0.05s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--leaf); color: #fff; }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-sky { background: var(--sky); color: #fff; }
.btn-outline { background: #fff; color: var(--leaf-dark); border: 2px solid var(--leaf); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-block { display: block; width: 100%; margin-top: 10px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Bottom nav */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: #fff;
  border-top: 1px solid #EADFC2;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 12px rgba(90,70,30,0.08);
}
.nav-btn {
  flex: 1; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 0.7rem; color: var(--ink-soft); padding: 4px;
  border-radius: 12px;
}
.nav-btn.active { color: var(--leaf-dark); font-weight: 700; background: var(--leaf-pale); }
.nav-ico { font-size: 1.4rem; }
.nav-cta .nav-ico {
  background: var(--gold); border-radius: 50%;
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  margin-top: -18px; box-shadow: 0 2px 8px rgba(224,168,0,0.5); font-size: 1.5rem;
}

/* Batch cards */
.batch-card { cursor: pointer; }
.batch-card .row-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.batch-name { font-weight: 800; font-size: 1.05rem; }
.batch-species { color: var(--ink-soft); font-size: 0.85rem; }
.progress-track { background: var(--cream-dark); border-radius: 999px; height: 12px; margin: 10px 0 6px; overflow: hidden; }
.progress-fill { background: linear-gradient(90deg, var(--leaf), var(--gold)); height: 100%; border-radius: 999px; transition: width 0.3s; }
.batch-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.85rem; color: var(--ink-soft); }
.badge {
  display: inline-block; font-size: 0.72rem; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.badge-hatch { background: var(--gold); color: var(--ink); }
.badge-lock { background: var(--sky-pale); color: #1E6FA0; }
.badge-turn { background: var(--leaf-pale); color: var(--leaf-dark); }

/* Reminders */
.reminders-card { border-left: 6px solid var(--gold); }
.reminders-card h3 { margin: 0 0 8px; font-size: 1rem; color: var(--gold-dark); }
.reminder-item { padding: 8px 0; border-top: 1px dashed #EADFC2; font-size: 0.9rem; }
.reminder-item:first-of-type { border-top: none; }
.reminder-note { font-size: 0.75rem; color: var(--ink-soft); margin-top: 8px; }

/* Wizard */
.wizard-steps { display: flex; gap: 6px; margin-bottom: 12px; }
.wstep {
  flex: 1; text-align: center; font-size: 0.8rem; font-weight: 700;
  padding: 8px 4px; border-radius: 10px; background: var(--cream-dark); color: var(--ink-soft);
}
.wstep.active { background: var(--leaf); color: #fff; }

.species-group { margin-bottom: 6px; }
.species-group > h3 {
  margin: 12px 4px 6px; font-size: 0.85rem; text-transform: uppercase;
  letter-spacing: 1px; color: var(--leaf-dark);
}
.species-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: #fff; border: 2px solid #EFE3C4; border-radius: 12px;
  padding: 10px 12px; margin-bottom: 6px; cursor: pointer;
  font-size: 1rem; text-align: left; color: var(--ink);
  white-space: nowrap; overflow: hidden;
}
.species-row .sp-ico { font-size: 1.4rem; flex: 0 0 auto; }
.species-row .sp-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.species-row .sp-days { flex: 0 0 auto; font-size: 0.8rem; color: var(--ink-soft); background: var(--cream-dark); padding: 3px 9px; border-radius: 999px; }
.species-row.selected { border-color: var(--leaf); background: var(--leaf-pale); }

/* Forms */
.field { margin-bottom: 12px; }
.field label { display: block; font-weight: 700; font-size: 0.9rem; margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px; font-size: 1rem;
  border: 2px solid #E7D9B8; border-radius: 12px; background: #fff; color: var(--ink);
  font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--leaf); }
.field .hint { font-size: 0.78rem; color: var(--ink-soft); margin-top: 4px; }
/* Universal account popup: underline tabs + password peek */
.acct-tabs { display: flex; border-bottom: 2px solid #E7D9B8; margin: 2px 0 14px; }
.acct-tab { flex: 1; background: none; border: none; border-bottom: 3px solid transparent; margin-bottom: -2px; padding: 10px 4px; font-family: inherit; font-size: 1rem; font-weight: 700; color: #8a7a5f; cursor: pointer; }
.acct-tab.active { color: var(--leaf-dark); border-bottom-color: var(--leaf-dark); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }
.pw-eye { position: absolute; right: 6px; bottom: 5px; background: none; border: none; font-size: 1.25rem; line-height: 1; padding: 7px 9px; cursor: pointer; }
.checkline { display: flex; align-items: flex-start; gap: 10px; font-size: 0.92rem; }
.checkline input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--leaf); flex: 0 0 auto; }

/* Task list */
.task {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 4px; border-bottom: 1px dashed #EADFC2; font-size: 0.95rem;
}
.task:last-child { border-bottom: none; }
.task input[type="checkbox"] { width: 24px; height: 24px; accent-color: var(--leaf); flex: 0 0 auto; cursor: pointer; }
.task.done .task-label { text-decoration: line-through; color: var(--ink-soft); }
.task .task-ico { font-size: 1.3rem; flex: 0 0 auto; }

/* Log rows */
.log-row { display: flex; justify-content: space-between; padding: 8px 2px; border-bottom: 1px dashed #EADFC2; font-size: 0.9rem; }
.log-row:last-child { border-bottom: none; }
.inline-form { display: flex; gap: 8px; margin-bottom: 8px; }
.inline-form input { flex: 1; padding: 10px; border: 2px solid #E7D9B8; border-radius: 12px; font-size: 1rem; min-width: 0; }
.inline-form .btn { padding: 10px 16px; white-space: nowrap; }

/* Photos */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; cursor: pointer; border: 2px solid #EFE3C4; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat-box { background: #fff; border-radius: var(--radius); padding: 12px 6px; text-align: center; box-shadow: var(--shadow); border: 1px solid #F0E6CC; }
.stat-box .num { font-size: 1.5rem; font-weight: 800; color: var(--leaf-dark); }
.stat-box .lbl { font-size: 0.72rem; color: var(--ink-soft); margin-top: 2px; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.data th, table.data td { padding: 8px 6px; text-align: left; border-bottom: 1px solid #F0E6CC; }
table.data th { color: var(--leaf-dark); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 400; background: rgba(58, 50, 38, 0.5);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  position: relative;
  background: var(--cream); border-radius: 20px 20px 0 0;
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
}
.modal h3 { margin-top: 0; color: var(--leaf-dark); }
.plan-card { border: 2px solid var(--gold); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; background: #fff; }
.plan-card .price { font-size: 1.4rem; font-weight: 800; }
.demo-note { font-size: 0.78rem; color: var(--ink-soft); background: #FFF3D6; border: 1px dashed var(--gold-dark); border-radius: 10px; padding: 8px 10px; margin: 10px 0; }

/* Toast */
#toast-root { position: fixed; bottom: 90px; left: 0; right: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 0.9rem; box-shadow: var(--shadow); animation: toast-in 0.2s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }

/* Update-available toast (needs pointer events for its buttons) */
.toast.toast-update { pointer-events: auto; display: flex; align-items: center; gap: 12px; }
.toast-btn {
  background: var(--leaf); border: none; border-radius: 999px;
  padding: 8px 18px; font-weight: 800; font-size: 0.9rem; color: #fff;
  cursor: pointer; min-height: 40px;
}
.toast-btn.toast-dismiss { background: transparent; color: #fff; padding: 8px 10px; font-weight: 400; opacity: 0.7; }

.empty { text-align: center; padding: 30px 10px; color: var(--ink-soft); }
.hidden { display: none !important; }
.small { font-size: 0.8rem; color: var(--ink-soft); }
.muted { color: var(--ink-soft); }
.divider { border: none; border-top: 1px solid #EADFC2; margin: 14px 0; }
canvas.chart { width: 100%; height: 220px; background: #fff; border-radius: 12px; border: 1px solid #EFE3C4; }

@media (min-width: 600px) {
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 20px; }
  .photo-grid { grid-template-columns: repeat(4, 1fr); }
}

.form-error { color: #b3261e; font-size: 0.88rem; margin: 8px 0; font-weight: 600; }
.btn-ghost { background: none; border: none; color: #4a7c3a; font-weight: 700; padding: 10px; font-size: 0.92rem; cursor: pointer; width: 100%; }

/* ---- server-backed boot / trial / login wall ---- */
#boot-loading { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; background: var(--cream); }
.boot-card { text-align: center; padding: 24px; max-width: 340px; }
.boot-emoji { font-size: 52px; }
.boot-card p { margin: 8px 0; }
#login-wall { position: fixed; inset: 0; z-index: 250; display: none; align-items: center; justify-content: center; background: var(--cream); padding: 20px; }
#login-wall.visible { display: flex; }
.login-wall-card { max-width: 380px; width: 100%; text-align: center; background: #fff; border-radius: var(--radius); padding: 28px 22px; box-shadow: var(--shadow); }
.login-wall-emoji { font-size: 54px; margin-bottom: 8px; }
.login-wall-card .btn { margin-top: 10px; }
.trial-banner { background: #FFF3D6; border: 1px solid #E3C36B; border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sync-error { background: #FDE8E8; color: #8f2b2b; text-align: center; font-size: 13px; padding: 8px 12px; }

/* ---------- Demo banner ---------- */
#demo-banner { position: sticky; top: 0; z-index: 300; background: #3A2E24; color: #FFF9EC; padding: 8px 12px; font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#demo-banner .btn { margin: 0; }

/* ---------- Landing page (logged-out visitors) ---------- */
#login-wall.landing.visible { display: block; overflow-y: auto; padding: 0; }
.lp { background: #FFF9EC; color: #3A2E24; min-height: 100%; font-size: 16px; line-height: 1.55; }
.lp-wrap { max-width: 960px; margin: 0 auto; padding: 0 20px; }
.lp-nav { position: sticky; top: 0; z-index: 50; background: linear-gradient(135deg, var(--leaf) 0%, #93C95E 100%); color: #fff; box-shadow: var(--shadow); }
.lp-nav-inner { display: flex; align-items: center; justify-content: space-between; padding-top: 10px; padding-bottom: 10px; }
.lp-brand { font-weight: 800; font-size: 1.25rem; color: #fff; }
.lp-brand-text { display: inline-flex; flex-direction: column; line-height: 1.25; }
.lp-brand .tagline { margin: 0; font-size: 0.75rem; opacity: 0.92; font-weight: 400; }
.lp-nav .btn-ghost { color: var(--leaf-dark); background: #fff; border: 2px solid #fff; border-radius: 999px; padding: 8px 20px; width: auto; font-weight: 800; }
.lp-nav .btn-ghost:hover { background: rgba(255,255,255,.85); }
.lp-nav-cta { display: none; }
.lp-nav.past-hero .lp-nav-cta { display: inline-block; }
.lp-nav-links { display: flex; gap: 8px; align-items: center; }
.lp-nav-links .btn { margin: 0; }
.lp-hero { text-align: center; padding: 64px 0 48px; background: linear-gradient(180deg, #FFF3D6 0%, #FFF9EC 100%); }
.lp-eyebrow { font-size: .8rem; font-weight: 800; letter-spacing: .12em; color: #2E7D32; margin-bottom: 12px; }
.lp-hero h1 { font-size: 2.6rem; line-height: 1.15; margin: 0 0 16px; }
.lp-sub { font-size: 1.1rem; color: #7A6A58; max-width: 640px; margin: 0 auto 24px; }
.lp-ctas { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.lp-fine { font-size: .85rem; color: #7A6A58; text-align: center; }
.lp section { padding: 40px 0; }
.lp h2 { text-align: center; font-size: 1.7rem; margin: 0 0 24px; }
.lp-sub2 { text-align: center; color: #7A6A58; margin: -12px 0 24px; }
.lp-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.lp-card { background: #fff; border-radius: 16px; padding: 22px; box-shadow: 0 2px 10px rgba(120,70,30,.10); }
.lp-ico { font-size: 2rem; margin-bottom: 8px; }
.lp-card h3 { margin: 0 0 8px; font-size: 1.15rem; }
.lp-card p { margin: 0; color: #7A6A58; font-size: .95rem; }
.lp-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.lp-feat { background: #fff; border-radius: 12px; padding: 14px 16px; box-shadow: 0 2px 10px rgba(120,70,30,.08); }
.lp-feat b { display: block; margin-bottom: 4px; }
.lp-feat span { font-size: .9rem; color: #7A6A58; }
.lp-how { background: #3A2E24; color: #FFF9EC; }
.lp-how h2 { color: #FFF9EC; }
.lp-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.lp-step b { display: inline-flex; width: 40px; height: 40px; border-radius: 50%; background: #E8A93D; color: #3A2E24; align-items: center; justify-content: center; font-size: 1.2rem; margin-bottom: 10px; }
.lp-step h3 { margin: 0 0 6px; color: #FFF9EC; }
.lp-step p { margin: 0; color: #D9C9A8; font-size: .95rem; }
.lp-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; max-width: 800px; margin: 0 auto; }
.lp-plan { background: #fff; border-radius: 16px; padding: 24px 20px; text-align: center; box-shadow: 0 2px 10px rgba(120,70,30,.10); border: 2px solid transparent; position: relative; }
.lp-plan.hot { border-color: #E8A93D; }
.lp-plan h3 { margin: 0 0 8px; }
.lp-price { font-size: 2rem; font-weight: 800; margin-bottom: 16px; }
.lp-price span { font-size: .9rem; font-weight: 400; color: #7A6A58; }
.lp-save { display: inline-block; background: #E8F5E9; color: #2E7D4F; font-size: .75rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; margin-bottom: 8px; text-transform: uppercase; letter-spacing: .05em; }
.lp-save.hot-tag { background: #E8A93D; color: #3A2E24; }
.lp-demo { background: linear-gradient(180deg, #FFF3D6, #FFF9EC); text-align: center; }
.lp-demo p { max-width: 560px; margin: 0 auto 20px; color: #7A6A58; }
.lp-faq { max-width: 680px; margin: 0 auto; }
.lp-faq details { background: #fff; border-radius: 12px; padding: 14px 18px; margin-bottom: 10px; box-shadow: 0 2px 10px rgba(120,70,30,.08); }
.lp-faq summary { font-weight: 700; cursor: pointer; }
.lp-faq p { margin: 8px 0 0; color: #7A6A58; font-size: .95rem; }
.lp-footer { text-align: center; padding: 32px 0 48px; color: #7A6A58; }
.lp-footer a { color: #2E7D32; }
@media (max-width: 560px) {
  .lp-hero h1 { font-size: 2rem; }
  .lp-hero { padding: 44px 0 32px; }
  .lp-nav-links .btn-outline { display: none; }
}

/* Modal close button */
.modal-x { position: absolute; top: 8px; right: 10px; background: none; border: none; font-size: 1.25rem; color: var(--ink-soft); cursor: pointer; padding: 8px; line-height: 1; z-index: 2; }
.modal-x:hover { color: var(--ink); }

/* ---- Education cards (Build 2: education-first) ---- */
.edu-card { margin-top: 10px; }
.edu-card > summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.edu-item { margin: 8px 0; border-top: 1px solid var(--line); padding-top: 8px; }
.edu-item > summary { cursor: pointer; font-weight: 600; }
.edu-body { padding: 6px 0 2px; }
.edu-body p { margin: 6px 0; }
.edu-body ul { margin: 6px 0; padding-left: 20px; }
.edu-body li { margin: 4px 0; }
.edu-inline { margin-top: 6px; }
.edu-inline > summary { cursor: pointer; color: var(--acc); font-size: 0.9em; }
.checkline { display: flex; align-items: center; gap: 8px; margin: 6px 0; cursor: pointer; }
.checkline input { width: auto; }

/* ---- Care guide ---- */
.task-link { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: var(--panel2); border: 1px solid var(--acc); border-radius: 10px;
  padding: 10px 12px; margin: 6px 0; cursor: pointer; color: var(--ink); font-size: 1em; }
.task-link:hover { border-color: var(--acc); filter: brightness(1.05); }
