/* ==============================================================================
   BABY DIETZ HUB — "THE VERY HUNGRY CATERPILLAR" NURSERY DESIGN SYSTEM
   Modern, Warm, Playful, Editorial & Desktop-First
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400..700;1,9..144,400&family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

:root {
  /* Eric Carle / Hungry Caterpillar Inspired Palette */
  --caterpillar-red: #D73C2C;       /* Head / Apple / Strawberry */
  --caterpillar-red-soft: #FDE8E5;
  --caterpillar-green: #2F633E;     /* Body segment deep */
  --caterpillar-green-light: #52935E;/* Leaf / Grass green */
  --caterpillar-green-bg: #EDF6EE;   /* Soft mint wash */
  --sun-yellow: #ECA328;            /* Warm sun / Honey */
  --sun-yellow-soft: #FEF6E6;
  --plum-purple: #55436E;           /* Plum / Night sky */
  --plum-soft: #F2EEF8;
  --pear-lime: #7E9E38;             /* Pear green */
  --pear-soft: #F3F8E8;
  --orange-accent: #E06D29;         /* Orange fruit */
  --orange-soft: #FDF0E7;
  --blueberry: #365D88;             /* Blueberry tone */
  --blueberry-soft: #EBF3FA;

  /* Surfaces & Neutrals */
  --bg-canvas: #FAF7F2;             /* Warm textured linen/cream */
  --surface-card: #FFFFFF;          /* Pure crisp card */
  --surface-subtle: #F5EFE6;        /* Subtle contrast section */
  --text-main: #272B28;             /* Deep earthy charcoal */
  --text-secondary: #5F6861;        /* Muted organic gray */
  --text-tertiary: #929D94;         /* Subtle caption */
  --border-subtle: #E8DFD3;         /* Warm border line */
  --border-focus: #2F633E;

  /* Elevations */
  --shadow-sm: 0 2px 6px rgba(47, 99, 62, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 8px 24px -4px rgba(47, 99, 62, 0.08), 0 3px 8px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 16px 36px -6px rgba(47, 99, 62, 0.12), 0 6px 16px -4px rgba(0, 0, 0, 0.06);

  /* Radii */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 30px;
  --radius-pill: 9999px;
  --radius-full: 9999px;

  /* Typography */
  --font-serif: 'Fraunces', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  
  --sidebar-width: 290px;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: flex;
  overflow-x: hidden;
  overflow-x: clip;
  overscroll-behavior-x: none;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

img, video {
  max-width: 100%;
  height: auto;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-canvas);
}
::-webkit-scrollbar-thumb {
  background: #D9CEBE;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #B8AB97;
}

/* ==============================================================================
   DESKTOP SIDEBAR
   ============================================================================== */
aside.sidebar {
  width: var(--sidebar-width);
  background: var(--surface-card);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.sidebar-brand {
  padding: 24px 22px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 48px;
  height: 48px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--caterpillar-green);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 2px;
}

.due-countdown-chip {
  margin-top: 14px;
  background: linear-gradient(135deg, var(--sun-yellow-soft) 0%, var(--orange-soft) 100%);
  border: 1px solid rgba(236, 163, 40, 0.35);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chip-due-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.due-countdown-chip .chip-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--orange-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.due-countdown-chip .chip-days {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.chip-stage-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding-top: 6px;
  border-top: 1px dashed rgba(236, 163, 40, 0.45);
}

.chip-stage-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--caterpillar-green);
  background: rgba(47, 99, 62, 0.12);
  padding: 2px 7px;
  border-radius: 10px;
}

.chip-stage-sub {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Navigation List */
.sidebar-nav {
  padding: 16px 14px;
  overflow-y: auto;
  flex-grow: 1;
  list-style: none;
}

.nav-category-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  padding: 12px 12px 6px;
}

.nav-item {
  margin-bottom: 3px;
}

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-btn:hover {
  background: var(--surface-subtle);
  color: var(--caterpillar-green);
  transform: translateX(3px);
}

.nav-btn.active {
  background: var(--caterpillar-green);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(47, 99, 62, 0.25);
}

.nav-btn .icon-badge {
  font-size: 1.15rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
}

.nav-btn .pill-counter {
  margin-left: auto;
  font-size: 0.72rem;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  font-weight: 700;
}

.nav-btn.active .pill-counter {
  background: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px 18px;
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-card);
}

.doc-link-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--caterpillar-green);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--caterpillar-green-bg);
  transition: all 0.15s ease;
  margin-bottom: 6px;
}

.doc-link-btn:hover {
  background: #DFEFE2;
  color: #1F452B;
}

/* ==============================================================================
   MAIN WORKSPACE & TOP BAR
   ============================================================================== */
.main-viewport {
  margin-left: var(--sidebar-width);
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  min-width: 0;
}

/* Top Sticky Header */
header.top-header {
  position: sticky;
  top: 0;
  z-index: 90;
  background: rgba(250, 247, 242, 0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 14px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  flex: 1 1 auto;
}

.page-title-wrap {
  min-width: 0;
  overflow: hidden;
}

.page-title-wrap h1 {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.btn-text-mobile {
  display: none;
}

/* Live Cloud Sync Pill */
.sync-status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.sync-status-pill.synced {
  background: var(--caterpillar-green-bg);
  border-color: rgba(47, 99, 62, 0.2);
  color: var(--caterpillar-green);
}

.sync-status-pill.syncing {
  background: var(--sun-yellow-soft);
  border-color: rgba(236, 163, 40, 0.3);
  color: #925807;
}

.sync-status-pill.local-only {
  background: var(--surface-subtle);
  color: var(--text-secondary);
}

.sync-status-pill.error {
  background: var(--caterpillar-red-soft);
  border-color: rgba(215, 60, 44, 0.25);
  color: var(--caterpillar-red);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.sync-status-pill.syncing .sync-dot {
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

/* Header Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--caterpillar-green);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(47, 99, 62, 0.2);
}

.btn-primary:hover {
  background: #234E30;
  box-shadow: 0 4px 14px rgba(47, 99, 62, 0.3);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-card);
  border-color: var(--border-subtle);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--surface-subtle);
  border-color: #D3C6B5;
}

.btn-icon-only {
  padding: 8px;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

/* Main Content Container */
.content-body {
  padding: 36px 44px 80px;
  max-width: 1400px;
  width: 100%;
  min-width: 0;
}

/* View Section Handling */
.view-section {
  display: none;
  animation: fadeInView 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 0;
  max-width: 100%;
}

.view-section.active {
  display: block;
}

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

/* ==============================================================================
   COMPACT WELCOME STRIPE & PRIORITY APPOINTMENT TOAST
   ============================================================================== */
.welcome-stripe-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, var(--caterpillar-green) 0%, #224d30 100%);
  color: #FFFFFF;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  min-height: 44px;
}

.welcome-stripe-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.welcome-stripe-icon {
  font-size: 1.15rem;
}

.welcome-stripe-title {
  font-family: var(--font-serif);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.welcome-stripe-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
}

.welcome-stripe-badge {
  background: rgba(255, 255, 255, 0.18);
  padding: 2px 10px;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: 0.03em;
  font-size: 0.74rem;
  text-transform: uppercase;
}

.welcome-stripe-sub {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
}

/* Floating Today's Priority Appointment Toast */
.priority-appointment-toast {
  position: fixed;
  top: 76px;
  right: 24px;
  z-index: 1200;
  max-width: min(400px, calc(100% - 24px));
  background: #FFFFFF;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(227, 44, 43, 0.25);
  overflow: hidden;
  display: flex;
  transform: translateY(-8px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, visibility 0.3s;
}

.priority-appointment-toast.visible {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.priority-appointment-toast .toast-indicator {
  width: 5px;
  background: var(--caterpillar-red);
  flex-shrink: 0;
}

.priority-appointment-toast .toast-body {
  padding: 12px 14px;
  flex-grow: 1;
}

.priority-appointment-toast .toast-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.priority-appointment-toast .toast-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--caterpillar-red);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.priority-appointment-toast .toast-close-btn {
  background: transparent;
  border: none;
  font-size: 1rem;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s ease;
}

.priority-appointment-toast .toast-close-btn:hover {
  color: var(--text-main);
}

.priority-appointment-toast .toast-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.priority-appointment-toast .toast-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 3px;
  line-height: 1.4;
}

@media (max-width: 640px) {
  .welcome-stripe-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 10px 14px;
  }
  .welcome-stripe-right {
    font-size: 0.76rem;
  }
  .priority-appointment-toast {
    right: 12px;
    left: 12px;
    max-width: none;
  }
}

/* ==============================================================================
   GRIDS & CARD COMPONENTS
   ============================================================================== */
.grid-desktop-2 {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 28px;
  min-width: 0;
}

.grid-desktop-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  min-width: 0;
}

.grid-desktop-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  min-width: 0;
}

