/* House Rules — the Field Suite look (Verdure: Evergreen ink, Moss, Bone), dark by default. */
:root, :root[data-theme="dark"] {
  --canvas: #121a15; --surface: #1e2a21; --raised: #26362a; --line: #2f4033; --line2: #3a4f3e;
  --ink: #edeae3; --ink2: #cfd6cf; --muted: #9aa79a; --faint: #7e887e;
  --moss: #6ca53e; --moss-text: #93ba70; --moss-bg: #2a3e26; --lime: #c4d93f;
  --btn: #3e5c41; --btn-hover: #4a6e4e; --btn-ink: #fff;
  --act: #cba192; --act-bg: #3a2c24; --act-line: #a2472e;
  --watch: #cba96b; --watch-bg: #373923; --watch-line: #b8862b;
  --shadow: 0 6px 20px rgba(0,0,0,.35);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --canvas: #ede9e3; --surface: #f7f5f0; --raised: #ffffff; --line: #ddd9cf; --line2: #cdc9bd;
  --ink: #17201a; --ink2: #3a403c; --muted: #646660; --faint: #8a8c85;
  --moss: #6ca53e; --moss-text: #486d2f; --moss-bg: #e1e8d4; --lime: #4a6a12;
  --btn: #334a36; --btn-hover: #293b2c; --btn-ink: #fff;
  --act: #8d412b; --act-bg: #e9d9d1; --act-line: #a2472e;
  --watch: #785d24; --watch-bg: #ede3d0; --watch-line: #b8862b;
  --shadow: 0 4px 14px rgba(23,32,26,.12);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--canvas); color: var(--ink2);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
