/* =========================================================
   Ma Cuisine — Design system
   Palette : sauge, crème, or chaud
   ========================================================= */

:root {
  --cream: #F5F1E8;
  --cream-deep: #EDE7D6;
  --paper: #FFFFFF;
  --sage: #8BAE6F;
  --sage-deep: #6B8F52;
  --sage-darker: #4A6741;
  --sage-light: #E8EFE1;
  --sage-mist: #F1F5EC;
  --gold: #D4A574;
  --gold-soft: #E8C9A0;
  --ink: #2C2E28;
  --ink-soft: #5C5F57;
  --muted: #9A9D94;
  --line: #E5E0D2;
  --line-soft: #EFEBDF;
  --danger: #C65D4F;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-xl: 32px;

  --shadow-sm: 0 2px 6px rgba(74, 103, 65, 0.06);
  --shadow: 0 8px 24px rgba(74, 103, 65, 0.08);
  --shadow-lg: 0 20px 60px rgba(74, 103, 65, 0.18);

  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

svg { display: inline-block; max-width: 100%; }

html, body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--cream);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, rgba(139, 174, 111, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 100%, rgba(212, 165, 116, 0.08) 0%, transparent 40%),
    var(--cream);
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; color: var(--sage-darker); }
h2 { font-size: 44px; letter-spacing: -0.5px; }
h3 { font-size: 20px; }

.eyebrow {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--sage);
  display: inline-block;
  margin-bottom: 8px;
}

.subtitle {
  color: var(--ink-soft);
  margin-top: 8px;
  font-size: 15px;
}

/* =========================================================
   Auth / Login
   ========================================================= */
body.auth-loading .site-header,
body.auth-loading main,
body.auth-loading .site-footer { display: none; }

.login-screen {
  display: none;
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(139, 174, 111, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(212, 165, 116, 0.15) 0%, transparent 50%),
    var(--cream);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-screen.show { display: flex; }

.login-card {
  background: var(--paper);
  border-radius: var(--radius-xl);
  padding: 48px 44px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line-soft);
}

.login-brand { text-align: center; margin-bottom: 32px; }
.login-brand svg { width: 64px; height: 64px; color: var(--sage); margin-bottom: 14px; }
.login-brand h1 { font-family: var(--serif); font-size: 34px; color: var(--sage-darker); margin-bottom: 4px; }
.login-brand p { font-size: 12px; color: var(--muted); letter-spacing: 2px; text-transform: uppercase; }

.login-form .form-field { margin-bottom: 16px; }
.login-form .form-field input {
  height: 46px;
  padding: 0 16px;
  font-size: 15px;
}
.login-form .btn-primary {
  width: 100%;
  height: 48px;
  margin-top: 8px;
  position: relative;
  justify-content: center;
  font-size: 15px;
}

.login-alt {
  text-align: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  color: var(--ink-soft);
}
.login-alt a {
  color: var(--sage-darker);
  font-weight: 600;
  text-decoration: none;
  margin-left: 6px;
}
.login-alt a:hover { text-decoration: underline; }

.register-success {
  display: none;
  margin-top: 12px;
  padding: 14px;
  background: var(--sage-light);
  border-radius: var(--radius);
  color: var(--sage-darker);
  font-size: 13px;
  text-align: center;
  line-height: 1.5;
}
.register-success.show { display: block; }

