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

:root {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --border: #dee2e6;
  --text: #212529;
  --text-muted: #6c757d;
  --primary: #e67e22;
  --primary-hover: #d35400;
  --danger: #dc3545;
  --danger-hover: #bb2d3b;
  --success: #198754;
  --sidebar-width: 240px;
  --topbar-height: 52px;
  --bottom-nav-height: 56px;

  --rating-yes: #198754;
  --rating-no: #dc3545;
  --rating-sort-of: #fd7e14;

  /* Safe area insets — filled by the browser on notched devices */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

html {
  /* Prevent elastic overscroll revealing white behind the bars */
  background: var(--surface);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  /* Prevent text size adjustment on orientation change */
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* ─── Buttons ─── */
button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  transition: background 0.15s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
  min-height: 36px;
}

button.btn-primary, a.btn-primary {
  background: var(--primary);
  color: #fff;
}
button.btn-primary:hover, a.btn-primary:hover { background: var(--primary-hover); }
button.btn-primary:active, a.btn-primary:active { opacity: 0.85; }

button.btn-danger {
  background: var(--danger);
  color: #fff;
}
button.btn-danger:hover { background: var(--danger-hover); }
button.btn-danger:active { opacity: 0.85; }

button.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
button.btn-ghost:hover { background: var(--border); color: var(--text); }
button.btn-ghost:active { opacity: 0.75; }

button.btn-sm {
  padding: 4px 10px;
  font-size: 0.82rem;
  min-height: 32px;
}

button.btn-icon {
  background: transparent;
  color: var(--text-muted);
  padding: 6px;
  border-radius: 8px;
  line-height: 1;
  min-height: 36px;
}
button.btn-icon:hover { background: var(--border); color: var(--text); }

/* ─── Add Recipe Wizard ─── */
.wizard-card {
  background: var(--surface);
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 24px 20px;
  margin-bottom: 24px;
  max-width: 560px;
}

.wizard-option-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: left;
  width: 100%;
  min-height: 60px;
  font-size: 0.95rem;
  color: var(--text);
}
.wizard-option-btn:hover { border-color: var(--primary); background: #fff7f0; }
.wizard-option-btn:active { opacity: 0.85; }

/* ─── Desktop layout ─── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  display: none;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
}

.sidebar-section {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.sidebar-section-title {
  padding: 4px 16px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.sidebar-link {
  display: block;
  padding: 9px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  min-height: 0;
  border-radius: 0;
  transition: background 0.1s;
}
.sidebar-link:hover { background: var(--bg); text-decoration: none; }
.sidebar-link.active { background: #fff3e0; color: var(--primary); font-weight: 600; }

.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.main-content {
  flex: 1;
  padding: 24px;
  max-width: 900px;
}

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

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
}

/* ─── Mobile topbar ─── */
#mobile-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  /* Push content down below the notch */
  padding-top: var(--sat);
  height: calc(var(--topbar-height) + var(--sat));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  align-items: flex-end;
  padding-bottom: 0;
  padding-left: 4px;
  padding-right: 4px;
  gap: 4px;
  z-index: 200;
}

/* The actual row of content below the safe area */
#mobile-topbar > * {
  margin-bottom: 0;
  /* Vertically center within the 52px strip below the notch */
  height: var(--topbar-height);
  display: flex;
  align-items: center;
}

#back-btn {
  background: none;
  border: none;
  border-radius: 8px;
  padding: 0 10px;
  color: var(--primary);
  font-size: 1rem;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
#back-btn:active { opacity: 0.6; }

#mobile-title-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 0;
}

#mobile-title {
  font-weight: 700;
  font-size: 0.95rem;
  text-align: center;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

#topbar-action {
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 4px;
}

#topbar-action button {
  min-height: 44px;
  padding: 0 10px;
  border-radius: 8px;
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.95rem;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}

