:root {
  --brand: #d56602;
  --brand-dark: #b8540a;
  --brand-light: #f6a14a;
  --brand-tint: #fdf3e7;
  --brand-tint-2: #fae6cf;
  --ink: #2a2520;
  --ink-soft: #6b625a;
  --line: #ece3d8;
  --bg: #fbf7f1;
  --card: #ffffff;
  --ok: #2e7d54;
  --danger: #c0392b;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(120, 80, 20, 0.07);
  --shadow-lg: 0 8px 28px rgba(120, 80, 20, 0.12);
}

* { box-sizing: border-box; }

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Noto Kufi Arabic', 'Segoe UI', Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  max-width: 100%;
  overflow-x: hidden;
}

main { max-width: 100%; overflow-x: clip; }

img { max-width: 100%; height: auto; }
.topbar { width: 100%; max-width: 100%; overflow-x: clip; }

[dir="ltr"] body { font-family: 'Poppins', 'Segoe UI', sans-serif; }

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

.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Top bar ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 8px 0;
  flex-wrap: wrap;
}
.brand-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
}
.brand-logo:hover { text-decoration: none; }
.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.brand-mark-svg,
.brand-logo .brand-mark svg {
  height: 48px;
  width: auto;
  display: block;
}
.brand-wordmark {
  display: block;
  line-height: 1;
  white-space: nowrap;
}
.brand-wordmark-ar {
  font-family: 'Noto Kufi Arabic', 'Segoe UI', Tahoma, sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
}
.brand-wordmark-en {
  font-family: 'Poppins', 'Segoe UI', sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2.2px;
  color: var(--ink);
  text-transform: uppercase;
}
.footer-logo .brand-mark-svg,
.footer-logo .brand-mark svg { height: 40px; }
.footer-logo .brand-wordmark-ar { font-size: 18px; }
.footer-logo .brand-wordmark-en { font-size: 15px; letter-spacing: 2px; }
.footer-logo .brand-lockup { gap: 8px; }
.nav {
  display: flex;
  gap: 4px;
  margin-inline-start: 12px;
  flex: 1;
  flex-wrap: wrap;
}
.nav a {
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 15px;
}
.nav a:hover { background: var(--brand-tint); color: var(--brand-dark); text-decoration: none; }
.nav a.active { background: var(--brand-tint-2); color: var(--brand-dark); }

.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }
.lang-toggle {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  background: #fff;
}
.lang-toggle:hover { border-color: var(--brand); color: var(--brand-dark); text-decoration: none; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--brand-tint-2);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .04s ease, background .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); text-decoration: none; color: #fff; }
.btn-outline { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand-dark); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--ink-soft); padding: 8px 12px; }
.btn-ghost:hover { background: var(--brand-tint); color: var(--brand-dark); text-decoration: none; }
.btn-danger { background: #fff; border-color: #e9c4bf; color: var(--danger); }
.btn-danger:hover { background: #fbeae8; text-decoration: none; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-google {
  background: #fff; border: 1px solid var(--line); color: #3c4043;
  font-weight: 700;
}
.btn-google:hover { box-shadow: var(--shadow); text-decoration: none; }
.btn-google svg { width: 18px; height: 18px; }

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(1200px 300px at 100% -10%, var(--brand-tint-2), transparent),
    linear-gradient(180deg, var(--brand-tint), var(--bg));
  border-bottom: 1px solid var(--line);
  padding: 44px 0 36px;
  overflow: hidden;
}
.hero h1 {
  font-size: clamp(28px, 5vw, 40px);
  margin: 0 0 12px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.25;
}
.hero .accent { color: var(--brand); }
.hero p { font-size: 17px; color: var(--ink-soft); margin: 0 0 20px; max-width: 520px; line-height: 1.7; }
.hero-search {
  margin: 0 0 22px;
  max-width: 580px;
}
.hero-search-label {
  display: block;
  font-weight: 800;
  font-size: 16px;
  margin-bottom: 10px;
  color: var(--ink);
}
.hero-search-box {
  display: flex;
  align-items: stretch;
  background: #fff;
  border: 2px solid var(--brand-light);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.hero-search-box:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(213, 102, 2, .14), var(--shadow-lg);
}
.hero-search-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-inline: 16px;
  color: var(--brand);
  flex-shrink: 0;
  background: var(--brand-tint);
}
.hero-search-icon svg { width: 22px; height: 22px; }
.hero-search input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  padding: 15px 12px;
  font-family: inherit;
  font-size: 16px;
  background: transparent;
  color: var(--ink);
}
.hero-search input::placeholder { color: var(--ink-soft); opacity: .85; }
.hero-search-btn {
  border-radius: 0;
  padding: 15px 22px;
  flex-shrink: 0;
  white-space: nowrap;
}
.hero-search-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }

