/* ── /care-schedule/ planner — page styles ───────────────────────────────────
   Loaded after base.css on the care-schedule tool page only. Lifted out of the
   page's inline <style>, where it was 956 lines that could never be cached:
   HTML bypasses the edge cache so the language redirect can run, so every view
   re-fetched it, and any copy edit invalidated all of it. As a hashed asset it
   caches at the edge and in the browser and survives copy edits.

   :root and the language-switcher rules stay inline per project convention.
   The breakpoint overrides for this page live in css/responsive.css. */

/* ── Main ── */
main { padding: 48px 24px 80px; }
.container { max-width: 1080px; margin: 0 auto; }

.page-header { margin-bottom: 32px; }
.page-header h1 {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.page-header p {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ── Card ── */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(26,30,35,0.06);
}

/* ── Top controls ── */
.controls-bar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 24px;
}
/* Top row: names on the left, Reset pinned to the top-right corner */
.controls-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  width: 100%;
}
.inputs-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
/* Undo + Reset, pinned together at the top-right */
.controls-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
/* Start/end date inputs — their own row directly under the mode switch */
.date-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
/* Shown when the chosen date range is longer than the grid can hold */
.range-hint {
  display: none;
  width: 100%;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary);
  max-width: 620px;
}
.range-hint.show { display: block; }
/* Inline clear (×) inside each date input */
.date-input-wrap { position: relative; display: inline-block; }
.date-input-wrap input { box-sizing: border-box; padding-right: 52px; }
.date-clear {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.date-clear.show { display: inline-flex; }
.date-clear:hover { background: var(--border); color: var(--text); }
.input-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.input-field label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
}
.input-field input {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface-card);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 148px;
}
.input-field input:focus {
  border-color: #B4DAD6;
  box-shadow: 0 0 0 3px #E9F5F3;
}

.btn-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  /* Reserve the taller (date-field) height so the controls sit at the
     bottom and don't jump when switching between Weeks and Dates. */
  min-height: 52px;
}

/* Stepper */
.stepper {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-card);
}
.stepper-btn {
  border: none;
  background: transparent;
  cursor: pointer;
  width: 36px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 400;
  color: var(--text);
  transition: background 0.13s;
  line-height: 1;
}
.stepper-btn:hover { background: var(--surface-subtle); }
.stepper-btn:active { background: var(--border); }
.stepper-label {
  height: 34px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: var(--surface-subtle);
  white-space: nowrap;
  min-width: 80px;
  justify-content: center;
}