.avatar {
  position: relative;
}
.pending-dot {
  position: absolute;
  top: -2px; right: -2px;
  min-width: 18px; height: 18px;
  background: var(--danger);
  color: #fff;
  border-radius: 100px;
  border: 2px solid var(--paper);
  font-size: 10px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.pending-dot.show { display: flex; }

.pending-section {
  background: linear-gradient(135deg, #FFF7EC 0%, #FBEACE 100%);
  border: 1px solid var(--gold-soft);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}
.pending-section h4 {
  font-family: var(--serif);
  font-size: 18px;
  color: #8B6A3C;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pending-section h4 .count {
  background: var(--danger);
  color: #fff;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
}
.pending-user .meta .r {
  color: #8B6A3C !important;
  font-weight: 600 !important;
}
.pending-user .contact {
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 3px;
  line-height: 1.4;
}
.pending-user .contact span { margin-right: 12px; }
.user-row .btn-approve {
  background: var(--sage-darker);
  color: var(--paper);
  border: 0;
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.user-row .btn-approve:hover { background: var(--sage-deep); }

/* =========================================================
   User menu
   ========================================================= */
.user-menu { position: relative; }
.user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 1px solid var(--line);
  padding: 6px 12px 6px 6px;
  border-radius: 100px;
  cursor: pointer;
  font-family: var(--sans);
  transition: all 0.2s;
}
.user-btn:hover { border-color: var(--sage); background: var(--paper); }
.user-btn svg { width: 14px; height: 14px; color: var(--muted); }
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--sage-darker);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
  text-transform: uppercase;
}
.avatar.super { background: var(--gold); }
.user-info { display: flex; flex-direction: column; text-align: left; line-height: 1.15; }
.user-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.user-role { font-size: 10px; color: var(--muted); letter-spacing: 0.8px; text-transform: uppercase; }

.user-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  min-width: 220px;
  padding: 6px;
  display: none;
  z-index: 150;
}
.user-dropdown.open { display: block; animation: fadeUp 0.2s ease; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  text-align: left;
  transition: background 0.15s;
}
.dropdown-item:hover { background: var(--sage-mist); }
.dropdown-item svg { width: 16px; height: 16px; color: var(--sage-darker); }
body:not(.is-super) .super-only { display: none; }
body:not(.is-family-admin) .family-admin-only { display: none; }

.dropdown-family-label {
  padding: 10px 12px 4px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 4px;
  font-weight: 600;
}
.dropdown-family-label strong { color: var(--sage-darker); display: block; font-size: 13px; margin-top: 2px; text-transform: none; letter-spacing: 0; }

.family-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}
.family-header h2 { margin: 0; font-size: 28px; }

.invite-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px dashed var(--gold-soft);
  border-radius: var(--radius);
  background: #FFF7EC;
  margin-bottom: 8px;
}
.invite-row .meta { flex: 1; }
.invite-row .n { font-weight: 500; font-size: 14px; color: var(--ink); }
.invite-row .sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.invite-row .copy-link {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--paper);
  border: 1px solid var(--line);
  cursor: pointer;
  color: var(--ink-soft);
}
.invite-row .copy-link:hover { background: var(--sage-mist); color: var(--sage-darker); }

/* =========================================================
   Users list (management)
   ========================================================= */
.create-user-form { margin-bottom: 20px; }
.users-list { display: flex; flex-direction: column; gap: 8px; }
.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--cream);
}
.user-row .avatar { width: 36px; height: 36px; }
.user-row .meta { flex: 1; }
.user-row .meta .n { font-weight: 600; font-size: 14px; }
.user-row .meta .r { font-size: 11px; color: var(--muted); letter-spacing: 0.5px; text-transform: uppercase; margin-top: 2px; }
.user-row .actions { display: flex; gap: 6px; }
.user-row .badge {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 100px;
  background: var(--gold-soft);
  color: #8B6A3C;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* =========================================================
   Header
   ========================================================= */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  gap: 24px;
}
.header-inner .main-nav { margin: 0 auto; }

.brand { display: flex; align-items: center; gap: 14px; color: var(--sage-darker); }
.brand-icon { width: 42px; height: 42px; color: var(--sage); flex-shrink: 0; }
.brand h1 { font-size: 24px; letter-spacing: -0.3px; }
.tagline { font-size: 11px; color: var(--muted); letter-spacing: 1.5px; text-transform: uppercase; margin-top: 2px; }

.main-nav { display: flex; gap: 4px; background: var(--sage-mist); padding: 5px; border-radius: 100px; }

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 100px;
  transition: all 0.2s ease;
}
.nav-btn svg { width: 18px; height: 18px; }
.nav-btn:hover { color: var(--sage-darker); }
.nav-btn.active {
  background: var(--paper);
  color: var(--sage-darker);
  box-shadow: var(--shadow-sm);
}

/* =========================================================
   Page header
   ========================================================= */
main { padding: 48px 0 60px; }