.category-bar { margin-top: 24px; overflow: hidden; }
.category-bar .filter-bar { margin-bottom: 0; padding: 12px 14px; overflow: hidden; }
.category-bar .filter-row {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 8px;
  padding-bottom: 2px;
}
.category-bar .filter-row::-webkit-scrollbar { display: none; }
.category-bar .chip { flex-shrink: 0; }

/* ---------- Cards / grid ---------- */
.section { padding: 36px 0; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; gap: 12px; flex-wrap: wrap;
}
.section-head h2 { font-size: 24px; margin: 0; font-weight: 800; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  gap: 18px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow .15s ease, transform .1s ease;
  display: flex; flex-direction: column;
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card-img {
  height: 160px; background: var(--brand-tint-2);
  background-size: cover; background-position: center;
  position: relative; display: block;
}
.card-img-wrap { position: relative; overflow: hidden; }
.card-img-wrap .card-img,
.card-img-wrap .recipe-cover-link { height: 160px; width: 100%; border-radius: 0; }
.recipe-cover,
.recipe-cover-link,
.detail-img.recipe-cover-link {
  background-size: cover; background-position: center; background-repeat: no-repeat;
  display: block; position: relative;
}
.detail-img.recipe-cover-link,
.detail-img {
  width: 100%;
  max-width: 320px;
  height: 230px; border-radius: var(--radius);
  background: var(--brand-tint-2); flex-shrink: 0; box-shadow: var(--shadow);
}
.recipe-cover-play {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  font-size: 42px; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.45);
  pointer-events: none;
}
.card-media-preview .recipe-cover-play { font-size: 32px; }
.recipe-cover-link:hover .recipe-cover-play,
.thumb.recipe-cover-link:hover .recipe-cover-play { transform: scale(1.05); }

