/* ============================================================
   Kirbelle Offshift
   Design system: 4 themes via CSS custom properties + evening
   dim palette override, system font stack.
   ============================================================ */

/* ---- Themes ---- */

:root,
[data-theme="calm-teal"] {
  --bg:           #FAF8F4;
  --surface:      #FFFFFF;
  --ink:          #1A2B2E;
  --ink-soft:     #4A5C5F;
  --primary:      #2A7F8A;
  --primary-ink:  #FFFFFF;
  --primary-soft: #E6F1F2;
  --secondary:    #7FB29A;
  --accent:       #E8A23D;
  --border:       #E4E0D8;
  --alert:        #C2412D;
  --alert-ink:    #FFFFFF;
  --success:      #3E8E5A;
  --success-ink:  #FFFFFF;
  --danger:       #C2412D;
  --danger-ink:   #FFFFFF;

  --shadow-sm: 0 1px 3px rgba(26,43,46,.10);
  --shadow-md: 0 2px 8px rgba(26,43,46,.12);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

[data-theme="warm-sand"] {
  --bg:           #F6F0E7;
  --surface:      #FFFEFB;
  --ink:          #2A2420;
  --ink-soft:     #6B5E52;
  --primary:      #C0894A;
  --primary-ink:  #FFFFFF;
  --primary-soft: #F1E4D2;
  --secondary:    #8A9A6B;
  --accent:       #2A7F8A;
  --border:       #E6DCCB;
  --alert:        #C2412D;
  --alert-ink:    #FFFFFF;
  --success:      #3E8E5A;
  --success-ink:  #FFFFFF;
  --danger:       #C2412D;
  --danger-ink:   #FFFFFF;

  --shadow-sm: 0 1px 3px rgba(42,36,32,.10);
  --shadow-md: 0 2px 8px rgba(42,36,32,.12);
}

[data-theme="soft-dark"] {
  --bg:           #15201F;
  --surface:      #1E2B2A;
  --ink:          #ECF1F0;
  --ink-soft:     #A9B8B6;
  --primary:      #4FB3BE;
  --primary-ink:  #10201F;
  --primary-soft: #23373A;
  --secondary:    #8FC4AB;
  --accent:       #F0B45A;
  --border:       #2C3B3A;
  --alert:        #E0563F;
  --alert-ink:    #1A1110;
  --success:      #5FB783;
  --success-ink:  #0D1A10;
  --danger:       #E0563F;
  --danger-ink:   #1A1110;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.30);
  --shadow-md: 0 2px 8px rgba(0,0,0,.35);
}

[data-theme="spirited"] {
  --bg:           #FFFFFF;
  --surface:      #F7FAFA;
  --ink:          #10242A;
  --ink-soft:     #46606A;
  --primary:      #0E6E7C;
  --primary-ink:  #FFFFFF;
  --primary-soft: #D7EBED;
  --secondary:    #5B6FB0;
  --accent:       #F2A93B;
  --border:       #DDE7E8;
  --alert:        #C2412D;
  --alert-ink:    #FFFFFF;
  --success:      #3E8E5A;
  --success-ink:  #FFFFFF;
  --danger:       #C2412D;
  --danger-ink:   #FFFFFF;

  --shadow-sm: 0 1px 3px rgba(16,36,42,.08);
  --shadow-md: 0 2px 8px rgba(16,36,42,.10);
}

/* ---- Text scale ---- */

:root {
  --text-base: 16px;
  --text-sm:   calc(var(--text-base) * 0.875);
  --text-lg:   calc(var(--text-base) * 1.25);
  --text-xl:   calc(var(--text-base) * 1.5);
  --text-2xl:  calc(var(--text-base) * 1.875);
}

[data-text-size="small"]  { --text-base: 14px; }
[data-text-size="medium"] { --text-base: 16px; }
[data-text-size="large"]  { --text-base: 18px; }
[data-text-size="xl"]     { --text-base: 20px; }

/* ---- Reduce motion ---- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

[data-reduce-motion="true"] *,
[data-reduce-motion="true"] *::before,
[data-reduce-motion="true"] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
}

/* ---- Reset / Base ---- */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  font-size: var(--text-base);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: var(--text-base);
  line-height: 1.55;
  background-color: var(--bg);
  color: var(--ink);
  height: 100dvh;
  overflow: hidden;   /* body never scrolls — main scrolls internally */
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }

/* ---- Layout ---- */

.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* Storage banner */
.storage-banner {
  background: var(--alert);
  color: var(--alert-ink);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--text-sm);
  font-weight: 600;
  flex-shrink: 0;
  z-index: 200;
}

.storage-banner[hidden] { display: none; }

.storage-banner__msg { flex: 1; }

.storage-banner__close {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.storage-banner__close:focus-visible {
  outline: 2px solid var(--alert-ink);
  outline-offset: 2px;
}

/* Header */
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-brand {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.brand-name {
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--primary);
  letter-spacing: -0.01em;
}

.brand-edition {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  font-weight: 400;
}

.app-version {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  font-weight: 500;
  background: var(--primary-soft);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 99px;
}

/* Main content */
#main-content {
  flex: 1;
  min-height: 0;       /* allows flex item to shrink below content height */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.view-inner {
  max-width: 700px;
  margin: 0 auto;
  padding: 20px 16px 32px;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.view-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.view-date {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

/* Bottom nav */
.bottom-nav {
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 100;
  box-shadow: 0 -1px 4px rgba(0,0,0,.06);
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  min-height: 56px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 11px;
  font-family: inherit;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
  border-top: 2px solid transparent;
  position: relative;
}

.nav-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  border-radius: var(--radius-sm);
}

.nav-btn--active {
  color: var(--primary);
  border-top-color: var(--primary);
}

.nav-btn svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.nav-btn:hover:not(.nav-btn--active) {
  color: var(--ink);
  background: var(--primary-soft);
}

/* Footer */
.app-footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 10px 16px;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--ink-soft);
  flex-shrink: 0;
}

/* ---- Utility ---- */

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0,0,0,0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  line-height: 1.2;
}

.btn:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-ink);
  border-color: var(--primary);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: var(--shadow-sm);
}

.btn-primary:active:not(:disabled) {
  filter: brightness(0.95);
}

.btn-secondary {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--primary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--primary-soft);
}

.btn-danger {
  background: var(--danger);
  color: var(--danger-ink);
  border-color: var(--danger);
}

.btn-danger:hover:not(:disabled) {
  filter: brightness(1.05);
}

.btn-sm {
  min-height: 36px;
  padding: 6px 14px;
  font-size: var(--text-sm);
}

/* ---- Toggle switch ---- */

.toggle {
  position: relative;
  width: 50px;
  height: 28px;
  background: var(--border);
  border: none;
  border-radius: 99px;
  cursor: pointer;
  transition: background 0.18s;
  flex-shrink: 0;
  min-width: 50px;
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 3px;
}

.toggle[aria-checked="true"] {
  background: var(--primary);
}

.toggle-thumb {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  transition: transform 0.18s;
  transform: translateX(0);
  pointer-events: none;
}

.toggle[aria-checked="true"] .toggle-thumb {
  transform: translateX(22px);
}

.toggle:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* ---- Forms ---- */

.setting-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  color: var(--ink);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 32px 8px 10px;
  font-family: inherit;
  font-size: var(--text-base);
  cursor: pointer;
  min-height: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%234A5C5F' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 8px;
}

.setting-select:focus {
  outline: 3px solid var(--primary);
  outline-offset: 1px;
  border-color: var(--primary);
}

/* ---- Settings view ---- */

.settings-section {
  margin-bottom: 28px;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
}

.settings-section-title {
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}

.settings-section-title--danger {
  color: var(--danger);
}

.settings-section--danger {
  border-color: var(--danger);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  min-height: 64px;
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-label {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--ink);
}

.setting-label-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.setting-label-group .setting-label {
  font-weight: 600;
}

.setting-hint {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

.settings-note {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  padding: 12px 16px;
  line-height: 1.5;
}

.settings-note--small {
  font-size: calc(var(--text-sm) * 0.95);
  padding-top: 4px;
}

.settings-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 4px 16px 16px;
}

.settings-actions .btn {
  flex: 1;
  min-width: 120px;
}

/* About block */
.about-block {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.about-product {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--ink);
}

