/* The family calendar (1.4): site/js/ui/calendar.js (grown-ups) and site/js/ui/kidWeek.js (a child's
   My days). Loaded after app.css and built from its tokens, so the dark set and the app themes apply.
   Phones first; the 7-column week starts at 960px. */

/* ---------- List | Calendar (phones: the calendar lives inside Priority) ---------- */
.pri-switch { display: none; }
@media (max-width: 700px) {
  .pri-switch { display: flex; margin: 0 0 12px; }
  .pri-switch .chip-btn { flex: 1; justify-content: center; min-height: 40px; text-decoration: none; }
  .pri-switch svg { width: 15px; height: 15px; }
}

/* ---------- Grown-up calendar ---------- */
.cal { max-width: 1440px; margin: 0 auto; padding: 22px 18px calc(60px + var(--tabbar-h)); }
.cal-head h1 { display: flex; align-items: center; gap: 10px; font-size: 32px; margin: 0; }
.cal-head h1 svg { width: 28px; height: 28px; color: var(--pink); }
.cal-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 12px 0 10px; }
.cal-steps { display: flex; align-items: center; gap: 4px; }
.cal-step { width: 40px; height: 40px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-sm); }
.cal-step svg { width: 18px; height: 18px; }
.cal-today[aria-disabled="true"] { opacity: .6; }
.cal-title { flex: 1 1 auto; margin: 0; font-size: 19px; min-width: 0; }
.cal-modes { margin: 0; }
.cal-modes .chip-btn { min-width: 70px; justify-content: center; min-height: 36px; }
.cal-chips { margin: 0 0 12px; }
.cal-none { text-align: center; margin: 18px 0 0; }

