/* Two-Homes Handoff — plain, calm, big targets. One column, phone first. */

:root {
  --ink: #1f2430;
  --ink-soft: #4a5160;
  --paper: #f6f4ef;
  --card: #ffffff;
  --line: #ddd8cc;
  --a: #2f6fed;
  --a-soft: #dbe7fd;
  --b: #d94f70;
  --b-soft: #fbe0e8;
  --good: #1d9e75;
  --bad: #c0392b;
  --seg: #e9e5da;
  --dot-off: #cfc9ba;
  --banner-bg: #fff4cc;
  --banner-line: #ecd27a;
  --tag-wait-bg: #fff4cc;
  --tag-wait-ink: #7a5c00;
  --tag-yes-bg: #d8f3e7;
  --tag-yes-ink: #0c6b4c;
  --tag-no-bg: #fbe0e0;
  --danger-line: #efc4c4;
  --radius: 16px;
}

/* Dark theme — main.ts stamps data-theme on <html> from the family's
   choice (Light / Dark / Match my phone). The four parent color vars
   (--a, --a-soft, --b, --b-soft) are set inline by applyAppearance and
   already arrive theme-mixed, so they are not redefined here. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #eceef2;
  --ink-soft: #a3aabb;
  --paper: #14161c;
  --card: #1f232d;
  --line: #343a48;
  --good: #35c08f;
  --bad: #e0655a;
  --seg: #262b36;
  --dot-off: #3a4050;
  --banner-bg: #33301c;
  --banner-line: #6d622c;
  --tag-wait-bg: #3a341a;
  --tag-wait-ink: #ecd27a;
  --tag-yes-bg: #173b2e;
  --tag-yes-ink: #5fd3a5;
  --tag-no-bg: #422222;
  --danger-line: #5c3230;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

#app { max-width: 560px; margin: 0 auto; }

/* ---------- shell ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--paper);
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--line);
}
.topbar .appname { font-weight: 800; font-size: 19px; letter-spacing: -0.01em; }
.topbar .appname small { display: block; font-weight: 500; font-size: 13px; color: var(--ink-soft); }

.viewas { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 15px; }
.viewas .seg { flex: 1; flex-wrap: wrap; }

.seg { display: flex; background: var(--seg); border-radius: 999px; padding: 3px; gap: 3px; }
.seg button {
  flex: 1; border: 0; background: transparent; border-radius: 999px;
  min-height: 42px; font-size: 16px; font-weight: 600; color: var(--ink-soft); cursor: pointer;
}
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.18); }

main { padding: 16px 16px 110px; }

.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 560px; z-index: 20;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; text-align: center; padding: 10px 2px 12px;
  color: var(--ink-soft); text-decoration: none; font-size: 13px; font-weight: 600;
  position: relative;
}
.tabbar a.on { color: var(--ink); }
.tabbar a.on::before {
  content: ""; position: absolute; top: 0; left: 22%; right: 22%;
  height: 3px; border-radius: 0 0 4px 4px; background: var(--ink);
}
.tabbar .badge {
  position: absolute; top: 4px; right: calc(50% - 22px);
  background: var(--bad); color: var(--paper); border-radius: 999px;
  min-width: 20px; height: 20px; line-height: 20px; font-size: 12px; font-weight: 700;
  padding: 0 5px;
}

/* ---------- words & cards ---------- */

h1 { font-size: 27px; line-height: 1.2; margin: 4px 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 20px; margin: 22px 0 8px; }
h3 { font-size: 17px; margin: 16px 0 6px; }
p { margin: 6px 0; }
.soft { color: var(--ink-soft); }
.small { font-size: 14px; }
.big-answer { font-size: 30px; font-weight: 800; line-height: 1.25; margin: 6px 0; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 12px 0;
}
.card.tintA { background: var(--a-soft); border-color: transparent; }
.card.tintB { background: var(--b-soft); border-color: transparent; }

.banner {
  background: var(--banner-bg); border: 1px solid var(--banner-line); border-radius: var(--radius);
  padding: 12px 16px; margin: 12px 0; font-size: 15px;
}

/* ---------- buttons & inputs ---------- */

.btn {
  display: block; width: 100%; min-height: 54px; padding: 14px 16px;
  border-radius: 14px; border: 2px solid var(--ink);
  background: var(--ink); color: var(--paper); font-size: 17px; font-weight: 700;
  cursor: pointer; text-align: center; text-decoration: none;
}
.btn.ghost { background: var(--card); color: var(--ink); }
.btn.small-btn { min-height: 46px; font-size: 15px; padding: 10px 12px; }
.btn.accept { background: var(--good); border-color: var(--good); }
.btn.decline { background: var(--card); color: var(--bad); border-color: var(--bad); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

label.field { display: block; margin: 14px 0 6px; font-weight: 600; font-size: 15px; }
input[type="text"], input[type="date"], input[type="time"], select, textarea {
  width: 100%; min-height: 50px; padding: 12px; font-size: 17px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink);
  font-family: inherit;
}
textarea { min-height: 76px; resize: vertical; }
input[type="checkbox"] { width: 26px; height: 26px; accent-color: var(--ink); }