.card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  margin-bottom: 24px;
  position: relative;
  min-width: 0;
  max-width: 100%;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title-group h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.card-subtitle {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Fruit Motif Badges */
.fruit-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.76rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.fruit-apple { background: var(--caterpillar-red-soft); color: var(--caterpillar-red); border-color: rgba(215, 60, 44, 0.2); }
.fruit-pear { background: var(--pear-soft); color: var(--pear-lime); border-color: rgba(126, 158, 56, 0.2); }
.fruit-strawberry { background: #FFEBEB; color: #C22D24; border-color: rgba(194, 45, 36, 0.2); }
.fruit-plum { background: var(--plum-soft); color: var(--plum-purple); border-color: rgba(85, 67, 110, 0.2); }
.fruit-orange { background: var(--orange-soft); color: var(--orange-accent); border-color: rgba(224, 109, 41, 0.2); }
.fruit-blueberry { background: var(--blueberry-soft); color: var(--blueberry); border-color: rgba(54, 93, 136, 0.2); }
.fruit-honey { background: var(--sun-yellow-soft); color: #9A6605; border-color: rgba(236, 163, 40, 0.25); }

/* Urgent Callout Alert */
.alert-urgent {
  background: linear-gradient(135deg, #FFF6F5 0%, #FEECEB 100%);
  border: 1px solid rgba(215, 60, 44, 0.3);
  border-left: 5px solid var(--caterpillar-red);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.alert-urgent-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.alert-urgent-content h4 {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--caterpillar-red);
  font-weight: 700;
  margin-bottom: 4px;
}

.alert-urgent-content p {
  font-size: 0.9rem;
  color: var(--text-main);
}

/* ==============================================================================
   INTERACTIVE CHECKLISTS & TASKS
   ============================================================================== */
.progress-bar-wrap {
  margin-bottom: 16px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--surface-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--pear-lime), var(--caterpillar-green));
  border-radius: var(--radius-pill);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.checklist-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.todo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  transition: all 0.18s ease;
}

.todo-row:hover {
  border-color: #D3C6B5;
  background: #FCFAF7;
  transform: translateX(2px);
}

.todo-row.completed {
  background: #F4F8F5;
  border-color: #DCE8DE;
  opacity: 0.72;
}

.custom-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 2px solid #C4B7A5;
  border-radius: 7px;
  background: #FFFFFF;
  cursor: pointer;
  display: grid;
  place-content: center;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.custom-checkbox:hover {
  border-color: var(--caterpillar-green);
}

.custom-checkbox:checked {
  background: var(--caterpillar-green);
  border-color: var(--caterpillar-green);
}

.custom-checkbox:checked::before {
  content: '✓';
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
}

.todo-label {
  flex-grow: 1;
  font-size: 0.94rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease, text-decoration 0.15s ease;
}

.todo-row.completed .todo-label {
  text-decoration: line-through;
  color: var(--text-tertiary);
}

/* Hierarchical Checklist Subtasks */
.todo-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.checklist-subtask-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-left: 28px;
  padding-left: 14px;
  border-left: 2px solid rgba(47, 99, 62, 0.2);
  margin-top: 2px;
  margin-bottom: 6px;
}

.checklist-subtask-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(220, 210, 195, 0.45);
  font-size: 0.88rem;
  transition: all 0.15s ease;
}

.checklist-subtask-row:hover {
  background: #FFFFFF;
  border-color: rgba(47, 99, 62, 0.3);
}

.checklist-subtask-row.completed {
  opacity: 0.65;
  background: #F4F8F5;
}

.checklist-subtask-row.completed .subtask-label {
  text-decoration: line-through;
  color: var(--text-tertiary);
}

.subtask-checkbox {
  width: 17px;
  height: 17px;
  border-radius: 5px;
  border-width: 1.5px;
}

.subtask-checkbox:checked::before {
  font-size: 11px;
}

.subtask-label {
  flex-grow: 1;
  font-size: 0.88rem;
  color: var(--text-main);
  cursor: pointer;
}

.btn-delete-task {
  background: transparent;
  border: none;
  color: #BEAFA0;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  opacity: 0;
  transition: all 0.15s ease;
}

.todo-row:hover .btn-delete-task {
  opacity: 1;
}

.btn-delete-task:hover {
  background: var(--caterpillar-red-soft);
  color: var(--caterpillar-red);
}

/* Add Task Input Bar */
.add-task-bar {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-subtle);
  min-width: 0;
}

.add-task-input {
  flex-grow: 1;
  min-width: 0;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  background: #FFFFFF;
  color: var(--text-main);
  outline: none;
  transition: all 0.18s ease;
}

.add-task-input:focus {
  border-color: var(--caterpillar-green);
  box-shadow: 0 0 0 3px rgba(47, 99, 62, 0.12);
}