/* Unified link preview — edit form, detail page, home cards */
.media-preview,
.detail-media-preview { margin-top: 12px; width: 100%; max-width: min(420px, 100%); }
.detail-media-preview { flex-shrink: 0; margin-top: 0; }
.link-preview-card {
  display: block; text-decoration: none; color: inherit;
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: #fff; box-shadow: var(--shadow);
  transition: box-shadow .15s ease;
  max-width: 100%;
}
.link-preview-card:hover { box-shadow: var(--shadow-lg); text-decoration: none; }
.link-preview-img-wrap {
  position: relative; width: 100%; aspect-ratio: 16 / 10;
  background: var(--brand-tint-2); overflow: hidden;
}
.link-preview-img-wrap img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  display: block;
}
.link-preview-meta {
  padding: 10px 14px 12px; border-top: 1px solid var(--line);
  background: #faf8f5; min-height: 52px;
}
.link-preview-title {
  font-size: 14px; font-weight: 700; color: var(--ink);
  line-height: 1.4; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.link-preview-domain { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

/* Home / list cards — same preview, flush inside card */
.card-media-preview {
  border: none; border-radius: 0; box-shadow: none;
}
.card-media-preview:hover { box-shadow: none; }
.card-media-preview .link-preview-meta {
  padding: 8px 12px; min-height: 0;
}
.card-media-preview .link-preview-title {
  font-size: 12px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.card-media-preview .link-preview-domain { font-size: 11px; margin-top: 4px; }

/* Detail / edit — full platform caption */
.detail-media-preview .link-preview-source .link-preview-title,
.media-preview .link-preview-source .link-preview-title {
  white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere;
  -webkit-line-clamp: unset; display: block;
  max-width: 100%; overflow: visible;
}

/* Detail: source preview then local recipe content */
.detail-layout { display: flex; flex-direction: column; gap: 20px; }
.detail-local {
  padding-top: 4px;
}
.detail-local h1 { margin: 0 0 8px; font-size: 30px; font-weight: 800; }
.detail-local .detail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

.media-preview-box {
  position: relative; width: 100%; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.media-preview-box img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.media-preview-empty {
  padding: 28px; text-align: center; color: var(--ink-soft); background: var(--brand-tint);
  border: 1px dashed var(--line); border-radius: 12px; font-size: 14px;
}
.gallery-thumb, .gallery-existing img {
  width: 72px; height: 72px; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--line); margin: 0 6px 6px 0;
}
.gallery-existing, .upload-preview { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.recipe-gallery { display: flex; flex-wrap: wrap; gap: 12px; }
.gallery-thumb-lg {
  width: 140px; height: 100px; object-fit: cover; border-radius: 12px;
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
.thumb.recipe-cover-link { display: flex; align-items: center; justify-content: center; text-decoration: none; }

.card-img .placeholder {
  height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--brand); opacity: .5;
}
.fav-btn {
  position: absolute; inset-block-start: 10px; inset-inline-end: 10px;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.92); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
}
.fav-btn svg { width: 18px; height: 18px; }
.card-body { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; }
.card-body h3 { margin: 0 0 6px; font-size: 17px; font-weight: 700; word-break: break-word; overflow-wrap: anywhere; }
.card-meta { font-size: 13px; color: var(--ink-soft); display: flex; gap: 10px; flex-wrap: wrap; }
.card-cat {
  display: inline-block; font-size: 12px; font-weight: 700;
  color: var(--brand-dark); background: var(--brand-tint);
  padding: 2px 10px; border-radius: 999px;
}

/* ---------- Tag pills ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
  font-size: 12px; font-weight: 600; color: var(--ink-soft);
  background: #f4ede4; border-radius: 999px; padding: 3px 10px;
}

/* ---------- Filters ---------- */
.filter-bar {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.chip {
  font-size: 13px; font-weight: 600; padding: 6px 14px;
  border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-soft); cursor: pointer;
}
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip:hover { text-decoration: none; border-color: var(--brand); background: var(--brand-tint); color: var(--brand-dark); }
label.chip { cursor: pointer; display: inline-flex; align-items: center; }
label.chip input[type=checkbox] { display: none; }

/* Recipe list — compact collapsible filters */
.recipe-results { position: relative; min-height: 120px; transition: opacity .15s ease; }
.recipe-results.is-loading { opacity: .55; pointer-events: none; }
.recipe-results-hint {
  text-align: center; padding: 28px 16px; color: var(--ink-soft);
  font-size: 14px; line-height: 1.6; background: var(--brand-tint);
  border: 1px dashed var(--line); border-radius: var(--radius);
}
.filter-search input[type=search],
.filter-search input[type=text] { padding-inline-end: 14px; }
.home-live-results[hidden] { display: none !important; }
.home-live-results .recipe-results {
  margin-top: 8px;
}
.home-live-results .section-head {
  margin-bottom: 12px;
}

#homeBrowseSections[hidden] { display: none !important; }
.recipe-list-page .recipe-filters {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 0;
}
.recipe-list-page .recipe-filters .filter-search,
.recipe-list-page .recipe-filters .filter-search.field {
  margin-bottom: 0;
}
.recipe-list-page #recipeResults {
  margin: 0;
  padding-top: 2px;
}
.recipe-list-page .recipe-filters .filter-more {
  margin-top: 0;
}
.filter-search-label {
  display: block; font-weight: 800; font-size: 14px;
  margin-bottom: 8px; color: var(--ink);
}
.filter-search-box {
  display: flex; align-items: stretch;
  background: #fff; border: 2px solid var(--brand-light);
  border-radius: 12px; box-shadow: var(--shadow);
  overflow: hidden;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.filter-search-box:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(213, 102, 2, .12), var(--shadow);
}
.filter-search-icon {
  display: flex; align-items: center; justify-content: center;
  padding-inline: 14px; color: var(--brand); background: var(--brand-tint);
  flex-shrink: 0;
}
.filter-search-icon svg { width: 20px; height: 20px; }
.filter-search-box input[type=search] {
  flex: 1; min-width: 0; border: none; outline: none;
  padding: 12px 10px; font-family: inherit; font-size: 16px; background: transparent;
}
.filter-search-box input[type=search]::placeholder { color: var(--ink-soft); opacity: .85; }

.recipe-filters .filter-more { margin-top: 10px; }
.recipe-filters .filter-more > summary { list-style: none; }
.recipe-filters .filter-more > summary::-webkit-details-marker { display: none; }
.recipe-filters .filter-more-toggle {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--brand-tint);
  color: var(--brand-dark);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.recipe-filters .filter-more-toggle::after {
  content: '▾';
  font-size: 12px;
  transition: transform .15s ease;
}
.recipe-filters .filter-more[open] .filter-more-toggle::after { transform: rotate(180deg); }
.filter-active-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 999px; background: var(--brand); color: #fff;
  font-size: 12px; font-weight: 800;
}
.recipe-filters .filter-more-body { padding-top: 12px; }
.recipe-filters .filter-group + .filter-group { margin-top: 10px; }
.recipe-filters .filter-label {
  font-weight: 700; font-size: 12px; color: var(--ink-soft);
  margin-bottom: 6px;
}
.filter-row--chips { flex-wrap: wrap; gap: 8px; }
.chip-toggle {
  border-style: dashed;
  background: var(--brand-tint);
  color: var(--brand-dark);
  font-family: inherit;
}
.chip-toggle:hover { background: var(--brand-tint-2); }
.chip-toggle[hidden] { display: none !important; }

@media (min-width: 641px) {
  .recipe-filters .filter-more-toggle { display: none; }
  .recipe-filters .filter-more-body { display: block; }
  .recipe-filters .chip-toggle { display: none !important; }
}

.tag-picker-field { position: relative; }

.tag-picker {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 46px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.tag-picker:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(213,102,2,.12);
}
.tag-picker-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-picker-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--brand-tint); color: var(--brand-dark);
  border-radius: 999px; padding: 4px 8px 4px 12px;
  font-size: 13px; font-weight: 600;
}
.tag-picker-remove {
  border: none; background: transparent; color: var(--ink-soft);
  cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px;
}
.tag-picker-remove:hover { color: var(--danger); }
.tag-picker-input {
  flex: 1; min-width: 120px; border: none; outline: none;
  font-family: inherit; font-size: 15px; background: transparent; padding: 4px 2px;
}
.tag-suggestions {
  position: absolute; inset-inline: 0; top: calc(100% + 4px);
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-lg); z-index: 20; overflow: hidden;
  max-height: 220px; overflow-y: auto;
}
.tag-suggestion {
  display: block; width: 100%; text-align: start;
  border: none; background: #fff; padding: 10px 14px;
  font-family: inherit; font-size: 14px; cursor: pointer; color: var(--ink);
}
.tag-suggestion:hover, .tag-suggestion:focus { background: var(--brand-tint); }
.tag-suggestion-new { color: var(--brand-dark); font-weight: 600; }

