/* Family Calendar. Phone first; light and dark follow the device. */
:root {
  --bg: #f6f4ef; --card: #ffffff; --ink: #1f2a2a; --muted: #5f6b6a; --line: #dedad2; --accent: #2f6f6a; --accent-ink: #ffffff;
  --danger: #b3261e; --soft: #ebe7de;
  --red: #c8473d; --orange: #cf7a1d; --yellow: #a88a00; --green: #3f8a4a; --teal: #1f8a8a; --blue: #3567c4; --purple: #7a52b8; --darkpurple: #4a2580; --pink: #c2478c;
  --tint: 14%; --on-c: #ffffff; --r: 12px; --head: inherit;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141918; --card: #1e2524; --ink: #e9eeec; --muted: #9eaaa8; --line: #303a39; --accent: #5fb3ab; --accent-ink: #0d1716;
    --danger: #f08a80; --soft: #263030;
    --red: #ee7d72; --orange: #eba052; --yellow: #d8bd45; --green: #76c383; --teal: #58c2c2; --blue: #7da6f0; --purple: #b193e6; --darkpurple: #8a5fe0; --pink: #ea86bb;
    --tint: 22%; --on-c: #10201f;
  }
}
.c-red { --c: var(--red); } .c-orange { --c: var(--orange); } .c-yellow { --c: var(--yellow); } .c-green { --c: var(--green); }
.c-teal { --c: var(--teal); } .c-blue { --c: var(--blue); } .c-purple { --c: var(--purple); } .c-darkpurple { --c: var(--darkpurple); } .c-pink { --c: var(--pink); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font);
  padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--head); }
h2 { font-size: 1.15rem; margin: 0 0 10px; }
h3 { font-size: 1rem; margin: 18px 0 8px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.offscreen { position: fixed; left: -999px; top: 0; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--accent); color: var(--accent-ink); }
.top h1 { font-size: 1.15rem; font-weight: 650; }
.who { font-size: .85rem; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--accent-ink) 18%, transparent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45vw; }
.banner { margin: 10px 16px 0; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--danger) 14%, var(--card)); color: var(--danger); border: 1px solid var(--danger); }
.dlg .banner { margin: 10px 0 0; }

.view { max-width: 760px; margin: 0 auto; padding: 16px; display: grid; gap: 22px; }
section { display: grid; gap: 10px; }
section > .primary, section > button { justify-self: start; }

button, .btn, input, select, textarea { font: inherit; color: inherit; }
button, .btn { min-height: 44px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; text-align: center; }
button:hover, .btn:hover { border-color: var(--accent); }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.danger { color: var(--danger); border-color: var(--danger); }
input[type=text], input[type=date], input[type=time], input[type=number], select, textarea { width: 100%; min-height: 44px; padding: 8px 10px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--card); }
textarea { resize: vertical; }
label, .label { display: grid; gap: 4px; font-size: .9rem; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 1rem; min-height: 44px; }
label.check input { width: 22px; height: 22px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions.end { justify-content: flex-end; margin-top: 16px; }
.actions.tight select { width: auto; }
.actions > input, .actions > select { flex: 1 1 140px; width: auto; }

.list { display: grid; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; justify-content: flex-start; padding: 10px 12px;
  border-radius: 12px; border: 1px solid var(--line); background: color-mix(in srgb, var(--c, var(--accent)) var(--tint), var(--card)); }
.row.static { cursor: default; background: var(--card); flex-wrap: wrap; }
.row.removed { opacity: .6; }
.dot { flex: 0 0 12px; width: 12px; height: 12px; border-radius: 50%; background: var(--c, var(--accent)); }
.row-main { display: grid; gap: 2px; flex: 1 1 160px; min-width: 0; }
.row-title { font-weight: 600; overflow-wrap: anywhere; }
.row-sub { font-size: .88rem; color: var(--muted); overflow-wrap: anywhere; }
.soon { font-size: .8rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--c, var(--accent)); color: var(--on-c); white-space: nowrap; }