/* ==============================================================================
   FREEZER MEALS & INTERACTIVE COUNTERS
   ============================================================================== */
.meal-category-block {
  margin-bottom: 24px;
}

.meal-category-header {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--caterpillar-green);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.meal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  transition: all 0.15s ease;
  min-width: 0;
}

.meal-row:hover {
  border-color: #D3C6B5;
  background: #FCFAF7;
}

.meal-info {
  flex-grow: 1;
  min-width: 0;
}

.meal-name {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--text-main);
  text-decoration: none;
}

.meal-name:hover {
  color: var(--caterpillar-green);
  text-decoration: underline;
}

.meal-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.counter-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-subtle);
  padding: 4px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
}

.btn-counter {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: #FFFFFF;
  color: var(--text-main);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: all 0.12s ease;
}

.btn-counter:hover {
  background: var(--caterpillar-green);
  color: #FFFFFF;
}

.counter-value {
  font-weight: 700;
  font-size: 0.9rem;
  min-width: 24px;
  text-align: center;
}

/* ==============================================================================
   TABLES & ROADMAPS
   One-line rows: cells never wrap. Narrow screens scroll sideways.
   ============================================================================== */
.table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  contain: inline-size;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  margin: 4px 0 8px;
}

.table-wrap::-webkit-scrollbar {
  height: 8px;
}

.modern-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  white-space: nowrap;
  table-layout: auto;
}

.modern-table th,
.modern-table td {
  white-space: nowrap;
  vertical-align: middle;
  word-break: normal;
  overflow-wrap: normal;
}

.modern-table th {
  background: var(--surface-subtle);
  color: var(--caterpillar-green);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 11px 16px;
  text-align: left;
  border-bottom: 2px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 1;
}

.modern-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  background: var(--surface-card);
}

.modern-table tbody tr:last-child td {
  border-bottom: none;
}

.modern-table tr:hover td {
  background-color: #FAF6EF;
}

.modern-table .cell-primary {
  font-weight: 600;
  color: var(--text-main);
}

.modern-table .cell-sep {
  color: var(--text-tertiary);
  padding: 0 2px;
}

.modern-table .cell-muted {
  color: var(--text-secondary);
  font-weight: 500;
}

.modern-table .fruit-badge {
  white-space: nowrap;
}

.modern-table th:first-child,
.modern-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  box-shadow: 8px 0 12px -8px rgba(47, 99, 62, 0.12);
}

.modern-table th:first-child {
  z-index: 3;
  background: var(--surface-subtle);
}

@media (max-width: 1100px) {
  .table-wrap {
    background-image: linear-gradient(to right, var(--surface-card) 70%, rgba(255,255,255,0)),
      linear-gradient(to right, rgba(47, 99, 62, 0), rgba(47, 99, 62, 0.08));
    background-position: left, right;
    background-size: 100% 100%, 28px 100%;
    background-repeat: no-repeat;
  }
}

/* Day-by-Day Milestone Cards */
.day-card {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  background: var(--surface-card);
  margin-bottom: 12px;
  border-left: 4px solid var(--caterpillar-green);
}

.day-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  margin-bottom: 6px;
}

/* ==============================================================================
   MODALS & TOAST
   ============================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(30, 40, 32, 0.45);
  backdrop-filter: blur(6px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--surface-card);
  border-radius: var(--radius-xl);
  max-width: 580px;
  width: 100%;
  max-height: min(90vh, 100%);
  overflow-y: auto;
  padding: 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-subtle);
  animation: modalScale 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScale {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

.modal-header h3 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--text-main);
}

.btn-close-modal {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  outline: none;
  background: #FFFFFF;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--caterpillar-green);
  box-shadow: 0 0 0 3px rgba(47, 99, 62, 0.12);
}

/* Toast */
.toast-msg {
  position: fixed;
  bottom: 30px;
  right: 30px;
  max-width: min(420px, calc(100% - 24px));
  background: #1C3322;
  color: #FFFFFF;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 1100;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-msg.show {
  opacity: 1;
  transform: translateY(0);
}

/* ==============================================================================
   MOBILE & TABLET NAVIGATION INFRASTRUCTURE
   ============================================================================== */

/* Hamburger Button in Top Header (Hidden on Desktop & Tablet) */
.mobile-hamburger-btn {
  display: none;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--text-main);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
}

.mobile-hamburger-btn:active {
  transform: scale(0.92);
  background: #EFE8E1;
}

/* Mobile Slide-Out Drawer & Backdrop Overlay */
.mobile-drawer-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(26, 23, 20, 0.48);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.mobile-drawer-overlay.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

aside.mobile-nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 86%);
  max-width: 100%;
  background: #FAF7F2;
  border-right: 1px solid var(--border-subtle);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

aside.mobile-nav-drawer.active {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}

.mobile-drawer-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-card);
}

.mobile-drawer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-drawer-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--caterpillar-green);
  line-height: 1.2;
}