/* ---------- Forms ---------- */
.form-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px;
  box-shadow: var(--shadow); max-width: 720px; margin: 0 auto;
}
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 14px; }
.field input[type=text],
.field input[type=number],
.field input[type=datetime-local],
.field select,
.field textarea {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: 10px;
  font-family: inherit; font-size: 15px; background: #fff;
}
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(213,102,2,.12);
}
.field .hint { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.field-hint-banner {
  font-size: 14px; color: var(--brand-dark); background: var(--brand-tint);
  border: 1px solid var(--brand-tint-2); border-radius: 10px;
  padding: 10px 14px; margin: 0 0 16px; line-height: 1.5;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--brand); }

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

.validation { color: var(--danger); font-size: 14px; margin-bottom: 12px; }

/* ---------- Detail ---------- */
.detail-head { display: flex; gap: 22px; flex-wrap: wrap; align-items: flex-start; }
.detail-info { flex: 1; min-width: 0; }
.detail-info h1 { margin: 0 0 8px; font-size: 30px; font-weight: 800; }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.recipe-section { margin-top: 26px; }
.recipe-section h3 {
  font-size: 19px; font-weight: 800; margin-bottom: 10px;
  padding-inline-start: 12px; border-inline-start: 4px solid var(--brand);
}
.recipe-section .body-text { white-space: pre-wrap; line-height: 1.8; }
.video-wrap {
  position: relative; padding-bottom: 56.25%; height: 0;
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- Stat cards (history) ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: 16px; margin-bottom: 26px;
}
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.stat .num { font-size: 32px; font-weight: 800; color: var(--brand); line-height: 1; }
.stat .lbl { font-size: 14px; color: var(--ink-soft); margin-top: 6px; }

