/* ============================================================
   Vilyge Lite — Design System
   Warm & friendly · Sky blue · Mobile-first
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Custom Properties (Design Tokens) ── */
:root {
  /* Brand */
  --color-primary:        #0EA5E9;
  --color-primary-dark:   #0284C7;
  --color-primary-light:  #BAE6FD;
  --color-primary-subtle: #F0F9FF;

  /* Backgrounds */
  --color-bg:             #FFFBF7;
  --color-surface:        #FFFFFF;
  --color-surface-raised: #FFFFFF;
  --color-surface-subtle: #F9F6F2;

  /* Text */
  --color-text:           #1C1917;
  --color-text-secondary: #44403C;
  --color-text-muted:     #78716C;
  --color-text-placeholder: #A8A29E;

  /* Semantic */
  --color-success:        #22C55E;
  --color-success-bg:     #F0FDF4;
  --color-warning:        #F59E0B;
  --color-warning-bg:     #FFFBEB;
  --color-danger:         #EF4444;
  --color-danger-bg:      #FEF2F2;
  --color-info:           #0EA5E9;
  --color-info-bg:        #F0F9FF;

  /* Role Colors */
  --color-guardian:       #8B5CF6;
  --color-villager:       #0EA5E9;
  --color-little-one:     #F59E0B;

  /* Borders */
  --color-border:         #E7E0D8;
  --color-border-light:   #F0EAE2;
  --color-border-focus:   #0EA5E9;

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(28,25,23,0.06), 0 1px 2px rgba(28,25,23,0.04);
  --shadow-md:   0 4px 12px rgba(28,25,23,0.08), 0 2px 4px rgba(28,25,23,0.04);
  --shadow-lg:   0 8px 24px rgba(28,25,23,0.12), 0 4px 8px rgba(28,25,23,0.06);
  --shadow-xl:   0 20px 40px rgba(28,25,23,0.16);

  /* Border Radii */
  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-xl:   24px;
  --radius-full: 9999px;

  /* Spacing */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-xs:   11px;
  --font-size-sm:   13px;
  --font-size-base: 15px;
  --font-size-md:   16px;
  --font-size-lg:   18px;
  --font-size-xl:   20px;
  --font-size-2xl:  24px;
  --font-size-3xl:  30px;

  /* Transitions */
  --transition-fast:   0.12s ease;
  --transition-base:   0.2s ease;
  --transition-slow:   0.3s ease;

  /* Nav */
  --nav-height:        64px;
  --header-height:     56px;
  --max-width:         480px;
}

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

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

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-bg);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }
ul, ol { list-style: none; }

/* ── App Layout ── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: var(--max-width);
  margin: 0 auto;
  position: relative;
}

.page {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 100dvh;
}
.page.active { display: flex; }

/* Pages with bottom nav have padding */
.page.has-nav {
  padding-bottom: var(--nav-height);
}

/* ── Screen Header ── */
.screen-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border-light);
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--header-height);
}

.screen-header h1 {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-text);
  flex: 1;
  max-width: calc(100% - var(--space-12));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen-header .header-action {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}


/* ── Sidebar Logo Header ── */
.sidebar-logo {
  display: none; /* hidden on mobile */
}
/* ── Bottom Navigation ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  height: var(--nav-height);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border-light);
  display: flex;
  align-items: stretch;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.bottom-nav::-webkit-scrollbar { display: none; }

.nav-item {
  flex: 1;
  min-width: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: 500;
  padding: var(--space-2) var(--space-1);
  transition: color var(--transition-fast);
  position: relative;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke var(--transition-fast);
}

.nav-item.active {
  color: var(--color-primary);
}

.nav-item.active svg {
  stroke: var(--color-primary);
}

.nav-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 14px);
  background: var(--color-danger);
  color: white;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--color-surface);
}

/* ── Scroll Container ── */
.scroll-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-5);
}

/* ── Typography ── */
h1 { font-size: var(--font-size-2xl); font-weight: 800; line-height: 1.2; }
h2 { font-size: var(--font-size-xl); font-weight: 700; line-height: 1.3; }
h3 { font-size: var(--font-size-lg); font-weight: 600; line-height: 1.3; }
h4 { font-size: var(--font-size-md); font-weight: 600; }
h5 { font-size: var(--font-size-base); font-weight: 600; }

.text-sm    { font-size: var(--font-size-sm); }
.text-xs    { font-size: var(--font-size-xs); }
.text-muted { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }
.text-primary { color: var(--color-primary); }
.text-success { color: var(--color-success); }
.text-danger  { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  font-weight: 600;
  line-height: 1;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px var(--space-6);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  position: relative;
  overflow: hidden;
}

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

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}
.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-dark);
}

