/* ============================================================
   Forenote · Dog Groomer Edition
   Design system: progressive disclosure, near-mono + one accent,
   system font stack, 4 themes via CSS custom properties.
   ============================================================ */

/* ---- 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;
}