.about-meta {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

.about-tagline {
  font-size: var(--text-sm);
  color: var(--primary);
  font-weight: 600;
}

.about-disclaimer {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  font-style: italic;
  border-left: 3px solid var(--border);
  padding-left: 10px;
  margin-top: 4px;
}

.about-data-note {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

/* ---- Empty states ---- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 48px 24px;
  gap: 12px;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  color: var(--border);
  margin-bottom: 8px;
}

.empty-state-icon svg {
  width: 100%;
  height: 100%;
}

.empty-state-heading {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--ink);
}

.empty-state-body {
  font-size: var(--text-base);
  color: var(--ink-soft);
  max-width: 320px;
  line-height: 1.55;
}

.empty-state-cta {
  margin-top: 8px;
}

.loading-note {
  color: var(--ink-soft);
  font-size: var(--text-sm);
  text-align: center;
  padding: 32px;
}

/* ---- Disclaimer inline ---- */

.disclaimer-inline {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  font-style: italic;
  text-align: center;
  padding: 0 16px 16px;
}

/* ---- Safety Alert Band ---- */

.alert-band {
  background: var(--alert);
  color: var(--alert-ink);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.alert-band__icon {
  font-size: 1.3em;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-band__label {
  font-weight: 700;
  font-size: var(--text-sm);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.alert-band__flags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.alert-flag {
  background: rgba(255,255,255,0.22);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: var(--text-sm);
  font-weight: 600;
}

/* ---- Toast ---- */

.app-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 20px;
  border-radius: 99px;
  font-size: var(--text-sm);
  font-weight: 600;
  z-index: 500;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  text-align: center;
}

.app-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.app-toast--error {
  background: var(--alert);
  color: var(--alert-ink);
}

/* ---- Day brief overlay ---- */

.day-brief-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  padding: 16px;
}

.day-brief-overlay[hidden] { display: none; }

.day-brief-panel {
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-md) var(--radius-md);
  padding: 24px 20px;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  box-shadow: var(--shadow-md);
}

.day-brief-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.day-brief-date {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  margin-bottom: 16px;
}

.day-brief-list {
  list-style: none;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.day-brief-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.day-brief-time {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--primary);
  min-width: 46px;
}

.day-brief-pet {
  flex: 1;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--ink);
}

.alert-badge {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--alert);
  background: rgba(194,65,45,.12);
  border: 1px solid var(--alert);
  border-radius: 4px;
  padding: 2px 7px;
  flex-shrink: 0;
}

[data-theme="soft-dark"] .alert-badge {
  background: rgba(224,86,63,.15);
}

.day-brief-close {
  width: 100%;
}

/* ---- Card ---- */

.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* ---- Pet list ---- */

.pet-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pet-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.pet-card--has-alert {
  border-color: var(--alert);
  border-width: 2px;
}

.pet-card__alert-bar {
  background: var(--alert);
  color: var(--alert-ink);
  padding: 5px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.pet-card__btn {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px 14px 14px;
  text-align: left;
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--ink);
  min-height: 64px;
  transition: background 0.12s;
}

.pet-card__btn:hover {
  background: var(--primary-soft);
}

.pet-card__btn:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: -2px;
  border-radius: var(--radius-md);
}

.pet-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pet-card__name {
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pet-card__meta {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

.pet-card__owner {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pet-card__chevron {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--ink-soft);
}

/* ---- Pet profile (detail) ---- */

.pet-profile__name {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  line-height: 1.2;
}

.pet-profile__meta {
  font-size: var(--text-base);
  color: var(--ink-soft);
  margin-bottom: 2px;
}

.profile-section {
  margin-top: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.profile-section__title {
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.profile-field {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-base);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-field:last-child {
  border-bottom: none;
}

.profile-field__label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-soft);
}

.profile-field__text {
  margin-top: 4px;
  white-space: pre-wrap;
  word-break: break-word;
}

.profile-link {
  color: var(--primary);
  text-decoration: none;
}

.profile-link:hover {
  text-decoration: underline;
}

/* ---- Alert Band (in pet profile) ---- */

.alert-band {
  background: var(--alert);
  color: var(--alert-ink);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.alert-band__icon {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--alert-ink);
}

.alert-band__icon svg {
  width: 22px;
  height: 22px;
}

.alert-band__body {
  flex: 1;
}

.alert-band__title {
  font-weight: 800;
  font-size: var(--text-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.alert-flag-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.alert-flag-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.alert-flag-item__label {
  font-weight: 700;
  font-size: var(--text-sm);
}

.alert-flag-item__note {
  font-size: var(--text-sm);
  opacity: 0.9;
}

/* ---- Pet form ---- */

.form-section {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 16px;
  overflow: hidden;
}

.form-section__title {
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}

.form-section__hint {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  padding: 10px 16px 0;
}

.form-group {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

/* Remove double-border at bottom of section */
.form-section > .form-group:last-child,
.form-section > .form-row:last-child > .form-group {
  border-bottom: none;
}

.form-group--toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.form-label--sm {
  font-size: calc(var(--text-sm) * 0.9);
}

.form-hint-text {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  margin-top: 2px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 44px;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

.form-input[aria-invalid="true"] {
  border-color: var(--alert);
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
}

.form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%234A5C5F' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px 8px;
  padding-right: 32px;
}

.form-checkbox {
  width: 22px;
  height: 22px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
  min-width: 22px;
}

.form-row {
  display: flex;
  gap: 0;
}

.form-row .form-group {
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.form-row .form-group:first-child {
  border-right: 1px solid var(--border);
}

.form-error {
  display: block;
  font-size: var(--text-sm);
  color: var(--alert);
  font-weight: 600;
  margin-top: 4px;
}

.form-error[hidden] { display: none; }

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  margin-bottom: 8px;
}

.form-actions .btn {
  flex: 1;
}

/* Flag rows in form */

.flag-list {
  display: flex;
  flex-direction: column;
}

.flag-row {
  border-bottom: 1px solid var(--border);
  padding: 0;
}

.flag-row:last-child {
  border-bottom: none;
}

.flag-row__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  min-height: 56px;
}

.flag-row__label {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--ink);
}

.flag-row__note {
  padding: 0 16px 14px;
}

.flag-row__note--hidden {
  display: none;
}

/* Back button */

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--primary);
  padding: 6px 2px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  transition: color 0.12s;
}

.btn-back:hover {
  color: var(--ink);
}

.btn-back:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.view-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ---- Responsive ---- */

@media (min-width: 600px) {
  .view-inner {
    padding: 28px 24px 40px;
  }

  .settings-actions {
    flex-wrap: nowrap;
  }

  .day-brief-overlay {
    align-items: center;
  }

  .day-brief-panel {
    border-radius: var(--radius-lg);
  }
}

@media (min-width: 900px) {
  .view-inner {
    padding: 36px 0 48px;
  }

  .bottom-nav {
    /* On large screens, keep bottom nav but make it slightly taller */
    height: 64px;
  }

  .nav-btn {
    font-size: 12px;
  }
}

/* ---- Schedule view — Stage 3 ---- */

.schedule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.schedule-tabs {
  display: flex;
  gap: 0;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
}

.schedule-tab {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-soft);
  padding: 6px 18px;
  border-radius: calc(var(--radius-md) - 2px);
  transition: background 0.12s, color 0.12s;
  min-height: 36px;
}

.schedule-tab--active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.schedule-tab:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* Today header */

.schedule-today { display: flex; flex-direction: column; gap: 16px; }

.schedule-day-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.schedule-day-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.schedule-day-count {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  margin-top: 2px;
}

/* Appointment list */

.appt-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Appointment card */

.appt-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: opacity 0.2s;
}

.appt-card--completed { opacity: 0.65; }
.appt-card--cancelled { opacity: 0.45; }

.appt-card__alert-bar {
  background: var(--alert);
  color: var(--alert-ink);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.appt-card__main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
}

.appt-card__time {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 58px;
  flex-shrink: 0;
  padding-top: 2px;
}

.appt-time-start {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--primary);
}

.appt-time-end {
  font-size: var(--text-xs, 11px);
  color: var(--ink-soft);
}

