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

:root {
  --bg: #FEFCF5;
  --bg-secondary: #F5EDD8;
  --bg-card: #FFFFFF;
  --text: #2C2A22;
  --text-muted: #6B6355;
  --accent: #C17D2E;
  --accent-hover: #A06822;
  --accent-light: #FBF0DC;
  --border: #E8DEC8;
  --shadow: rgba(44, 42, 34, 0.08);
  --shadow-lg: rgba(44, 42, 34, 0.14);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --bg: #1C1A14;
  --bg-secondary: #252318;
  --bg-card: #2A2720;
  --text: #F0E8D0;
  --text-muted: #9A9080;
  --accent: #D4953A;
  --accent-hover: #E8A84A;
  --accent-light: #2A2215;
  --border: #3A3525;
  --shadow: rgba(0, 0, 0, 0.3);
  --shadow-lg: rgba(0, 0, 0, 0.5);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

/* ── Typography ── */
h1, h2, h3, h4 {
  font-family: 'Fraunces', Georgia, serif;
  line-height: 1.2;
  font-weight: 600;
}
h1 { font-size: clamp(2rem, 5vw, 3rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.8rem); }
h3 { font-size: 1.2rem; }

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

/* ── Layout ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.page-content { padding: 2.5rem 0 4rem; }

/* ── Header ── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  transition: background var(--transition), border-color var(--transition);
}
nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Fraunces', serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
}
.logo:hover { color: var(--accent); }
.logo-icon { font-size: 1.6rem; }
.logo em { font-style: italic; color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
}
.nav-links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.nav-links a:hover, .nav-links a.active {
  color: var(--accent);
  background: var(--accent-light);
}

.nav-actions { display: flex; align-items: center; gap: 0.5rem; }

/* Theme toggle */
.theme-toggle {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all var(--transition);
}
.theme-toggle:hover { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--accent); background: var(--accent-light); }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  box-shadow: 0 2px 8px var(--shadow);
}
.card:hover { box-shadow: 0 8px 24px var(--shadow-lg); transform: translateY(-2px); }
.card-body { padding: 1.25rem; }

/* ── Recipe Grid ── */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.recipe-card { cursor: pointer; }
.recipe-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}
.recipe-card-placeholder {
  width: 100%;
  height: 200px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}
.recipe-card-body { padding: 1.25rem; }
.recipe-card-title {
  font-family: 'Fraunces', serif;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text);
}
.recipe-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.75rem;
}
.recipe-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.recipe-meta span { display: flex; align-items: center; gap: 0.25rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag {
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  border: 1px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
}
.tag:hover { border-color: var(--accent); }

/* ── Search / Filter bar ── */
.search-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}
.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 220px;
  padding: 0 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  transition: all var(--transition);
}
.search-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.search-icon {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-input-wrap input[type="text"] {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  padding: 0.6rem 0;
  border: 0;
  outline: 0;
  box-shadow: none;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  color: var(--text);
  font-size: 0.9rem;
  font-family: 'DM Sans', sans-serif;
}
.search-input-wrap input[type="text"]:focus {
  border: 0;
  outline: 0;
  box-shadow: none;
}

/* ── Forms ── */
.form-group { margin-bottom: 1.25rem; }
label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--text-muted); margin-bottom: 0.4rem; }
input[type="text"],
input[type="number"],
input[type="password"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.9rem;
  font-family: 'DM Sans', sans-serif;
  transition: all var(--transition);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
textarea { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* ── Page Header ── */
.page-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 2.5rem 0;
  margin-bottom: 0;
}
.page-header h1 { margin-bottom: 0.4rem; }
.page-header p { color: var(--text-muted); }

/* ── Hero (home) ── */
.hero {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 3rem 0 2rem;
}
.hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}
.hero h1 { margin-bottom: 0.6rem; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero p { color: var(--text-muted); font-size: 1.05rem; margin-bottom: 1.5rem; max-width: 480px; }
.hero-search { max-width: 560px; }

/* ── Recipe Detail ── */
.recipe-detail { display: grid; grid-template-columns: 1fr 360px; gap: 2.5rem; align-items: start; }
.recipe-detail-image {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}
.recipe-info-bar {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 1rem 1.25rem;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}
.recipe-info-item { text-align: center; }
.recipe-info-item .value { font-family: 'Fraunces', serif; font-size: 1.3rem; font-weight: 700; color: var(--accent); }
.recipe-info-item .label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.steps-list { list-style: none; counter-reset: steps; }
.steps-list li {
  counter-increment: steps;
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  align-items: flex-start;
}
.steps-list li::before {
  content: counter(steps);
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 2px;
}

.ingredients-sidebar {
  position: sticky;
  top: 80px;
}
.ingredient-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  gap: 0.5rem;
}
.ingredient-item:last-child { border-bottom: none; }
.ingredient-amount { color: var(--text-muted); font-size: 0.85rem; white-space: nowrap; }