.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding: 10px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bar {
  width: 100%; max-width: 42px; background: var(--brand);
  border-radius: 6px 6px 0 0; min-height: 4px;
  transition: height .3s ease;
}
.bar-col small { font-size: 11px; color: var(--ink-soft); }

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
table.list {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  background: var(--card);
  border-radius: var(--radius);
}
table.list th, table.list td { padding: 12px 14px; text-align: start; border-bottom: 1px solid var(--line); }
table.list th { background: var(--brand-tint); font-size: 13px; color: var(--brand-dark); }
table.list tr:last-child td { border-bottom: none; }

/* ---------- Plan / calendar ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
@media (max-width: 820px){ .cal-grid { grid-template-columns: repeat(2,1fr);} }
.cal-day {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; min-height: 150px;
}
.cal-day.today { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(213,102,2,.12); }
.cal-day h4 { margin: 0 0 8px; font-size: 14px; }
.cal-day .date { color: var(--ink-soft); font-weight: 600; font-size: 12px; }
.plan-item {
  background: var(--brand-tint); border-radius: 8px; padding: 6px 10px;
  font-size: 13px; margin-bottom: 6px; display: flex; justify-content: space-between; gap: 6px;
}
.plan-item .mt { color: var(--brand-dark); font-weight: 700; font-size: 11px; }
.plan-item form { margin: 0; }
.plan-item button { background: none; border: none; color: var(--ink-soft); cursor: pointer; font-size: 14px; }

/* ---------- Empty state ---------- */
.empty {
  text-align: center; padding: 48px 20px 60px; color: var(--ink-soft);
}
.empty svg { width: 60px; height: 60px; opacity: .35; margin-bottom: 12px; }
.empty p { margin: 0 0 8px; font-size: 17px; font-weight: 600; color: var(--ink); }
.empty-hint { font-size: 15px; color: var(--ink-soft); max-width: 400px; margin: 0 auto 16px; line-height: 1.6; }
.empty .btn { margin-top: 4px; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line); margin-top: 40px;
  padding: 24px 0; color: var(--ink-soft); font-size: 14px;
}
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; align-items: center; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(40,30,15,.5);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: var(--radius); padding: 24px;
  max-width: 460px; width: 100%; box-shadow: var(--shadow-lg);
}
.modal h3 { margin: 0 0 16px; }

@media (max-width: 768px){
  .container { padding: 0 14px; }
  .topbar-inner { gap: 8px; }
  .brand-mark-svg,
  .brand-logo .brand-mark svg { height: 42px; }
  .brand-wordmark-ar { font-size: 19px; }
  .brand-wordmark-en { font-size: 16px; letter-spacing: 1.8px; }
  .brand-lockup { gap: 8px; }
  .nav {
    order: 3;
    width: 100%;
    margin-inline-start: 0;
    flex: none;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 4px;
    padding-bottom: 4px;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 14px;
    padding: 6px 10px;
  }
  .topbar-actions {
    margin-inline-start: auto;
    gap: 6px;
  }
  .topbar-actions .btn-primary.btn-sm { padding: 6px 10px; font-size: 12px; }
  .section { padding: 28px 0; }
  .section-head h2 { font-size: 20px; }
  .form-card { padding: 18px 14px; }
  .detail-local h1 { font-size: 24px; }
  .footer-inner { flex-direction: column; text-align: center; }
}

