/* Only the six owned habit/thought/notification views and their sheets. */
.pw-habits-scope .pw-feature-body > * { flex-shrink: 0; }
.pw-habits-scope .pw-feature-card,
.pw-habits-sheet-scope .pw-feature-card { min-width: 0; }
.pw-habits-scope .pw-feature-row,
.pw-habits-sheet-scope .pw-feature-row { flex-wrap: wrap; align-items: flex-start; }
.pw-habits-scope .pw-feature-row > *,
.pw-habits-sheet-scope .pw-feature-row > * { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.pw-habits-scope .pw-money-digits,
.pw-habits-sheet-scope .pw-money-digits { font-size: 24px; }
.pw-habits-scope .pw-money-line,
.pw-habits-sheet-scope .pw-money-line { flex-wrap: wrap; }
.pw-habits-scope .pw-button,
.pw-habits-sheet-scope .pw-button { min-height: 48px; min-width: 48px; }
.pw-habits-scope .pw-feature-field input,
.pw-habits-scope .pw-feature-field select,
.pw-habits-sheet-scope .pw-feature-field input,
.pw-habits-sheet-scope .pw-feature-field select {
  width: 100%; min-width: 0; min-height: 48px; padding: 12px;
  border: 1px solid var(--pw-divider); border-radius: 14px;
  color: var(--pw-ink-strong); background: var(--pw-surface); font-size: 1rem;
}
.pw-habits-scope .pw-feature-field,
.pw-habits-sheet-scope .pw-feature-field { display: grid; gap: 6px; min-width: 0; }
.pw-habits-scope .pw-feature-field label,
.pw-habits-sheet-scope .pw-feature-field label { font-weight: 650; line-height: 1.45; overflow-wrap: anywhere; }
.pw-habits-scope .pw-feature-toggle,
.pw-habits-sheet-scope .pw-feature-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-width: 0; min-height: 48px; padding: 12px;
  border: 1px solid var(--pw-divider); border-radius: 16px;
  background: var(--pw-surface-soft); text-align: left; font-size: 1rem; line-height: 1.45;
}
.pw-habits-scope .pw-feature-toggle[aria-checked="true"],
.pw-habits-sheet-scope .pw-feature-toggle[aria-checked="true"] {
  border-color: var(--pw-primary-text); background: var(--pw-primary-soft);
}
.pw-habits-scope .pw-feature-toggle > span,
.pw-habits-sheet-scope .pw-feature-toggle > span { min-width: 0; overflow-wrap: anywhere; }
.pw-habits-scope .pw-feature-toggle > span:last-child,
.pw-habits-sheet-scope .pw-feature-toggle > span:last-child { flex-shrink: 0; font-size: .875rem; }
.pw-habits-scope .pw-habits-visual { height: 108px; min-height: 108px; --pw-art-size: 128px; }
.pw-habits-sheet-scope .pw-habits-sheet-art { width: 96px; height: 96px; max-width: 100%; object-fit: contain; margin: 0 auto; flex-shrink: 0; }
.pw-habits-sheet-scope.pw-flow[open] { grid-template-rows: minmax(48px, auto) minmax(0, 1fr) auto; overflow: auto; }
.pw-habits-sheet-scope .pw-flow-body { justify-content: flex-start; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 3px; }
.pw-habits-sheet-scope .pw-flow-body > * { flex-shrink: 0; }
.pw-habits-sheet-scope .pw-flow-footer { min-width: 0; }
.pw-habits-sheet-scope .pw-flow-footer .pw-button { width: 100%; }
.pw-habits-scope .pw-habits-list { display: grid; gap: 12px; list-style: none; padding: 0; margin: 0; min-width: 0; }
.pw-habits-scope .pw-habits-list > li { min-width: 0; }
.pw-habits-scope .pw-habits-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; min-width: 0; }
.pw-habits-scope .pw-habits-actions,
.pw-habits-sheet-scope .pw-habits-actions { display: grid; gap: 8px; min-width: 0; }
.pw-habits-scope .pw-habits-actions .pw-button,
.pw-habits-sheet-scope .pw-habits-actions .pw-button { width: 100%; }

/* At a 320px frame: 320 - 8 root gutter - 2 border - 2 card padding = 308.
   Seven gap-free columns are each at least 44px. Actual available width,
   not just a viewport breakpoint, chooses the weekly-list fallback. */