.appt-card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.appt-card__pet {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appt-card__owner,
.appt-card__services {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

.appt-card__price {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
}

.appt-card__notes {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  white-space: pre-wrap;
  word-break: break-word;
}

.appt-card__recurrence {
  font-size: var(--text-sm);
  color: var(--primary);
  opacity: 0.8;
}

.appt-status-badge {
  display: inline-block;
  font-size: var(--text-sm);
  font-weight: 700;
  border-radius: 4px;
  padding: 2px 8px;
  margin-top: 4px;
  width: fit-content;
}

.appt-status-badge--done {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  border: 1px solid var(--primary);
}

.appt-status-badge--cancelled {
  background: var(--bg);
  color: var(--ink-soft);
  border: 1px solid var(--border);
}

.appt-card__actions {
  display: flex;
  gap: 8px;
  padding: 0 14px 14px;
}

.appt-action-btn {
  flex: 1;
}

.appt-action-complete {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary);
  border-color: var(--primary);
}

.appt-action-complete:hover:not(:disabled) {
  background: var(--primary);
  color: var(--primary-ink);
}

.appt-action-cancel {
  color: var(--alert);
  border-color: var(--alert);
}

.appt-action-cancel:hover:not(:disabled) {
  background: color-mix(in srgb, var(--alert) 8%, transparent);
}

/* Week view */

.schedule-week {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.week-range {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--ink);
}

.btn-icon {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
}

.btn-icon:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary);
}

.btn-icon:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.week-day {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  min-height: 72px;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s;
}

.week-day:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.week-day:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.week-day--today {
  background: var(--primary);
  border-color: var(--primary);
}

.week-day--today .week-day__name,
.week-day--today .week-day__num {
  color: var(--primary-ink);
}

.week-day__name {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.week-day__num {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--ink);
}

.week-day__count {
  font-size: 10px;
  font-weight: 700;
  background: var(--primary);
  color: var(--primary-ink);
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
}

.week-day--today .week-day__count {
  background: var(--primary-ink);
  color: var(--primary);
}

.week-day__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  /* transparent — just reserves space */
}

.week-day--has-appts .week-day__dot {
  background: var(--primary);
}

/* Rebooking prompt */

.rebook-prompt {
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}

.rebook-prompt__body {
  flex: 1;
  min-width: 0;
  font-size: var(--text-sm);
  color: var(--ink);
}

.rebook-prompt__body strong {
  display: block;
  font-size: var(--text-base);
  margin-bottom: 2px;
}

.rebook-prompt__body p {
  color: var(--ink-soft);
  margin: 0;
}

.rebook-prompt__actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

/* ---- Service history (in pet detail) — Stage 4 ---- */

.history-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.history-row__date {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  min-width: 72px;
  flex-shrink: 0;
}

.history-row__services {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-row__earned {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink);
  flex-shrink: 0;
}

/* ---- Photos section — Stage 4 ---- */

.profile-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0;
}

.profile-section__header .profile-section__title {
  border-bottom: none;
  padding-bottom: 0;
}

.profile-section__header + * {
  border-top: 1px solid var(--border);
}

.photos-add-btns {
  display: flex;
  gap: 6px;
  padding-right: 6px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 12px 16px;
}

.photo-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.photo-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
}

.photo-caption {
  display: flex;
  align-items: center;
  gap: 6px;
}

.photo-type-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
}

.photo-type-badge--before {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
}

.photo-type-badge--after {
  background: color-mix(in srgb, var(--secondary) 15%, transparent);
  color: var(--secondary);
  border: 1px solid color-mix(in srgb, var(--secondary) 30%, transparent);
}

.photo-date {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

.photo-delete-btn {
  background: none;
  border-color: var(--border);
  color: var(--alert);
  width: 100%;
  min-height: 32px;
  font-size: var(--text-sm);
}

.photo-delete-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--alert) 8%, transparent);
  border-color: var(--alert);
}

/* ---- Finances view — Stage 4 ---- */

.finances-tabs {
  display: flex;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: 16px;
}

.finances-tab {
  flex: 1;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-soft);
  padding: 7px 4px;
  border-radius: calc(var(--radius-md) - 2px);
  transition: background 0.12s, color 0.12s;
  min-height: 36px;
}

.finances-tab--active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.finances-tab:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

/* Month nav */

.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.month-label {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--ink);
}

/* Summary grid */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.summary-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-cell--net {
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 25%, transparent);
}

.summary-label {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  font-weight: 600;
}

.summary-value {
  font-size: var(--text-xl);
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.summary-value--expense { color: var(--alert); }
.summary-value--negative { color: var(--alert); }

/* Bar chart */

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 100px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 8px 0;
  margin-bottom: 6px;
}

.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.chart-bars {
  width: 100%;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  flex: 1;
  min-height: 0;
}

.chart-bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  transition: height 0.3s ease;
}

.chart-bar--income  { background: var(--primary); }
.chart-bar--expense { background: var(--accent); opacity: 0.85; }

.chart-label {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 3px 0 4px;
  width: 100%;
  text-align: center;
  transition: color 0.12s;
}

.chart-label--active { color: var(--primary); }
.chart-label:hover   { color: var(--primary); }
.chart-label:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.chart-col--active .chart-bars {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 3px;
}

.chart-legend {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  vertical-align: middle;
}

.legend-dot--income  { background: var(--primary); }
.legend-dot--expense { background: var(--accent); opacity: 0.85; }

/* Ledger list */

.ledger-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.ledger-section-title {
  font-size: var(--text-lg, 18px);
  font-weight: 700;
  color: var(--ink);
}

.ledger-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ledger-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ledger-row__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.ledger-row__date {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

.ledger-row__cat {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--ink);
}

.ledger-row__note {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

.ledger-row__right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ledger-row__amount {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--ink);
}

.ledger-edit-btn {
  background: none;
  border-color: var(--border);
  color: var(--primary);
  min-height: 30px;
  padding: 4px 10px;
  font-size: var(--text-sm);
}

.ledger-del-btn {
  background: none;
  border-color: var(--border);
  color: var(--alert);
  min-height: 30px;
  min-width: 30px;
  padding: 4px 8px;
  font-size: var(--text-base);
  font-weight: 700;
}

.ledger-del-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--alert) 8%, transparent);
  border-color: var(--alert);
}

/* Ledger form */

.ledger-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.ledger-form__title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 16px;
}

.ledger-form .form-group {
  padding: 0;
  border-bottom: none;
  margin-bottom: 14px;
}

/* ---- Skip link (a11y) — Stage 5 ---- */

.skip-link {
  position: absolute;
  top: -100%;
  left: 8px;
  background: var(--primary);
  color: var(--primary-ink);
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  text-decoration: none;
  z-index: 999;
  font-size: var(--text-base);
  transition: top 0.12s;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid var(--primary-ink);
  outline-offset: 2px;
}

/* ---- Today's Focus card — Stage 5 ---- */

.focus-card {
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
  border: 1.5px solid color-mix(in srgb, var(--primary) 30%, transparent);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.focus-card__body {
  flex: 1;
  min-width: 0;
}

.focus-card__label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.focus-card__tip {
  font-size: var(--text-base);
  color: var(--ink);
  margin: 0;
  line-height: 1.5;
}

.focus-card__dismiss {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-soft);
  padding: 2px;
  min-width: 28px;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: color 0.12s, background 0.12s;
}

.focus-card__dismiss:hover {
  color: var(--ink);
  background: var(--bg);
}

.focus-card__dismiss:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* ---- Notes view — Stage 5 ---- */

.notes-tabs {
  display: flex;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: 16px;
}

.notes-tab {
  flex: 1;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-soft);
  padding: 7px 4px;
  border-radius: calc(var(--radius-md) - 2px);
  transition: background 0.12s, color 0.12s;
  min-height: 36px;
}

.notes-tab--active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.notes-tab:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

/* Brain dump */

.braindump-capture {
  margin-bottom: 16px;
}

.braindump-input-row {
  display: flex;
  gap: 8px;
}

.braindump-input {
  flex: 1;
}

.braindump-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style: none;
}