/* Segmented Weeks / Dates mode switch */
.mode-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-card);
}
.mode-opt {
  border: none;
  background: transparent;
  cursor: pointer;
  height: 34px;
  padding: 0 15px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background 0.13s, color 0.13s;
  white-space: nowrap;
}
.mode-opt + .mode-opt { border-left: 1px solid var(--border); }
.mode-opt:hover { background: var(--surface-subtle); }
.mode-opt.active, .mode-opt.active:hover {
  background: var(--primary);
  color: #fff;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.13s, border-color 0.13s;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text);
  white-space: nowrap;
}
.btn:hover { background: var(--border-subtle); }
.btn-danger { color: #C1443A; }
.btn-danger:hover { background: #F5D6D3; border-color: #e8c0c0; }
.btn-primary {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}
.btn-primary:hover { background: #2c333b; }

.btn-active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}
.btn-active:hover { background: #2c333b; }

/* ── Preset patterns (Quick start) ── */
.preset-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.preset-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
  margin-right: 2px;
}
.preset-btn {
  height: 30px;
  padding: 0 12px;
  font-size: 12.5px;
}
.preset-sep {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 2px;
}
@media (max-width: 599px) {
  /* In the wrapping preset row, this 1px divider can end up stranded
     alone at the end of a line when "Swap parents" wraps past it. */
  .preset-sep {
    display: none;
  }
}

/* ── Shared-link banner ── */
.shared-banner {
  display: none;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
  padding: 12px 16px;
  border: 1px solid rgba(13, 107, 100, 0.35);
  border-radius: 12px;
  background: rgba(13, 107, 100, 0.06);
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
}
.shared-banner.show { display: flex; }
.shared-banner p { margin: 0; }
.banner-close {
  margin-left: auto;
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}
.banner-close:hover { color: var(--text); background: rgba(13, 107, 100, 0.08); }

/* ── Share card ── */
.share-card { margin-top: 24px; }
.share-card .card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.share-info h3 { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.share-info p { font-size: 13px; color: var(--text-secondary); max-width: 520px; }

/* ── Grid ── */
.grid-scroll {
  overflow-x: auto;
  border-radius: 8px;
  width: 100%;
}
#schedule-grid {
  width: fit-content;
}
.grid-scroll::-webkit-scrollbar { height: 8px; }
.grid-scroll::-webkit-scrollbar-track { background: transparent; }
.grid-scroll::-webkit-scrollbar-thumb {
  background: rgba(80,86,94,0.2);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.schedule-table {
  border-collapse: separate;
  border-spacing: 4px;
  width: max-content;
}

/* Week header row */
.th-week {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  padding: 2px 6px 6px;
  letter-spacing: 0.04em;
}
/* Day header row */
.th-day {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  padding: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 34px;
}
.th-day.weekend { color: var(--text-secondary); }
.th-date {
  font-size: 9px;
  font-weight: 400;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  margin-top: 2px;
}

/* Week separator in data row */
.td-week-sep { padding-left: 6px; }

/* Cell */
.cell {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
  user-select: none;
  /* pan-y, not none: the browser keeps vertical scrolling (the grid is taller
     than the viewport on mobile), while horizontal drag stays with the pointer
     handlers for drag-to-paint. Painting is always horizontal — within one
     parent's row — so the two gestures never compete. */
  touch-action: pan-y;
}
.cell:hover { background: var(--surface-subtle); border-color: #C8CBCF; }
.cell:active { transform: scale(0.96); }
.cell:focus-visible {
  outline: none;
  border-color: #B4DAD6;
  box-shadow: 0 0 0 3px #E9F5F3;
}

.cell.on-a {
  background: rgba(13, 107, 100, 0.28);
  border-color: rgba(13, 107, 100, 0.6);
  box-shadow: inset 0 0 0 1px rgba(13, 107, 100, 0.32);
}
.cell.on-a:hover { background: rgba(13, 107, 100, 0.36); }

.cell.on-b {
  background: rgba(224, 160, 64, 0.32);
  border-color: rgba(224, 160, 64, 0.62);
  box-shadow: inset 0 0 0 1px rgba(224, 160, 64, 0.34);
}
.cell.on-b:hover { background: rgba(224, 160, 64, 0.42); }

/* Row label column (Parent A / Parent B on the left of each data row) */
.th-corner { padding: 0; }
.td-rowlabel {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  text-align: right;
  vertical-align: middle;
  padding: 0 12px 0 2px;
}

/* Lead-in days before the start date — crossed out, not assignable */
.cell.cell-x {
  cursor: default;
  background-color: var(--surface-subtle);
  border-color: var(--border-subtle);
  box-shadow: none;
  background-image: linear-gradient(135deg, transparent 44%, var(--text-muted) 44%, var(--text-muted) 56%, transparent 56%);
  opacity: 0.65;
}
.cell.cell-x:hover { background-color: var(--surface-subtle); border-color: var(--border-subtle); }

/* Combined parent legend above the grid (mobile only) */
.grid-legend-mobile { display: none; }
.rl-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 7px;
  vertical-align: middle;
}

/* Larger tap targets on touch screens; drop the left label column and
   name both parents in one legend above the grid so a full week fits. */
@media (max-width: 599px) {
  .cell { width: 40px; height: 40px; border-radius: 9px; }
  .th-day { min-width: 40px; }
  .td-rowlabel, .th-corner { display: none; }
  .grid-legend-mobile {
    display: flex;
    gap: 18px;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
  }
  .grid-legend-mobile .gl-item { display: flex; align-items: center; }
}

/* Hint under the grid clarifying the one-parent-per-day model */
.grid-hint {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 12px;
  line-height: 1.5;
  max-width: 560px;
}

/* Divider between week groups in table body */
.td-sep { padding-left: 8px; }
.row-divider { height: 8px; }

/* ── Stats ── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 24px;
}
.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}
.stat-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 6px;
}
.stat-row:last-child { margin-bottom: 0; }
.stat-row.muted { color: var(--text-secondary); }
.stat-val { font-weight: 500; }
.stat-bar-wrap {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin: 4px 0 8px;
}
.stat-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}
.stat-bar-a { background: var(--primary); }
.stat-bar-b { background: var(--amber); }
.stat-big {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 4px;
}
.stat-sub { font-size: 13px; color: var(--text-secondary); }
.stat-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 12px 0;
}

/* ── More-details disclosure ── */
.stats-more { margin-top: 12px; }
.stats-more > summary {
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  padding: 13px 18px;
  border: 1px solid rgba(13, 107, 100, 0.35);
  border-radius: 12px;
  background: rgba(13, 107, 100, 0.06);
  display: flex;
  align-items: center;
  gap: 9px;
  user-select: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.stats-more > summary:hover {
  background: rgba(13, 107, 100, 0.1);
  border-color: rgba(13, 107, 100, 0.5);
}
.stats-more > summary::before {
  content: '';
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3v18h18'/%3E%3Crect x='7' y='12' width='3' height='6'/%3E%3Crect x='12' y='8' width='3' height='10'/%3E%3Crect x='17' y='5' width='3' height='13'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3v18h18'/%3E%3Crect x='7' y='12' width='3' height='6'/%3E%3Crect x='12' y='8' width='3' height='10'/%3E%3Crect x='17' y='5' width='3' height='13'/%3E%3C/svg%3E") center / contain no-repeat;
}
.stats-more > summary::-webkit-details-marker { display: none; }
.stats-more > summary::after {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-left: auto;
  transition: transform 0.2s ease;
}
.stats-more[open] > summary::after { transform: rotate(-135deg); }
.stats-more[open] > summary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
}
.stats-more-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

/* ── Export card ── */
.export-card {
  margin-top: 12px;
}
.export-card .card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.export-info h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}
.export-info p {
  font-size: 13px;
  color: var(--text-secondary);
}
.export-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.btn:disabled:hover { background: var(--surface-subtle); }
/* Opt-in recurrence for the .ics export — hidden unless the calendar
   export is actually available, and irrelevant once an end date bounds
   the plan. */
.ics-repeat {
  display: none;
  width: 100%;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}
.ics-repeat.show { display: flex; }
.ics-repeat input { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }
.ics-hint {
  display: none;
  width: 100%;
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}
.ics-hint.show { display: block; }

/* ── App nudge (shown after export/share) ── */
.app-nudge { display: none; margin-top: 12px; }
.app-nudge.show { display: block; }
.app-nudge .card {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  border-color: rgba(13, 107, 100, 0.35);
  background: rgba(13, 107, 100, 0.04);
}
.app-nudge p {
  flex: 1;
  min-width: 220px;
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.btn-teal {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  text-decoration: none;
}
.btn-teal:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

/* ── Info / FAQ ── */
.cs-info { padding: 0 24px 24px; }
.cs-info .container { max-width: 1080px; }
.cs-info-block { margin-top: 56px; }
.cs-info-block h2 {
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.cs-info-block > p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 68ch;
}
.cs-sched-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px 36px;
  margin: 22px 0 4px;
}
/* Each pattern is its own anchor target (#pattern-2-2-3) so answer engines
   and inbound links can cite one rotation rather than the whole section. */
.cs-sched-list > div { scroll-margin-top: 88px; }
.cs-sched-list dt {
  font-weight: 600;
  color: var(--text);
}
.cs-sched-list dt a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.cs-sched-list dt a:hover { color: var(--primary); border-bottom-color: var(--primary); }
.cs-sched-list dd {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.cs-info-next {
  margin-top: 18px;
  font-size: 15px;
  color: var(--text-secondary);
}
.cs-info-next a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  margin-left: 6px;
}
.cs-info-next a:hover { text-decoration: underline; }
.cs-info-links { margin-top: 24px; font-size: 15px; }
.cs-info-links a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.cs-info-links a:hover { text-decoration: underline; }
.cs-info-links span { margin: 0 8px; color: var(--text-muted); }

/* FAQ accordion — every answer stays in the HTML, just collapsed by default */
.cs-faq { margin-top: 18px; border-top: 1px solid var(--border-subtle); }
.cs-faq-item { border-bottom: 1px solid var(--border-subtle); }
.cs-faq-item > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 2px;
  cursor: pointer;
  list-style: none;
}
.cs-faq-item > summary::-webkit-details-marker { display: none; }
.cs-faq-item > summary::after {
  content: '';
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  margin-bottom: 3px;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}
.cs-faq-item[open] > summary::after { transform: rotate(-135deg); margin: 3px 0 0; }
.cs-faq-item > summary:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}
.cs-faq-item h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}
.cs-faq-item > summary:hover h3 { color: var(--primary); }
.cs-faq-item > p {
  margin: 0 0 18px;
  max-width: 68ch;
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.btn-appstore {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--text);
  color: #fff;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
  white-space: nowrap;
}
.btn-appstore:hover { background: #2c333b; }
.btn-appstore svg { flex-shrink: 0; }

@media print { nav, footer, .btn-row, .share-card, .export-card, .app-nudge, .shared-banner, .cs-info, #cta { display: none !important; } }