:root {
  --teal: #0f766e;
  --teal-dark: #115e59;
  --teal-soft: #ccfbf1;
  --teal-wash: #f0fdfa;
  --purple: #6d28d9;
  --purple-dark: #5b21b6;
  --purple-soft: #ede9fe;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --amber-line: #f59e0b;
  --ink: #0f172a;
  --muted: #475569;
  --line: #d9e2ec;
  --bg: #ffffff;
  --panel: #f8fafc;
  --header: #18332d;
  --radius: 14px;
  --tap: 48px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow-x: hidden;
}
img { max-width: 100%; }
a { color: var(--teal-dark); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.25rem; margin-top: 28px; }
p { margin: 8px 0; }
[hidden] { display: none !important; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
  background: var(--header); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-height: var(--tap); min-width: 0; }
.brand img { width: 40px; height: 40px; border-radius: 9px; flex: none; }
.brand span { font-weight: 700; font-size: 1.08rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who {
  flex: none; min-height: 44px; padding: 0 14px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.35); background: transparent; color: #fff; font: inherit; font-size: .95rem; font-weight: 600;
}
.modebar { background: var(--purple-soft); color: var(--purple-dark); font-size: .92rem; padding: 8px 14px; font-weight: 600; }

main { max-width: 760px; margin: 0 auto; padding: 16px 14px 80px; outline: none; }
.loading { color: var(--muted); }

/* Buttons */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 18px; border-radius: 12px;
  border: 2px solid var(--teal); background: #fff; color: var(--teal-dark);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--teal); color: #fff; }