.braindump-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.braindump-item__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.braindump-item__text {
  font-size: var(--text-base);
  color: var(--ink);
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.braindump-item__date {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

.braindump-item__del {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-soft);
  padding: 4px;
  min-width: 28px;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: color 0.12s, background 0.12s;
}

.braindump-item__del:hover {
  color: var(--alert);
  background: color-mix(in srgb, var(--alert) 8%, transparent);
}

.braindump-item__del:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* Notepad */

.notepad-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.notepad-textarea {
  width: 100%;
  min-height: 300px;
  resize: vertical;
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  line-height: 1.6;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.notepad-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

.notepad-hint {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  margin: 0;
  text-align: right;
}

/* ---- Patch 02: Payment / income / outstanding styles ---- */

/* Summary tab guidance */
.summary-guidance {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0 0 var(--space-3) 0;
}

.summary-empty-hint {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0 0 var(--space-3) 0;
}

.btn-inline-link {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
  font-weight: 500;
  min-height: 44px;
  min-width: 44px;
}

.summary-add-tip {
  display: block;
  margin-top: var(--space-1);
}

/* Outstanding card — finances summary */
.outstanding-card {
  background: var(--amber-bg, #fff8e7);
  border: 2px solid var(--amber-border, #e6a800);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin: var(--space-3) 0;
}

[data-theme="soft-dark"] .outstanding-card {
  background: rgba(230, 168, 0, 0.15);
  border-color: #e6a800;
}

.outstanding-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-2);
}

.outstanding-card__label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}

.outstanding-card__total {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
}

.outstanding-card__row {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}

.outstanding-card__row--pastdue {
  color: #c0392b;
  font-weight: 600;
}

[data-theme="soft-dark"] .outstanding-card__row--pastdue {
  color: #ff6b6b;
}

.outstanding-card__cta {
  margin-top: var(--space-2);
}

/* Balance chip — pet profile */
.balance-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full, 9999px);
  font-size: var(--text-sm);
  font-weight: 600;
  margin: var(--space-2) 0 var(--space-1) 0;
}

.balance-chip--current {
  background: var(--amber-bg, #fff8e7);
  color: #7a5900;
  border: 1.5px solid var(--amber-border, #e6a800);
}

[data-theme="soft-dark"] .balance-chip--current {
  background: rgba(230, 168, 0, 0.18);
  color: #f5c842;
  border-color: #e6a800;
}

.balance-chip--pastdue {
  background: #fdecea;
  color: #c0392b;
  border: 1.5px solid #c0392b;
}

[data-theme="soft-dark"] .balance-chip--pastdue {
  background: rgba(192, 57, 43, 0.18);
  color: #ff6b6b;
  border-color: #ff6b6b;
}

.balance-chip__icon {
  font-style: normal;
}

/* Payment status badges */
.status-badge {
  display: inline-block;
  font-size: var(--text-xs, 11px);
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  vertical-align: middle;
}

.status-badge--owed {
  background: #fdecea;
  color: #c0392b;
  border: 1px solid #c0392b;
}

.status-badge--partial {
  background: #fff8e7;
  color: #7a5900;
  border: 1px solid #e6a800;
}

[data-theme="soft-dark"] .status-badge--owed {
  background: rgba(192, 57, 43, 0.18);
  color: #ff6b6b;
  border-color: #ff6b6b;
}

[data-theme="soft-dark"] .status-badge--partial {
  background: rgba(230, 168, 0, 0.18);
  color: #f5c842;
  border-color: #e6a800;
}

/* Ledger row additions */
.ledger-row--pastdue {
  border-left: 3px solid #c0392b;
}

.ledger-row__tip {
  font-size: var(--text-xs, 11px);
  color: var(--text-secondary);
  display: block;
}

.ledger-row__owed {
  font-size: var(--text-xs, 11px);
  color: #c0392b;
  font-weight: 600;
  display: block;
}

[data-theme="soft-dark"] .ledger-row__owed {
  color: #ff6b6b;
}

/* Payment plan cards */
.plan-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-3);
}

.plan-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-2);
}

.plan-card__label {
  font-weight: 600;
  color: var(--text-primary);
  display: block;
}

.plan-card__pet {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  display: block;
  margin-top: 2px;
}

.plan-card__progress {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.plan-card__sep {
  color: var(--border);
}

.plan-card__view {
  margin-top: var(--space-1);
}

.plan-list {
  margin-bottom: var(--space-4);
}

/* Plan detail / installments */
.plan-detail {
  padding: var(--space-4);
}

.plan-detail__label {
  font-size: var(--text-lg);
  font-weight: 700;
  margin: 0 0 var(--space-1) 0;
}

.plan-detail__pet {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin: 0 0 var(--space-2) 0;
}

.plan-detail__summary {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0 0 var(--space-4) 0;
}

.plan-installment-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.plan-installment {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}

.plan-installment--paid {
  opacity: 0.6;
}

.plan-installment--pastdue {
  border-left: 3px solid #c0392b;
}

.plan-installment__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.plan-installment__date {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.plan-installment__amount {
  font-weight: 600;
}

.plan-installment__status {
  font-size: var(--text-xs, 11px);
  color: var(--text-secondary);
}

.plan-installment__status--paid {
  color: var(--secondary);
}

.plan-installment__status--pastdue {
  color: #c0392b;
  font-weight: 600;
}

[data-theme="soft-dark"] .plan-installment__status--pastdue {
  color: #ff6b6b;
}

/* Plan form installment rows */
.installment-row__inner {
  align-items: flex-end;
}

/* Income tab layout */
.finances-income {
  padding: var(--space-4);
}

/* sr-only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ---- Draft resume prompt ---- */

.draft-prompt {
  background: var(--bg-card);
  border: 2px solid var(--primary);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}

.draft-prompt__text {
  font-size: var(--text-sm);
  color: var(--text-primary);
  margin: 0 0 var(--space-2) 0;
  font-weight: 500;
}

.draft-prompt__actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.draft-prompt__actions .btn {
  min-height: 44px;
  min-width: 88px;
}

/* ---- Focus ring global ---- */

:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Remove default focus for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* ---- Patch 03: Restriction flags ---- */

/* Restriction band on pet profile — NOT the solid-red alert band */
.restriction-band {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: var(--space-3);
}

.restriction-band__icon {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--text-secondary);
}

.restriction-band__body {
  flex: 1;
}

.restriction-band__title {
  font-weight: 800;
  font-size: var(--text-sm);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.restriction-flag-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0;
}

.restriction-flag-item + .restriction-flag-item {
  border-top: 1px solid var(--border);
}

.restriction-flag-item__label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.restriction-flag-item__reason {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  padding-left: 18px;
}

/* Inline form restriction warning — border uses --alert for visibility, NOT solid-red band fill */
.restriction-warning {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: color-mix(in srgb, var(--alert) 8%, var(--bg-card));
  border: 2px solid var(--alert);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: 1.5;
}

.restriction-warning strong {
  color: var(--alert);
}

/* Inline notice replacing a rebook prompt after a no_rebook block */
.restriction-notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: color-mix(in srgb, var(--alert) 8%, var(--bg-card));
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: var(--space-3);
}

/* Restriction bar on appointment cards — distinct from the solid-red appt-card__alert-bar */
.appt-card__restriction-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: color-mix(in srgb, var(--text-secondary) 10%, var(--bg-card));
  border-top: 1px solid var(--border);
  color: var(--text-primary);
  padding: 5px 14px;
  font-size: var(--text-sm);
  font-weight: 600;
}

/* Restriction badge — used on pet cards and income list rows */
.restriction-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 5px;
  font-size: var(--text-sm);
  font-weight: 700;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
  background: color-mix(in srgb, var(--text-secondary) 8%, transparent);
  vertical-align: middle;
  line-height: 1;
  flex-shrink: 0;
}

/* Tiny alert badge on income rows */
.alert-badge-sm {
  font-size: var(--text-sm);
  color: var(--alert);
  font-weight: 700;
}

/* Form section restriction rows */
.restriction-flag-row .form-hint-text {
  margin-top: 2px;
  margin-bottom: 0;
}

/* Ensure restriction form reason inputs have sufficient touch target */
.restriction-flag-row input.form-input {
  min-height: 44px;
}

/* Restriction toggle uses same toggle styles as flag-toggle */
.restriction-toggle[aria-checked="true"] {
  background: var(--ink, var(--text-primary));
}

/* ---- Patch 04: Animal type label ---- */

.animal-type-label {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 28%, transparent);
  vertical-align: middle;
  margin-left: 6px;
  white-space: nowrap;
  max-width: 9ch;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Patch 06: chart title + per-tab totals ---- */

.chart-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-soft);
  margin: 0 0 8px 0;
}

.tab-month-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--primary) 20%, transparent);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 16px;
}

.tab-month-total__label {
  font-size: var(--text-sm);
  color: var(--ink-soft);
}

.tab-month-total__value {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--primary);
}