/* ---------- parent colors ---------- */

.dot { display: inline-block; width: 13px; height: 13px; border-radius: 4px; vertical-align: -1px; }
.dotA { background: var(--a); }
.dotB { background: var(--b); }
.tintA { background: var(--a-soft) !important; }
.tintB { background: var(--b-soft) !important; }
.splitAB { background: linear-gradient(135deg, var(--a-soft) 50%, var(--b-soft) 50%) !important; }
.splitBA { background: linear-gradient(135deg, var(--b-soft) 50%, var(--a-soft) 50%) !important; }

/* mini pattern strip (setup cards + previews) */
.strip { display: flex; gap: 2px; margin: 10px 0 4px; flex-wrap: nowrap; }
.strip .sq { flex: 1; height: 16px; border-radius: 3px; min-width: 0; }
.sqA { background: var(--a); }
.sqB { background: var(--b); }

/* ---------- setup ---------- */

.dots { display: flex; gap: 7px; justify-content: center; margin: 6px 0 14px; }
.dots span { width: 10px; height: 10px; border-radius: 999px; background: var(--dot-off); }
.dots span.on { background: var(--ink); }

.pick {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin: 10px 0; font-size: 17px; color: var(--ink); font-family: inherit;
}
.pick .t { font-weight: 800; font-size: 18px; display: block; }
.pick .d { color: var(--ink-soft); font-size: 15px; display: block; margin-top: 3px; }
.pick.on { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink) inset; }

.kidrow { display: flex; gap: 8px; align-items: end; }
.kidrow .grow { flex: 1; }
.icon-btn {
  min-width: 50px; min-height: 50px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--card); font-size: 19px; cursor: pointer; color: var(--ink);
}

/* preview + paint */
.preview { overflow-x: auto; }
table.cal { border-collapse: separate; border-spacing: 3px; width: 100%; }
table.cal td, table.cal th {
  text-align: center; font-size: 13px; padding: 0; border-radius: 8px;
}
table.cal th { color: var(--ink-soft); font-weight: 600; padding: 2px 0; }
table.cal td .cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 44px; border-radius: 8px; font-weight: 600; width: 100%;
}
table.cal td button.cell { border: 0; cursor: pointer; font-family: inherit; font-size: 13px; color: var(--ink); }
table.cal td.dim { opacity: .38; }
table.cal td.today .cell { outline: 3px solid var(--ink); outline-offset: -3px; }
table.cal td.sel .cell { outline: 3px solid var(--ink); outline-offset: -3px; }
.cell .mark { font-size: 10px; line-height: 1; }

.paint td button.cell { min-height: 50px; font-size: 14px; }

/* holiday rows */
.hol { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: 12px 14px; margin: 10px 0; }
.hol .name { font-weight: 700; }
.pills { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.pills button {
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 9px 13px; font-size: 15px; font-weight: 600; cursor: pointer; min-height: 44px;
  font-family: inherit;
}
.pills button.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------- requests ---------- */

.req { border-radius: var(--radius); padding: 16px; margin: 12px 0; background: var(--card); border: 1px solid var(--line); }
.req.pending { border: 2px solid var(--ink); }
.req .who { font-size: 19px; font-weight: 700; line-height: 1.35; }
.req .note { background: var(--paper); border-radius: 10px; padding: 9px 12px; margin-top: 9px; font-size: 15px; }
.tag {
  display: inline-block; font-size: 12.5px; font-weight: 700; letter-spacing: .02em;
  border-radius: 999px; padding: 3px 9px; background: var(--seg); color: var(--ink-soft);
  text-transform: uppercase;
}
.tag.waiting { background: var(--tag-wait-bg); color: var(--tag-wait-ink); }
.tag.yes { background: var(--tag-yes-bg); color: var(--tag-yes-ink); }
.tag.no { background: var(--tag-no-bg); color: var(--bad); }
.tag.mine { background: var(--ink); color: var(--paper); }

/* ---------- checklist / items ---------- */

.check { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line); cursor: pointer; min-height: 52px; }
.check:last-child { border-bottom: 0; }
.check .nm { flex: 1; font-size: 17px; }
.check input { flex: none; }
.check.done .nm { color: var(--ink-soft); text-decoration: line-through; }