/* ─── Nav brand (visible on desktop) ─── */
#nav-brand {
  display: none;
  align-items: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  padding: 0 10px 0 4px;
  margin-right: auto;
  flex-shrink: 0;
  gap: 6px;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s;
  height: 100%;
}
#nav-brand:hover { background: var(--bg); }

#nav-box-name::before {
  content: '·';
  margin-right: 6px;
  opacity: 0.5;
}

#nav-box-name {
  font-weight: 500;
  color: var(--text);
  font-size: 1rem;
}

/* ─── Mobile brand button ─── */
#mobile-brand {
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.1s;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
#mobile-brand:hover { background: var(--bg); }

.mobile-box-name {
  font-weight: 400;
  color: var(--text);
}

/* ─── Box switcher dropdown ─── */
#box-switcher-drop {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.14);
  z-index: 600;
  min-width: 220px;
  overflow: hidden;
  padding: 4px 0;
}

.box-switcher-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  text-align: left;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  color: var(--text);
  gap: 12px;
}
.box-switcher-item:hover { background: var(--bg); }
.box-switcher-item.active { color: var(--primary); font-weight: 600; }

.box-switcher-name { flex: 1; }

.box-switcher-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.box-switcher-divider {
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

.box-switcher-manage {
  display: block;
  width: 100%;
  padding: 10px 14px;
  background: none;
  border: none;
  text-align: left;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
}
.box-switcher-manage:hover { color: var(--text); background: var(--bg); }

/* ─── Bottom nav ─── */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bottom-nav-height) + var(--sab));
  padding-bottom: var(--sab);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 200;
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  border-radius: 0;
  background: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 6px 4px;
  min-height: var(--bottom-nav-height);
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s;
}

.tab-btn svg { transition: transform 0.15s; }
.tab-btn:active svg { transform: scale(0.9); }
.tab-btn.active { color: var(--primary); }
.tab-btn.active svg { stroke: var(--primary); }

/* ─── Account sheet ─── */
#account-sheet {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 300;
  display: none;
  align-items: flex-end;
}
#account-sheet.open { display: flex; }

#account-sheet-inner {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 12px 20px calc(20px + var(--sab));
  width: 100%;
}

.account-sheet-section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.account-collections-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 4px;
}

.account-collection-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.95rem;
  text-align: left;
  border: none;
}
.account-collection-btn:hover { background: var(--bg); }
.account-collection-btn.active {
  background: var(--bg);
  color: var(--primary);
  font-weight: 600;
}

.account-collection-count {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.account-sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  margin: 0 auto 20px;
}

/* ─── Sidebar backdrop (unused on mobile now, kept for safety) ─── */
#sidebar-backdrop { display: none; }

/* ─── Desktop nav (top bar) ─── */
@media (min-width: 769px) {
  #nav-brand { display: flex; }

  #bottom-nav {
    top: 0;
    bottom: auto;
    border-top: none;
    border-bottom: 1px solid var(--border);
    height: 56px;
    padding: 0 16px;
    gap: 0;
  }

  .tab-btn {
    flex-direction: row;
    gap: 7px;
    font-size: 0.875rem;
    min-height: auto;
    height: 100%;
    padding: 0 14px;
    flex: none;
    border-radius: 6px;
  }

  .main-content {
    padding-top: calc(56px + 24px);
  }
}

/* ─── Login view: hide chrome ─── */
body.login-view #mobile-topbar,
body.login-view #bottom-nav { display: none !important; }

/* ─── Shared view (logged-out): hide bottom nav ─── */
body.shared-view #bottom-nav { display: none !important; }