/* ---- Patch 07: tappable summary figures + daily breakdown panel ---- */

button.summary-cell {
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  width: 100%;
  min-height: 44px;
  transition: background 0.1s;
}

button.summary-cell:hover {
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
}

button.summary-cell:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.summary-cell--selected {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.summary-cell--net.summary-cell--selected {
  outline-color: var(--primary);
}

.breakdown-chevron {
  font-style: normal;
  font-size: 0.65em;
  margin-left: 3px;
  display: inline-block;
  transition: transform 0.15s;
  vertical-align: middle;
}

button.summary-cell[aria-expanded="true"] .breakdown-chevron {
  transform: rotate(180deg);
}

.summary-tip-bar {
  display: flex;
  justify-content: flex-end;
  padding: 2px 0 10px;
}

.breakdown-panel {
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
  border-radius: var(--radius-md);
  padding: 14px;
  margin: 4px 0 12px;
}

.breakdown-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.breakdown-header__left {
  flex: 1;
  min-width: 0;
}

.breakdown-header__metric {
  font-weight: 700;
  font-size: var(--text-sm);
  display: block;
}

.breakdown-header__mth {
  font-size: var(--text-xs);
  color: var(--ink-soft);
  display: block;
}

.breakdown-header__total {
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--primary);
  white-space: nowrap;
}

.breakdown-close {
  flex-shrink: 0;
  color: var(--ink-soft);
}

.breakdown-list {
  display: flex;
  flex-direction: column;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
}

.breakdown-row:last-child {
  border-bottom: none;
}

.breakdown-row__date {
  color: var(--ink-soft);
}

.breakdown-row__val {
  font-weight: 600;
}

.breakdown-empty {
  font-size: var(--text-sm);
  color: var(--ink-soft);
  padding: 12px 0;
  text-align: center;
  margin: 0;
}

/* ============================================================
   Kirbelle Offshift — product styles
   ============================================================ */

/* ---- Evening dim palette — HARD RULE: overrides ALL themes ----
   Near-black bg, low-luminance warm tones, WCAG AA maintained.
   Applied when data-evening="true" is on the html element.
*/
[data-evening="true"] {
  --bg:           #18140e;
  --surface:      #231f18;
  --ink:          #c4b498;
  --ink-soft:     #7a6e5a;
  --primary:      #a09070;
  --primary-ink:  #18140e;
  --primary-soft: #30291e;
  --secondary:    #6b5f47;
  --accent:       #8a7a5a;
  --border:       #322c22;
  --alert:        #8a4030;
  --alert-ink:    #f0e4d0;
  --success:      #4a7050;
  --success-ink:  #d0e8d4;
  --danger:       #8a4030;
  --danger-ink:   #f0e4d0;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.45);
  --shadow-md:    0 2px 8px rgba(0,0,0,.55);
}

/* ---- Button size variant ---- */

.btn-lg {
  min-height: 52px;
  font-size:  var(--text-lg);
  padding:    0 28px;
}

/* ---- Morning: light anchor card ---- */

.morning-light-card,
.morning-one-thing-card {
  margin-bottom: 16px;
}

.morning-light-header {
  margin-bottom: 16px;
}

.morning-light-title {
  font-size:     var(--text-lg);
  font-weight:   700;
  color:         var(--ink);
  margin-bottom: 4px;
}

.morning-light-hint {
  font-size: var(--text-sm);
  color:     var(--ink-soft);
}

.light-actions {
  display:        flex;
  flex-direction: column;
  align-items:    flex-start;
  gap:            12px;
}

.light-idle-actions {
  display:     flex;
  gap:         12px;
  flex-wrap:   wrap;
  align-items: center;
}

.light-countdown {
  font-size:             3rem;
  font-weight:           700;
  color:                 var(--primary);
  font-variant-numeric:  tabular-nums;
  letter-spacing:        0.02em;
  line-height:           1;
  margin-bottom:         8px;
}

.light-done-state {
  display:     flex;
  align-items: center;
  gap:         10px;
  font-size:   var(--text-base);
  font-weight: 600;
  color:       var(--success);
}

.light-done-icon {
  font-size: var(--text-xl);
}

/* ---- Morning: one-thing card ---- */

.card-section-title {
  font-size:     var(--text-base);
  font-weight:   700;
  color:         var(--ink);
  margin-bottom: 12px;
}

.one-thing-form {
  display:        flex;
  flex-direction: column;
  gap:            10px;
}

.draft-restored-note {
  font-size: var(--text-sm);
  color:     var(--ink-soft);
  margin:    0;
}

/* ---- Evening: hand-back card ---- */

.evening-hand-back-card,
.evening-invite-card,
.evening-brain-dump-card {
  margin-bottom: 16px;
}

.evening-one-thing-label {
  font-size:      var(--text-sm);
  color:          var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight:    600;
  margin-bottom:  8px;
}

.evening-one-thing-text {
  font-size:     var(--text-xl);
  font-weight:   700;
  color:         var(--ink);
  line-height:   1.3;
  margin-bottom: 20px;
  word-break:    break-word;
}

.evening-actions {
  display:   flex;
  gap:       12px;
  flex-wrap: wrap;
}

.evening-btn-done,
.evening-btn-bump {
  min-height: 48px;
  font-size:  var(--text-base);
}

.evening-btn-done {
  flex: 1;
}

/* ---- Evening: invite prompt ---- */

.evening-invite-prompt {
  font-size:     var(--text-base);
  font-weight:   600;
  color:         var(--ink);
  margin-bottom: 12px;
}

/* ---- Evening: done screen ---- */

.evening-done-screen {
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  justify-content: center;
  min-height:      60vh;
  padding:         40px 24px;
  text-align:      center;
}

.evening-done-heading {
  font-size:     var(--text-2xl);
  font-weight:   700;
  color:         var(--ink);
  margin-bottom: 8px;
}

.evening-done-sub {
  font-size: var(--text-base);
  color:     var(--ink-soft);
}

/* ---- Log entries ---- */

.log-date-group {
  margin-bottom: 24px;
}

.log-date-heading {
  font-size:      var(--text-sm);
  font-weight:    600;
  color:          var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom:  10px;
}

.log-entry {
  background:    var(--surface);
  border:        1px solid var(--border);
  border-radius: var(--radius-md);
  padding:       12px 14px;
  margin-bottom: 8px;
}

.log-entry-type {
  font-size:     var(--text-sm);
  font-weight:   600;
  color:         var(--ink-soft);
  margin-bottom: 4px;
}

.log-entry-text {
  font-size:   var(--text-base);
  color:       var(--ink);
  white-space: pre-wrap;
  word-break:  break-word;
  margin:      0;
}

.log-entry-status {
  font-size:  var(--text-sm);
  color:      var(--success);
  font-weight: 600;
  margin-top: 4px;
  margin-bottom: 0;
}

.log-entry-status--missed {
  color: var(--ink-soft);
}

/* ---- Selftest results ---- */

.selftest-summary {
  font-weight:   600;
  font-size:     var(--text-base);
  margin-bottom: 16px;
}

.selftest-summary--pass { color: var(--success); }
.selftest-summary--fail { color: var(--danger); }

.selftest-list {
  list-style: none;
  padding:    0;
  margin:     0;
}

.selftest-row {
  display:       flex;
  gap:           12px;
  align-items:   flex-start;
  padding:       8px 0;
  border-bottom: 1px solid var(--border);
  font-size:     var(--text-sm);
}

.selftest-row:last-child { border-bottom: none; }

.selftest-icon {
  font-weight:  700;
  flex-shrink:  0;
  margin-top:   1px;
}

.selftest-row--pass .selftest-icon { color: var(--success); }
.selftest-row--fail .selftest-icon { color: var(--danger); }

.selftest-name { color: var(--ink); }

/* ====================================================
   Kirbelle Offshift v1.1 — component styles
   ==================================================== */

/* ---- Men's edition accent override ---- */
[data-edition="men"] {
  --primary:      #33565E;
  --primary-ink:  #FFFFFF;
  --primary-soft: #D4E5E8;
}

/* ---- Card interior padding (morning/evening cards) ---- */
.morning-light-card,
.morning-one-thing-card,
.evening-hand-back-card,
.evening-invite-card,
.evening-brain-dump-card,
.resets-card {
  margin-bottom: 16px;
}