.mobile-drawer-sub {
  font-size: 0.76rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.mobile-drawer-close {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  width: 44px;
  height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.mobile-drawer-close:hover,
.mobile-drawer-close:active {
  background: #EFE8E1;
  color: var(--caterpillar-red);
}

/* Mobile Drawer Edit Mode Toggle Card */
.mobile-drawer-edit-card {
  margin: 12px 14px 6px;
  padding: 12px 14px;
  background: var(--surface-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.drawer-edit-info {
  display: flex;
  flex-direction: column;
}

.drawer-edit-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.drawer-edit-desc {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 1px;
}

.btn-drawer-edit-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 700;
  border: 1.5px solid var(--border-subtle);
  background: #FAF8F5;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-drawer-edit-toggle.active {
  background: #E8F5E9 !important;
  color: #1B5E20 !important;
  border-color: #81C784 !important;
  box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.2);
}

.mobile-drawer-scroll {
  flex-grow: 1;
  overflow-y: auto;
  padding: 6px 10px 24px;
}

.drawer-nav-group {
  margin-bottom: 14px;
}

.drawer-nav-heading {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  padding: 8px 12px 4px;
}

.drawer-nav-item {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.drawer-nav-item:active {
  background: rgba(47, 99, 62, 0.08);
  transform: scale(0.98);
}

.drawer-nav-item.active {
  background: #EAF3EC;
  color: var(--caterpillar-green);
  font-weight: 700;
}

.drawer-nav-icon {
  font-size: 1.25rem;
  width: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.drawer-nav-label {
  flex-grow: 1;
}

.mobile-drawer-footer {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  padding-left: 8px;
}

.drawer-doc-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--caterpillar-green);
  font-size: 0.86rem;
  font-weight: 600;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: #F2ECE4;
}

/* Mobile Fallback Navigation (Hidden on Desktop & Tablet) */
.mobile-nav-bar {
  display: none;
}

/* ==============================================================================
   1. MOBILE-ONLY VIEW (< 768px: PHONES)
   ============================================================================== */
@media (max-width: 767px) {
  html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-x: clip;
  }

  body {
    touch-action: pan-y;
  }

  body.drawer-open {
    overflow: hidden;
  }

  aside.sidebar {
    display: none !important;
  }

  .mobile-hamburger-btn {
    display: inline-flex !important;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  /* Keep mobile header ultra-clean: Edit mode toggle lives in drawer on phones */
  .top-header .btn-edit-mode-toggle {
    display: none !important;
  }

  .btn-text-desktop {
    display: none !important;
  }

  .btn-text-mobile {
    display: inline-block !important;
    font-weight: 700 !important;
    font-size: 1.15rem !important;
    line-height: 1 !important;
  }

  .top-header .btn-header-add-task {
    padding: 6px 12px !important;
    min-height: 44px !important;
    min-width: 44px !important;
    border-radius: var(--radius-full) !important;
  }

  header.top-header {
    padding: 8px 12px;
    padding-top: max(8px, env(safe-area-inset-top, 0px));
    padding-left: max(12px, env(safe-area-inset-left, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    height: auto;
    min-height: 56px;
    gap: 8px;
    width: 100%;
    max-width: 100%;
  }

  .header-left {
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
  }

  .page-title-wrap {
    min-width: 0;
    overflow: hidden;
  }

  .page-title-wrap h1 {
    font-size: 1.12rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-right {
    gap: 8px;
    flex-shrink: 0;
  }

  .header-scarry-mascot-wrap {
    width: 36px;
    height: 36px;
    max-width: 36px;
    max-height: 36px;
    margin-left: 4px;
  }

  .header-scarry-mascot-wrap img {
    width: 36px !important;
    height: 36px !important;
    max-width: 36px !important;
    max-height: 36px !important;
  }

  .main-viewport {
    margin-left: 0 !important;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }

  .content-body {
    padding: 12px 12px calc(88px + env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
  }

  /* Responsive Mobile Typography Overrides */
  .view-section h1,
  .view-section h2 {
    font-size: 1.35rem !important;
    line-height: 1.3 !important;
    letter-spacing: -0.01em !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    margin-bottom: 6px !important;
  }

  .view-section h3,
  .card h2,
  .card h3,
  .recovery-pillar-title,
  .bedrest-card-title {
    font-size: 1.15rem !important;
    line-height: 1.35 !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }

  .card-header,
  .card-header-flex {
    flex-wrap: wrap !important;
    gap: 8px !important;
    align-items: flex-start !important;
  }

  .card-header h2,
  .card-header h3,
  .card-header-flex h2,
  .card-header-flex h3 {
    max-width: 100% !important;
  }

  .view-section p,
  .view-header p,
  .card p {
    font-size: 0.9rem !important;
    line-height: 1.45 !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }

  /* Keep real table layout; ONLY the wrap scrolls — never the page */
  .table-wrap {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x pan-y;
    contain: inline-size;
  }

  table.modern-table {
    display: table !important;
    width: max-content !important;
    min-width: 100% !important;
    max-width: none !important;
    white-space: nowrap !important;
  }

  .modern-table th,
  .modern-table td {
    display: table-cell !important;
    padding: 10px 14px !important;
    font-size: 0.86rem !important;
    white-space: nowrap !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
  }

  /* Single-column responsive stacking on phones */
  .grid-desktop-2,
  .grid-desktop-3,
  .grid-desktop-4,
  .recovery-grid-2,
  .hero-stats-row,
  .bedrest-timeline-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .card {
    padding: 16px 14px !important;
    border-radius: var(--radius-lg) !important;
    min-width: 0;
    max-width: 100%;
  }

  .add-task-bar {
    flex-wrap: wrap;
  }

  .add-task-bar .form-select {
    max-width: 100% !important;
    width: 100%;
  }

  .meal-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .interactive-calendar-card {
    padding: 16px 12px;
    border-radius: var(--radius-lg);
  }

  .cal-grid-wrapper {
    gap: 4px;
  }

  .cal-cell-num {
    font-size: 0.82rem;
  }

  .priority-appointment-toast .toast-tag {
    white-space: normal;
  }

  .todo-label {
    min-width: 0;
  }

  .card-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Mobile Touch-Friendly Checklists (48px+ Tap Targets, 22px+ Box) */
  .todo-row {
    min-height: 48px;
    padding: 11px 12px !important;
    gap: 10px;
  }

  .custom-checkbox {
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
  }

  .todo-label {
    font-size: 0.92rem !important;
    line-height: 1.38;
  }

  .btn-edit-task,
  .btn-delete-task {
    opacity: 0.85 !important;
    padding: 6px 8px;
    min-height: 36px;
    min-width: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Bottom Navigation Bar (5 Large Touch Targets) */
  .mobile-nav-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-subtle);
    z-index: 950;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -3px 14px rgba(0, 0, 0, 0.08);
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    min-width: 0;
    flex: 1 1 0;
    min-height: 48px;
    padding: 4px 4px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-nav-item:active {
    transform: scale(0.92);
    background: rgba(47, 99, 62, 0.06);
  }

  .mobile-nav-item .mob-icon {
    font-size: 1.35rem;
    line-height: 1;
  }

  .mobile-nav-item .mob-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: -0.01em;
  }

  .mobile-nav-item.active {
    color: var(--caterpillar-green);
  }

  .mobile-nav-item.active .mob-icon {
    transform: scale(1.1);
  }

  .mobile-nav-item.mob-menu-trigger {
    color: var(--caterpillar-green);
    font-weight: 700;
  }

  /* Floating toast sizing on phones */
  .priority-appointment-toast {
    top: 64px;
    right: 12px;
    left: 12px;
    max-width: none;
  }
}

/* ==============================================================================
   2. ANDROID PIXEL TABLET 11" & TABLET LANDSCAPE VIEW (768px – 1366px)
   ============================================================================== */
@media (min-width: 768px) and (max-width: 1366px) {
  aside.sidebar {
    display: flex !important;
    width: 250px !important;
  }

  .mobile-hamburger-btn {
    display: none !important;
  }

  .mobile-nav-bar {
    display: none !important;
  }

  .mobile-drawer-overlay,
  aside.mobile-nav-drawer {
    display: none !important;
  }

  .main-viewport {
    margin-left: 250px !important;
    padding-bottom: 30px;
  }

  header.top-header {
    padding: 12px 24px;
  }

  .top-header .btn-edit-mode-toggle {
    display: inline-flex !important;
  }

  .content-body {
    padding: 20px 24px 40px;
  }

  /* Optimized 2-Column Landscape Layout */
  .grid-desktop-2 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 18px !important;
  }

  .grid-desktop-3 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 18px !important;
  }

  .grid-desktop-4 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 18px !important;
  }

  .hero-stats-row {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
  }

  /* Morgan's Golden Bed Rest 3 cards fit horizontally on 16:10 landscape */
  .bedrest-timeline-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 14px !important;
  }

  /* Touch sizing for tablet */
  .nav-btn {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 0.92rem;
  }

  .custom-checkbox {
    width: 20px !important;
    height: 20px !important;
  }

  .todo-row {
    min-height: 46px;
    padding: 10px 14px;
  }
}

/* ==============================================================================
   INTERACTIVE MONTHLY CALENDAR WIDGET (TOP OF DASHBOARD)
   ============================================================================== */
.interactive-calendar-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 24px 28px;
  margin-bottom: 26px;
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 28px;
  align-items: start;
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 900px) {
  .interactive-calendar-card {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
  }
}