.btn.purple { background: var(--purple); border-color: var(--purple); color: #fff; }
.btn.warn { border-color: var(--amber-line); color: var(--amber); background: #fff; }
.btn.warn.solid { background: var(--amber); border-color: var(--amber); color: #fff; }
.btn.ghost { border-color: var(--line); color: var(--ink); }
.btn.block { display: flex; width: 100%; }
.btn.big { min-height: 58px; font-size: 1.08rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.small { min-height: 48px; padding: 8px 12px; font-size: .95rem; }

/* Form fields */
label { display: block; font-weight: 600; margin-top: 12px; }
label > input, label > textarea, label > select,
input[type=text], input[type=search], input[type=email], textarea, select {
  display: block; width: 100%; max-width: 100%; min-width: 0; margin-top: 6px;
  min-height: var(--tap); padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px;
  font: inherit; font-weight: 400; color: var(--ink); background: #fff;
}
textarea { min-height: 130px; resize: vertical; }
select {
  -webkit-appearance: none; appearance: none; height: var(--tap); padding-right: 40px;
  background: #fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%230f766e' stroke-width='2.2'/%3E%3C/svg%3E") no-repeat right 14px center;
}
input[type=search] { -webkit-appearance: none; appearance: none; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.hint { color: var(--muted); font-size: .95rem; }
.mic { color: var(--purple-dark); font-size: .9rem; margin: 6px 0 0; }

/* Status chips (no red anywhere) */
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .82rem; font-weight: 700; white-space: nowrap; }
.chip.not_started { background: #eef2f6; color: #334155; }
.chip.steps_written { background: var(--teal-soft); color: var(--teal-dark); }
.chip.drawing_in_progress { background: var(--purple-soft); color: var(--purple-dark); }
.chip.draft_ready { background: var(--purple); color: #fff; }
.chip.approved { background: var(--teal); color: #fff; }
.chip.live { background: var(--teal-dark); color: #fff; }
.chip.draft { background: var(--purple-soft); color: var(--purple-dark); }
.chip.changes_requested { background: var(--amber-soft); color: var(--amber); }
.chip.published { background: var(--teal-dark); color: #fff; }

/* Home */
.intro p { color: var(--muted); }
.tools { display: grid; grid-template-columns: 1fr; gap: 2px; margin-top: 8px; }
.summary { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 4px; }
.count { color: var(--muted); font-size: .95rem; margin: 10px 0; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.card {
  display: block; padding: 16px; border: 2px solid var(--line); border-radius: var(--radius);
  color: var(--ink); text-decoration: none; background: #fff; min-height: 88px;
  border-left: 6px solid var(--teal);
}
.card:active { background: var(--teal-wash); }
.card .row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card h3 { font-size: 1.15rem; }
.card .meta { color: var(--muted); font-size: .92rem; margin-top: 6px; }
.card .match { color: var(--purple-dark); font-size: .9rem; margin-top: 6px; }
.card.live, .card.approved { border-left-color: var(--purple); }
.excluded { margin-top: 24px; color: var(--muted); }
details > summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; font-weight: 700; color: var(--ink); }

/* Family page */
.navrow {
  position: sticky; top: var(--hdr, 64px); z-index: 10; background: rgba(255,255,255,.96);
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  margin: -16px -14px 12px; padding: 8px 14px; border-bottom: 1px solid var(--line);
}
.savestate { font-size: .88rem; font-weight: 600; color: var(--teal-dark); text-align: right; }
.savestate.saving { color: var(--purple-dark); }
.savestate.error { color: var(--amber); }
.famhead .meta { color: var(--muted); margin-top: 6px; }
.famhead .chip { margin-top: 8px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-top: 14px; }
.panel.purple { background: var(--purple-soft); border-color: #d8ccfb; }
.variants { margin: 8px 0 0; padding-left: 20px; }
.proplist { list-style: none; margin: 0; padding: 0; }
.proplist li { padding: 10px 0; border-top: 1px solid var(--line); }
.proplist .parks { display: block; color: var(--muted); font-size: .88rem; }

.steps { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 16px; }
.step { border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; background: #fff; border-top: 5px solid var(--teal); }
.step-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.step-num { font-weight: 800; font-size: 1.1rem; color: var(--teal-dark); }
.step-tools { display: flex; gap: 6px; }
.step-tools .btn { min-width: 48px; }
.photos { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; align-items: center; }
.thumb { position: relative; width: 96px; }
.thumb img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
.thumb button { margin-top: 4px; width: 96px; min-height: 40px; font-size: .85rem; padding: 4px; }
.filebtn input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.filebtn { position: relative; margin-top: 0; }

.exlist { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.exlist li { background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--purple); border-radius: 12px; padding: 10px 12px; }
.exlist .who2 { color: var(--muted); font-size: .85rem; }
.exlist .rowx { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.two { display: grid; grid-template-columns: 1fr; gap: 0; }

.draft { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-top: 12px; }
.draft .imgs { display: flex; gap: 8px; overflow-x: auto; margin-top: 8px; }
.draft .imgs img { height: 150px; width: auto; border-radius: 8px; border: 1px solid var(--line); }
.comments { list-style: none; padding: 0; margin: 8px 0 0; }
.comments li { padding: 8px 0; border-top: 1px solid var(--line); font-size: .95rem; }
.comments .who2 { color: var(--muted); font-size: .85rem; }
.btnrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btnrow .btn { flex: 1 1 140px; }

.activity { list-style: none; margin: 0; padding: 0; }
.activity li { padding: 8px 0; border-top: 1px solid var(--line); font-size: .93rem; }
.activity .when { color: var(--muted); font-size: .85rem; display: block; }

/* Sign in */
.signin { max-width: 460px; margin: 10px auto; }
.people { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.person { min-height: 64px; border: 2px solid var(--line); border-radius: 14px; background: #fff; font: inherit; font-weight: 700; font-size: 1.05rem; color: var(--ink); }
.person small { display: block; font-weight: 500; color: var(--muted); font-size: .8rem; }
.person[aria-pressed=true] { border-color: var(--teal); background: var(--teal-wash); color: var(--teal-dark); box-shadow: 0 0 0 3px var(--teal-soft); }

/* Modal + toast */
.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: flex-end; justify-content: center; z-index: 50; padding: 12px; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 480px; padding: 18px; border-top: 6px solid var(--teal); }
.modal.warn { border-top-color: var(--amber-line); }
.modal.warn h3 { color: var(--amber); }
.modal .btnrow .btn { flex: 1 1 120px; }
#toast { position: fixed; left: 12px; right: 12px; bottom: 16px; z-index: 60; display: none; background: var(--ink); color: #fff; border-radius: 12px; padding: 12px 14px; font-weight: 600; }
#toast.show { display: block; }
#toast.warn { background: var(--amber-soft); color: var(--amber); border: 2px solid var(--amber-line); }

@media (min-width: 700px) {
  .tools { grid-template-columns: 2fr 1fr; gap: 12px; }
  .two { grid-template-columns: 1fr 2fr; gap: 12px; }
  .overlay { align-items: center; }
  .people { grid-template-columns: repeat(4, 1fr); }
}