.btn-secondary {
  background: var(--color-surface-subtle);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--color-border-light);
}

.btn-ghost {
  background: transparent;
  color: var(--color-primary);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--color-primary-subtle);
}

.btn-danger {
  background: var(--color-danger);
  color: white;
}
.btn-danger:hover:not(:disabled) {
  background: #DC2626;
}

.btn-success {
  background: var(--color-success);
  color: white;
}

.btn-full  { width: 100%; }
.btn-sm    { font-size: var(--font-size-sm); padding: 10px var(--space-4); border-radius: var(--radius-sm); }
.btn-icon  { padding: 10px; border-radius: var(--radius-md); }

.btn-google {
  background: white;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}
.btn-google:hover:not(:disabled) {
  background: var(--color-surface-subtle);
}

/* Loading spinner in button */
.btn.loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.btn.loading > * { opacity: 0; }


/* ── Password Toggle ── */
.pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.pw-wrap .form-input {
  padding-right: 44px;
  width: 100%;
}
.pw-toggle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  border-radius: 0 var(--radius-input) var(--radius-input) 0;
  transition: color 0.15s;
}
.pw-toggle:hover { color: var(--color-text); }
.pw-toggle svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pw-toggle .hidden { display: none; }

/* ── Forms ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
}

.form-input {
  width: 100%;
  padding: 14px var(--space-4);
  font-size: var(--font-size-base);
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.form-input::placeholder {
  color: var(--color-text-placeholder);
}

.form-input:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
}

.form-input.error {
  border-color: var(--color-danger);
}

.form-input:focus.error {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.form-select {
  width: 100%;
  padding: 14px var(--space-4);
  font-size: var(--font-size-base);
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2378716C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

.form-select:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
}

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

.form-error {
  font-size: var(--font-size-sm);
  color: var(--color-danger);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.form-hint {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

/* ── Cards ── */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-body {
  padding: var(--space-5);
}

.card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: var(--font-size-base);
  font-weight: 600;
}

.card-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border-light);
  background: var(--color-surface-subtle);
}

/* Pressable cards */
.card-pressable {
  cursor: pointer;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.card-pressable:active {
  transform: scale(0.98);
  box-shadow: none;
}

/* ── List Items ── */
.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border-light);
  transition: background var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

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

.list-item.pressable {
  cursor: pointer;
}
.list-item.pressable:active {
  background: var(--color-surface-subtle);
}

.list-item-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.list-item-content {
  flex: 1;
  min-width: 0;
}

.list-item-title {
  font-size: var(--font-size-base);
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* ── Badges / Chips ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-primary  { background: var(--color-primary-subtle); color: var(--color-primary-dark); }
.badge-success  { background: var(--color-success-bg); color: #16A34A; }
.badge-warning  { background: var(--color-warning-bg); color: #B45309; }
.badge-danger   { background: var(--color-danger-bg); color: #B91C1C; }
.badge-muted    { background: var(--color-surface-subtle); color: var(--color-text-muted); }
.badge-guardian { background: #EDE9FE; color: #6D28D9; }
.badge-villager { background: var(--color-primary-subtle); color: var(--color-primary-dark); }
.badge-little-one { background: #FFFBEB; color: #92400E; }

/* ── Avatar ── */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-base);
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  user-select: none;
}

.avatar-sm { width: 32px; height: 32px; font-size: var(--font-size-sm); }
.avatar-lg { width: 52px; height: 52px; font-size: var(--font-size-xl); }
.avatar-xl { width: 72px; height: 72px; font-size: var(--font-size-2xl); }

/* ── Dividers ── */
.divider {
  height: 1px;
  background: var(--color-border-light);
  margin: var(--space-5) 0;
}

.divider-text {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-5) 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}
.divider-text::before, .divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* ── Section Headers ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-placeholder);
}

/* ── Empty States ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
  gap: var(--space-3);
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-xl);
  background: var(--color-surface-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-2);
}

.empty-state-icon svg {
  width: 28px;
  height: 28px;
  stroke: var(--color-text-muted);
  fill: none;
  stroke-width: 1.5;
}

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

.empty-state p {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  max-width: 260px;
  line-height: 1.6;
}


/* ── Ghost / illustrated empty states ── */
.ghost-empty {
  padding: var(--space-6) var(--space-4) var(--space-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
  width: 100%;
}

.ghost-empty-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.ghost-empty-icon {
  font-size: 44px;
  line-height: 1;
  margin-bottom: var(--space-1);
}

.ghost-empty-header h3 {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text);
  margin: 0;
}

.ghost-empty-header p {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  max-width: 260px;
  line-height: 1.6;
  margin: 0;
}

.ghost-preview-wrap {
  position: relative;
  width: 100%;
  max-width: 480px;
}

.ghost-preview-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
  user-select: none;
}