.morning-light-card > *,
.morning-one-thing-card > * {
  padding-left: 16px;
  padding-right: 16px;
}

.morning-light-card > *:first-child { padding-top: 16px; }
.morning-light-card > *:last-child  { padding-bottom: 16px; }
.morning-one-thing-card > *:first-child { padding-top: 16px; }
.morning-one-thing-card > *:last-child  { padding-bottom: 16px; }

.evening-hand-back-card,
.evening-invite-card,
.evening-brain-dump-card {
  padding: 16px;
}

/* ---- Warning sign nudge (morning, silent when none set) ---- */
.warning-sign-nudge {
  background:    var(--primary-soft);
  border-left:   3px solid var(--primary);
  border-radius: var(--radius-sm);
  padding:       10px 14px;
  margin-top:    8px;
  display:       flex;
  gap:           8px;
  align-items:   baseline;
  flex-wrap:     wrap;
}

.warning-sign-label {
  font-size:  var(--text-sm);
  font-weight: 700;
  color:      var(--primary);
  white-space: nowrap;
}

.warning-sign-text {
  font-size:   var(--text-sm);
  color:       var(--ink);
  line-height: 1.5;
}

/* ---- Resets card (evening, collapsed) ---- */

.resets-toggle-btn {
  width:        100%;
  display:      flex;
  align-items:  center;
  justify-content: space-between;
  gap:          12px;
  padding:      14px 16px;
  background:   none;
  border:       none;
  cursor:       pointer;
  font-family:  inherit;
  text-align:   left;
  min-height:   52px;
  transition:   background 0.12s;
}

.resets-toggle-btn:hover {
  background: var(--primary-soft);
}

.resets-toggle-btn:focus-visible {
  outline:       3px solid var(--primary);
  outline-offset: -2px;
  border-radius: var(--radius-md);
}

.resets-title-text {
  font-size:   var(--text-base);
  font-weight: 600;
  color:       var(--ink);
}

.resets-chevron {
  font-size:  1.1em;
  color:      var(--ink-soft);
  flex-shrink: 0;
}

.resets-body {
  padding:    0 16px 16px;
  border-top: 1px solid var(--border);
}

.reset-content {
  display:        flex;
  flex-direction: column;
  gap:            10px;
  padding-top:    14px;
}

.reset-counter {
  font-size:   var(--text-sm);
  color:       var(--ink-soft);
  font-weight: 600;
  margin:      0;
}

.reset-title {
  font-size:   var(--text-base);
  font-weight: 700;
  color:       var(--ink);
  line-height: 1.35;
  margin:      0;
}

.reset-body-text {
  font-size:   var(--text-base);
  color:       var(--ink);
  line-height: 1.6;
  margin:      0;
}

.resets-complete {
  font-size:   var(--text-sm);
  color:       var(--ink-soft);
  font-style:  italic;
  padding:     14px 0 10px;
  margin:      0;
}

.reset-picker {
  display:        flex;
  flex-direction: column;
  gap:            4px;
}

.reset-picker-item {
  border:        1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow:      hidden;
}

.reset-picker-summary {
  padding:     10px 12px;
  cursor:      pointer;
  font-size:   var(--text-sm);
  font-weight: 600;
  color:       var(--primary);
  list-style:  none;
  display:     flex;
  align-items: center;
  gap:         6px;
}

.reset-picker-summary::-webkit-details-marker { display: none; }
.reset-picker-summary::marker               { display: none; content: ''; }
.reset-picker-summary::before               { content: '▸'; font-size: 0.75em; }
.reset-picker-item[open] .reset-picker-summary::before { content: '▾'; }

.reset-picker-body {
  padding:     0 12px 12px;
  font-size:   var(--text-sm);
  color:       var(--ink);
  line-height: 1.6;
  margin:      0;
}

.resets-empty {
  font-size: var(--text-sm);
  color:     var(--ink-soft);
  padding:   14px 0;
  margin:    0;
}

/* ---- Check-in view ---- */

.checkin-intro {
  font-size:     var(--text-base);
  color:         var(--ink-soft);
  line-height:   1.6;
  margin-bottom: 24px;
}

.checkin-questions {
  display:        flex;
  flex-direction: column;
  gap:            20px;
  margin-bottom:  24px;
}

.checkin-question {
  display:        flex;
  flex-direction: column;
}

.checkin-actions {
  display:   flex;
  gap:       12px;
  flex-wrap: wrap;
}

.checkin-closing {
  font-size:     var(--text-base);
  color:         var(--ink-soft);
  line-height:   1.6;
  margin-bottom: 24px;
}

.checkin-purpose {
  font-size:     var(--text-sm);
  color:         var(--ink-soft);
  line-height:   1.6;
  margin-bottom: 20px;
}

.checkin-bridge {
  border:        1px solid var(--border);
  border-radius: var(--radius-md);
  padding:       16px;
  margin-bottom: 16px;
  background:    var(--surface);
}

.checkin-bridge-quote {
  font-size:     var(--text-sm);
  color:         var(--ink);
  font-style:    italic;
  line-height:   1.55;
  margin:        0 0 10px;
  padding:       0 0 0 12px;
  border-left:   3px solid var(--border);
}

.checkin-bridge-text {
  font-size:     var(--text-sm);
  color:         var(--ink-soft);
  line-height:   1.5;
  margin:        0 0 12px;
}

.checkin-bridge-confirm {
  font-size:     var(--text-sm);
  color:         var(--ink);
  margin:        0 0 12px;
  font-weight:   500;
}

.checkin-bridge-confirm-btns {
  display:   flex;
  gap:       10px;
  flex-wrap: wrap;
}

.checkin-bridge-done {
  font-size:  var(--text-sm);
  color:      var(--success);
  font-weight: 500;
  margin:     0;
}

/* ---- Why screen ---- */

.why-body {
  display:        flex;
  flex-direction: column;
  gap:            16px;
  margin-bottom:  24px;
}

.why-paragraph {
  font-size:   var(--text-base);
  color:       var(--ink);
  line-height: 1.65;
  margin:      0;
}

.why-disclaimer {
  font-size:   var(--text-sm);
  color:       var(--ink-soft);
  font-style:  italic;
  border-top:  1px solid var(--border);
  padding-top: 16px;
  margin:      0;
  line-height: 1.55;
}

/* ---- Log: check-in entries ---- */

.log-checkin-qa {
  display:        flex;
  flex-direction: column;
  gap:            2px;
  padding:        8px 0;
  border-bottom:  1px solid var(--border);
}

.log-checkin-qa:last-child {
  border-bottom:  none;
  padding-bottom: 0;
}

.log-checkin-q {
  font-size:   var(--text-sm);
  color:       var(--ink-soft);
  font-weight: 600;
  margin:      0;
}

.log-checkin-a {
  font-size:   var(--text-base);
  color:       var(--ink);
  margin:      0;
  white-space: pre-wrap;
  word-break:  break-word;
}

.log-checkin-empty {
  font-size: var(--text-sm);
  color:     var(--ink-soft);
  margin:    0;
}

/* ---- Settings: drainers section ---- */

.drainers-textarea {
  margin:  0 16px 4px;
  width:   calc(100% - 32px);
}

.settings-note--spaced {
  padding-top: 16px;
  font-weight: 600;
  color:       var(--ink);
}

/* ---- Why this? inline toggle (v1.1.1) ---- */

.why-toggle {
  margin-top: 8px;
}

.why-toggle-btn {
  background:              none;
  border:                  none;
  cursor:                  pointer;
  font-family:             inherit;
  font-size:               var(--text-sm);
  color:                   var(--ink-soft);
  padding:                 4px 0;
  min-height:              36px;
  text-decoration:         underline;
  text-decoration-style:   dotted;
  text-underline-offset:   2px;
  opacity:                 0.72;
  transition:              opacity 0.12s;
  display:                 inline-block;
}

.why-toggle-btn:hover {
  opacity: 1;
}

.why-toggle-btn:focus-visible {
  outline:        2px solid var(--primary);
  outline-offset: 2px;
  border-radius:  2px;
  opacity:        1;
}

.why-toggle-body {
  font-size:   var(--text-sm);
  color:       var(--ink-soft);
  line-height: 1.55;
  margin:      6px 0 0;
  padding:     8px 10px;
  background:  var(--primary-soft);
  border-radius: var(--radius-sm);
}