.tab-panel { display: none; animation: fadeUp 0.4s ease; }
.tab-panel.active { display: block; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.page-actions { display: flex; gap: 12px; align-items: center; }

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 100px;
  height: 46px;
  min-width: 280px;
  transition: border-color 0.2s;
}
.search-box:focus-within { border-color: var(--sage); }
.search-box svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.search-box input {
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  width: 100%;
}
.search-box input::placeholder { color: var(--muted); }

/* =========================================================
   Buttons
   ========================================================= */
.btn-primary, .btn-ghost, .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 22px;
  height: 46px;
  border-radius: 100px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  border: 1px solid transparent;
}
.btn-primary svg, .btn-ghost svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--sage-darker);
  color: var(--paper);
}
.btn-primary:hover { background: var(--sage-deep); transform: translateY(-1px); box-shadow: var(--shadow); }

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line);
}
.btn-ghost:hover { background: var(--paper); color: var(--sage-darker); border-color: var(--sage); }
.btn-ghost.small { height: 34px; padding: 0 14px; font-size: 13px; }
.btn-ghost.danger { color: var(--danger); border-color: rgba(198, 93, 79, 0.3); }
.btn-ghost.danger:hover { background: rgba(198, 93, 79, 0.08); border-color: var(--danger); }

/* =========================================================
   Recipe grid
   ========================================================= */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 28px;
}

.recipe-card {
  background: var(--paper);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
}
.recipe-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--sage-light); }

.recipe-card .thumb {
  aspect-ratio: 4/3;
  background: var(--sage-mist);
  position: relative;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.recipe-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.recipe-card:hover .thumb img { transform: scale(1.05); }
.recipe-card .thumb-placeholder { font-size: 56px; opacity: 0.4; }

.recipe-card .tag {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  color: var(--sage-darker);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 100px;
}

.recipe-card .body { padding: 22px; flex: 1; display: flex; flex-direction: column; }
.recipe-card .body h3 { font-size: 22px; margin-bottom: 14px; }

.pictos {
  display: flex;
  gap: 16px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.picto {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-soft);
}
.picto svg { width: 17px; height: 17px; color: var(--sage); flex-shrink: 0; }
.picto strong { color: var(--ink); font-weight: 600; }

/* =========================================================
   Recipe view modal
   ========================================================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal.open { display: flex; animation: fadeIn 0.25s ease; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(44, 46, 40, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--paper);
  border-radius: var(--radius-xl);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 48px;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.3s cubic-bezier(.2,.9,.3,1.2);
}
.modal-content.recipe-view { padding: 0; }
.modal-content.picker { max-width: 560px; }

@keyframes popIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }

.close-btn {
  position: absolute;
  top: 16px;
  right: 18px;
  background: var(--cream);
  border: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 22px;
  color: var(--ink-soft);
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s;
}
.close-btn:hover { background: var(--sage-light); color: var(--sage-darker); }

.recipe-view .hero {
  aspect-ratio: 16/9;
  background: var(--sage-mist);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  overflow: hidden;
}
.recipe-view .hero img { width: 100%; height: 100%; object-fit: cover; }

.recipe-view .details { padding: 40px 48px 48px; }
.recipe-view h1 {
  font-family: var(--serif);
  font-size: 42px;
  color: var(--sage-darker);
  margin-bottom: 24px;
  letter-spacing: -0.5px;
  font-weight: 600;
}

.recipe-view .meta-row {
  display: flex;
  gap: 40px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 12px;
}
.meta-item .icon-circle {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--sage);
  border-radius: 50%;
  color: var(--sage);
}
.meta-item .icon-circle svg { width: 20px; height: 20px; }
.meta-item .label { font-size: 11px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }
.meta-item .value { font-weight: 600; font-size: 15px; color: var(--ink); }

.recipe-body-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 48px;
}

.recipe-body-grid h3 {
  font-family: var(--serif);
  font-size: 26px;
  color: var(--sage-darker);
  margin-bottom: 18px;
  font-weight: 600;
}

.recipe-body-grid ul { list-style: none; }
.recipe-body-grid li {
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  color: var(--ink-soft);
  font-size: 14px;
  display: flex;
  gap: 10px;
}
.recipe-body-grid li:before {
  content: "•";
  color: var(--sage);
  font-weight: bold;
  flex-shrink: 0;
}
.recipe-body-grid li:last-child { border-bottom: 0; }

.recipe-body-grid .instructions p {
  padding: 12px 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.7;
}
.recipe-body-grid .instructions p:not(:last-child) {
  border-bottom: 1px solid var(--line-soft);
}

.recipe-view-actions { display: flex; gap: 10px; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--line); }

/* =========================================================
   Recipe edit form
   ========================================================= */
.modal-content h2 {
  font-size: 32px;
  margin-bottom: 28px;
  color: var(--sage-darker);
}

.form-row { display: flex; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.form-field { flex: 1; min-width: 120px; }
.form-field.full { flex-basis: 100%; }

.form-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}
.form-field input, .form-field select, .form-field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--paper);
  transition: border-color 0.2s;
  resize: vertical;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: 0;
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(139, 174, 111, 0.15);
}