.cal-left-pane {
  display: flex;
  flex-direction: column;
}

.cal-month-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.cal-month-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.cal-nav-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-cal-nav {
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  color: var(--text-main);
  transition: all 0.15s ease;
}

.btn-cal-nav:hover {
  background: var(--caterpillar-green);
  color: #FFF;
  border-color: var(--caterpillar-green);
}

.cal-grid-wrapper {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  text-align: center;
  min-width: 0;
  width: 100%;
}

.cal-day-header {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  padding: 6px 0;
  letter-spacing: 0.05em;
}

.cal-cell {
  position: relative;
  aspect-ratio: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.cal-cell.empty {
  cursor: default;
  pointer-events: none;
}

.cal-cell:hover:not(.empty) {
  background: #F4EFEB;
}

.cal-cell-num {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1;
}

.cal-cell.today {
  background: #E8F1EC;
  border-color: var(--caterpillar-green-soft);
}

.cal-cell.today .cal-cell-num {
  font-weight: 800;
  color: var(--caterpillar-green);
}

.cal-cell.selected {
  background: var(--caterpillar-green) !important;
  box-shadow: 0 4px 10px rgba(47, 99, 62, 0.25);
}

.cal-cell.selected .cal-cell-num {
  color: #FFFFFF !important;
  font-weight: 800;
}

.cal-cell.selected .cal-event-dot {
  background: #FFF !important;
}

.cal-dots-wrap {
  display: flex;
  gap: 3px;
  margin-top: 4px;
  height: 6px;
}

.cal-event-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--caterpillar-red);
}

.cal-event-dot.dot-due {
  background: #E27D60;
  width: 7px;
  height: 7px;
}

.cal-event-dot.dot-class {
  background: #D9A036;
}

/* Right Side: Selected Day Preview Panel */
.cal-preview-pane {
  background: #FAF7F2;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 230px;
}

.cal-preview-date-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--caterpillar-green);
  margin-bottom: 8px;
}

.cal-preview-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
  line-height: 1.25;
}

.cal-preview-meta {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 12px;
}

.cal-preview-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px dashed var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.btn-jump-next {
  background: var(--caterpillar-green);
  color: #FFF;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-jump-next:hover {
  background: #1C3E26;
}

/* ==============================================================================
   FREEZER MEAL MADE TOGGLE BUTTONS
   ============================================================================== */
.btn-meal-made {
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid var(--border-subtle);
  background: #FFF;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-meal-made:hover {
  border-color: var(--caterpillar-green);
  color: var(--caterpillar-green);
}

.btn-meal-made.made {
  background: #E8F4EC;
  border-color: var(--caterpillar-green-soft);
  color: var(--caterpillar-green);
}

.meal-row.meal-completed {
  background: #F9FCFA;
  border-left: 4px solid var(--caterpillar-green);
}

/* ==============================================================================
   CLOTHING INTERACTIVE CHECKLIST IN WARDROBE
   ============================================================================== */
.clothing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 768px) {
  .clothing-grid {
    grid-template-columns: 1fr;
  }
}

.clothing-card {
  background: #FFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
}

.clothing-card-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--caterpillar-green);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border-subtle);
}

.clothing-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #F5F1EB;
  cursor: pointer;
  user-select: none;
}

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

.clothing-item-row.done span {
  text-decoration: line-through;
  color: var(--text-tertiary);
}

/* ==============================================================================
   CALENDAR & APPOINTMENT IN-APP EDITING CONTROLS
   ============================================================================== */
.btn-cal-action {
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid var(--border-subtle);
  background: #FFFFFF;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-main);
}

.btn-cal-action:hover {
  background: #F4EFEB;
  border-color: #D3C6B5;
}

.btn-cal-edit {
  color: var(--caterpillar-green);
  border-color: var(--caterpillar-green-soft);
}

.btn-cal-edit:hover {
  background: #E8F4EC;
  border-color: var(--caterpillar-green);
}

.btn-cal-delete {
  color: var(--caterpillar-red);
  border-color: #F0D5D2;
}

.btn-cal-delete:hover {
  background: var(--caterpillar-red-soft);
  border-color: var(--caterpillar-red);
}

.btn-cal-add {
  background: var(--caterpillar-green);
  color: #FFFFFF;
  border-color: var(--caterpillar-green);
}

.btn-cal-add:hover {
  background: #1C3E26;
  color: #FFFFFF;
}

/* Appointments Table Row Actions */
.btn-table-action {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 0.82rem;
  cursor: pointer;
  margin-right: 4px;
  transition: all 0.15s ease;
}

.btn-table-action:hover {
  background: #F4EFEB;
}

.btn-table-edit:hover {
  border-color: var(--caterpillar-green);
  color: var(--caterpillar-green);
}

.btn-table-delete:hover {
  border-color: var(--caterpillar-red);
  color: var(--caterpillar-red);
}

/* Guardrail: Google Doc Table Verification Badge on Calendar */
.cal-table-sync-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.03em;
  transition: all 0.2s ease;
}

.cal-table-sync-badge.sync-verified {
  background: #E8F4EC;
  color: var(--caterpillar-green);
  border: 1px solid #C4E3CB;
}

.cal-table-sync-badge.sync-cached {
  background: #FFF4E5;
  color: #B76E00;
  border: 1px solid #FFE2B8;
}

.cal-table-sync-badge.sync-checking {
  background: #F0F4F8;
  color: #607274;
  border: 1px solid #D8E0E8;
}

/* ==============================================================================
   LIGHTWEIGHT LINE ITEM EDIT & SYNC STYLES
   ============================================================================== */
.btn-edit-task {
  background: transparent;
  border: none;
  color: #BEAFA0;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  opacity: 0;
  transition: all 0.15s ease;
}

.todo-row:hover .btn-edit-task {
  opacity: 1;
}

.btn-edit-task:hover {
  background: #EFE8E1;
  color: var(--caterpillar-green);
}

.todo-row.item-pending-edit {
  border-left: 3px solid #ECA328;
  background: #FFFDF9;
}

.todo-edit-input {
  flex-grow: 1;
  padding: 6px 10px;
  font-size: 0.92rem;
  border: 1.5px solid var(--caterpillar-green);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  color: var(--text-main);
  background: #FFFFFF;
  outline: none;
}