/* Resets card why-toggle: explicit horizontal padding since the card has no uniform padding */
.resets-card-why {
  padding:     0 16px 8px;
  border-bottom: 1px solid var(--border);
}

.resets-card-why .why-toggle {
  margin-top: 0;
}

/* ============================================================
   v1.1.2 — Log tabs + Path list + Resets card top row
   ============================================================ */

/* Log segmented tabs */
.log-tabs {
  display:       flex;
  background:    var(--bg);
  border:        1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding:       3px;
  margin-bottom: 16px;
  gap:           3px;
}

.log-tab {
  flex:          1;
  background:    none;
  border:        none;
  cursor:        pointer;
  font-family:   inherit;
  font-size:     var(--text-sm);
  font-weight:   600;
  color:         var(--ink-soft);
  padding:       7px 4px;
  border-radius: calc(var(--radius-md) - 3px);
  transition:    background 0.12s, color 0.12s;
  min-height:    36px;
}

.log-tab--active {
  background: var(--surface);
  color:      var(--primary);
  box-shadow: var(--shadow-sm);
}

.log-tab:focus-visible {
  outline:        2px solid var(--primary);
  outline-offset: -2px;
  border-radius:  calc(var(--radius-md) - 3px);
}

/* Path screen */
.path-header-text {
  font-size:     var(--text-sm);
  color:         var(--ink-soft);
  line-height:   1.55;
  margin-bottom: 8px;
}

.path-progress {
  font-size:     var(--text-sm);
  color:         var(--ink-soft);
  font-weight:   600;
  margin-bottom: 16px;
}

.path-complete {
  font-size:     var(--text-sm);
  color:         var(--ink-soft);
  font-style:    italic;
  margin-bottom: 10px;
}

.path-list {
  display:        flex;
  flex-direction: column;
  gap:            4px;
}

.path-item {
  display:       flex;
  flex-direction: column;
  border-radius: var(--radius-sm);
  overflow:      hidden;
}

.path-item-btn {
  display:       flex;
  align-items:   center;
  gap:           8px;
  width:         100%;
  background:    none;
  border:        none;
  cursor:        pointer;
  font-family:   inherit;
  text-align:    left;
  padding:       10px 12px;
  min-height:    44px;
  transition:    background 0.12s;
}

.path-item-btn:focus-visible {
  outline:        2px solid var(--primary);
  outline-offset: -2px;
}

/* Read state */
.path-item--read {
  background: var(--surface);
  border:     1px solid var(--border);
}

.path-item-btn--read {
  color: var(--ink);
}

.path-item-btn--read:hover {
  background: var(--primary-soft);
}

/* Current state */
.path-item--current {
  background: var(--primary-soft);
  border:     2px solid var(--primary);
}

.path-item-btn--current {
  color:       var(--primary);
  font-weight: 700;
}

.path-item-btn--current:hover {
  background: var(--primary-soft);
  opacity:    0.88;
}

/* Upcoming state — inactive, no contrast requirement applies */
.path-item--upcoming {
  display:     flex;
  align-items: center;
  gap:         8px;
  padding:     10px 12px;
  opacity:     0.5;
}

.path-item-num {
  font-size:  var(--text-sm);
  color:      var(--ink-soft);
  font-weight: 600;
  min-width:  20px;
  flex-shrink: 0;
}

.path-item-label {
  font-size: var(--text-sm);
  color:     var(--ink);
  flex:      1;
}

.path-item-label--upcoming {
  color: var(--ink-soft);
}

.path-item-check {
  font-size:   var(--text-sm);
  color:       var(--primary);
  flex-shrink: 0;
  font-weight: 700;
}

.path-item-expand {
  padding:    0 12px 12px;
  background: inherit;
}

.path-item-body-text {
  font-size:   var(--text-sm);
  color:       var(--ink-soft);
  line-height: 1.6;
  margin:      0 0 10px;
}

.path-done-btn {
  margin-top: 4px;
}

/* Resets card top row: toggle button + path link side by side */
.resets-card-top {
  display:     flex;
  align-items: stretch;
}

.resets-card-top .resets-toggle-btn {
  flex: 1;
}

.resets-path-link {
  background:             none;
  border:                 none;
  cursor:                 pointer;
  font-family:            inherit;
  font-size:              var(--text-sm);
  color:                  var(--ink-soft);
  opacity:                0.7;
  padding:                14px 16px;
  min-height:             52px;
  white-space:            nowrap;
  text-decoration:        underline;
  text-decoration-style:  dotted;
  text-underline-offset:  2px;
  transition:             opacity 0.12s;
  flex-shrink:            0;
}

.resets-path-link:hover {
  opacity: 1;
}

.resets-path-link:focus-visible {
  outline:        2px solid var(--primary);
  outline-offset: -2px;
  border-radius:  2px;
}

/* Evening dim palette: path link stays readable */
[data-evening="true"] .resets-path-link {
  color:   var(--ink-soft);
  opacity: 0.65;
}

/* ============================================================
   v1.1.3 — First-run hints + completion confirmation lines
   ============================================================ */

.first-run-hint {
  display:       flex;
  align-items:   flex-start;
  gap:           10px;
  padding:       10px 14px;
  margin-bottom: 14px;
  background:    var(--primary-soft);
  border-radius: var(--radius-sm);
}

.first-run-hint-text {
  flex:        1;
  font-size:   var(--text-sm);
  color:       var(--ink-soft);
  line-height: 1.5;
  margin:      0;
}

.first-run-hint-close {
  background:      none;
  border:          none;
  cursor:          pointer;
  font-family:     inherit;
  font-size:       var(--text-sm);
  color:           var(--ink-soft);
  opacity:         0.65;
  padding:         0;
  min-width:       24px;
  min-height:      24px;
  display:         flex;
  align-items:     center;
  justify-content: center;
  flex-shrink:     0;
  line-height:     1;
  transition:      opacity 0.12s;
}

.first-run-hint-close:hover { opacity: 1; }

.first-run-hint-close:focus-visible {
  outline:        2px solid var(--primary);
  outline-offset: 2px;
  border-radius:  2px;
}

[data-evening="true"] .first-run-hint {
  background: rgba(255, 255, 255, 0.08);
}

/* Completion confirmation lines (always-visible in relevant states) */
.light-done-confirm,
.one-thing-confirm {
  font-size:   var(--text-sm);
  color:       var(--ink-soft);
  font-style:  italic;
  margin-top:  8px;
  line-height: 1.5;
}

/* Settings permanent drainers hint */
.settings-note--hint {
  font-style: italic;
  opacity:    0.85;
}

/* ============================================================
   v1.2 Companion flow — Morning + Evening
   ============================================================ */

/* --- Morning greeting --- */

.morning-greeting {
  font-size:    var(--text-lg);
  font-weight:  500;
  color:        var(--ink);
  text-align:   center;
  line-height:  1.4;
  margin:       0 0 20px;
  padding:      0 8px;
}

/* --- Step reveal (one-thing card after light done) --- */