.pw-calendar-view { padding-inline: 4px; }
.pw-calendar-view .pw-feature-header,
.pw-calendar-view .pw-feature-footer { padding-inline: 8px; }
.pw-calendar-view .pw-feature-body { padding-inline: 0; }
.pw-calendar-view .pw-calendar-card { padding: 12px 1px; gap: 10px; }
.pw-calendar-view .pw-calendar-explanation { padding-inline: 8px; }
.pw-calendar-view .pw-calendar-toolbar {
  display: grid; grid-template-columns: 76px minmax(0, 1fr) 76px; gap: 0;
  align-items: center; min-width: 0;
}
.pw-calendar-view .pw-calendar-toolbar .pw-button { padding: 8px 4px; font-size: .875rem; }
.pw-calendar-view .pw-calendar-month { text-align: center; font-size: 1rem; line-height: 1.45; overflow-wrap: anywhere; }
.pw-calendar-view .pw-calendar-layout { min-width: 0; width: 100%; }
.pw-calendar-view .pw-calendar-table { width: 100%; table-layout: fixed; border-collapse: collapse; border-spacing: 0; }
.pw-calendar-view .pw-calendar-table th { height: 32px; padding: 0; color: var(--pw-ink-muted); font-size: .75rem; font-weight: 650; text-align: center; }
.pw-calendar-view .pw-calendar-table td { padding: 0; border: 0; vertical-align: top; }
.pw-calendar-view .pw-calendar-day {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  width: 100%; min-width: 44px; min-height: 60px; padding: 4px 0; margin: 0;
  border: 1px solid transparent; border-radius: 9px; background: transparent;
  color: var(--pw-ink-strong); font-size: .875rem; line-height: 1.2;
}
.pw-calendar-view .pw-calendar-day[data-recorded="true"] { background: var(--pw-primary-soft); }
.pw-calendar-view .pw-calendar-day[aria-current="date"] { border-color: var(--pw-primary-text); }
.pw-calendar-view .pw-calendar-day:hover { background: var(--pw-visual-blue); }
.pw-calendar-view .pw-calendar-day:focus-visible { outline-offset: -3px; }
.pw-calendar-view .pw-calendar-day-number { font-weight: 750; font-variant-numeric: tabular-nums; }
.pw-calendar-view .pw-calendar-day-mark { font-size: 11px; line-height: 1.25; color: var(--pw-primary-text); }
.pw-calendar-view .pw-calendar-blank { display: block; min-height: 60px; }
.pw-calendar-view .pw-calendar-week-lists { display: none; gap: 14px; padding-inline: 8px; }
.pw-calendar-view .pw-calendar-layout[data-list-fallback="true"] .pw-calendar-table { display: none; }
.pw-calendar-view .pw-calendar-layout[data-list-fallback="true"] .pw-calendar-week-lists { display: grid; }
.pw-calendar-view .pw-calendar-week { display: grid; gap: 8px; min-width: 0; }
.pw-calendar-view .pw-calendar-week-title { margin: 0; font-size: 1rem; line-height: 1.45; }
.pw-calendar-view .pw-calendar-date-list { display: grid; gap: 4px; list-style: none; margin: 0; padding: 0; min-width: 0; }
.pw-calendar-view .pw-calendar-list-day {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px;
  width: 100%; min-height: 48px; padding: 10px; border: 1px solid var(--pw-divider);
  border-radius: 12px; background: var(--pw-surface); font-size: 1rem; text-align: left; line-height: 1.45;
}
.pw-calendar-view .pw-calendar-list-day[data-recorded="true"] { background: var(--pw-primary-soft); }
.pw-calendar-view .pw-calendar-list-day[aria-current="date"] { border-color: var(--pw-primary-text); }
.pw-calendar-view .pw-calendar-list-day > span { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.pw-calendar-view .pw-calendar-list-status { color: var(--pw-ink-muted); font-size: .875rem; }

.pw-habits-scope .pw-streak-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; list-style: none; padding: 0; margin: 0; min-width: 0; }
.pw-habits-scope .pw-streak-day { display: grid; gap: 8px; align-content: center; min-width: 0; min-height: 80px; padding: 8px 3px; border: 1px solid var(--pw-divider); border-radius: 12px; text-align: center; overflow-wrap: anywhere; }
.pw-habits-scope .pw-streak-day[data-recorded="true"] { border-color: var(--pw-primary-text); background: var(--pw-primary-soft); }
.pw-habits-scope .pw-streak-day[aria-current="date"] { outline: 1px solid var(--pw-primary-text); outline-offset: 2px; }
.pw-habits-scope .pw-streak-day-label { font-size: .75rem; font-weight: 650; }
.pw-habits-scope .pw-streak-day-state { font-size: .75rem; line-height: 1.4; }
.pw-notification-view .pw-notification-select { display: flex; align-items: center; gap: 10px; min-height: 48px; min-width: 0; line-height: 1.45; }
.pw-notification-view .pw-notification-select input { width: 24px; height: 24px; flex-shrink: 0; accent-color: var(--pw-primary-text); }
.pw-notification-view .pw-notification-controls { display: grid; gap: 10px; min-width: 0; }

@media (max-width: 420px) {
  .pw-habits-scope .pw-habits-filters { grid-template-columns: minmax(0, 1fr); }
  .pw-habits-scope .pw-streak-week { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
}
.pw-accessible .pw-calendar-view .pw-calendar-table { display: none; }
.pw-accessible .pw-calendar-view .pw-calendar-week-lists { display: grid; }
.pw-accessible .pw-calendar-view .pw-calendar-toolbar { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.pw-accessible .pw-calendar-view .pw-calendar-month { grid-row: 1; }
.pw-accessible .pw-habits-scope .pw-habits-filters,
.pw-accessible .pw-habits-scope .pw-streak-week { grid-template-columns: minmax(0, 1fr); }
.pw-accessible .pw-habits-scope .pw-streak-day { min-height: 48px; padding: 12px; text-align: left; }
.pw-accessible .pw-habits-scope .pw-streak-day-label,
.pw-accessible .pw-habits-scope .pw-streak-day-state { font-size: 1rem; }
.pw-accessible .pw-habits-scope .pw-status-chip,
.pw-accessible .pw-habits-sheet-scope .pw-status-chip { font-size: .875rem; }
.pw-accessible .pw-habits-scope .pw-feature-toggle,
.pw-accessible .pw-habits-sheet-scope .pw-feature-toggle { flex-wrap: wrap; }
.pw-accessible .pw-habits-scope .pw-money-digits,
.pw-accessible .pw-habits-sheet-scope .pw-money-digits { font-size: 1.5rem; }
.pw-habits-sheet-scope[data-compact="true"] .pw-habits-sheet-art { width: 64px; height: 64px; }