.image-input-row {
  display: flex;
  gap: 8px;
}
.image-input-row input { flex: 1; }
.image-input-row .btn-ghost { height: 42px; flex-shrink: 0; }

.image-preview {
  margin-top: 10px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--sage-mist);
  max-height: 180px;
  display: none;
}
.image-preview.show { display: block; }
.image-preview img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  display: block;
}

.import-input-row {
  display: flex;
  gap: 8px;
  margin: 20px 0 8px;
}
.import-input-row input {
  flex: 1;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 100px;
  font-family: var(--sans);
  font-size: 14px;
  background: var(--paper);
  height: 46px;
}
.import-input-row input:focus {
  outline: 0;
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(139, 174, 111, 0.15);
}
.import-input-row .btn-primary { position: relative; min-width: 130px; justify-content: center; }
.btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: var(--paper);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.btn-primary.loading .btn-label { visibility: hidden; }
.btn-primary.loading .btn-spinner { display: block; position: absolute; top: 50%; left: 50%; margin: -8px 0 0 -8px; }
@keyframes spin { to { transform: rotate(360deg); } }

.import-error {
  color: var(--danger);
  font-size: 13px;
  padding: 8px 12px;
  background: rgba(198, 93, 79, 0.08);
  border-radius: var(--radius-sm);
  display: none;
  margin-top: 8px;
}
.import-error.show { display: block; }

.import-examples { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line-soft); }
.import-examples ul { list-style: none; margin-top: 10px; font-size: 13px; color: var(--ink-soft); line-height: 1.9; }
.import-examples li::before { content: "✓  "; color: var(--sage); font-weight: bold; }

.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
  margin-top: 16px;
  padding: 2px;
}
.photo-tile {
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  border: 2px solid transparent;
  transition: all 0.2s;
  background: var(--sage-mist);
}
.photo-tile:hover { border-color: var(--sage); transform: scale(1.03); }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tile .fname {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: white;
  font-size: 10px;
  padding: 16px 8px 6px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
.photos-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 14px;
}

code {
  background: var(--sage-mist);
  color: var(--sage-darker);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'SF Mono', Menlo, monospace;
}

.form-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 28px 0 14px;
}
.form-section-title h3 {
  font-family: var(--serif);
  font-size: 20px;
  color: var(--sage-darker);
}

.ingredients-editor .ing-row {
  display: grid;
  grid-template-columns: 90px 90px 1fr 130px 36px;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}
.ingredients-editor input, .ingredients-editor select {
  padding: 10px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--sans);
}
.ingredients-editor .remove-ing {
  width: 36px; height: 36px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
}
.ingredients-editor .remove-ing:hover { background: rgba(198, 93, 79, 0.1); color: var(--danger); }

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  align-items: center;
}

/* =========================================================
   Calendar
   ========================================================= */
.week-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  padding: 6px;
  border-radius: 100px;
  border: 1px solid var(--line);
}
.week-btn {
  width: 36px; height: 36px;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink-soft);
  transition: all 0.2s;
}
.week-btn svg { width: 16px; height: 16px; }
.week-btn:hover { background: var(--sage-light); color: var(--sage-darker); }
.week-label {
  padding: 0 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  min-width: 180px;
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 14px;
}

.day-col {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-soft);
}
.day-col.today { background: var(--sage-mist); border-color: var(--sage-light); }