/* Items: a strip in the board's colour, the time, the title and a hearts chip. */
.cal-item { list-style: none; position: relative; }
.ci-open {
  display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: 'time text tags' 'board board board'; align-items: center; column-gap: 8px; width: 100%;
  min-height: 44px; padding: 7px 10px 7px 14px; border: 0; border-radius: 12px; text-align: left; cursor: pointer; color: var(--ink); font: inherit;
  background: color-mix(in srgb, var(--bc) 13%, var(--surface)); box-shadow: inset 4px 0 0 var(--bc);
}
.ci-open:hover { background: color-mix(in srgb, var(--bc) 20%, var(--surface)); }
.ci-open:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }
.ci-time { grid-area: time; font-weight: 900; font-size: 12.5px; color: var(--soft); font-variant-numeric: tabular-nums; }
.ci-text { grid-area: text; font-weight: 800; font-size: 14px; line-height: 1.25; overflow-wrap: anywhere; min-width: 0; }
.ci-board { grid-area: board; font-size: 12px; font-weight: 700; color: var(--soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-tags { grid-area: tags; display: inline-flex; align-items: center; gap: 4px; }
.ci-rep { display: inline-flex; color: var(--soft); }
.ci-hearts { display: inline-flex; align-items: center; gap: 2px; padding: 1px 7px; border-radius: 999px; background: var(--kitty-soft); color: var(--kitty-deep); font-weight: 900; font-size: 11.5px; }
/* Any-time items have no time: the title takes its place. */
.ci-open:not(:has(.ci-time)) { grid-template-areas: 'text text tags' 'board board board'; }
.cal-item.done .ci-text { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--soft); }
.cal-item.done .ci-open { opacity: .72; }
.cal-item[draggable="true"] .ci-open { cursor: grab; }
.cal-item.repeat[draggable="true"] .ci-open { cursor: pointer; }
.cal-item.dragging { opacity: .45; }

/* Week as an agenda (phones and tablets): the days stacked. */
.cal-week { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.cal-day { background: var(--surface); border-radius: 20px; padding: 10px 12px 12px; box-shadow: var(--shadow-sm); transition: box-shadow .15s, background .15s; }
.cal-day.past { background: color-mix(in srgb, var(--surface) 70%, var(--bg)); }
.cal-day.past .cd-head { color: var(--faint); }
.cal-day.today { box-shadow: 0 0 0 2px var(--pink), var(--shadow); }
.cal-day.drop-on, .cm-day.drop-on { background: var(--pink-soft); box-shadow: 0 0 0 2px var(--pink); }
.cd-head { display: flex; align-items: center; gap: 8px; min-height: 40px; color: var(--ink); }
.cd-dow { font-family: var(--f-display); font-weight: 600; font-size: 16px; }
.cd-num { font-family: var(--f-display); font-weight: 600; font-size: 16px; color: var(--soft); }
.cd-month { font-weight: 800; font-size: 12px; color: var(--soft); text-transform: uppercase; letter-spacing: .04em; }
.cal-day.today .cd-dow { color: var(--pink-deep); }
.cal-day.today .cd-num { display: inline-grid; place-items: center; min-width: 30px; height: 30px; border-radius: 50%; background: var(--pink); color: #fff; }
.cd-add { margin-left: auto; width: 44px; height: 44px; border-radius: 50%; color: var(--soft); }
.cd-add:hover { background: var(--fill); color: var(--ink); }
.cd-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cd-items:empty { display: none; }
.cd-empty { margin: 2px 0 0; }

/* Week as 7 columns (wide screens) */
@media (min-width: 960px) {
  .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; align-items: stretch; }
  .cal-week .cal-day { min-height: 420px; padding: 8px; display: flex; flex-direction: column; border-radius: 18px; cursor: copy; }
  .cal-week .cd-head { flex-wrap: wrap; gap: 4px 6px; min-height: 0; padding: 2px 2px 8px; }
  .cal-week .cd-dow { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; width: 100%; }
  .cal-week .cd-num { font-size: 22px; color: var(--ink); }
  .cal-week .cal-day.today .cd-num { min-width: 36px; height: 36px; font-size: 20px; }
  .cal-week .cd-add { position: absolute; opacity: 0; }
  .cal-week .cal-day { position: relative; }
  .cal-week .cal-day .cd-add { top: 6px; right: 4px; width: 34px; height: 34px; }
  .cal-week .cal-day:hover .cd-add, .cal-week .cd-add:focus-visible { opacity: 1; }
  .cal-week .cd-items:empty { display: flex; flex: 1; }
  .cal-week .ci-open { grid-template-columns: 1fr auto; grid-template-areas: 'time tags' 'text text' 'board board'; padding: 6px 8px 6px 11px; min-height: 0; }
  .cal-week .ci-open:not(:has(.ci-time)) { grid-template-areas: 'text tags' 'board board'; }
  .cal-week .ci-text { font-size: 13.5px; }
  .cal.dragging .cal-day { outline: 2px dashed var(--line2); outline-offset: -2px; }
}

/* Month */
.cal-month { background: var(--surface); border-radius: 20px; padding: 8px; box-shadow: var(--shadow-sm); }
.cm-dows, .cm-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cm-dows span { text-align: center; font-size: 12px; font-weight: 900; color: var(--soft); text-transform: uppercase; letter-spacing: .05em; padding: 4px 0 6px; }
.cm-week + .cm-week { margin-top: 4px; }
.cm-day { position: relative; min-width: 0; min-height: 56px; border-radius: 12px; padding: 4px; display: flex; flex-direction: column; align-items: center; gap: 3px; background: var(--surface2); cursor: pointer; }
.cm-day.out { background: transparent; }
.cm-day.out .cm-num { color: var(--faint); }
.cm-day.past:not(.out) { background: color-mix(in srgb, var(--surface2) 55%, var(--bg)); }
.cm-num { border: 0; background: none; font: 600 15px var(--f-display); color: var(--ink); min-width: 36px; min-height: 36px; border-radius: 50%; cursor: pointer; padding: 0; }
.cm-num:hover { background: var(--fill); }
.cm-day.today .cm-num { background: var(--pink); color: #fff; }
.cm-day.sel { box-shadow: 0 0 0 2px var(--ink); }
.cm-dots { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
.cm-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--bc); }
.cm-dots b { font-size: 10px; line-height: 7px; color: var(--soft); }
.cm-items { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 3px; }
.cm-items .ci-open { min-height: 0; padding: 3px 6px 3px 9px; border-radius: 8px; grid-template-areas: 'time text tags'; box-shadow: inset 3px 0 0 var(--bc); }
.cm-items .ci-open:not(:has(.ci-time)) { grid-template-areas: 'text text tags'; }
.cm-items .ci-text { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-items .ci-time { font-size: 11px; }
/* Every day jobs folded into one line in the month (ui/calendar.js dailyHtml). */
.cm-daily .ci-open { box-shadow: inset 3px 0 0 var(--bc); background: var(--fill); }
.cm-daily .ci-text { font-weight: 800; color: var(--soft); }
.cm-more { font-size: 12px; font-weight: 900; align-self: flex-start; padding: 2px 6px; }
.cm-sel { margin-top: 12px; }
@media (min-width: 701px) {
  .cm-day { min-height: 128px; align-items: stretch; padding: 4px 6px 6px; cursor: copy; }
  .cm-num { align-self: flex-start; min-width: 30px; min-height: 30px; font-size: 14px; }
  .cm-day.drop-on { outline: 2px solid var(--pink); }
}
@media (min-width: 1280px) {
  .cm-day { min-height: 140px; }
}

/* ---------- A child's My days ---------- */
.kid-week { max-width: 1280px; }
.kw-top { margin-bottom: 12px; }
.kw-top h1 { font-size: 32px; }
.kw-weeks { margin: 0 0 12px; }
.kw-weeks .chip-btn { min-height: 48px; padding: 8px 18px; font-size: 15px; }
.kw-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin: 0 0 12px; }
.kw-chip { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 56px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-sm); color: var(--ink); text-decoration: none; font-weight: 800; font-size: 12px; }
.kw-chip b { font: 600 19px var(--f-display); }
.kw-chip.past { opacity: .6; }
.kw-chip.today { background: var(--pink); color: #fff; }
.kw-chip.all-done { box-shadow: inset 0 -4px 0 var(--mint), var(--shadow-sm); }
.kw-chip:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.kw-days { list-style: none; margin: 0 -18px; padding: 4px 18px 14px; display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 18px; overscroll-behavior-x: contain; }
.kw-day { flex: 0 0 min(86vw, 380px); scroll-snap-align: start; background: var(--surface); border-radius: 26px; padding: 16px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 10px; }
.kw-day.past { background: color-mix(in srgb, var(--surface) 62%, var(--bg)); box-shadow: none; }
.kw-day.past .kw-head, .kw-day.past .kw-job { opacity: .75; }
.kw-day.today { background: linear-gradient(160deg, var(--pink-soft), var(--sun-soft)); box-shadow: 0 0 0 3px var(--pink), var(--shadow); }
.kw-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.kw-word { font: 600 26px var(--f-display); color: var(--ink); }
.kw-day.today .kw-word { font-size: 32px; color: var(--pink-deep); }
.kw-date { font-weight: 800; color: var(--soft); font-size: 15px; }
.kw-count { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: var(--fill); font-weight: 900; font-size: 14px; color: var(--ink); }
.kw-day.all-done .kw-count { background: var(--mint-soft); }
.kw-count .kb-glyph { color: var(--sun); }
.kw-jobs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.kw-job { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 12px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-sm); transition: opacity .3s, transform .3s; }
.kw-day.today .kw-job { box-shadow: 0 2px 10px rgba(43, 34, 54, .08); }
.kw-job.done .kw-text strong { color: var(--soft); text-decoration: line-through; text-decoration-thickness: 2px; }
.kw-job.look { background: var(--surface2); box-shadow: none; }
.kw-job.completing { transform: scale(.98); }
.kw-tick { flex: none; position: relative; width: 48px; height: 48px; cursor: pointer; }
.kw-tick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.kw-tick input:disabled { cursor: default; }
.kw-tick span { pointer-events: none; position: absolute; inset: 6px; border-radius: 50%; border: 3px solid var(--line2); background: var(--surface); transition: background .2s, border-color .2s; }
.kw-tick input:not(:disabled):hover + span { border-color: var(--mint); }
.kw-tick input:checked + span { background: var(--mint); border-color: var(--mint); }
.kw-tick span::after { content: ''; position: absolute; left: 12px; top: 6px; width: 9px; height: 17px; border: solid #fff; border-width: 0 4px 4px 0; transform: rotate(45deg) scale(0); transition: transform .2s cubic-bezier(.2, .9, .3, 1.4); }
.kw-tick input:checked + span::after { transform: rotate(45deg) scale(1); }
.kw-tick input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 2px; }
.kw-tick input:disabled:not(:checked) + span { border-style: dashed; opacity: .6; }
.kw-look { flex: none; display: grid; place-items: center; width: 48px; height: 48px; }
.kw-text { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; border: 0; background: none; padding: 6px 0; min-height: 48px; text-align: left; cursor: pointer; color: var(--ink); font: inherit; }
.kw-text strong { font-size: 18px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.kw-text small { font-size: 13.5px; font-weight: 700; color: var(--soft); display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.kw-text:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 10px; }
.kw-hearts { flex: none; display: inline-flex; align-items: center; gap: 3px; padding: 6px 11px; border-radius: 999px; background: var(--kitty-soft); color: var(--kitty-deep); font-weight: 900; font-size: 16px; }
.kw-empty { margin: 6px 2px; font-weight: 700; color: var(--soft); font-size: 16px; }
.kw-cheer { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 20px; background: var(--mint-soft); color: var(--ink); animation: kw-pop .5s cubic-bezier(.2, .9, .3, 1.4) both; }
.kw-cheer strong { font: 600 19px var(--f-display); flex: 1; }
.kw-sticker { display: inline-flex; transform: rotate(-8deg); }
@keyframes kw-pop { from { transform: scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .kw-cheer { animation: none; }
  .kw-job, .kw-tick span, .kw-tick span::after { transition: none; }
  .kw-days { scroll-behavior: auto; }
}

/* The big My days card on a child's home */
.kw-home { display: flex; align-items: center; gap: 14px; min-height: 76px; margin-top: 14px; padding: 12px 16px; border-radius: 24px; background: linear-gradient(135deg, var(--sun-soft), var(--pink-soft)); color: var(--ink); text-decoration: none; box-shadow: var(--shadow-sm); transition: transform .12s, box-shadow .12s; }
.kw-home:hover { box-shadow: var(--shadow); }
.kw-home:active { transform: scale(.98); }
.kw-home:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.kw-home-ico { flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--surface); }
.kw-home-text { flex: 1; display: flex; flex-direction: column; }
.kw-home-text strong { font: 600 21px var(--f-display); }
.kw-home-text small { font-weight: 800; font-size: 14px; color: var(--soft); }
.kw-home-go { color: var(--sun); }

/* Tablets and computers: the week as a grid of big cards, today twice as wide. */
@media (min-width: 701px) {
  .kw-strip { display: none; }
  .kw-days { margin: 0; padding: 4px 0 0; overflow: visible; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); scroll-snap-type: none; }
  .kw-day { flex: none; }
  .kw-day.today { grid-column: span 2; }
}
@media (min-width: 1100px) {
  .kid-week.home { padding: 28px 32px calc(60px + var(--tabbar-h)); }
  .kw-days { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Calendar sync (1.5, ui/calSync.js): the Calendar's button and the Settings card / popover. */
.cal-sync { display: inline-flex; align-items: center; gap: 6px; }
.cal-sync .upsell-lock { margin-left: 2px; }
.calsync { display: grid; gap: 10px; }
.calsync p { margin: 0; }
.calsync-link { margin: 0; }
.calsync-link .row { align-items: center; }
.calsync-link input { min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.calsync-add .btn { text-decoration: none; }
.calsync-notes { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.calsync-paused { padding: 10px 12px; border-radius: 12px; border: 2px solid var(--line2); }
@media (max-width: 480px) { .calsync-add .btn { flex: 1 1 100%; justify-content: center; } }