.ghost-preview-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border: 1px solid var(--color-border);
  opacity: 0.55;
  filter: blur(1.8px);
}

.ghost-preview-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255,251,247,0.2) 0%, rgba(255,251,247,0.88) 100%);
  pointer-events: none;
  border-radius: var(--radius-lg);
}

.ghost-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  flex-shrink: 0;
}

.ghost-square {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #bae6fd, #7dd3fc);
  flex-shrink: 0;
  opacity: 0.7;
}

.ghost-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ghost-line {
  height: 10px;
  border-radius: 6px;
  background: linear-gradient(90deg, #e2e8f0 0%, #f1f5f9 50%, #e2e8f0 100%);
  background-size: 200% 100%;
  animation: ghost-shimmer 1.8s ease-in-out infinite;
}

.ghost-line--wide  { width: 68%; }
.ghost-line--mid   { width: 48%; }
.ghost-line--short { width: 32%; }

@keyframes ghost-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.ghost-pill {
  height: 22px;
  width: 58px;
  border-radius: 999px;
  background: linear-gradient(135deg, #bae6fd, #7dd3fc);
  flex-shrink: 0;
  opacity: 0.65;
}

.ghost-cta-btn {
  margin-top: var(--space-1);
  padding: var(--space-3) var(--space-6);
  font-size: var(--font-size-base);
  min-width: 220px;
  max-width: 100%;
  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.3);
}

/* ── Alerts / Toasts ── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
}

.alert-success { background: var(--color-success-bg); color: #15803D; }
.alert-warning { background: var(--color-warning-bg); color: #92400E; }
.alert-danger  { background: var(--color-danger-bg);  color: #991B1B; }
.alert-info    { background: var(--color-info-bg);    color: #0369A1; }

.toast-container {
  position: fixed;
  top: var(--space-4);
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: calc(100% - var(--space-8));
  max-width: calc(var(--max-width) - var(--space-8));
  pointer-events: none;
}

.toast {
  background: var(--color-text);
  color: white;
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.2s ease;
  pointer-events: auto;
}

.toast.success { background: #15803D; }
.toast.error   { background: #B91C1C; }
.toast.warning { background: #B45309; }

/* ── Modal / Bottom Sheet ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: overlay-in 0.15s ease;
}

.modal-overlay.center-modal {
  align-items: center;
  padding: var(--space-5);
}

.bottom-sheet {
  background: var(--color-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-3) var(--space-5) calc(var(--space-6) + env(safe-area-inset-bottom, 0));
  width: 100%;
  max-width: var(--max-width);
  max-height: 90dvh;
  overflow-y: auto;
  animation: sheet-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-5);
}

.modal-dialog {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  width: 100%;
  max-width: 360px;
  animation: modal-in 0.2s ease;
}

.modal-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.modal-body {
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
  margin-bottom: var(--space-6);
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: var(--space-3);
}
.modal-actions .btn { flex: 1; }

/* ── FAB (Floating Action Button) ── */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--space-4) + env(safe-area-inset-bottom, 0px));
  right: max(var(--space-5), env(safe-area-inset-right, 0px));
  width: 52px;
  height: 52px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: white;
  border: none;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 50;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.fab:active { transform: scale(0.92); }
