/* Phone app. Mobile first; works on iPhone and Android, fine on desktop too. */

:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #6b7785;
  --line: #e3e7ec;
  --accent: #1f2933;
  --sun: #ffd45c;
  --danger: #c0352b;
  --ok: #2e7d4f;
  --radius: 14px;
  font-family: "Lexend", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; background: var(--bg); color: var(--ink); }

body {
  min-height: 100vh;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

button, input, select { font: inherit; color: inherit; }

button { cursor: pointer; }

.wrap { max-width: 640px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 16px 24px; }

/* Header */
.head { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 16px; gap: 12px; }
.head h1 { margin: 0; font-size: 1.6rem; letter-spacing: -0.01em; }
.head .sub { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }
.me-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--c); display: inline-block; margin-right: 8px; vertical-align: middle; }

/* Segmented control */
.seg { display: flex; background: #e8edf2; border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px 6px; border-radius: 8px; font-size: 0.92rem; color: var(--muted); }
.seg button.on { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

/* Sections and lists */
.group { margin-bottom: 18px; }
.group h2 { margin: 0 0 6px 4px; font-size: 0.9rem; font-weight: 600; color: var(--muted); }
.group.overdue h2 { color: var(--danger); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

.row { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; min-height: 58px; border-top: 1px solid var(--line); border-left: 5px solid var(--c, transparent); }
.row:first-child { border-top: 0; }
.row .check { width: 44px; height: 58px; border: 0; background: none; display: grid; place-items: center; padding: 0; }
.row .check span { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--c); display: grid; place-items: center; color: #fff; font-size: 15px; font-weight: 700; }
.row.done .check span { background: var(--c); }
.row .check:disabled span { border-style: dashed; opacity: 0.6; }
.row .body { padding: 10px 4px; min-width: 0; border: 0; background: none; text-align: left; }
.row .title { font-size: 1rem; overflow-wrap: anywhere; }
.row.done .title { text-decoration: line-through; color: var(--muted); }
.row .meta { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }
.row.late .meta .due { color: var(--danger); font-weight: 600; }
.row .pts { margin-right: 12px; font-size: 0.8rem; padding: 2px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }

.empty { padding: 18px 16px; color: var(--muted); text-align: center; font-size: 0.95rem; }

/* Events */
.ev { display: grid; grid-template-columns: 78px 1fr auto; gap: 8px; align-items: center; padding: 12px 12px 12px 14px; border-top: 1px solid var(--line); border-left: 5px solid var(--c, var(--line)); }
.ev:first-child { border-top: 0; }
.ev .t { font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ev .x { border: 0; background: none; color: var(--muted); font-size: 1.1rem; padding: 6px 8px; }

/* Month */
.score { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.score .card { padding: 14px; border-top: 5px solid var(--c); }
.score .name { font-weight: 600; color: var(--c); }
.score .pay { font-size: 1.9rem; font-weight: 700; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.score .lead { font-size: 0.8rem; font-weight: 600; color: var(--ok); }
.score dl { margin: 10px 0 0; display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; font-size: 0.85rem; }
.score dt { color: var(--muted); }
.score dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.month-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.month-nav button { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 6px 12px; }
.month-nav strong { font-size: 1.1rem; }
.rules { font-size: 0.85rem; color: var(--muted); line-height: 1.5; padding: 14px; }
.rules p { margin: 0 0 8px; }

/* Bottom tab bar */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; background: rgba(255,255,255,0.96); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); z-index: 5; }
.tabs .inner { display: flex; width: 100%; max-width: 640px; }
.tabs button { flex: 1; border: 0; background: none; padding: 12px 0 10px; font-size: 0.82rem; color: var(--muted); }
.tabs button.on { color: var(--ink); font-weight: 600; }
.tabs .ico { display: block; font-size: 1.25rem; line-height: 1; margin-bottom: 3px; }

.fab { position: fixed; right: max(16px, calc(50% - 304px)); bottom: calc(88px + env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-size: 30px; line-height: 1; box-shadow: 0 6px 18px rgba(0,0,0,0.22); z-index: 6; }

/* Bottom sheet for forms */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--panel); width: 100%; max-width: 640px; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 92vh; overflow: auto; }
.sheet h3 { margin: 0 0 14px; font-size: 1.15rem; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 0.85rem; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
.field input[type=text], .field input[type=date], .field input[type=time] { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 16px; min-height: 46px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 9px 14px; font-size: 0.95rem; }
.chips button.on { border-color: var(--c, var(--ink)); background: var(--c, var(--ink)); color: #fff; }
.check-line { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 0.95rem; }
.check-line input { width: 20px; height: 20px; }
.actions { display: flex; gap: 10px; margin-top: 6px; }
.btn { flex: 1; border: 0; border-radius: 12px; padding: 14px; font-weight: 600; font-size: 1rem; background: var(--accent); color: #fff; }
.btn.ghost { background: #e8edf2; color: var(--ink); }
.btn.danger { background: #fbe9e7; color: var(--danger); flex: 0 0 auto; padding: 14px 16px; }
.btn:disabled { opacity: 0.5; }
.err { color: var(--danger); font-size: 0.9rem; margin: 0 0 10px; }

/* Toast */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(160px + env(safe-area-inset-bottom)); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 0.9rem; z-index: 20; }

/* Setup and gate screens */
.center { max-width: 520px; margin: 0 auto; padding: calc(40px + env(safe-area-inset-top)) 20px 40px; }
.center h1 { font-size: 1.8rem; margin: 0 0 8px; }
.center p { color: var(--muted); line-height: 1.5; }
.link-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.link-box strong { display: block; margin-bottom: 6px; }
.link-box code { display: block; font-size: 0.78rem; word-break: break-all; background: var(--bg); padding: 8px; border-radius: 8px; margin-bottom: 8px; }
.color-in { width: 46px; height: 46px; border: 1px solid var(--line); border-radius: 10px; padding: 2px; background: #fff; }
.name-row { display: grid; grid-template-columns: 1fr 56px; gap: 10px; align-items: end; }

/* Repeating chores */
.hint { color: var(--muted); font-size: 0.88rem; margin: 0 4px 12px; line-height: 1.45; display: block; }
.field small.hint { margin: 6px 0 0; }
.field input[type=number] { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 16px; min-height: 46px; }
.row .check .rep-ico { border: 0; background: none; color: var(--c, var(--muted)); font-size: 20px; font-weight: 600; }
.row.turns { position: relative; border-left-color: var(--a); }
.row.turns::before { content: ''; position: absolute; left: -5px; top: 50%; bottom: 0; width: 5px; background: var(--b); }
.row .meta .rep { color: var(--c, var(--muted)); font-weight: 600; }
.tabs button { font-size: 0.78rem; }
[hidden] { display: none !important; }

/* Visual pass: avatar dot in the greeting, pastel event rows, rounder cards */
.card { border-radius: 18px; }
.me-dot { width: 30px; height: 30px; margin-right: 10px; display: inline-grid; place-items: center; color: #fff; font-size: 15px; font-weight: 600; vertical-align: 4px; }
.ev { background: color-mix(in srgb, var(--c, #8d99a6) 10%, white); }