.day-header {
  text-align: center;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.day-header .name { font-size: 11px; color: var(--muted); letter-spacing: 1.5px; text-transform: uppercase; font-weight: 600; }
.day-header .num { font-family: var(--serif); font-size: 26px; color: var(--sage-darker); margin-top: 2px; }
.day-col.today .num { color: var(--gold); }

.meal-slot {
  margin-bottom: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--cream);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px dashed transparent;
  min-height: 70px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}
.meal-slot:hover { background: var(--sage-light); }
.meal-slot.empty { border-style: dashed; border-color: var(--line); background: transparent; color: var(--muted); text-align: center; font-size: 12px; }
.meal-slot.empty:hover { border-color: var(--sage); color: var(--sage-darker); background: var(--sage-mist); }
.meal-slot.drag-over { border-color: var(--sage); background: var(--sage-light); }

.meal-slot .meal-label { font-size: 10px; color: var(--muted); letter-spacing: 1.2px; text-transform: uppercase; font-weight: 600; margin-bottom: 4px; }
.meal-slot .meal-name { font-size: 13px; font-weight: 500; color: var(--ink); line-height: 1.3; }

.meal-slot .remove-meal {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px; height: 22px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.15s;
}
.meal-slot:hover .remove-meal { opacity: 1; }
.meal-slot .remove-meal:hover { background: rgba(198, 93, 79, 0.15); color: var(--danger); }

/* =========================================================
   Picker
   ========================================================= */
.picker-context { color: var(--ink-soft); margin-bottom: 20px; font-size: 14px; }

.cook-selector { margin-bottom: 14px; padding: 12px 14px; background: var(--sage-mist); border-radius: var(--radius); }
.cook-label { display: block; font-size: 12px; font-weight: 600; color: var(--sage-darker); margin-bottom: 8px; letter-spacing: 0.3px; }
.cook-label .optional { font-weight: normal; color: var(--muted); font-size: 11px; }
.cook-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cook-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--cream);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  justify-content: flex-end;
}
.cook-actions .small { height: 32px; padding: 0 14px; font-size: 12px; }
.cook-actions .btn-primary.small { background: var(--sage-darker); }
.cook-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 4px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 100px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-soft);
  transition: all 0.15s;
  font-family: var(--sans);
}
.cook-chip.none { padding: 6px 12px; }
.cook-chip:hover { border-color: var(--sage); color: var(--sage-darker); }
.cook-chip.selected { background: var(--sage-darker); color: var(--paper); border-color: var(--sage-darker); }
.cook-chip .mini-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--sage);
  color: var(--paper);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase;
}
.cook-chip.selected .mini-avatar { background: var(--gold); color: var(--paper); }

.meal-slot .cook-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--sage-darker);
  background: var(--sage-mist);
  padding: 2px 8px 2px 2px;
  border-radius: 100px;
  align-self: flex-start;
}
.meal-slot .cook-badge .mini-avatar {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--sage-darker);
  color: var(--paper);
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700;
  text-transform: uppercase;
}