.fab svg {
  width: 24px;
  height: 24px;
  stroke: white;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Skeleton Loader ── */
.skeleton {
  background: linear-gradient(90deg, var(--color-border-light) 25%, var(--color-surface-subtle) 50%, var(--color-border-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ── Toggle / Switch ── */
.toggle {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}
.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--color-border);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
  cursor: pointer;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: white;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}
.toggle input:checked + .toggle-track {
  background: var(--color-primary);
}
.toggle input:checked + .toggle-track::after {
  transform: translateX(20px);
}

/* ── Progress Bar ── */
.progress-bar {
  height: 8px;
  background: var(--color-border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}
.progress-fill.success { background: var(--color-success); }
.progress-fill.warning { background: var(--color-warning); }

/* ── Icon Button ── */
.icon-btn {
  width: 40px;
  height: 40px;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { background: var(--color-surface-subtle); color: var(--color-text); }
.icon-btn:active { transform: scale(0.9); }
.icon-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Priority Indicators ── */
.priority-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.priority-high   { background: var(--color-danger); }
.priority-med    { background: var(--color-warning); }
.priority-low    { background: var(--color-success); }

/* ── Utility Classes ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }
.hidden { display: none !important; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.text-center { text-align: center; }
.rounded-full { border-radius: var(--radius-full); }

/* ── Animations ── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

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

@keyframes overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes sheet-in {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fade-in 0.2s ease; }

/* ── Loading Screen ── */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  gap: var(--space-4);
}

.loading-logo {
  font-size: var(--font-size-2xl);
  font-weight: 800;
  color: var(--color-primary);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Checkbox ── */
.checkbox-group {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}
.checkbox-input {
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  background: white;
  transition: all var(--transition-fast);
}
.checkbox-input:checked {
  background: var(--color-primary);
  border-color: var(--color-primary);
}
.checkbox-input:checked::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 5px;
  width: 6px;
  height: 10px;
  border: 2px solid white;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

/* ── Date Chip ── */
.date-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-height: 48px;
  border-radius: var(--radius-md);
  background: var(--color-surface-subtle);
  flex-shrink: 0;
}
.date-chip .month {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}
.date-chip .day {
  font-size: var(--font-size-lg);
  font-weight: 800;
  color: var(--color-text);
  line-height: 1;
}
.date-chip.today {
  background: var(--color-primary);
}
.date-chip.today .month,
.date-chip.today .day {
  color: white;
}
.date-chip.overdue {
  background: var(--color-danger-bg);
}
.date-chip.overdue .month,
.date-chip.overdue .day {
  color: var(--color-danger);
}


/* ── Settings Desktop Panels (base/mobile: stacked, no flex) ── */
.settings-desktop-wrap { display: block; }
.settings-profile-panel {
  padding: var(--space-5);
  border-bottom: 1px solid var(--color-border-light);
}
.settings-main-panel { padding: 0; }
.settings-section {
  padding: var(--space-5);
  border-bottom: 1px solid var(--color-border-light);
}
.settings-section:last-child { border-bottom: none; }
.settings-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-placeholder);
  margin-bottom: var(--space-4);
}
/* Desktop profile block: hidden on mobile, shown on desktop */
.settings-profile-block { display: none; }
/* Mobile profile row: shown on mobile, hidden on desktop */
.settings-profile-mobile { display: flex; }
.settings-profile-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ── Home Screen Base Styles ────────────────────────────────── */
.home-hero {
  position: relative;
  overflow: hidden;
  /* Default: afternoon — overridden by data-theme */
  background: linear-gradient(160deg, #0284C7 0%, #0EA5E9 55%, #38BDF8 100%);
  transition: background 0.6s ease;
}

/* ── Time-of-day adaptive gradients ── */
.home-hero[data-theme="dawn"]      { background: linear-gradient(160deg, #7C3AED 0%, #EC4899 45%, #F97316 100%); }
.home-hero[data-theme="morning"]   { background: linear-gradient(160deg, #0369A1 0%, #0EA5E9 55%, #7DD3FC 100%); }
.home-hero[data-theme="afternoon"] { background: linear-gradient(160deg, #0284C7 0%, #0EA5E9 55%, #38BDF8 100%); }
.home-hero[data-theme="evening"]   { background: linear-gradient(160deg, #92400E 0%, #EC4899 45%, #7C3AED 100%); }
.home-hero[data-theme="night"]     { background: linear-gradient(160deg, #0F172A 0%, #1E3A5F 50%, #312E81 100%); }

/* ── Subtle dot pattern overlay ── */
.home-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.18) 1.5px, transparent 1.5px);
  background-size: 22px 22px;
  pointer-events: none;
  z-index: 0;
}
.home-hero-inner {
  position: relative;
  z-index: 1;
  padding: var(--space-5) var(--space-5) var(--space-4);
}
.home-hero-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.home-hero-left { flex: 1; min-width: 0; }

/* ── Hero footer row: weather + inline stats ── */
.home-hero-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.home-hero-stats-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: rgba(255,255,255,0.82);
}
.hstat-num {
  font-size: 15px;
  font-weight: 800;
  color: white;
  line-height: 1;
}
.hstat-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.62);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 2px;
}
.hstat-sep {
  font-size: 12px;
  color: rgba(255,255,255,0.3);
  margin: 0 2px;
}

/* City row */
.home-city-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}
.home-city-pin  { font-size: 11px; opacity: 0.8; }
.home-city-name { color: rgba(255,255,255,0.82); font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }

.home-date   { color: rgba(255,255,255,0.68); font-size: 12px; margin-bottom: 4px; }
.home-greeting { color: white; font-size: 26px; font-weight: 800; margin-bottom: 4px; text-shadow: 0 1px 4px rgba(0,0,0,0.15); overflow-wrap: break-word; word-break: break-word; }
.home-family-name { color: rgba(255,255,255,0.78); font-size: 14px; }

/* ── Weather Button (in hero) ── */
.weather-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.32);
  border-radius: var(--radius-full);
  color: white;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: background 0.15s;
  margin-top: 8px;
}
.weather-btn:hover { background: rgba(255,255,255,0.26); }
.weather-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ── Weather Modal ── */
.weather-modal { max-height: 88dvh; overflow-y: auto; }
.weather-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}
.weather-modal-location {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 600;
}
.weather-loc-icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--color-primary); }
.weather-modal-today {
  background: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  color: white;
  margin-bottom: var(--space-5);
  min-height: 100px;
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.wm-today-icon { opacity: 0.92; flex-shrink: 0; }
.wm-today-temp { font-size: 44px; font-weight: 900; line-height: 1; }
.wm-today-desc { font-size: 14px; font-weight: 600; opacity: 0.85; margin-top: 4px; text-transform: capitalize; }
.wm-loading { color: rgba(255,255,255,0.7); font-size: 14px; width: 100%; text-align: center; }
.weather-modal-week-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-placeholder);
  margin-bottom: var(--space-3);
}
.weather-modal-week {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 4px;
}
.weather-modal-week::-webkit-scrollbar { display: none; }
.wm-day-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border-light);
  border-radius: 12px;
  padding: 10px 12px;
  min-width: 60px;
  flex-shrink: 0;
}
.wm-day-chip--today {
  border-color: var(--color-primary);
  background: var(--color-primary-subtle);
}
.wm-day-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); }
.wm-day-icon  { color: var(--color-primary); }
.wm-day-hi    { font-size: 13px; font-weight: 800; color: var(--color-text); }
.wm-day-lo    { font-size: 11px; font-weight: 600; color: var(--color-text-muted); }