.todo-edit-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.btn-inline-save, .btn-inline-cancel {
  border: none;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 0.78rem;
  font-weight: 600;
}

.btn-inline-save {
  background: var(--caterpillar-green);
  color: #FFFFFF;
}

.btn-inline-cancel {
  background: #E8DFD5;
  color: var(--text-main);
}

/* --------------------------------------------------------------------------
   ERIC CARLE VERY HUNGRY CATERPILLAR MASCOT & INCHWORM ANIMATION
   -------------------------------------------------------------------------- */
.brand-caterpillar-img,
.scarry-header-mascot {
  width: 48px;
  height: 48px;
  max-width: 48px;
  max-height: 48px;
  object-fit: contain;
  display: block;
  transform-origin: bottom center;
  transition: transform 0.25s ease;
}

.brand-badge:hover .brand-caterpillar-img,
.header-scarry-mascot-wrap:hover .scarry-header-mascot {
  transform: scale(1.08);
}

.brand-caterpillar-img.is-inching,
.scarry-header-mascot.is-inching {
  animation: caterpillar-inchworm 2.8s cubic-bezier(0.45, 0, 0.55, 1) 1;
}

@keyframes caterpillar-inchworm {
  0% {
    transform: scale(1) translateY(0);
  }
  15% {
    transform: scaleX(1.14) scaleY(0.90) translateY(2px);
  }
  35% {
    transform: scaleX(0.86) scaleY(1.15) translateY(-4px);
  }
  55% {
    transform: scaleX(1.12) scaleY(0.92) translateY(2px);
  }
  75% {
    transform: scaleX(0.88) scaleY(1.12) translateY(-3px);
  }
  100% {
    transform: scale(1) translateY(0);
  }
}

.header-caterpillar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: -6px;
  margin-left: 10px;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(47, 99, 62, 0.25);
  display: inline-block;
}

.inline-caterpillar-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: -5px;
  margin-right: 8px;
  border: 1.5px solid #fff;
  box-shadow: 0 2px 6px rgba(47, 99, 62, 0.2);
  display: inline-block;
}

/* Hospital Bag Card Icon Badges */
.bag-badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 1.15rem;
  margin-right: 8px;
  vertical-align: middle;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.bag-icon-morgan {
  background: var(--caterpillar-red-soft);
  border: 1px solid rgba(215, 60, 44, 0.2);
}

.bag-icon-docs {
  background: var(--honey-cream);
  border: 1px solid rgba(235, 178, 58, 0.35);
}

.bag-icon-baby {
  background: var(--pear-lime-soft);
  border: 1px solid rgba(138, 171, 71, 0.25);
}

.bag-icon-nick {
  background: var(--blueberry-slate-soft);
  border: 1px solid rgba(82, 110, 140, 0.2);
}

/* Richard Scarry Smiling Caterpillar Mascot in Header Right */
.header-scarry-mascot-wrap {
  display: flex;
  align-items: center;
  margin-left: 12px;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  max-width: 48px;
  max-height: 48px;
}

.scarry-header-mascot {
  height: 48px;
  width: 48px;
  max-height: 48px;
  max-width: 48px;
  object-fit: contain;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
}

.scarry-header-mascot:hover {
  transform: scale(1.18) rotate(6deg);
}

/* --------------------------------------------------------------------------
   NEWBORN & POSTPARTUM PROGRESSIVE ACCORDIONS & WATCHLIST
   -------------------------------------------------------------------------- */
.recovery-week-card {
  margin-bottom: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface-card);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all 0.2s ease;
}

.recovery-week-card:hover {
  border-color: rgba(47, 99, 62, 0.3);
  box-shadow: var(--shadow-md);
}

.recovery-header-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  gap: 12px;
}

.recovery-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.recovery-week-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.recovery-chevron {
  font-size: 1.1rem;
  color: var(--text-secondary);
  transition: transform 0.22s ease;
  flex-shrink: 0;
}

.recovery-week-card.collapsed .recovery-chevron {
  transform: rotate(-90deg);
}

.recovery-week-card.collapsed .recovery-body {
  display: none;
}

.recovery-body {
  padding: 4px 20px 20px 20px;
  border-top: 1px solid var(--border-subtle);
}

.recovery-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 12px;
}

@media (max-width: 768px) {
  .recovery-grid-2 {
    grid-template-columns: 1fr;
  }
}

.recovery-pillar-box {
  background: #FAF8F5;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.recovery-pillar-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--caterpillar-green);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.recovery-action-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.recovery-action-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-main);
  line-height: 1.4;
}

.recovery-action-item input[type="checkbox"] {
  margin-top: 2px;
  cursor: pointer;
}

.watchlist-card {
  background: linear-gradient(135deg, #FFFDF8, #FBF6ED);
  border: 1px solid rgba(235, 178, 58, 0.35);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   MORGAN'S GOLDEN BED REST RULE INFOGRAPHIC
   -------------------------------------------------------------------------- */
.bedrest-infographic-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.bedrest-infographic-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 14px;
}

.bedrest-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bedrest-main-icon {
  font-size: 1.8rem;
}

.bedrest-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--text-main);
  margin: 0;
  font-weight: 700;
}

.bedrest-subtitle {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.bedrest-timeline-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.bedrest-card {
  border-radius: var(--radius-md);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bedrest-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Week 1: Crimson / Rose */
.bedrest-card.week-1 {
  background: linear-gradient(180deg, #FFF5F5 0%, #FFFFFF 100%);
  border: 1.5px solid rgba(227, 44, 43, 0.3);
  border-top: 4px solid var(--caterpillar-red);
}

.bedrest-card.week-1 .bedrest-badge-label {
  color: var(--caterpillar-red);
}

.bedrest-card.week-1 .bedrest-card-title {
  color: #9E1C1B;
}

/* Week 2: Warm Amber / Terracotta */
.bedrest-card.week-2 {
  background: linear-gradient(180deg, #FFFDF5 0%, #FFFFFF 100%);
  border: 1.5px solid rgba(236, 163, 40, 0.35);
  border-top: 4px solid var(--orange-accent);
}

.bedrest-card.week-2 .bedrest-badge-label {
  color: var(--orange-accent);
}

.bedrest-card.week-2 .bedrest-card-title {
  color: #8E560B;
}

/* Week 3: Soft Sage Green */
.bedrest-card.week-3 {
  background: linear-gradient(180deg, #F5FAF6 0%, #FFFFFF 100%);
  border: 1.5px solid rgba(47, 99, 62, 0.25);
  border-top: 4px solid var(--caterpillar-green);
}

.bedrest-card.week-3 .bedrest-badge-label {
  color: var(--caterpillar-green);
}

.bedrest-card.week-3 .bedrest-card-title {
  color: var(--caterpillar-green);
}

.bedrest-card-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.bedrest-card-badge .bedrest-icon {
  font-size: 1.3rem;
}

.bedrest-badge-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.bedrest-card-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 10px 0;
}

.bedrest-card-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
  flex-grow: 1;
}

.bedrest-card-list li {
  position: relative;
  padding-left: 14px;
  margin-bottom: 6px;
}

.bedrest-card-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--text-tertiary);
  font-weight: bold;
}

.bedrest-card-list li.rule-highlight {
  font-weight: 600;
  color: var(--text-main);
}

.bedrest-iron-callout {
  margin-top: 12px;
  background: #FFEBEB;
  border-left: 3px solid var(--caterpillar-red);
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 0.78rem;
  color: #821817;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  line-height: 1.35;
}

@media (max-width: 900px) {
  .bedrest-timeline-grid {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   HUB SETTINGS & MASTER CONTENT EDITOR
   -------------------------------------------------------------------------- */
.master-editor-toolbar {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: #FAF8F5;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  min-width: 0;
}

.master-toolbar-field {
  min-width: min(100%, 200px);
  flex: 1 1 200px;
}

.settings-reset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 12px;
}

.master-items-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 6px;
}

.master-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.master-item-row:hover {
  border-color: var(--caterpillar-green);
  box-shadow: var(--shadow-sm);
}

.master-item-category-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 6px;
  background: #F3EEE8;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

.master-item-input {
  flex-grow: 1;
  font-size: 0.92rem;
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--text-main);
  transition: all 0.18s ease;
}