/* ── Pantry / Table ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { background: var(--bg-secondary); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--accent-light); }
.expiry-soon { color: #d97706; font-weight: 500; }
.expiry-past { color: #dc2626; font-weight: 500; }

/* ── Cook Page ── */
.cook-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; margin-top: 1.5rem; }
.cook-card { padding: 1.25rem; }
.match-bar-wrap { margin: 0.75rem 0; }
.match-label { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.match-bar { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; }
.match-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.5s ease; }
.match-fill.full { background: #16a34a; }
.missing-list { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.5rem; }
.missing-list span { background: var(--bg-secondary); padding: 0.15rem 0.5rem; border-radius: 4px; margin: 0.15rem; display: inline-block; }

/* ── Shopping List ── */
.shopping-list { list-style: none; }
.shopping-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background var(--transition);
}
.shopping-item:hover { background: var(--accent-light); }
.shopping-item:last-child { border-bottom: none; }
.shopping-item.checked { opacity: 0.5; text-decoration: line-through; }
.shopping-item input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }

/* ── Admin Tabs ── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 2rem; }
.tab-btn {
  padding: 0.7rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: -1px;
}
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn:hover { color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px var(--shadow-lg);
  transform: translateY(20px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1.1rem; }
.modal-body { padding: 1.5rem; }
.modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}
.close-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.2rem; padding: 0.25rem; border-radius: 4px; transition: all var(--transition); }
.close-btn:hover { color: var(--text); background: var(--bg-secondary); }

/* ── Dynamic ingredient/step fields ── */
.dynamic-list { display: flex; flex-direction: column; gap: 0.5rem; }
.dynamic-item { display: flex; gap: 0.5rem; align-items: center; }
.dynamic-item input { flex: 1; }
.remove-btn { flex-shrink: 0; background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 0.3rem; border-radius: 4px; font-size: 1rem; transition: all var(--transition); }
.remove-btn:hover { color: #dc2626; background: #fee2e2; }
.add-field-btn { align-self: flex-start; margin-top: 0.25rem; }

/* ── Login ── */
.login-wrap {
  min-height: calc(100vh - 70px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.login-card { width: 100%; max-width: 380px; padding: 2.5rem; }
.login-card .logo { justify-content: center; margin: 0 0 1.5rem; font-size: 1.6rem; }
.login-card h2 { text-align: center; margin-bottom: 0.25rem; }
.login-card .subtitle { text-align: center; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.75rem; }

/* ── Alerts / Messages ── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
[data-theme="dark"] .alert-error { background: #3b0a0a; color: #fca5a5; border-color: #7f1d1d; }
[data-theme="dark"] .alert-success { background: #052e16; color: #86efac; border-color: #14532d; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 3.5rem; margin-bottom: 1rem; }
.empty-state h3 { font-family: 'Fraunces', serif; color: var(--text); margin-bottom: 0.5rem; }

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: auto;
}
footer a { color: var(--accent); }

/* ── Utility ── */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-gap { display: flex; gap: 0.75rem; align-items: center; }
.section-title { margin-bottom: 1.25rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }

/* ════════════════ SOCIAL / COMMUNITY ════════════════ */

/* ── Nav user chip ── */
.nav-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.6rem 0.25rem 0.3rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  color: var(--text);
  transition: all var(--transition);
}
.nav-user:hover { border-color: var(--accent); color: var(--accent); }
.nav-username { font-size: 0.85rem; font-weight: 500; }
.avatar-sm {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 600;
  flex-shrink: 0;
}

/* ── Feed grid + cards ── */
.feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}
.feed-card { display: flex; flex-direction: column; overflow: hidden; }
.feed-card-image { width: 100%; height: 190px; object-fit: cover; display: block; }
.feed-card-placeholder {
  width: 100%; height: 190px;
  background: var(--bg-secondary);
  display: flex; align-items: center; justify-content: center; font-size: 3rem;
}
.feed-card-body { padding: 1.1rem 1.25rem 1.25rem; display: flex; flex-direction: column; flex: 1; }
.feed-card-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.card-author { font-size: 0.8rem; font-weight: 600; color: var(--accent); }
.card-author:hover { text-decoration: underline; }
.card-time { font-size: 0.75rem; color: var(--text-muted); margin-left: auto; }
.badge-private {
  font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--bg-secondary); color: var(--text-muted);
  padding: 0.12rem 0.5rem; border-radius: 99px; border: 1px solid var(--border);
}
.feed-card-title {
  font-family: 'Fraunces', serif; font-size: 1.15rem; font-weight: 600;
  color: var(--text); margin-bottom: 0.35rem; line-height: 1.25;
}
.feed-card-title:hover { color: var(--accent); }
.feed-card-desc {
  font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.75rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.feed-card .tags { margin-bottom: 0.9rem; }
.feed-actions {
  display: flex; align-items: center; gap: 0.4rem;
  margin-top: auto; padding-top: 0.75rem; border-top: 1px solid var(--border);
}
.action-btn {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.35rem 0.65rem; border-radius: 99px;
  background: transparent; border: 1px solid transparent;
  color: var(--text-muted); font-family: 'DM Sans', sans-serif; font-size: 0.8rem; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
}
.action-btn:hover { background: var(--bg-secondary); color: var(--text); }
.like-btn.active { color: #e0245e; }
.like-btn.active:hover { background: #fde8ef; }
.save-btn.active { color: var(--accent); }

/* ── Sort / segmented control ── */
.feed-toolbar { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.segmented button {
  padding: 0.5rem 0.9rem; background: var(--bg-card); border: none;
  color: var(--text-muted); font-family: 'DM Sans', sans-serif; font-size: 0.85rem; font-weight: 500; cursor: pointer;
  transition: all var(--transition);
}
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button.active { background: var(--accent); color: #fff; }

/* ── Profile ── */
.profile-header {
  display: flex; align-items: center; gap: 1.5rem;
  padding: 2rem 0; flex-wrap: wrap;
}
.avatar-lg {
  width: 84px; height: 84px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fraunces', serif; font-size: 2.2rem; font-weight: 700; flex-shrink: 0;
}
.profile-info h1 { margin-bottom: 0.2rem; }
.profile-handle { color: var(--accent); font-weight: 500; font-size: 0.95rem; }
.profile-bio { color: var(--text-muted); margin-top: 0.5rem; max-width: 520px; }
.profile-stats { display: flex; gap: 1.5rem; margin-top: 0.75rem; }
.profile-stats span { font-size: 0.85rem; color: var(--text-muted); }
.profile-stats strong { color: var(--text); font-family: 'Fraunces', serif; }

/* ── Comments ── */
.comments-section { margin-top: 2.5rem; }
.comment-form { display: flex; gap: 0.75rem; margin-bottom: 1.5rem; align-items: flex-start; }
.comment-form textarea { min-height: 44px; }
.comment {
  display: flex; gap: 0.75rem; padding: 1rem 0; border-bottom: 1px solid var(--border);
}
.comment:last-child { border-bottom: none; }
.comment-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 0.9rem; font-weight: 600;
}
.comment-main { flex: 1; }
.comment-head { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.2rem; }
.comment-author { font-weight: 600; font-size: 0.9rem; }
.comment-author:hover { color: var(--accent); }
.comment-time { font-size: 0.75rem; color: var(--text-muted); }
.comment-delete { margin-left: auto; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.8rem; padding: 0.2rem 0.4rem; border-radius: 4px; }
.comment-delete:hover { color: #dc2626; background: #fee2e2; }
.comment-body { font-size: 0.9rem; color: var(--text); white-space: pre-wrap; }

/* ── Recipe detail social bar ── */
.recipe-social { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.recipe-social .action-btn { padding: 0.5rem 0.9rem; border: 1px solid var(--border); font-size: 0.88rem; }
.recipe-byline { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.recipe-byline a { font-weight: 600; }

/* ── Visibility toggle in forms ── */
.visibility-row { display: flex; gap: 0.75rem; align-items: center; padding: 0.75rem 1rem; background: var(--bg-secondary); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.visibility-row label { margin: 0; cursor: pointer; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: var(--border); border-radius: 99px; transition: var(--transition); cursor: pointer; }
.switch .slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: var(--transition); }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ── Auth helper ── */
.auth-switch { text-align: center; font-size: 0.875rem; color: var(--text-muted); margin-top: 1.25rem; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .recipe-detail { grid-template-columns: 1fr; }
  .ingredients-sidebar { position: static; }
}
@media (max-width: 640px) {
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .recipe-grid { grid-template-columns: 1fr; }
  .feed { grid-template-columns: 1fr; }
  .nav-username { display: none; }
}