/* ── Home body: clean card grid ── */
.home-body {
  padding: var(--space-4) var(--space-4) var(--space-6);
  display: flex;
  flex-direction: column;
  gap: 0;
}
.home-body--villager .home-col-right { display: none; }
.home-end-spacer { height: var(--space-6); }

/* ── Home cards ── */
.hcard {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
  box-shadow: 0 1px 4px rgba(28,25,23,0.05), 0 0 0 0.5px rgba(28,25,23,0.04);
  overflow: hidden;
  margin-bottom: var(--space-4);
}
.hcard-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px var(--space-4);
  border-bottom: 1px solid var(--color-border-light);
  background: var(--color-surface);
}
.hcard-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hcard-icon svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hcard-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text);
  flex: 1;
}

/* Quick actions grid */
/* quick-action-grid removed */

/* Family member strip */
.family-member-strip {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  padding-bottom: var(--space-2);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.family-member-strip::-webkit-scrollbar { display: none; }
.family-member-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.family-member-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
  max-width: 56px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.section-link {
  font-size: 13px;
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: none;
}


/* ── Home hero: compact mobile stats (shown on mobile below greeting) ── */
.home-hero-stats-mobile {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 10px;
}
.home-hero-stats-mobile .hero-stat-m {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.home-hero-stats-mobile .hero-stat-m-num {
  font-size: 20px;
  font-weight: 800;
  color: white;
  line-height: 1;
}
.home-hero-stats-mobile .hero-stat-m-label {
  font-size: 9px;
  font-weight: 700;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.home-hero-stats-mobile .hero-stat-m-divider {
  width: 1px;
  height: 24px;
  background: rgba(255,255,255,0.25);
}

/* ═══════════════════════════════════════════════════════════════
   Desktop Layout (≥768px)
   Sidebar nav replaces bottom nav. Content fills full width.
   Home screen becomes a 2-column dashboard grid.
   Mobile layout is completely unchanged below this breakpoint.
   ═══════════════════════════════════════════════════════════════ */

@media (min-width: 768px) {

  /* ─── Base ──────────────────────────────────────────── */
  body {
    background: #DDD6CC;
    min-height: 100dvh;
  }
  #app {
    max-width: 100%;
    margin: 0;
    min-height: 100dvh;
    background: transparent;
  }

  /* ─── Loading screen ─────────────────────────────────── */
  .loading-screen { background: linear-gradient(160deg, #0EA5E9 0%, #0284C7 50%, #075985 100%); }
  .loading-logo   { color: white; }
  .spinner { border-color: rgba(255,255,255,0.25); border-top-color: white; }

  /* ═══════════════════════════════════════════════════════
     SIDEBAR NAVIGATION
  ═══════════════════════════════════════════════════════ */
  .bottom-nav {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 220px;
    height: 100dvh;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 0 0 24px 0;
    background: #1E1B18;
    border-top: none;
    border-right: none;
    box-shadow: 2px 0 20px rgba(0,0,0,0.25);
    z-index: 200;
    overflow-y: auto;
    transform: none;
  }

  /* Brand header — replaced by .sidebar-logo element */
  .bottom-nav::before { display: none; }

  .sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 8px;
    flex-shrink: 0;
  }
  .sidebar-logo-img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    border-radius: 6px;
    flex-shrink: 0;
  }
  .sidebar-logo-text {
    font-size: 15px;
    font-weight: 800;
    color: #60BFFF;
    letter-spacing: -0.3px;
    white-space: nowrap;
  }

  /* Nav items */
  .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-radius: 10px;
    margin: 2px 10px;
    min-height: 44px;
    flex: 0 0 auto;
    width: auto;
    font-size: 14px;
    border-bottom: none;
    color: #B0A8A0;
    transition: background 0.15s, color 0.12s;
  }
  .nav-item svg { width: 18px; height: 18px; flex-shrink: 0; stroke: #8A8078; transition: stroke 0.12s; }
  .nav-item span { font-size: 14px; font-weight: 500; }
  .nav-item:hover:not(.active) { background: rgba(255,255,255,0.07); color: #F5F0EB; }
  .nav-item:hover:not(.active) svg { stroke: #60BFFF; }
  .nav-item.active {
    background: rgba(14,165,233,0.18);
    color: #60BFFF;
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(14,165,233,0.25);
  }
  .nav-item.active svg { stroke: #60BFFF; }

  /* ═══════════════════════════════════════════════════════
     MAIN CONTENT AREA — full width, no max-width cap
  ═══════════════════════════════════════════════════════ */
  .page.has-nav {
    margin-left: 220px;
    padding-bottom: 0;
    min-height: 100dvh;
    max-width: none;
    background: #F2EDE6;
    overflow-y: auto;
  }

  /* Sticky header */
  .page.has-nav .screen-header {
    background: rgba(242,237,230,0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid #DDD6CC;
    max-width: none;
    padding: 16px 48px;
    min-height: 60px;
  }
  .page.has-nav .screen-header h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
  }

  /* Scroll content: NO max-width, fills the whole area */
  .page.has-nav .scroll-content {
    max-width: none;
    margin: 0;
    padding: 40px 48px 60px;
  }

  /* Section title */
  .section-title { font-size: 12px; letter-spacing: 0.07em; }
  .section-link  { font-size: 13px; }

  /* ─── Cards ──────────────────────────────────────────── */
  .card {
    box-shadow: 0 1px 4px rgba(28,25,23,0.06), 0 0 0 1px rgba(28,25,23,0.04);
    border: none;
    transition: box-shadow 0.2s, transform 0.15s;
  }
  .card-pressable:hover {
    box-shadow: 0 6px 18px rgba(28,25,23,0.11), 0 0 0 1px rgba(14,165,233,0.14);
    transform: translateY(-2px);
    cursor: pointer;
  }
  .card-pressable:active { transform: translateY(0); }

  /* ─── List items ─────────────────────────────────────── */
  .list-item { padding: 14px 20px; min-height: 58px; }

  /* ─── Buttons ────────────────────────────────────────── */
  .btn { height: 42px; font-size: 14px; }
  .btn-lg { height: 50px; font-size: 16px; }

  /* ─── Forms ──────────────────────────────────────────── */
  .form-input, .form-select { height: 46px; font-size: 15px; }

  /* ═══════════════════════════════════════════════════════
     HOME SCREEN — two-column dashboard
  ═══════════════════════════════════════════════════════ */

  /* Hero: full bleed, taller, bigger text */
  /* ── Hero on desktop ── */
  .home-hero { min-height: 180px; }
  .home-hero-inner {
    padding: 40px 56px 36px;
    max-width: none;
  }
  .home-greeting { font-size: 36px; }
  .home-date     { font-size: 14px; }
  .home-family-name { font-size: 15px; }
  .home-hero-footer { flex-wrap: nowrap; }
  .hstat-num { font-size: 18px; }
  .hstat-label { font-size: 11px; }

  /* ── Home body: 2-col grid on desktop ── */
  .home-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 24px;
    align-items: start;
    padding: 28px 40px 48px;
  }
  .home-col-left  { grid-column: 1; }
  .home-col-right { grid-column: 2; }
  .home-panel-full { grid-column: 1 / -1; }
  .home-body--villager .home-col-left { grid-column: 1 / -1; }
  .home-end-spacer { display: none; }
  .hcard { margin-bottom: 24px; }
  .hcard-head { padding: 14px 20px; }
  .hcard-title { font-size: 15px; }
  .family-member-strip { gap: var(--space-5); }
  .family-member-chip  { gap: 8px; }

  /* ═══════════════════════════════════════════════════════
     MODALS: centered dialog on desktop
  ═══════════════════════════════════════════════════════ */
  .modal-overlay {
    align-items: center;
    justify-content: center;
    padding: 24px;
  }
  .bottom-sheet {
    position: relative;
    transform: none !important;
    left: auto !important;
    border-radius: 20px;
    max-width: 520px;
    width: 100%;
    padding: 32px 32px 28px;
    max-height: 90dvh;
    overflow-y: auto;
    animation: modal-fade-in 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
    box-shadow:
      0 24px 64px rgba(28,25,23,0.22),
      0 4px 16px rgba(28,25,23,0.10),
      0 0 0 1px rgba(28,25,23,0.06);
  }
  .sheet-handle { display: none; }

  @keyframes modal-fade-in {
    from { opacity: 0; transform: scale(0.96) translateY(-8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
  }
  @keyframes sheet-in {
    from { opacity: 0; transform: scale(0.96) translateY(-8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
  }
  .modal-dialog {
    max-width: 420px;
    box-shadow: 0 24px 64px rgba(28,25,23,0.22), 0 4px 16px rgba(28,25,23,0.10);
  }

  /* ─── Toast ──────────────────────────────────────────── */
  .toast-container { max-width: 380px; left: auto; right: 24px; top: 24px; transform: none; }

  /* ═══════════════════════════════════════════════════════
     AUTH SCREENS: white card on gradient
  ═══════════════════════════════════════════════════════ */
  #page-login, #page-signup, #page-forgot-password, #page-check-email {
    min-height: 100dvh !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #0EA5E9 0%, #0284C7 50%, #075985 100%) !important;
    overflow-y: auto !important;
    padding: 48px 20px;
    box-sizing: border-box;
  }
  #page-login > div, #page-signup > div,
  #page-forgot-password > div, #page-check-email > div {
    background: #FFFFFF;
    border-radius: 24px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.22), 0 4px 16px rgba(0,0,0,0.10);
    padding: 52px 48px !important;
    width: 100%;
    max-width: 480px;
    flex-shrink: 0;
    min-height: auto !important;
  }
  #page-check-email > div {
    background: transparent;
    box-shadow: none;
    color: white;
    padding: 0 !important;
    text-align: center;
  }

  /* ═══════════════════════════════════════════════════════
     ONBOARDING: white card on gradient
  ═══════════════════════════════════════════════════════ */
  .page.active:not(.has-nav):not(#page-splash):not(#page-check-email) {
    min-height: 100dvh;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #0EA5E9 0%, #0284C7 50%, #075985 100%) !important;
    padding: 48px 20px;
    box-sizing: border-box;
    overflow-y: auto;
  }
  .page.active:not(.has-nav):not(#page-splash):not(#page-check-email) > div {
    background: #FFFFFF;
    border-radius: 24px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.22), 0 4px 16px rgba(0,0,0,0.10);
    padding: 48px 40px !important;
    width: 100%;
    max-width: 520px;
    min-height: auto !important;
  }

  /* FAB */
  .fab { bottom: 40px; right: 40px; }

}

  /* ═══════════════════════════════════════════════════════
     SIDEBAR FOOTER — user profile pinned to bottom
  ═══════════════════════════════════════════════════════ */
  .sidebar-footer {
    margin-top: auto;
    padding: 12px 10px 8px;
    border-top: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
  }
  .sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
  }
  .sidebar-user:hover { background: rgba(255,255,255,0.06); }
  .sidebar-user-info { flex: 1; min-width: 0; }
  .sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: #E0D9D3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .sidebar-user-role { font-size: 11px; color: #8A8078; margin-top: 1px; }

  /* home layout handled by grid */

  /* ─── Home hero right side ───────────────────────────── */
  .home-hero-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 16px;
    min-width: 220px;
  }
  .home-hero-stats {
    display: flex;
    gap: 20px;
    align-items: center;
  }
  .hero-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
  }
  .hero-stat-num {
    font-size: 26px;
    font-weight: 800;
    color: white;
    line-height: 1;
  }
  .hero-stat-label {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.65);
    text-transform: uppercase;
    letter-spacing: 0.07em;
  }
  .hero-stat-divider {
    width: 1px;
    height: 36px;
    background: rgba(255,255,255,0.2);
  }

  /* ─── Home panel cards: left accent border ───────────── */
  .home-col-left .card,
  .home-col-right .card {
    border-left: 3px solid var(--color-primary-light);
  }

  /* ─── Home: section headers inside columns ───────────── */
  .home-col-left .section-title,
  .home-col-right .section-title,
  .home-panel-full .section-title {
    font-size: 10px;
    letter-spacing: 0.1em;
  }

  /* ═══════════════════════════════════════════════════════
     CALENDAR: fill viewport, better cell height
  ═══════════════════════════════════════════════════════ */
  #cal-view .cal-day { min-height: 112px !important; }
  .view-btn.active {
    background: var(--color-primary) !important;
    color: white !important;
    box-shadow: none !important;
  }
  /* Calendar takes remaining height */
  .page.has-nav #cal-view {
    min-height: calc(100dvh - 210px);
  }

  /* ═══════════════════════════════════════════════════════
     ALL CONTENT PAGES: no void at bottom
  ═══════════════════════════════════════════════════════ */
  .page.has-nav > .scroll-content {
    min-height: calc(100dvh - 60px);
  }

  /* ─── Empty states on desktop: bigger, more centered ─── */
  .empty-state {
    padding-top: 80px;
    padding-bottom: 80px;
  }
  .empty-state-icon {
    width: 72px;
    height: 72px;
    border-radius: 20px;
  }
  .empty-state-icon svg { width: 34px; height: 34px; }
  .empty-state h3 { font-size: 20px; }
  .empty-state p { font-size: 14px; max-width: 320px; }

  /* ─── Filter tabs (tasks/vault): consistent style ─────── */
  .filter-tab, .cat-tab {
    height: 34px;
    font-size: 13px !important;
  }

  /* ═══════════════════════════════════════════════════════
     SETTINGS: two-panel layout on desktop
  ═══════════════════════════════════════════════════════ */
  /* Show desktop centered profile, hide mobile row */
  .settings-profile-block { display: flex; }
  .settings-profile-mobile { display: none; }
  .settings-desktop-wrap {
    display: flex;
    align-items: flex-start;
    min-height: calc(100dvh - 60px);
  }
  .settings-profile-panel {
    width: 300px;
    flex-shrink: 0;
    padding: 40px 32px 60px;
    border-right: 1px solid var(--color-border-light);
    background: var(--color-surface);
    min-height: calc(100dvh - 60px);
  }
  .settings-main-panel {
    flex: 1;
    min-width: 0;
    padding: 40px 56px 60px;
  }
  /* Settings sections on desktop: no side padding (panel handles it) */
  .settings-section {
    padding: 0;
    border-bottom: 1px solid var(--color-border-light);
    padding-bottom: 32px;
    margin-bottom: 32px;
  }
  .settings-section:last-child { border-bottom: none; margin-bottom: 0; }
  .settings-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--color-text-placeholder);
    margin-bottom: 16px;
  }
  /* Profile panel: center-aligned profile block */
  .settings-profile-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--color-border-light);
    margin-bottom: 24px;
  }
  .settings-profile-name { font-size: 18px; font-weight: 700; }
  .settings-profile-email { font-size: 13px; color: var(--color-text-muted); }
  .settings-profile-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; }
  .settings-profile-actions .btn {
    height: 38px;
    font-size: 13px;
  }


/* END @media (min-width: 768px) */


/* ── Prize Icon Picker (Store) ── */
.prize-icon-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 4px 0;
}
.prize-icon-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  border: 2px solid var(--color-border-light);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  padding: 0;
}
.prize-icon-tile:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-subtle);
  color: var(--color-primary);
}
.prize-icon-tile.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-subtle);
  color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(14,165,233,0.2);
}
.prize-icon-tile svg { width: 22px; height: 22px; pointer-events: none; }

/* ── Small screen (≤380px, e.g. iPhone SE) polish ── */
@media (max-width: 380px) {
  .home-greeting { font-size: 22px; }

  .ghost-cta-btn {
    min-width: unset;
    width: 100%;
  }

  .screen-header h1 { font-size: 18px; }

  .btn { padding: 13px var(--space-5); }
}