@keyframes stepReveal {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.step-reveal {
  animation: stepReveal 0.35s ease both;
}

[data-reduce-motion="true"] .step-reveal {
  animation: none;
}

/* --- Classic / show-everything toggle link --- */

.classic-toggle-row {
  text-align:  center;
  margin:      16px 0 8px;
}

.btn-text-link {
  background:       none;
  border:           none;
  padding:          4px 8px;
  color:            var(--ink-soft);
  font-size:        var(--text-sm);
  font-family:      inherit;
  cursor:           pointer;
  text-decoration:  underline;
  text-underline-offset: 2px;
  transition:       color 0.15s;
}

.btn-text-link:hover  { color: var(--primary); }
.btn-text-link:focus-visible {
  outline:        2px solid var(--primary);
  outline-offset: 2px;
  border-radius:  2px;
}

/* --- Evening companion Stage 1 --- */

.evening-stage1 {
  display:        flex;
  flex-direction: column;
  gap:            20px;
  padding:        8px 0;
}

.evening-greeting {
  font-size:   var(--text-lg);
  font-weight: 500;
  color:       var(--ink);
  line-height: 1.4;
  text-align:  center;
  padding:     0 8px;
}

.evening-put-down {
  font-size:   var(--text-base);
  line-height: 1.55;
  resize:      vertical;
  min-height:  100px;
}

[data-evening="true"] .evening-greeting {
  color: rgba(255, 255, 255, 0.90);
}

[data-evening="true"] .evening-put-down {
  background:    rgba(255, 255, 255, 0.07);
  border-color:  rgba(255, 255, 255, 0.18);
  color:         rgba(255, 255, 255, 0.88);
}

[data-evening="true"] .evening-put-down::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

/* --- Evening companion Stage 2 --- */

.evening-stage2 {
  display:        flex;
  flex-direction: column;
  gap:            24px;
  padding:        8px 0;
}

.evening-settling-line {
  font-size:   var(--text-lg);
  font-weight: 400;
  color:       var(--ink);
  line-height: 1.45;
  text-align:  center;
  padding:     0 8px;
}

[data-evening="true"] .evening-settling-line {
  color: rgba(255, 255, 255, 0.85);
}

/* --- Chips --- */

.evening-chips {
  display:         flex;
  flex-wrap:       wrap;
  gap:             10px;
  justify-content: center;
}

.chip {
  position:        relative;
  display:         inline-flex;
  align-items:     center;
  gap:             6px;
  padding:         10px 18px;
  border-radius:   var(--radius-lg);
  font-size:       var(--text-sm);
  font-family:     inherit;
  font-weight:     500;
  cursor:          pointer;
  transition:      background 0.15s, border-color 0.15s, color 0.15s;
  border:          2px solid var(--primary);
  background:      var(--primary-soft);
  color:           var(--primary);
  white-space:     nowrap;
}

.chip:hover {
  background: var(--primary);
  color:      var(--primary-ink);
}

.chip--outline {
  background: transparent;
}

.chip--active {
  background: var(--primary);
  color:      var(--primary-ink);
}

.chip-dot {
  display:       inline-block;
  width:         7px;
  height:        7px;
  border-radius: 50%;
  background:    var(--accent);
  flex-shrink:   0;
}

.chip--active .chip-dot {
  background: var(--primary-ink);
}

[data-evening="true"] .chip {
  border-color: rgba(255, 255, 255, 0.40);
  background:   rgba(255, 255, 255, 0.08);
  color:        rgba(255, 255, 255, 0.85);
}

[data-evening="true"] .chip:hover,
[data-evening="true"] .chip--active {
  background:   rgba(255, 255, 255, 0.22);
  color:        #ffffff;
  border-color: rgba(255, 255, 255, 0.60);
}

/* --- Chip reveal area --- */

.chip-reveal-area {
  border-radius: var(--radius-md);
  background:    var(--surface);
  box-shadow:    var(--shadow-sm);
  padding:       20px;
}

[data-evening="true"] .chip-reveal-area {
  background:   rgba(255, 255, 255, 0.09);
  box-shadow:   none;
  border:       1px solid rgba(255, 255, 255, 0.14);
}

.chip-reveal-body { }

.chip-reveal-label {
  font-size:     var(--text-sm);
  font-weight:   600;
  color:         var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

[data-evening="true"] .chip-reveal-label {
  color: rgba(255, 255, 255, 0.55);
}

.chip-reveal-text {
  font-size:   var(--text-base);
  color:       var(--ink);
  line-height: 1.55;
  margin:      0 0 16px;
}

[data-evening="true"] .chip-reveal-text {
  color: rgba(255, 255, 255, 0.88);
}

.chip-reveal-hint {
  font-size:  var(--text-sm);
  color:      var(--ink-soft);
  font-style: italic;
}

[data-evening="true"] .chip-reveal-hint {
  color: rgba(255, 255, 255, 0.55);
}

.chip-reveal-actions {
  display:   flex;
  flex-wrap: wrap;
  gap:       10px;
  margin-top: 4px;
}

/* --- Done for tonight row --- */

.done-tonight-row {
  text-align: center;
  margin-top: 4px;
}

.done-tonight-btn {
  background:      none;
  border:          none;
  padding:         8px 16px;
  color:           var(--ink-soft);
  font-size:       var(--text-sm);
  font-family:     inherit;
  cursor:          pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition:      color 0.15s;
}

.done-tonight-btn:hover { color: var(--primary); }

.done-tonight-btn:focus-visible {
  outline:        2px solid var(--primary);
  outline-offset: 2px;
  border-radius:  2px;
}

[data-evening="true"] .done-tonight-btn {
  color: rgba(255, 255, 255, 0.55);
}

[data-evening="true"] .done-tonight-btn:hover {
  color: rgba(255, 255, 255, 0.85);
}

/* --- Breathing exercise --- */

.breath-wrap {
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  gap:             20px;
  padding:         24px 0 16px;
  position:        relative;
}

.breath-circle {
  width:         100px;
  height:        100px;
  border-radius: 50%;
  border:        3px solid var(--primary);
  background:    var(--primary-soft);
  transition:    transform 4s ease-in-out;
}

.breath-circle--in  { transform: scale(1.45); }
.breath-circle--out { transform: scale(0.80); }

.breath-word {
  font-size:   var(--text-xl);
  font-weight: 600;
  color:       var(--ink);
  margin:      0;
}

.breath-exit {
  position:   absolute;
  top:        0;
  right:      0;
  background: none;
  border:     none;
  font-size:  1.1rem;
  color:      var(--ink-soft);
  cursor:     pointer;
  padding:    4px 8px;
  line-height: 1;
  transition: color 0.15s;
}

.breath-exit:hover { color: var(--ink); }

.breath-exit:focus-visible {
  outline:        2px solid var(--primary);
  outline-offset: 2px;
  border-radius:  2px;
}

/* Reduce-motion breathing */

.breath-wrap--rm {
  gap: 16px;
}

.breath-rm-text {
  font-size:   var(--text-lg);
  font-weight: 500;
  color:       var(--ink);
  text-align:  center;
  line-height: 1.4;
  margin:      0;
}

.breath-end-text {
  font-size:  var(--text-base);
  color:      var(--ink-soft);
  text-align: center;
  font-style: italic;
  margin:     16px 0 8px;
}

[data-evening="true"] .breath-circle {
  border-color: rgba(255, 255, 255, 0.45);
  background:   rgba(255, 255, 255, 0.10);
}

[data-evening="true"] .breath-word,
[data-evening="true"] .breath-rm-text {
  color: rgba(255, 255, 255, 0.88);
}

[data-evening="true"] .breath-exit {
  color: rgba(255, 255, 255, 0.50);
}

[data-evening="true"] .breath-exit:hover {
  color: rgba(255, 255, 255, 0.85);
}

[data-evening="true"] .breath-end-text {
  color: rgba(255, 255, 255, 0.60);
}

/* --- Reset action buttons (Did it / Not tonight) --- */

.reset-action-btns {
  display:    flex;
  flex-wrap:  wrap;
  gap:        10px;
  margin-top: 16px;
}

.btn-ghost {
  background:   transparent;
  border:       2px solid var(--border);
  color:        var(--ink-soft);
  padding:      10px 18px;
  border-radius: var(--radius-sm);
  font-family:  inherit;
  font-size:    var(--text-sm);
  font-weight:  500;
  cursor:       pointer;
  transition:   border-color 0.15s, color 0.15s;
}

.btn-ghost:hover {
  border-color: var(--ink-soft);
  color:        var(--ink);
}

.btn-ghost:focus-visible {
  outline:        2px solid var(--primary);
  outline-offset: 2px;
}

[data-evening="true"] .btn-ghost {
  border-color: rgba(255, 255, 255, 0.22);
  color:        rgba(255, 255, 255, 0.60);
}

[data-evening="true"] .btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.50);
  color:        rgba(255, 255, 255, 0.88);
}

/* --- Path action buttons (Did it / Not tonight in Log→Path) --- */

.path-action-btns {
  display:    flex;
  flex-wrap:  wrap;
  gap:        10px;
  margin-top: 16px;
}

/* --- Evening done screen --- */

.evening-done-screen {
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  justify-content: center;
  padding:         60px 24px;
  gap:             12px;
}

.evening-done-heading {
  font-size:   var(--text-xl);
  font-weight: 600;
  color:       var(--ink);
  margin:      0;
}

.evening-done-sub {
  font-size:  var(--text-base);
  color:      var(--ink-soft);
  margin:     0;
}

[data-evening="true"] .evening-done-heading {
  color: rgba(255, 255, 255, 0.88);
}

[data-evening="true"] .evening-done-sub {
  color: rgba(255, 255, 255, 0.55);
}