/* ─── Mobile overrides ─── */
@media (max-width: 768px) {
  #mobile-topbar { display: flex; }
  #bottom-nav { display: flex !important; }

  #box-switcher-drop {
    left: 12px !important;
    right: 12px;
    min-width: unset;
  }

  .main-content {
    margin-left: 0;
    padding: 16px 16px 24px;
    padding-left: calc(16px + var(--sal));
    padding-right: calc(16px + var(--sar));
    /* Space for topbar above + bottom nav below */
    padding-top: calc(var(--topbar-height) + var(--sat) + 16px);
    padding-bottom: calc(var(--bottom-nav-height) + var(--sab) + 16px);
    max-width: 100%;
  }

  /* Page title shown in content; topbar shows brand+box only */
  #mobile-title { display: none; }
  .back-link { display: none; }

  /* Inputs: 16px prevents iOS auto-zoom */
  input[type="text"],
  input[type="url"],
  input[type="email"],
  input[type="number"],
  textarea,
  select {
    font-size: 16px;
  }

  /* Bigger touch targets for small buttons */
  button.btn-sm {
    min-height: 36px;
    padding: 6px 12px;
  }

  /* Recipe cards: active state for touch */
  .recipe-card:active {
    background: var(--bg);
    border-color: var(--primary);
  }

  /* Full-bleed recipe detail on mobile */
  .recipe-detail {
    border-radius: 0;
    border-left: none;
    border-right: none;
    margin: 0 -16px;
  }

  .recipe-detail-header {
    padding: 16px 16px;
  }

  .recipe-detail-title {
    font-size: 1.25rem;
  }

  .recipe-detail-body {
    padding: 16px;
  }

  /* PDF embed shorter on phone */
  .recipe-pdf-embed {
    height: 420px;
  }

  /* Filter members: horizontal scroll */
  .filter-members {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .filter-members::-webkit-scrollbar { display: none; }

  .filter-member-btn {
    flex-shrink: 0;
    /* Larger touch target */
    padding: 8px 16px;
    font-size: 0.9rem;
  }

  /* Rating buttons: bigger for thumbs */
  .rating-btn {
    padding: 8px 12px;
    font-size: 0.85rem;
    min-height: 40px;
  }

  .rating-row {
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
  }

  .rating-member-name {
    width: 80px;
    font-size: 0.85rem;
  }

  .rating-buttons { gap: 6px; }

  /* Member items: taller touch target */
  .member-item {
    padding: 14px;
    min-height: 56px;
  }

  /* Collection items */
  .collection-item {
    padding: 14px;
    min-height: 56px;
  }

  /* Form container: no border/shadow on mobile */
  .form-container {
    border: none;
    border-radius: 0;
    padding: 0;
    background: transparent;
    margin: 0 -16px;
    padding: 0 16px;
  }

  /* Inline file input: looks better on iOS */
  input[type="file"] {
    font-size: 15px;
    padding: 8px 0;
  }

  /* Account sheet only shown on mobile */
  #account-sheet { display: none; }
  #account-sheet.open { display: flex; }
}

/* ─── Forms ─── */
.form-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

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

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

.form-hint {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

input[type="text"],
input[type="url"],
input[type="email"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.12);
}

textarea {
  resize: vertical;
  min-height: 160px;
  line-height: 1.6;
}

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

.error-msg {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 6px;
}

/* ─── Recipe list ─── */
.recipe-list {
  display: grid;
  gap: 10px;
}

.recipe-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.recipe-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.recipe-card-body { flex: 1; min-width: 0; }

.recipe-card-title-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.recipe-card-title {
  font-weight: 600;
  font-size: 1rem;
}