.master-item-input:focus {
  background: #FFFDF8;
  border-color: var(--caterpillar-green);
  outline: none;
  box-shadow: 0 0 0 2px rgba(47, 99, 62, 0.15);
}

.master-item-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.btn-master-delete {
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.9rem;
  transition: color 0.15s ease, background 0.15s ease;
}

.btn-master-delete:hover {
  color: var(--caterpillar-red);
  background: #FFF0F0;
}

/* --------------------------------------------------------------------------
   LIVE EDIT MODE & IN-PLACE PERMISSIONS
   -------------------------------------------------------------------------- */
.btn-edit-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-edit-mode-toggle.active {
  background: #E8F5E9 !important;
  color: #1B5E20 !important;
  border-color: #81C784 !important;
  box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.2);
}

/* ==============================================================================
   LIVE EDIT MODE & IN-PLACE CONTENT PERMISSIONS (STRICTLY GATED)
   ============================================================================== */

/* When Edit Mode is OFF: completely disable and hide all editing controls and cues */
.btn-node-del,
.btn-card-del,
.btn-node-add,
.btn-section-reset {
  display: none !important;
}

[contenteditable="false"] {
  outline: none !important;
  cursor: default !important;
}

/* When Edit Mode is ON: activate in-place editing cues and outlines */
body.edit-mode-active [contenteditable="true"] {
  outline: 1px dashed rgba(47, 99, 62, 0.4);
  outline-offset: 2px;
  border-radius: 4px;
  cursor: text !important;
  background-color: rgba(255, 253, 235, 0.35);
  transition: background 0.15s ease, outline 0.15s ease;
}

body.edit-mode-active [contenteditable="true"]:hover {
  outline: 2px dashed var(--caterpillar-green);
  background-color: rgba(255, 253, 235, 0.85);
}

body.edit-mode-active [contenteditable="true"]:focus {
  outline: 2px solid var(--caterpillar-green) !important;
  background-color: #FFFDF8 !important;
}

/* Delete button for list items, badges, and table rows (Edit Mode ON) */
body.edit-mode-active .btn-node-del {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.8rem;
  line-height: 1;
  margin-left: 8px;
  vertical-align: middle;
  transition: all 0.15s ease;
}

body.edit-mode-active .btn-node-del:hover {
  color: var(--caterpillar-red);
  background: #FFF0F0;
  border-color: #FFCDD2;
}

/* Card delete button (Edit Mode ON) */
body.edit-mode-active .btn-card-del {
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
  background: #FFF5F5;
  border: 1px solid #FFCDD2;
  color: var(--caterpillar-red);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-left: auto;
}

body.edit-mode-active .btn-card-del:hover {
  background: var(--caterpillar-red);
  color: #FFFFFF;
}

/* Add Item & Add Row buttons (Edit Mode ON) */
body.edit-mode-active .btn-node-add {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  background: #F4FAF5;
  border: 1px dashed var(--caterpillar-green);
  color: var(--caterpillar-green);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
  margin-bottom: 12px;
  transition: all 0.15s ease;
}

body.edit-mode-active .btn-node-add:hover {
  background: var(--caterpillar-green);
  color: #FFFFFF;
}

/* Section Reset to Defaults Button (Edit Mode ON) */
body.edit-mode-active .btn-section-reset {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  background: #FAF8F5;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

body.edit-mode-active .btn-section-reset:hover {
  border-color: var(--caterpillar-red);
  color: var(--caterpillar-red);
  background: #FFF5F5;
}

/* Meal row action buttons */
.meal-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.btn-meal-action {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.88rem;
  color: var(--text-tertiary);
  transition: all 0.15s ease;
}

.btn-meal-action:hover {
  background: #F0ECE6;
  color: var(--text-main);
}

.btn-meal-action.btn-meal-del:hover {
  background: #FFF0F0;
  color: var(--caterpillar-red);
}

/* Note edit input */
.note-edit-input {
  width: 100%;
  font-size: 0.95rem;
  padding: 8px 12px;
  border: 1px solid var(--caterpillar-green);
  border-radius: 6px;
  outline: none;
  font-family: inherit;
  background: #FFFDF8;
}

/* ==============================================================================
   DIETZ BIRTH PLAN — Hungry Caterpillar varnish on Morgan's one-pager
   Cream paper, serif headings, fruit-colored section rules. Not a dashboard.
   ============================================================================== */
.birthplan-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 16px;
}

.birthplan-toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.birthplan-doc-link {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border-subtle);
}

.birthplan-doc-link:hover {
  color: var(--caterpillar-green);
  text-decoration-color: var(--caterpillar-green);
}

.birthplan-doc {
  --paper: #FFFBF4;
  width: 100%;
  max-width: 740px;
  min-width: 0;
  margin: 0 auto 40px;
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 10% 6%, rgba(215, 60, 44, 0.035), transparent 42%),
    radial-gradient(ellipse at 92% 10%, rgba(236, 163, 40, 0.045), transparent 40%),
    radial-gradient(ellipse at 82% 96%, rgba(47, 99, 62, 0.04), transparent 46%);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  padding: 42px 52px 48px;
  color: var(--text-main);
  print-color-adjust: exact;
  -webkit-print-color-adjust: exact;
}

.birthplan-doc-header {
  text-align: center;
  margin-bottom: 28px;
  padding-bottom: 18px;
}