.notice { padding: 14px; border-radius: 14px; border: 1px solid var(--line); border-left: 6px solid var(--c, var(--accent));
  background: color-mix(in srgb, var(--c, var(--accent)) var(--tint), var(--card)); display: grid; gap: 8px; }
.notice h3 { margin: 0; font-size: 1.05rem; }
.body { white-space: pre-wrap; overflow-wrap: anywhere; }

.monthbar { display: flex; align-items: center; gap: 8px; }
.monthbar h2 { flex: 1; margin: 0; text-align: center; }
.monthbar button { min-width: 44px; font-size: 1.2rem; }
.monthbar .todaybtn { font-size: .9rem; }
.grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.grid.head { margin-bottom: -18px; }
.grid.head span { text-align: center; font-size: .78rem; color: var(--muted); padding: 2px 0; }
.cell { min-height: 58px; padding: 3px; border-radius: 8px; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 2px; overflow: hidden; }
.cell .num { font-size: .82rem; text-align: left; padding-left: 2px; }
.cell.other { opacity: .45; }
.cell.today .num { font-weight: 700; color: var(--accent); }
.cell.today { border-color: var(--accent); }
.cell.picked { background: var(--soft); border-color: var(--accent); border-width: 2px; padding: 2px; }
.chips { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chip { font-size: .66rem; line-height: 1.25; padding: 1px 3px; border-radius: 4px; background: var(--c, var(--accent)); color: var(--on-c);
  white-space: nowrap; overflow: hidden; text-overflow: clip; text-align: left; }
.more { font-size: .66rem; color: var(--muted); text-align: left; }
@media (min-width: 620px) { .cell { min-height: 84px; } .chip { font-size: .74rem; text-overflow: ellipsis; } }

.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; background: var(--c); border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--line); }
.swatch.on { box-shadow: 0 0 0 3px var(--ink); }
.swatch.mine::after { content: "me"; font-size: .7rem; color: var(--on-c); font-weight: 700; }

.linkrow { display: flex; gap: 8px; }
.linkbox { flex: 1; min-width: 0; font-size: .85rem; }
.log p { padding: 4px 0; border-bottom: 1px solid var(--line); color: var(--muted); overflow-wrap: anywhere; }

.fab { position: fixed; right: 18px; bottom: calc(78px + env(safe-area-inset-bottom)); z-index: 6; width: 58px; height: 58px; border-radius: 50%;
  font-size: 2rem; line-height: 1; background: var(--accent); color: var(--accent-ink); border: none; box-shadow: 0 4px 14px rgba(0, 0, 0, .3); }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { border: none; border-radius: 0; min-height: 56px; padding: 6px 1px; font-size: .78rem; background: transparent; color: var(--muted); border-top: 3px solid transparent; }
.tabs button.on { color: var(--accent); font-weight: 700; border-top-color: var(--accent); }

.dlg { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); border: 1px solid var(--line); border-radius: 16px; padding: 18px;
  background: var(--card); color: var(--ink); overflow: auto; }
.dlg::backdrop { background: rgba(0, 0, 0, .45); }
.dlg h2 { overflow-wrap: anywhere; }
.dlg-body { display: grid; gap: 12px; }
.when { font-weight: 600; }
.menu { display: grid; gap: 8px; }
.menu button { justify-content: flex-start; font-size: 1.05rem; min-height: 54px; }

body.plain { display: grid; place-items: center; min-height: 100dvh; padding: 16px; }
.card { max-width: 440px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 24px; display: grid; gap: 14px; }
.card form { display: grid; gap: 12px; }

/* the + on the add button is drawn from two bars, so it sits exactly in the middle whatever the font */
.fab { font-size: 0; }
.fab::before, .fab::after { content: ""; position: absolute; left: 50%; top: 50%; width: 24px; height: 4px; margin: -2px 0 0 -12px; border-radius: 2px; background: currentColor; }
.fab::after { transform: rotate(90deg); }