h1, h2, h3 { font-family: Georgia, 'Times New Roman', serif; color: var(--ink); margin: 0; letter-spacing: -.01em; text-wrap: balance; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:not(:disabled):active { transform: scale(.97); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; color: var(--ink); }
:focus-visible { outline: 2px solid var(--moss); outline-offset: 2px; }
ul { margin: 0; padding: 0; list-style: none; }
.boot { padding: 60px 20px; text-align: center; color: var(--muted); }

/* ---------- shell ---------- */
.farm-bg {
  background: radial-gradient(120% 60% at 0% 0%, rgba(108,165,62,.2) 0%, transparent 55%), linear-gradient(180deg, #26362a 0%, #17201a 100%);
  color: #fff;
}
.top { position: sticky; top: 0; z-index: 20; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 2px 10px rgba(0,0,0,.35); }
.brand { display: flex; align-items: center; gap: 9px; }
.brand b { font-family: Georgia, serif; font-size: 20px; font-weight: 600; line-height: 1; display: block; letter-spacing: -.01em; }
.brand small { font-size: 11px; color: rgba(255,255,255,.62); display: block; margin-top: 2px; }
.chips { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 99px; font-weight: 600; }
.chip.on { background: rgba(16,185,129,.2); color: #d1fae5; }
.chip.off { background: rgba(244,63,94,.3); color: #ffe4e6; }
.chip.sync { background: rgba(251,191,36,.9); color: #17201a; }
.round { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,.1); color: rgba(255,255,255,.85); font-size: 11px; font-weight: 700; }
.round.me { box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); color: #c4d93f; } /* the header is dark in both themes */
main { max-width: 520px; margin: 0 auto; padding: 14px 14px calc(92px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center;
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.nav-in { display: grid; grid-template-columns: repeat(5, 1fr); width: 100%; max-width: 520px; }
.nav button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 8px; font-size: 10.5px; font-weight: 600; color: var(--faint); position: relative; }
.nav button svg { width: 22px; height: 22px; }
.nav button.on { color: var(--moss-text); }
.nav button.on::before { content: ''; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--moss); }
.nav .dot { position: absolute; top: 6px; right: calc(50% - 20px); min-width: 16px; height: 16px; border-radius: 8px; background: var(--act-line); color: #fff; font-size: 10px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }

/* ---------- surfaces ---------- */
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.tile.flush { padding: 0; overflow: hidden; }
.tile h2 { font-size: 17px; margin-bottom: 2px; }
.sub { color: var(--muted); font-size: 13px; }
.label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 14px 0 6px; }
.sec { display: flex; align-items: baseline; justify-content: space-between; padding: 2px 4px 0; }
.sec h3 { font-size: 15px; }
.sec span { font-size: 12px; color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.right { margin-left: auto; text-align: right; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { color: var(--ink); font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; line-height: 1; padding: 4px 8px; border-radius: 99px; background: var(--raised); color: var(--ink2); white-space: nowrap; }
.pill.good { background: var(--moss-bg); color: var(--moss-text); }
.pill.act { background: var(--act-bg); color: var(--act); }
.pill.watch { background: var(--watch-bg); color: var(--watch); }

/* ---------- hello card ---------- */
.hello { padding: 18px 16px; }
.hello h1 { font-size: 21px; }
.big { font-family: Georgia, serif; font-size: 34px; color: var(--ink); line-height: 1; letter-spacing: -.02em; }
.bar { height: 9px; border-radius: 9px; background: var(--raised); overflow: hidden; position: relative; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #4f8a2e, var(--moss)); border-radius: 9px; transition: width .4s; }
.bar i.warn { background: linear-gradient(90deg, #b8862b, #d6a443); }
.bar i.bad { background: linear-gradient(90deg, #a2472e, #c0583c); }
.bar .goal { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--lime); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.stat { background: var(--raised); border-radius: 12px; padding: 9px 10px; }
.stat b { display: block; font-family: Georgia, serif; font-size: 22px; color: var(--ink); line-height: 1.1; }
.stat span { font-size: 11px; color: var(--muted); font-weight: 600; }
.stat.bad b { color: var(--act); }

/* ---------- banners ---------- */
.banner { display: flex; gap: 10px; align-items: flex-start; border-radius: 14px; padding: 12px 14px; font-size: 13.5px; border: 1px solid; }
.banner.act { background: var(--act-bg); border-color: var(--act-line); color: var(--act); }
.banner.watch { background: var(--watch-bg); border-color: var(--watch-line); color: var(--watch); }
.banner.good { background: var(--moss-bg); border-color: var(--moss); color: var(--moss-text); }
.banner b { color: inherit; }
.notice { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--lime); border-radius: 12px; padding: 11px 14px; }
.notice small { display: block; color: var(--muted); margin-top: 3px; }

/* ---------- tasks ---------- */
.task { display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; position: relative; }
.task.overdue { border-color: var(--act-line); background: linear-gradient(90deg, var(--act-bg), var(--surface) 55%); }
.task.locked { opacity: .55; }
.task.done, .task.late { background: transparent; }
.tick { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--line2); display: flex; align-items: center; justify-content: center; color: transparent; background: var(--raised); transition: .15s; }
.tick svg { width: 24px; height: 24px; }
.task.open .tick { border-color: var(--moss); }
.task.overdue .tick { border-color: var(--act-line); }
.task.done .tick { background: var(--moss); border-color: var(--moss); color: #fff; }
.task.late .tick { background: var(--watch-line); border-color: var(--watch-line); color: #fff; }
.tname { color: var(--ink); font-weight: 600; font-size: 15.5px; line-height: 1.25; }
.task.done .tname, .task.late .tname { color: var(--muted); font-weight: 500; }
.tmeta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.tmeta.red { color: var(--act); font-weight: 600; }
.tmeta.amber { color: var(--watch); font-weight: 600; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
details.steps { margin-top: 6px; }
details.steps summary { font-size: 12px; color: var(--moss-text); cursor: pointer; list-style: none; font-weight: 600; }
details.steps summary::-webkit-details-marker { display: none; }
details.steps ul { margin-top: 6px; font-size: 13px; color: var(--ink2); }
details.steps li { padding: 2px 0 2px 16px; position: relative; }
details.steps li::before { content: ''; position: absolute; left: 2px; top: 10px; width: 5px; height: 5px; border-radius: 50%; background: var(--moss); }
.link { color: var(--moss-text); font-weight: 600; font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- buttons & forms ---------- */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 14px 16px; border-radius: 16px; background: var(--btn); color: var(--btn-ink); font-weight: 700; font-size: 16px; box-shadow: var(--shadow); }
.btn:hover { background: var(--btn-hover); }
.btn.sm { width: auto; padding: 9px 14px; font-size: 14px; border-radius: 12px; box-shadow: none; }
.btn.ghost { background: var(--raised); color: var(--ink); box-shadow: none; border: 1px solid var(--line2); }
.btn.danger { background: var(--act-line); }
.btns { display: flex; gap: 8px; }
.btns .btn { flex: 1; }
.field, select.field, textarea.field { width: 100%; padding: 11px 12px; background: var(--raised); border: 1px solid var(--line2); border-radius: 12px; font-size: 15px; }
textarea.field { resize: vertical; min-height: 64px; }
input[type=time].field { min-width: 0; }
.field::placeholder { color: var(--faint); }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { padding: 9px 13px; border-radius: 99px; background: var(--raised); border: 1px solid var(--line2); font-size: 13.5px; font-weight: 600; color: var(--ink2); }
.choice.on { background: var(--btn); border-color: var(--moss); color: #fff; }
.switch { position: relative; width: 44px; height: 26px; border-radius: 13px; background: var(--line2); flex: none; transition: .15s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .15s; }
.switch.on { background: var(--moss); }
.switch.on::after { left: 21px; }

/* ---------- lists ---------- */
.list > * { padding: 12px 16px; border-top: 1px solid var(--line); }
.list > *:first-child { border-top: 0; }
.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--moss-bg); color: var(--moss-text); font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.rank { width: 22px; flex: none; text-align: center; font-family: Georgia, serif; font-weight: 700; color: var(--muted); }
.rank.first { color: var(--lime); }
.person { display: flex; align-items: center; gap: 12px; }
.person.me { background: rgba(108,165,62,.08); }

.meter { text-align: center; }
.meter .big { font-size: 48px; }

.grid { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.rota { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12px; min-width: 430px; }
.rota th, .rota td { padding: 8px 4px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rota th { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.rota th:first-child, .rota td:first-child { text-align: left; padding-left: 14px; position: sticky; left: 0; background: var(--surface); font-weight: 600; color: var(--ink); z-index: 1; }
.rota .today { background: rgba(108,165,62,.12); }
.rota th.today { color: var(--lime); }
.zone { display: inline-block; padding: 3px 6px; border-radius: 7px; font-size: 11px; font-weight: 700; background: var(--raised); color: var(--ink2); }
.z-kitchen { background: #34402a; color: #c4d9a0; } .z-bath1 { background: #223a45; color: #9ccce0; } .z-bath2 { background: #2a3350; color: #a9b8ee; }
.z-living { background: #43372a; color: #e3c79c; } .z-lapa { background: #47302a; color: #eab29f; } .z-pets { background: #3c2c44; color: #d6b4e6; }
:root[data-theme="light"] .z-kitchen { background: #e1e8d4; color: #3c5929; } :root[data-theme="light"] .z-bath1 { background: #d3e4ec; color: #1f5670; }
:root[data-theme="light"] .z-bath2 { background: #dcdff2; color: #3a4688; } :root[data-theme="light"] .z-living { background: #efe3cf; color: #6b4a1a; }
:root[data-theme="light"] .z-lapa { background: #f0dcd4; color: #8d412b; } :root[data-theme="light"] .z-pets { background: #e8dcef; color: #5e3a78; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: flex; flex-direction: column; }
.login .head { padding: calc(32px + env(safe-area-inset-top)) 20px 22px; display: flex; align-items: center; gap: 12px; }
.login .head b { font-family: Georgia, serif; font-size: 28px; font-weight: 600; display: block; line-height: 1; }
.login .head small { color: rgba(255,255,255,.62); font-size: 12px; }
.login .panel { flex: 1; background: var(--canvas); border-radius: 26px 26px 0 0; padding: 24px 20px 32px; }
.login .panel h1 { font-size: 21px; }
.people-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.pick { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; text-align: left; width: 100%; }
.pick:hover { border-color: var(--moss); }
.pinbox { display: flex; flex-direction: column; align-items: center; }
.dots { display: flex; gap: 10px; height: 16px; margin: 14px 0 6px; align-items: center; }
.dots i { width: 13px; height: 13px; border-radius: 50%; background: var(--line2); }
.dots i.f { background: var(--moss); }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; max-width: 280px; margin-top: 14px; }
.pad button { height: 58px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); font-size: 22px; font-weight: 600; color: var(--ink); }
.pad button.go { background: var(--btn); color: #fff; border-color: var(--btn); font-size: 17px; }
.pad button.alt { background: var(--raised); color: var(--muted); }
.err { color: var(--act); font-size: 14px; min-height: 20px; text-align: center; font-weight: 600; }

/* ---------- sheet & toast ---------- */
.veil { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); border: 1px solid var(--line2); border-radius: 22px 22px 0 0; width: 100%; max-width: 520px; max-height: 88vh; overflow: auto; padding: 20px 18px calc(22px + env(safe-area-inset-bottom)); }
.sheet h2 { font-size: 19px; margin-bottom: 4px; }
.sheet pre { white-space: pre-wrap; background: var(--raised); border-radius: 12px; padding: 12px; font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; color: var(--ink2); margin: 12px 0; max-height: 40vh; overflow: auto; }
.pinshow { font-family: Georgia, serif; font-size: 44px; letter-spacing: .25em; text-align: center; color: var(--ink); margin: 14px 0 6px; }
#toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 60; background: #edeae3; color: #17201a; padding: 11px 16px; border-radius: 14px; font-weight: 600; font-size: 14px; max-width: 88vw; text-align: center; opacity: 0; pointer-events: none; transition: .2s; box-shadow: var(--shadow); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: #a2472e; color: #fff; }

.empty { padding: 26px 16px; text-align: center; color: var(--muted); }
.rules h3 { font-size: 16px; margin: 18px 0 6px; }
.rules h3:first-child { margin-top: 0; }
.rules li { padding: 5px 0; display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--line); font-size: 14px; }
.rules li span:last-child { color: var(--muted); white-space: nowrap; }
.rules p { margin: 6px 0; font-size: 14px; }
.dueedit { display: grid; grid-template-columns: 1fr 104px; gap: 8px 10px; align-items: center; font-size: 13.5px; }