.birthplan-motif {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  margin-bottom: 14px;
}

.birthplan-seg {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.birthplan-seg-head { width: 10px; height: 10px; background: var(--caterpillar-red); }
.birthplan-seg-2 { background: var(--caterpillar-green); }
.birthplan-seg-3 { background: var(--caterpillar-green-light); }
.birthplan-seg-4 { background: var(--pear-lime); }
.birthplan-seg-5 { background: var(--orange-accent); }
.birthplan-seg-tail { background: var(--sun-yellow); }

.birthplan-doc-header h2 {
  font-family: var(--font-serif);
  font-size: 2.05rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin: 0 0 12px;
  color: var(--text-main);
}

.birthplan-priorities {
  margin: 0 auto;
  max-width: 36em;
  font-family: var(--font-serif);
  font-size: 0.98rem;
  font-style: italic;
  line-height: 1.45;
  color: var(--text-main);
  padding: 10px 14px 0;
  border-top: 1px solid rgba(236, 163, 40, 0.45);
}

.birthplan-priorities-label {
  font-style: normal;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: #9A6605;
}

.birthplan-section {
  --birthplan-accent: var(--caterpillar-green);
  margin-bottom: 22px;
}

.birthplan-section[data-accent="apple"] { --birthplan-accent: var(--caterpillar-red); }
.birthplan-section[data-accent="pear"] { --birthplan-accent: var(--pear-lime); }
.birthplan-section[data-accent="honey"] { --birthplan-accent: var(--sun-yellow); }
.birthplan-section[data-accent="orange"] { --birthplan-accent: var(--orange-accent); }
.birthplan-section[data-accent="strawberry"] { --birthplan-accent: #C22D24; }
.birthplan-section[data-accent="plum"] { --birthplan-accent: var(--plum-purple); }
.birthplan-section[data-accent="blueberry"] { --birthplan-accent: var(--blueberry); }

.birthplan-section h3 {
  font-family: var(--font-serif);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-main);
  margin: 0 0 10px;
  padding: 0 0 6px;
  border-bottom: 2.5px solid var(--birthplan-accent);
}

.birthplan-subhead {
  font-family: var(--font-serif);
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-main);
  margin: 12px 0 6px;
}

.birthplan-facts {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.birthplan-fact,
.birthplan-birth-control {
  display: grid;
  grid-template-columns: 15.75rem 1fr;
  gap: 4px 16px;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
  align-items: baseline;
}

.birthplan-fact-nested {
  padding-left: 0.35rem;
}

.birthplan-fact-nested .birthplan-label {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.birthplan-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
  white-space: nowrap;
}

.birthplan-value {
  color: var(--text-main);
  min-width: 0;
  overflow-wrap: anywhere;
}

.birthplan-birth-control {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-subtle);
}

.birthplan-section ul {
  margin: 0;
  padding-left: 1.2em;
  line-height: 1.5;
  font-size: 0.95rem;
}

.birthplan-section li {
  margin: 0 0 3px;
}

.birthplan-section li::marker {
  color: var(--birthplan-accent);
}

.birthplan-doc a.tel-link,
.birthplan-doc a.mail-link {
  color: var(--caterpillar-green);
  text-decoration: none;
  font-weight: 600;
}

.birthplan-doc a.tel-link:hover,
.birthplan-doc a.mail-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 767px) {
  .birthplan-doc {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0 0 24px;
    padding: 18px 14px 24px;
    border-radius: var(--radius-md);
  }

  .birthplan-doc-header h2 {
    font-size: 1.45rem !important;
    letter-spacing: 0.04em;
    overflow-wrap: anywhere;
  }

  .birthplan-priorities {
    font-size: 0.9rem;
    padding-left: 0;
    padding-right: 0;
  }

  .birthplan-fact,
  .birthplan-birth-control {
    grid-template-columns: 1fr;
    gap: 1px;
    margin-bottom: 6px;
    min-width: 0;
  }

  .birthplan-label {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .birthplan-section {
    margin-bottom: 20px;
    min-width: 0;
  }

  .birthplan-toolbar {
    gap: 8px;
  }
}

@media print {
  body {
    background: #fff !important;
  }

  aside.sidebar,
  header.top-header,
  .mobile-nav-bar,
  .mobile-nav-drawer,
  .mobile-drawer-overlay,
  .birthplan-toolbar,
  .birthplan-doc-link,
  .priority-appointment-toast,
  #toast-msg,
  .btn-section-reset {
    display: none !important;
  }

  .main-viewport {
    margin: 0 !important;
  }

  .content-body {
    padding: 0 !important;
  }

  .view-section {
    display: none !important;
  }

  #view-birthplan {
    display: block !important;
  }

  .birthplan-doc {
    max-width: none;
    margin: 0;
    border: none;
    box-shadow: none;
    padding: 0;
    background: #fff;
    background-image: none;
  }

  .birthplan-section {
    break-inside: avoid;
    margin-bottom: 14px;
  }

  .birthplan-doc-header {
    margin-bottom: 16px;
    padding-bottom: 10px;
  }

  .birthplan-doc-header h2 {
    font-size: 22pt;
  }

  .birthplan-section h3 {
    font-size: 12pt;
  }

  .birthplan-fact,
  .birthplan-birth-control,
  .birthplan-section ul {
    font-size: 10.5pt;
  }
}

/* ==============================================================================
   PHONE APP SHELL — overflow containment (page never pans sideways)
   Tables may scroll inside .table-wrap only.
   ============================================================================== */
.master-item-row {
  min-width: 0;
}

.master-item-input {
  min-width: 0;
}

.todo-row,
.todo-wrapper,
.todo-label {
  min-width: 0;
}

.welcome-stripe-banner,
.welcome-stripe-left,
.welcome-stripe-right,
.welcome-stripe-title {
  min-width: 0;
  max-width: 100%;
}

.birthplan-fact,
.birthplan-birth-control {
  min-width: 0;
}

@media (max-width: 767px) {
  .master-item-row {
    flex-wrap: wrap;
  }

  .master-item-category-badge {
    white-space: normal;
  }

  .modal-overlay {
    padding: 12px;
    align-items: flex-end;
  }

  .modal-box {
    padding: 22px 18px;
    border-radius: var(--radius-lg) var(--radius-lg) 12px 12px;
    max-height: calc(100dvh - 16px);
  }

  .toast-msg {
    left: 12px;
    right: 12px;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    max-width: none;
  }

  .welcome-stripe-title {
    white-space: normal;
  }

  .fruit-badge {
    max-width: 100%;
    white-space: normal;
    text-align: left;
  }

  .modern-table .fruit-badge {
    white-space: nowrap;
  }

  .btn,
  .btn-primary,
  .btn-secondary {
    max-width: 100%;
  }

  #master-add-category {
    max-width: 100% !important;
  }
}