.meal-type-tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
  text-transform: capitalize;
  background: var(--bg-alt, #f0f0f0);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.meal-type-tag.meal-type-breakfast  { background: #fef9c3; color: #713f12; border-color: #fde68a; }
.meal-type-tag.meal-type-brunch     { background: #fef9c3; color: #713f12; border-color: #fde68a; }
.meal-type-tag.meal-type-lunch      { background: #dcfce7; color: #14532d; border-color: #86efac; }
.meal-type-tag.meal-type-dinner     { background: #dbeafe; color: #1e3a8a; border-color: #93c5fd; }
.meal-type-tag.meal-type-appetizer  { background: #fce7f3; color: #831843; border-color: #f9a8d4; }
.meal-type-tag.meal-type-side-dish  { background: #e0f2fe; color: #0c4a6e; border-color: #7dd3fc; }
.meal-type-tag.meal-type-snack      { background: #ffedd5; color: #7c2d12; border-color: #fdba74; }
.meal-type-tag.meal-type-dessert    { background: #fae8ff; color: #581c87; border-color: #e879f9; }
.meal-type-tag.meal-type-drink      { background: #ecfdf5; color: #064e3b; border-color: #6ee7b7; }

.recipe-card-cook-meta {
  font-size: 0.75rem;
  margin-top: 4px;
}

.recipe-card-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ─── Rating badges ─── */
.rating-badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  white-space: nowrap;
}

.rating-badge.yes    { background: #d1e7dd; color: #0a3622; }
.rating-badge.no     { background: #f8d7da; color: #58151c; }
.rating-badge.sort_of{ background: #ffe8cd; color: #7d3e00; }
.rating-badge.unrated{ background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }

/* ─── Search bar ─── */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.search-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text);
  outline: none;
  min-width: 0;
}

.search-input:focus {
  border-color: var(--primary);
}

.filter-toggle-btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.filter-toggle-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
}

/* ─── Filter drawer ─── */
.filter-drawer {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.filter-drawer.open {
  display: block;
}

.filter-section + .filter-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.filter-ingredient-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
  background: var(--bg);
  color: var(--text);
  outline: none;
  box-sizing: border-box;
}

.filter-ingredient-input:focus {
  border-color: var(--primary);
}

/* ─── Filter panel (legacy name kept for inner elements) ─── */
.filter-panel-title {
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.filter-members {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.filter-member-btn {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.875rem;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  min-height: 36px;
}

.filter-member-btn.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.filter-threshold {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-threshold label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  cursor: pointer;
  min-height: 36px;
}

/* ─── Recipe detail ─── */
.recipe-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.recipe-detail-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recipe-detail-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.3;
}

.recipe-detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.recipe-detail-body { padding: 24px; }

.recipe-cover-image { margin-bottom: 20px; }

.recipe-cover-image img {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

.recipe-file-section { margin-bottom: 24px; }

.recipe-file-section img {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  display: block;
}

.recipe-pdf-embed {
  width: 100%;
  height: 600px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.recipe-url-section {
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.recipe-content-section { margin-bottom: 24px; }

.recipe-content-section h1,
.recipe-content-section h2,
.recipe-content-section h3 { margin: 16px 0 8px; }
.recipe-content-section p  { margin-bottom: 8px; }
.recipe-content-section ul,
.recipe-content-section ol { padding-left: 24px; margin-bottom: 8px; }
.recipe-content-section li { margin-bottom: 4px; line-height: 1.6; }

.ratings-section {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 4px;
}

.ratings-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.rating-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: nowrap;
}

.rating-member-name {
  width: 90px;
  font-weight: 500;
  font-size: 0.85rem;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rating-buttons { display: flex; gap: 4px; flex-wrap: wrap; }

.rating-btn {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
  min-height: 32px;
  -webkit-tap-highlight-color: transparent;
}
.rating-btn:active { opacity: 0.75; }

.rating-btn.active-yes    { border-color: var(--rating-yes);    background: var(--rating-yes);    color: #fff; }
.rating-btn.active-no     { border-color: var(--rating-no);     background: var(--rating-no);     color: #fff; }
.rating-btn.active-sort_of{ border-color: var(--rating-sort-of);background: var(--rating-sort-of);color: #fff; }

/* ─── Family members ─── */
.member-list { display: grid; gap: 8px; margin-bottom: 20px; }

.member-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 52px;
}

.member-name { font-weight: 500; font-size: 1rem; }
.member-actions { display: flex; gap: 6px; }

/* ─── Collections ─── */
.collection-list {
  list-style: none;
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}

.collection-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 52px;
}

.collection-name { flex: 1; font-weight: 500; font-size: 1rem; cursor: pointer; }
.collection-recipe-count { font-size: 0.8rem; color: var(--text-muted); }
.shared-by-label { font-size: 0.8rem; color: var(--text-muted); font-style: italic; }
.collection-shares-row { list-style: none; }

.share-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: -4px;
  margin-bottom: 4px;
}

.share-panel-title { font-size: 0.85rem; font-weight: 600; margin-bottom: 8px; }

.share-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.875rem;
}

.share-email { color: var(--text-muted); font-size: 0.8rem; }
.share-empty { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 8px; }

/* ─── Login ─── */
/* ─── Login page — mobile-first split layout ─── */
.login-page {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}

.login-preview-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.login-bottom {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 20px 28px calc(20px + var(--sab));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.login-bottom-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
}

/* Desktop: revert to centered card */
@media (min-width: 600px) {
  .login-page {
    height: auto;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    overflow: auto;
    gap: 0;
  }
  .login-preview-wrap {
    flex: none;
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px 16px 0 0;
    border-bottom: none;
  }
  .login-bottom {
    width: 100%;
    max-width: 400px;
    border-radius: 0 0 16px 16px;
    border-top: 1px solid var(--border);
    padding: 20px 32px 28px;
  }
}

.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 24px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s;
  min-height: 48px;
}
.btn-google:hover { background: var(--bg); box-shadow: 0 2px 8px rgba(0,0,0,0.1); text-decoration: none; }
.btn-google:active { opacity: 0.8; }

/* ─── Misc ─── */
.loading { padding: 60px 24px; text-align: center; color: var(--text-muted); }

.empty-state { padding: 60px 24px; text-align: center; color: var(--text-muted); }
.empty-state p { margin-bottom: 16px; font-size: 1rem; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 16px;
  cursor: pointer;
  min-height: 36px;
}
.back-link:hover { color: var(--text); text-decoration: none; }

/* Existing files grid in recipe form */
#existing-files {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.existing-file-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.collection-edit-input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  flex: 1;
  min-height: 40px;
}

/* ─── Shopping list ─── */
.sl-recipe-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.sl-recipe-title {
  flex: 1;
  min-width: 120px;
  text-align: left;
  font-weight: 500;
  font-size: 0.95rem;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 4px;
  min-height: 36px;
}
.sl-recipe-title:hover { color: var(--primary); text-decoration: underline; }

.sl-recipe-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.sl-made-btn {
  background: transparent;
  border: 1px solid var(--success);
  color: var(--success);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 0.82rem;
  min-height: 32px;
  font-family: inherit;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.sl-made-btn:hover:not(:disabled) { background: var(--success); color: #fff; }
.sl-made-btn:disabled { opacity: 0.6; }

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

.sl-ing-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.sl-check-wrap {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
  padding: 6px;
  margin: -6px;
  border-radius: 6px;
}
.sl-check-wrap:hover { background: var(--bg); }

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

.sl-ing-body {
  flex: 1;
  min-width: 0;
}

.sl-ing-name {
  display: block;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sl-ing-meta {
  display: block;
  color: var(--text-muted);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sl-ing-row.is-checked .sl-ing-name,
.sl-ing-row.is-checked .sl-ing-meta {
  text-decoration: line-through;
  opacity: 0.45;
}

.sl-ing-del {
  flex-shrink: 0;
  opacity: 0.4;
  transition: opacity 0.15s, color 0.15s;
}
.sl-ing-del:hover { opacity: 1; color: var(--danger); }

@media (max-width: 480px) {
  .sl-recipe-row { gap: 6px; }
  .sl-recipe-title { min-width: 0; flex-basis: 100%; }
  .sl-recipe-actions { margin-left: auto; }
}