.quick-meal-shortcut {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--sage-mist) 0%, var(--sage-light) 100%);
  border: 1px solid var(--sage-light);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  margin-bottom: 16px;
  transition: all 0.2s ease;
  font-family: var(--sans);
}
.quick-meal-shortcut:hover {
  border-color: var(--sage);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.quick-meal-shortcut svg { width: 24px; height: 24px; color: var(--gold); flex-shrink: 0; }
.quick-meal-shortcut strong { display: block; color: var(--sage-darker); font-size: 15px; font-weight: 600; }
.quick-meal-shortcut span { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

.note-shortcut {
  background: linear-gradient(135deg, #FBF4E8 0%, #F3E6CD 100%);
  border-color: var(--gold-soft);
  margin-top: -8px;
}
.note-shortcut:hover { border-color: var(--gold); }
.note-shortcut svg { color: var(--gold); }

.meal-slot.note-slot {
  background: linear-gradient(135deg, #FBF4E8 0%, #F3E6CD 100%);
  border-color: var(--gold-soft);
}
.meal-slot.note-slot:hover { background: linear-gradient(135deg, #F3E6CD 0%, #E8C9A0 100%); }
.meal-slot.note-slot .meal-name {
  font-style: italic;
  color: #8B6A3C;
  display: flex;
  align-items: center;
  gap: 6px;
}
.meal-slot.note-slot .meal-name::before {
  content: "📝";
  font-size: 14px;
  font-style: normal;
}

.hint { font-size: 12px; color: var(--muted); margin-top: 6px; font-style: italic; }
.form-field textarea { min-height: 80px; }
.picker-list { max-height: 50vh; overflow-y: auto; margin-top: 16px; }
.picker-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}
.picker-item:hover { background: var(--sage-mist); }
.picker-item .thumb-sm {
  width: 50px; height: 50px;
  border-radius: 10px;
  background: var(--sage-mist);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.picker-item .thumb-sm img { width: 100%; height: 100%; object-fit: cover; }
.picker-item .info { flex: 1; }
.picker-item .name { font-weight: 500; font-size: 14px; color: var(--ink); }
.picker-item .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* =========================================================
   Grocery list
   ========================================================= */
.grocery-list {
  background: var(--paper);
  border-radius: var(--radius-xl);
  padding: 40px 48px;
  border: 1px solid var(--line-soft);
  max-width: 880px;
  margin: 0 auto;
}

.grocery-category { margin-bottom: 32px; }
.grocery-category:last-child { margin-bottom: 0; }
.grocery-category h3 {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--sage-darker);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--sage-light);
  display: flex;
  align-items: center;
  gap: 10px;
}
.grocery-category h3 .emoji { font-size: 22px; }

.grocery-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px; }

.grocery-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.grocery-item:hover { background: var(--sage-mist); }
.grocery-item input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--sage);
  cursor: pointer;
  flex-shrink: 0;
}
.grocery-item.checked .label { text-decoration: line-through; color: var(--muted); }
.grocery-item .label { font-size: 14px; flex: 1; }
.grocery-item .qty { font-weight: 600; color: var(--sage-darker); }

.grocery-item .extra-badge {
  font-size: 10px;
  color: var(--gold);
  background: rgba(212, 165, 116, 0.12);
  padding: 2px 6px;
  border-radius: 8px;
  letter-spacing: 0.3px;
  margin-left: 4px;
}
.grocery-item .delete-extra {
  background: transparent;
  border: 0;
  color: var(--muted);
  width: 22px; height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  opacity: 0;
  transition: all 0.15s;
}
.grocery-item:hover .delete-extra { opacity: 1; }
.grocery-item .delete-extra:hover { background: rgba(198, 93, 79, 0.12); color: var(--danger); }

.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--muted);
}
.empty-state svg { width: 64px; height: 64px; margin-bottom: 20px; opacity: 0.4; }
.empty-state h3 { font-family: var(--serif); font-size: 24px; color: var(--ink-soft); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* =========================================================
   Toast
   ========================================================= */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--sage-darker);
  color: var(--paper);
  padding: 14px 24px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(.2,.9,.3,1.2), visibility 0.3s;
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  background: var(--sage-darker);
  color: var(--cream);
  padding: 28px 0;
  margin-top: 80px;
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.5px;
}
.site-footer p { opacity: 0.9; }

/* =========================================================
   Administration (super)
   ========================================================= */