@media (max-width: 640px){
  .hero { padding: 32px 0 28px; }
  .hero h1 { font-size: 26px; }
  .hero-search { max-width: 100%; margin-bottom: 18px; }
  .hero-search-label { font-size: 15px; margin-bottom: 8px; }
  .hero-search input { padding: 13px 10px; font-size: 15px; }
  .hero-search-icon { padding-inline: 12px; }
  .hero-search-icon svg { width: 20px; height: 20px; }
  .hero-search-btn { padding: 13px 16px; }
  .hero-search-btn span { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .filter-bar { padding: 12px; }
  .filter-bar .filter-row:has(input:not([type=checkbox]):not([type=hidden])),
  .filter-bar .filter-row:has(select) {
    flex-direction: column;
    align-items: stretch;
    overflow-x: visible;
  }
  .filter-bar .filter-row input:not([type=checkbox]):not([type=hidden]),
  .filter-bar .filter-row select { min-width: 0; width: 100%; }
  .filter-row { gap: 8px; }

  .recipe-list-page .section-head { margin-bottom: 10px; }
  .recipe-list-page .section-head h2 { font-size: 22px; }
  .recipe-list-page .recipe-filters {
    gap: 16px;
    padding: 10px 12px;
    margin-bottom: 14px;
  }
  .recipe-filters .filter-more { margin-top: 0; }
  .recipe-filters .filter-more-toggle { display: flex; }
  .recipe-filters .filter-more:not([open]) .filter-more-body { display: none; }
  .recipe-filters .filter-more-body { padding-top: 10px; }
  .recipe-filters .filter-group + .filter-group { margin-top: 8px; }
  .recipe-filters .filter-label { margin-bottom: 4px; font-size: 11px; }
  .recipe-filters .filter-row--chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    padding-bottom: 2px;
  }
  .recipe-filters .filter-row--chips::-webkit-scrollbar { display: none; }
  .recipe-filters .chip {
    flex-shrink: 0;
    font-size: 12px;
    padding: 5px 11px;
    white-space: nowrap;
  }
  .recipe-filters .filter-row--chips:not(.filter-row--expanded) .chip-item--extra:not(.chip-item--pinned) {
    display: none;
  }

  .form-actions { flex-wrap: wrap; }
  .detail-actions { gap: 8px; }
  .detail-actions .btn { flex: 1 1 auto; justify-content: center; min-width: 0; }
  .action-row { width: 100%; }
  .my-recipe-row { padding: 12px 14px; }
}

/* ---------- Admin panel ---------- */
.admin-nav {
  display: flex; gap: 4px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px; margin-bottom: 24px;
}
.admin-nav a {
  padding: 8px 14px; border-radius: 8px; color: var(--ink-soft);
  font-weight: 700; font-size: 14px;
}
.admin-nav a.active { background: var(--brand-tint-2); color: var(--brand-dark); }
.admin-nav a:hover { background: var(--brand-tint); text-decoration: none; }

.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
}
.badge-ok     { background: #d4edda; color: #1a6630; }
.badge-off    { background: #f8d7da; color: #721c24; }
.badge-admin  { background: var(--brand-tint-2); color: var(--brand-dark); }

.action-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* My recipes card style (table-based on desktop, cards on mobile) */
.my-recipes-list { display: flex; flex-direction: column; gap: 12px; }
.my-recipe-row {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 18px;
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
}
.my-recipe-row .thumb,
.my-recipe-row a.thumb {
  width: 64px; height: 64px; border-radius: 10px;
  background: var(--brand-tint-2); background-size: cover; background-position: center;
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  color: var(--brand); opacity: .7; text-decoration: none;
}
.my-recipe-row a.thumb.recipe-cover-link { opacity: 1; }
.my-recipe-row h4 { margin: 0 0 4px; font-size: 16px; font-weight: 700; }
.pub-dot {
  width: 9px; height: 9px; border-radius: 50%;
  display: inline-block; margin-inline-end: 6px;
}
.pub-dot.on  { background: var(--ok); }
.pub-dot.off { background: #c0392b; }

@media (max-width: 600px){
  .my-recipe-row { grid-template-columns: auto 1fr; }
  .my-recipe-row .action-row { grid-column: 1/-1; }
}