.itemrow { display: flex; align-items: center; gap: 10px; padding: 12px 4px; border-bottom: 1px solid var(--line); min-height: 56px; }
.itemrow:last-child { border-bottom: 0; }
.itemrow .nm { flex: 1; }
.where {
  border: 0; border-radius: 999px; padding: 10px 14px; font-weight: 700; font-size: 15px;
  cursor: pointer; min-height: 46px; font-family: inherit; color: var(--ink);
}
.where.A { background: var(--a-soft); }
.where.B { background: var(--b-soft); }
.where.N { background: var(--seg); }
.star { background: none; border: 0; font-size: 23px; cursor: pointer; padding: 6px; color: #b9b2a0; line-height: 1; }
.star.on { color: #e8a400; }

/* ---------- misc ---------- */

.switchrow { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.switchrow button {
  border: 1.5px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 10px 14px; font-size: 15px; font-weight: 600; cursor: pointer; min-height: 46px; font-family: inherit; color: var(--ink);
}
.switchrow button.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; color: var(--ink-soft); margin: 8px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.danger { border-color: var(--danger-line); }
.danger .btn { background: var(--bad); border-color: var(--bad); }
a.plain { color: var(--ink); font-weight: 700; }
.empty { text-align: center; color: var(--ink-soft); padding: 26px 10px; }

/* ---------- color-coding off: neutral parent markers ---------- */

/* initial chip that replaces the color dot when coding is off */
.ini {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 999px; vertical-align: -5px;
  background: var(--seg); color: var(--ink-soft);
  font-size: 12px; font-weight: 800;
}
/* pattern strips without color: solid vs outlined still reads as A/B */
.sqOffA { background: var(--ink-soft); }
.sqOffB { background: transparent; box-shadow: inset 0 0 0 2px var(--ink-soft); }

/* ---------- day notes ---------- */

/* markers row under the day number: ★, shared-note dot, private lock */
.cell .marks { display: inline-flex; gap: 3px; align-items: center; line-height: 1; min-height: 10px; }
.ndot { display: inline-block; width: 7px; height: 7px; border-radius: 999px; background: var(--ink); }
.nlock { font-size: 9px; line-height: 1; }

.daynote {
  background: var(--paper); border-radius: 10px; padding: 9px 12px; margin-top: 8px;
  font-size: 15px;
}
.daynote .txt { display: block; margin-top: 5px; }
.daynote .who { color: var(--ink-soft); font-size: 13.5px; }
/* Today "Just for me" side panel: the viewer's own private notes for
   the week. Set apart from the regular cards — paper ground, dashed
   edge — so it reads as a personal side list, not family business. */
.side-panel { background: var(--paper); border: 1.5px dashed var(--line); }
.privrow {
  display: flex; gap: 12px; align-items: baseline;
  padding: 9px 2px; border-top: 1px solid var(--line);
  color: inherit; text-decoration: none; font-size: 15px;
}
.privrow .pdate { font-weight: 700; white-space: nowrap; }
.privrow .ptxt { overflow-wrap: break-word; }
.note-actions { display: flex; gap: 14px; margin-top: 6px; }
.mini-btn {
  background: none; border: 0; padding: 4px 0; cursor: pointer;
  font-size: 14px; font-weight: 700; color: var(--ink); font-family: inherit;
}
.mini-btn.warn { color: var(--bad); }

/* ---------- appearance settings ---------- */

.swatches { display: flex; gap: 9px; flex-wrap: wrap; margin: 8px 0 4px; }
.swatch {
  width: 38px; height: 38px; border-radius: 999px; padding: 0; cursor: pointer;
  border: 3px solid transparent; background-clip: padding-box;
}
.swatch.on { border-color: var(--card); box-shadow: 0 0 0 2.5px var(--ink); }

/* ---------- chat ---------- */

.chatlog { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 82%; }
.msg .bub {
  border-radius: 16px; padding: 10px 13px; font-size: 16px; overflow-wrap: break-word;
}
.msg.mine { align-self: flex-end; }
.msg.mine .bub { background: var(--ink); color: var(--paper); border-bottom-right-radius: 6px; }
.msg.theirs { align-self: flex-start; }
.msg.theirs .bub { background: var(--card); border: 1.5px solid var(--line); border-bottom-left-radius: 6px; }
/* when color-coding is on, bubbles tint by the SENDER's color (the
   tintA/tintB rules set the background) and the words go back to ink */
.msg .bub.tintA, .msg .bub.tintB { color: var(--ink); }
.msg .meta { font-size: 12.5px; color: var(--ink-soft); margin: 3px 4px 0; }
.msg.mine .meta { text-align: right; }
.composer { display: flex; gap: 8px; align-items: flex-end; margin-top: 14px; }
.composer textarea { flex: 1; min-height: 50px; }
.composer .btn { width: auto; flex: none; }