.modal-content.admin-content { max-width: 880px; }
.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 8px 0 24px;
}
.admin-stats > div {
  background: var(--sage-mist);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.admin-stats strong { font-size: 18px; color: var(--sage-darker); }
.admin-stats span { font-size: 11px; color: var(--muted); letter-spacing: 0.5px; text-transform: uppercase; }
.admin-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.admin-tab {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 10px 14px;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: -1px;
}
.admin-tab:hover { color: var(--ink); }
.admin-tab.active { color: var(--sage-darker); border-bottom-color: var(--sage-darker); font-weight: 600; }
.admin-panel { display: none; }
.admin-panel.active { display: block; }
.admin-sub { color: var(--muted); font-weight: normal; font-size: 12px; }
.admin-empty { color: var(--muted); font-size: 13px; padding: 8px 14px; }
.user-row .contact { font-size: 12px; color: var(--ink-soft); margin-top: 4px; line-height: 1.5; }
.user-row .contact span { margin-right: 12px; white-space: nowrap; display: inline-block; }
.user-row .badge { margin-left: 6px; vertical-align: middle; }
.user-row .badge.badge-off { background: rgba(198, 93, 79, 0.12); color: var(--danger); }
.user-row.is-disabled .meta { opacity: 0.55; }
.admin-family-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.admin-family-row select {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  background: var(--paper);
}
.admin-user .actions, .admin-family .actions { flex-wrap: wrap; justify-content: flex-end; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 960px) {
  .calendar-grid { grid-template-columns: repeat(2, 1fr); }
  .recipe-body-grid { grid-template-columns: 1fr; gap: 24px; }
  .recipe-view .details { padding: 28px; }
  .recipe-view h1 { font-size: 32px; }
  .modal-content { padding: 28px; }
  h2 { font-size: 32px; }
}

@media (max-width: 640px) {
  .container { padding: 0 20px; }
  .header-inner { flex-direction: column; padding: 16px 20px; gap: 12px; }
  .main-nav { width: 100%; justify-content: space-between; }
  .nav-btn { flex: 1; justify-content: center; padding: 10px 8px; font-size: 12px; }
  .nav-btn svg { width: 16px; height: 16px; }
  .page-header { flex-direction: column; align-items: stretch; }
  .page-actions { flex-direction: column; align-items: stretch; }
  .search-box { min-width: 0; }
  .calendar-grid { grid-template-columns: 1fr; }
  .recipe-grid { grid-template-columns: 1fr; }
  .meta-row { flex-wrap: wrap; gap: 20px !important; }
  .grocery-list { padding: 24px; }
  .ingredients-editor .ing-row { grid-template-columns: 1fr 1fr; gap: 6px; }
  .ingredients-editor .ing-row > input:nth-child(3) { grid-column: 1 / -1; }
  .ingredients-editor .ing-row > select { grid-column: 1 / -1; }
  .ingredients-editor .ing-row > .remove-ing { justify-self: end; }
}

/* =========================================================
   Print
   ========================================================= */
@media print {
  @page { size: letter; margin: 1cm; }

  body { background: white; font-size: 11px; }
  .site-header, .site-footer, .page-actions, .nav-btn,
  .tab-panel:not(.active), .modal, .toast,
  #tab-recipes, #tab-calendar,
  .eyebrow, .subtitle,
  .grocery-item input[type="checkbox"] { display: none !important; }

  main { padding: 0 !important; }
  .container { padding: 0 !important; max-width: 100% !important; }
  #tab-grocery .page-header { display: block; margin-bottom: 10px; border-bottom: 2px solid #000; padding-bottom: 6px; }
  #tab-grocery .page-header h2 {
    font-size: 18px;
    margin: 0;
    display: inline-block;
    font-family: var(--sans);
    color: #000;
  }
  #tab-grocery #grocery-week-label {
    display: inline-block !important;
    font-family: var(--sans);
    font-size: 11px;
    color: #333;
    font-weight: normal;
    margin: 0 0 0 12px;
    font-style: italic;
  }

  .grocery-list {
    box-shadow: none;
    border: 0;
    padding: 0;
    max-width: 100%;
    columns: 2;
    column-gap: 20px;
  }

  .grocery-category {
    break-inside: avoid;
    margin-bottom: 12px;
    page-break-inside: avoid;
  }
  .grocery-category h3 {
    font-size: 12px;
    font-family: var(--sans);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #000;
    padding: 2px 0 3px;
    margin-bottom: 4px;
    border-bottom: 1.5px solid #000;
  }
  .grocery-category h3 .emoji { font-size: 12px; margin-right: 4px; }

  .grocery-items {
    display: block;
    grid-template-columns: none;
    gap: 0;
  }

  .grocery-item {
    display: block;
    padding: 1px 0 1px 14px;
    position: relative;
    font-size: 11px;
    line-height: 1.35;
    break-inside: avoid;
    color: #000 !important;
  }
  .grocery-item::before {
    content: "☐";
    position: absolute;
    left: 0;
    top: 0;
    font-size: 11px;
  }
  .grocery-item.checked { display: none !important; }
  .grocery-item .qty { font-weight: 600; }
}

@media (max-width: 640px) {
  .admin-stats { grid-template-columns: repeat(2, 1fr); }
  .admin-user, .admin-family { flex-wrap: wrap; }
  .admin-user .actions, .admin-family .actions { width: 100%; justify-content: flex-start; }
}
