/* =========================================================
   Components — one shared visual language
   ========================================================= */

/* =========== Buttons =========== */
.btn {
  --btn-bg: var(--color-primary); --btn-fg: var(--color-on-primary); --btn-bd: transparent;
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px;
  border: 1px solid var(--btn-bd); border-radius: var(--border-radius-md);
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 600; font-size: var(--text-sm); line-height: 1; letter-spacing: .005em; white-space: nowrap;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow-sm);
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}
.btn:hover { --btn-bg: var(--color-primary-hover); color: var(--btn-fg); box-shadow: var(--shadow-md); }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
.btn .icon { transition: transform var(--transition-normal); }
.btn:hover .icon { transform: scale(1.08); }

/* Secondary — supporting actions (".ghost" kept as alias used across pages) */
.btn.secondary, .btn.ghost {
  --btn-bg: var(--color-surface); --btn-fg: var(--color-text); --btn-bd: var(--color-border);
}
.btn.secondary:hover, .btn.ghost:hover { --btn-bg: var(--color-surface-hover); --btn-bd: var(--color-border-strong); --btn-fg: var(--color-text); }
/* Ghost — low emphasis */
.btn.quiet { --btn-bg: transparent; --btn-fg: var(--color-text-muted); --btn-bd: transparent; box-shadow: none; }
.btn.quiet:hover { --btn-bg: var(--color-surface-hover); --btn-fg: var(--color-text); box-shadow: none; }
.btn.dark { --btn-bg: var(--color-text); --btn-fg: var(--color-background); }
.btn.dark:hover { --btn-bg: var(--color-text); opacity: .9; }
/* Destructive */
.btn.danger { --btn-bg: var(--color-danger); --btn-fg: #fff; }
.btn.danger:hover { --btn-bg: var(--color-danger); filter: brightness(.92); }
.btn.danger.ghost { --btn-bg: transparent; --btn-fg: var(--color-danger); --btn-bd: var(--color-border); }
.btn.success { --btn-bg: var(--color-success); --btn-fg: #fff; }
.btn.success:hover { --btn-bg: var(--color-success); filter: brightness(.93); }
/* AI — used only for AI-powered actions */
.btn.ai { --btn-bg: transparent; --btn-fg: #fff; background: var(--gradient-ai); background-size: 160% 100%; background-position: 0 0; transition: background-position var(--transition-slow), box-shadow var(--transition-fast), transform var(--transition-fast); }
.btn.ai:hover { background-position: 100% 0; box-shadow: 0 8px 24px -10px rgba(212, 97, 44, .65); }
[data-theme="dark"] .btn.ai { --btn-fg: #1a0c05; }

.btn.sm { height: 34px; padding: 0 12px; font-size: var(--text-xs); border-radius: var(--border-radius-sm); gap: 6px; }
.btn.lg { height: 50px; padding: 0 26px; font-size: var(--text-base); border-radius: var(--border-radius-md); }
.btn.block { width: 100%; }
.btn.loading { pointer-events: none; color: transparent !important; }
.btn.loading > * { opacity: 0; }
.btn.loading::after {
  content: ''; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px;
  border: 2px solid var(--btn-fg); border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* Ripple (created by animations.js) */
.ripple { position: absolute; border-radius: 50%; pointer-events: none; background: currentColor; opacity: .18; transform: scale(0); animation: ripple 560ms var(--ease-out) forwards; z-index: -1; }
.btn:not(.ghost):not(.secondary):not(.quiet) .ripple { background: #fff; opacity: .28; }

/* Icon buttons — compact controls */
.icon-btn {
  position: relative; display: inline-grid; place-items: center;
  width: 40px; height: 40px; padding: 0; border: 0; border-radius: var(--border-radius-md);
  background: transparent; color: var(--color-text-muted);
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { background: var(--color-surface-hover); color: var(--color-text); }
.icon-btn:active { transform: scale(.92); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: var(--border-radius-sm); }
.icon-btn.danger:hover { color: var(--color-danger); background: var(--color-danger-soft); }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; display: grid; place-items: center; background: var(--color-primary); color: var(--color-on-primary); font-size: 10px; font-weight: 700; box-shadow: 0 0 0 2px var(--color-background); }
[data-theme="dark"] .i-sun, [data-theme="light"] .i-moon { display: none; }
.theme-toggle .icon { transition: transform var(--transition-slow); }
.theme-toggle:hover .icon { transform: rotate(-20deg); }

/* =========== Cards =========== */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: var(--space-4); }
a.card { display: block; transition: border-color var(--transition-fast), box-shadow var(--transition-normal), transform var(--transition-normal); }
a.card:hover { color: inherit; border-color: var(--color-border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card-title { display: flex; align-items: center; gap: 10px; margin: 0 0 var(--space-4); font-weight: 650; font-size: var(--text-base); letter-spacing: -.01em; }
.card-title .icon { color: var(--color-primary); }
.card-title .card-action { margin-left: auto; font-weight: 550; font-size: var(--text-xs); color: var(--color-text-muted); }
.card-title .card-action:hover { color: var(--color-primary); }
.card.flush { padding: 0; overflow: hidden; }
.card.soft { background: var(--color-surface-hover); box-shadow: none; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin: var(--space-10) 0 var(--space-4); }
.section-title h2 { margin: 0; font-size: var(--text-lg); }
.section-title a { font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted); display: inline-flex; align-items: center; gap: 4px; }
.section-title a:hover { color: var(--color-primary); }

/* =========== Forms =========== */
label { display: block; margin-bottom: 6px; font-weight: 600; font-size: var(--text-sm); color: var(--color-text); }
.field { position: relative; margin-bottom: var(--space-4); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=url], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 14px;
  border: 1px solid var(--color-border); border-radius: var(--border-radius-md);
  background: var(--color-surface); color: var(--color-text);
  outline: 0; box-shadow: inset 0 1px 1px rgba(41, 27, 15, .03);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}
input::placeholder, textarea::placeholder { color: var(--color-text-subtle); }
input:hover, select:hover, textarea:hover { border-color: var(--color-border-strong); }
input:focus, select:focus, textarea:focus { border-color: var(--color-primary); box-shadow: var(--shadow-focus); }
input:disabled, select:disabled, textarea:disabled { opacity: .6; cursor: not-allowed; }
select {
  -webkit-appearance: none; appearance: none; padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238A8075' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
textarea { resize: vertical; min-height: 104px; line-height: 1.55; }
input[type=date] { cursor: pointer; }
input[type=file] { font-size: var(--text-sm); color: var(--color-text-muted); }
input[type=file]::file-selector-button { margin-right: 12px; height: 36px; padding: 0 14px; border-radius: var(--border-radius-sm); border: 1px solid var(--color-border); background: var(--color-surface-hover); color: var(--color-text); font-weight: 600; cursor: pointer; }
.hint { margin-top: 6px; font-size: var(--text-xs); color: var(--color-text-muted); }

/* Validation: icon + text, never colour alone */
.field-error, .field-success { display: flex; align-items: flex-start; gap: 6px; margin-top: 6px; font-size: var(--text-xs); font-weight: 550; animation: fade-up var(--transition-normal) both; }
.field-error { color: var(--color-danger); }
.field-success { color: var(--color-success); }
.field-error .icon, .field-success .icon { margin-top: 1px; }
.is-invalid, input.is-invalid, select.is-invalid, textarea.is-invalid { border-color: var(--color-danger) !important; }
.is-invalid:focus { box-shadow: 0 0 0 3px var(--color-danger-soft) !important; }
input.is-valid { border-color: var(--color-success); padding-right: 38px; background: var(--color-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232E7A4A' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") no-repeat right 12px center; }

.input-wrap { position: relative; }
.input-wrap .pw-toggle { position: absolute; right: 4px; top: 2px; }
.input-wrap input { padding-right: 48px; }

/* Checkbox & radio */
input[type=checkbox], input[type=radio] {
  -webkit-appearance: none; appearance: none; flex-shrink: 0; margin: 0;
  width: 18px; height: 18px; border: 1.5px solid var(--color-border-strong); border-radius: 5px;
  background: var(--color-surface); display: inline-grid; place-items: center; cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}
input[type=radio] { border-radius: 50%; }
input[type=checkbox]::after { content: ''; width: 10px; height: 10px; transform: scale(0); transition: transform var(--transition-fast) var(--ease-spring);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/contain no-repeat; }
input[type=radio]::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #fff; transform: scale(0); transition: transform var(--transition-fast) var(--ease-spring); }
input[type=checkbox]:checked, input[type=radio]:checked { background: var(--color-primary); border-color: var(--color-primary); }
input[type=checkbox]:checked::after, input[type=radio]:checked::after { transform: scale(1); }
input[type=checkbox]:active, input[type=radio]:active { transform: scale(.9); }
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.check { display: inline-flex; align-items: center; gap: 10px; margin: 0 16px 10px 0; font-weight: 500; cursor: pointer; }

/* Chip selector */
.chip-check { display: inline-block; margin: 0 6px 8px 0; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px;
  border: 1px solid var(--color-border); border-radius: var(--border-radius-full);
  background: var(--color-surface); font-size: var(--text-sm); font-weight: 550; cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}
.chip-check span:hover { border-color: var(--color-border-strong); background: var(--color-surface-hover); }
.chip-check input:checked + span { background: var(--color-text); border-color: var(--color-text); color: var(--color-background); }
.chip-check input:checked + span::before { content: '✓'; font-size: 12px; }
.chip-check input:focus-visible + span { box-shadow: var(--shadow-focus); }
.chip-check span:active { transform: scale(.96); }

/* Segmented control */
.seg { display: inline-flex; gap: 2px; padding: 4px; border-radius: var(--border-radius-md); background: var(--color-surface-sunken); border: 1px solid var(--color-border); }
.seg a, .seg button, .seg label { margin: 0; padding: 0; border: 0; background: none; color: var(--color-text-muted); font-weight: 600; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label span, .seg a, .seg button { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: 9px; font-size: var(--text-sm); transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast); }
.seg .active, .seg input:checked + span { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--color-border); }
.seg input:focus-visible + span { box-shadow: var(--shadow-focus); }

/* File drop */
.file-drop {
  display: grid; justify-items: center; gap: 6px; padding: var(--space-8) var(--space-6);
  border: 1.5px dashed var(--color-border-strong); border-radius: var(--border-radius-lg);
  background: var(--color-surface-hover); color: var(--color-text-muted); text-align: center; cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-normal);
}
.file-drop .drop-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--color-surface); color: var(--color-primary); box-shadow: var(--shadow-sm); margin-bottom: 6px; transition: transform var(--transition-normal) var(--ease-spring); }
.file-drop strong { color: var(--color-text); font-weight: 600; }
.file-drop:hover, .file-drop.drag { border-color: var(--color-primary); background: var(--color-primary-soft); }
.file-drop:hover .drop-icon, .file-drop.drag .drop-icon { transform: translateY(-3px) scale(1.04); }
.file-drop:focus-within { box-shadow: var(--shadow-focus); }
.file-drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--space-2); margin-top: var(--space-3); }
.previews:empty { display: none; }
.previews img, .previews video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--border-radius-md); animation: pop-in var(--transition-normal) both; }
.previews label { margin: 0; font-weight: 500; }
.previews .check { margin: 6px 0 0; font-size: var(--text-xs); }

/* =========== Alerts, badges, pills =========== */
.alert {
  display: flex; align-items: flex-start; gap: 12px; margin-bottom: var(--space-4); padding: 14px 16px;
  border: 1px solid var(--color-border); border-radius: var(--border-radius-md);
  background: var(--color-surface); font-weight: 500; font-size: var(--text-sm); line-height: 1.5;
  animation: fade-up var(--transition-normal) both;
}
.alert::before { content: ''; flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; background: currentColor;
  -webkit-mask: var(--alert-icon) center/contain no-repeat; mask: var(--alert-icon) center/contain no-repeat; }
.alert > .icon:first-child { display: none; }
.alert.error { --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E"); color: var(--color-danger); background: var(--color-danger-soft); border-color: transparent; }
.alert.success { --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolyline points='16 9 10.5 15 8 12.5'/%3E%3C/svg%3E"); color: var(--color-success); background: var(--color-success-soft); border-color: transparent; }
.alert.info { --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='16' x2='12' y2='12'/%3E%3Cline x1='12' y1='8' x2='12.01' y2='8'/%3E%3C/svg%3E"); color: var(--color-text); background: var(--color-accent-soft); border-color: transparent; }
.alert.info::before { color: var(--color-warning); }
.alert a { text-decoration: underline; text-underline-offset: 2px; }

.pill, .badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px;
  border-radius: var(--border-radius-full); border: 1px solid var(--color-border);
  background: var(--color-surface); color: var(--color-text-muted);
  font-size: 12px; font-weight: 600; white-space: nowrap; text-transform: capitalize; vertical-align: middle;
}
.pill.orange, .pill.primary { background: var(--color-primary-soft); border-color: transparent; color: var(--color-primary); }
.pill.danger { background: var(--color-danger-soft); border-color: transparent; color: var(--color-danger); }
.pill.success { background: var(--color-success-soft); border-color: transparent; color: var(--color-success); }
.pill.warn { background: var(--color-warning-soft); border-color: transparent; color: var(--color-warning); }
.pill.herb { background: var(--color-secondary-soft); border-color: transparent; color: var(--color-secondary); }
.pill.ai, .badge-ai { background: var(--gradient-ai-soft); border-color: transparent; color: var(--color-primary); }
.pill.ai .icon, .badge-ai .icon { color: var(--color-accent); }
.badge { height: 20px; padding: 0 8px; font-size: 11px; background: var(--color-primary); border-color: transparent; color: var(--color-on-primary); }
.tag { display: inline-flex; align-items: center; height: 28px; padding: 0 11px; border-radius: var(--border-radius-full); background: var(--color-secondary-soft); color: var(--color-secondary); font-size: var(--text-xs); font-weight: 600; transition: background var(--transition-fast), transform var(--transition-fast); }
.tag:hover { color: var(--color-secondary); background: rgba(63, 93, 69, .18); transform: translateY(-1px); }

.chef-badge { display: inline-flex; margin-left: 5px; vertical-align: -2px; color: var(--color-primary); }
.user-link { font-weight: 650; color: var(--color-text); }
.user-link:hover { color: var(--color-primary); }

.allergy-warn { display: flex; align-items: center; gap: 8px; padding: 10px 12px; margin: var(--space-3) 0; border-radius: var(--border-radius-md); background: var(--color-danger-soft); color: var(--color-danger); font-weight: 600; font-size: var(--text-sm); }

.announcement {
  position: relative; overflow: hidden; border: 0; color: #FBF4EC;
  background: var(--gradient-warm);
}
.announcement::after { content: ''; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, rgba(231, 169, 63, .35), transparent 70%); pointer-events: none; }
.announcement h4 { display: flex; align-items: center; gap: 8px; color: #F4C065; margin-bottom: 6px; }
.announcement p { color: rgba(251, 244, 236, .86); }

/* =========== Avatars =========== */
.avatar { border-radius: 50%; object-fit: cover; background: var(--color-surface-sunken); flex-shrink: 0; }
.avatar.xs { width: 28px; height: 28px; }
.avatar.sm { width: 40px; height: 40px; }
.avatar.md { width: 56px; height: 56px; }
.avatar.lg { width: 128px; height: 128px; border: 4px solid var(--color-surface); box-shadow: var(--shadow-md); }
.avatar-ring { padding: 2px; border-radius: 50%; background: var(--gradient-ai); display: inline-flex; }
.avatar-ring .avatar { border: 2px solid var(--color-surface); }
.avatar-btn { padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; display: inline-flex; transition: transform var(--transition-fast), box-shadow var(--transition-fast); }
.avatar-btn:hover { box-shadow: 0 0 0 3px var(--color-primary-soft); }
.avatar-btn:active { transform: scale(.94); }
.avatar-btn .avatar { width: 36px; height: 36px; }

/* =========== Dropdowns =========== */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: var(--z-dropdown);
  min-width: 240px; padding: 6px;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.97); transform-origin: top right;
  transition: opacity var(--transition-fast), transform var(--transition-normal), visibility 0s linear 240ms;
}
.dropdown.up .dropdown-menu { top: auto; bottom: calc(100% + 8px); transform-origin: bottom left; left: 0; right: auto; }
.dropdown.left .dropdown-menu { left: 0; right: auto; transform-origin: top left; }
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: none; transition: opacity var(--transition-fast), transform var(--transition-normal), visibility 0s; }
.dropdown-menu a, .dropdown-menu button {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 8px 12px;
  border: 0; border-radius: var(--border-radius-sm); background: none; color: var(--color-text);
  font-size: var(--text-sm); font-weight: 500; text-align: left; cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.dropdown-menu a .icon, .dropdown-menu button .icon { color: var(--color-text-muted); }
.dropdown-menu a:hover, .dropdown-menu button:hover, .dropdown-menu a:focus-visible, .dropdown-menu button:focus-visible { background: var(--color-surface-hover); color: var(--color-text); outline: none; }
.dropdown-menu .danger, .dropdown-menu .text-danger { color: var(--color-danger); }
.dropdown-menu .danger .icon, .dropdown-menu .text-danger .icon { color: var(--color-danger); }
.dropdown-menu .danger:hover, .dropdown-menu .text-danger:hover { background: var(--color-danger-soft); color: var(--color-danger); }
.dropdown-menu form { margin: 0; }
.dropdown-menu hr, .dd-sep { margin: 6px 0; border: 0; border-top: 1px solid var(--color-border); }
.dd-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--color-border); }
.dd-head strong { display: block; font-size: var(--text-sm); }
.dd-head span { display: block; }

/* =========== Tooltips (CSS-only, aria-label carries meaning) =========== */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip); position: absolute; left: 50%; bottom: calc(100% + 8px); z-index: var(--z-dropdown);
  padding: 6px 10px; border-radius: var(--border-radius-sm); white-space: nowrap; pointer-events: none;
  background: var(--color-text); color: var(--color-background); font-size: 12px; font-weight: 600;
  opacity: 0; transform: translate(-50%, 4px); transition: opacity var(--transition-fast), transform var(--transition-fast);
}
[data-tooltip]:hover::after, [data-tooltip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); transition-delay: .35s; }
[data-tooltip-pos="right"]::after { left: calc(100% + 10px); bottom: auto; top: 50%; transform: translate(-4px, -50%); }
[data-tooltip-pos="right"]:hover::after, [data-tooltip-pos="right"]:focus-visible::after { transform: translate(0, -50%); }
[data-tooltip-pos="bottom"]::after { bottom: auto; top: calc(100% + 8px); transform: translate(-50%, -4px); }
@media (hover: none) { [data-tooltip]::after { display: none; } }

/* =========== Tabs =========== */
.tabs { position: relative; display: flex; gap: var(--space-6); margin-bottom: var(--space-5); border-bottom: 1px solid var(--color-border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 46px; color: var(--color-text-muted); font-weight: 600; font-size: var(--text-sm); white-space: nowrap; transition: color var(--transition-fast); }
.tabs a::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--color-text); transform: scaleX(0); transition: transform var(--transition-normal); }
.tabs a:hover { color: var(--color-text); }
.tabs a.active { color: var(--color-text); }
.tabs a.active::after { transform: scaleX(1); }
.tabs a .muted { font-weight: 500; }
.tabs .count { font-weight: 600; color: var(--color-text-subtle); font-size: var(--text-xs); }

/* Pill tabs (feed switcher) */
.pill-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--border-radius-full); background: var(--color-surface-sunken); border: 1px solid var(--color-border); }
.pill-tabs a { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 16px; border-radius: var(--border-radius-full); font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted); transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast); }
.pill-tabs a:hover { color: var(--color-text); }
.pill-tabs a.active { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--color-border); }

/* Horizontal chip scroller */
.chip-row { display: flex; gap: var(--space-2); overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; scroll-snap-type: x proximity; }
.chip-row::-webkit-scrollbar { display: none; }
.chip-link {
  flex-shrink: 0; scroll-snap-align: start; display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: var(--border-radius-full); border: 1px solid var(--color-border); background: var(--color-surface);
  font-size: var(--text-sm); font-weight: 600; color: var(--color-text);
  transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
}
.chip-link:hover { color: var(--color-text); border-color: var(--color-border-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.chip-link .count { color: var(--color-text-subtle); font-weight: 550; font-size: var(--text-xs); }
.chip-link.active { background: var(--color-text); border-color: var(--color-text); color: var(--color-background); }

/* =========== Modal / drawer / sheet =========== */
.modal { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: var(--space-4); }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: var(--color-overlay); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity var(--transition-normal); }
.modal-box {
  position: relative; width: 100%; max-width: 520px; max-height: min(88vh, 820px); overflow: auto; overscroll-behavior: contain;
  padding: var(--space-6); border-radius: var(--border-radius-xl);
  background: var(--color-surface); border: 1px solid var(--color-border); box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(14px) scale(.97); filter: blur(4px);
  transition: opacity var(--transition-normal), transform var(--transition-slow), filter var(--transition-normal);
}
.modal.is-open .modal-backdrop { opacity: 1; }
.modal.is-open .modal-box { opacity: 1; transform: none; filter: none; }
.modal.is-closing .modal-backdrop { opacity: 0; }
.modal.is-closing .modal-box { opacity: 0; transform: translateY(8px) scale(.98); }
.modal-close { position: absolute; top: 14px; right: 14px; z-index: 2; }
.modal-content h3 { font-family: var(--font-display); font-weight: 700; font-size: var(--text-lg); padding-right: 40px; margin-bottom: 6px; }
.modal-content > p.muted:first-of-type { margin-bottom: var(--space-5); }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-6); }
.modal-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; margin-bottom: var(--space-4); background: var(--color-primary-soft); color: var(--color-primary); }
.modal-icon.danger { background: var(--color-danger-soft); color: var(--color-danger); }
.modal.size-sm .modal-box { max-width: 420px; }
.modal.size-lg .modal-box { max-width: 680px; }

/* Drawer: slides from the right on desktop */
.modal.variant-drawer { place-items: stretch end; padding: 0; }
.modal.variant-drawer .modal-box {
  height: 100%; max-height: none; max-width: 460px; border-radius: 0; border-width: 0 0 0 1px; padding: 0;
  display: flex; flex-direction: column; transform: translateX(40px); filter: none;
}
.modal.variant-drawer.is-open .modal-box { transform: none; }
.modal.variant-drawer.is-closing .modal-box { transform: translateX(40px); }
.modal.variant-drawer .modal-content { display: flex; flex-direction: column; min-height: 0; flex: 1; }

/* =========== Toasts =========== */
.toast-region { position: fixed; z-index: var(--z-toast); right: var(--space-6); bottom: var(--space-6); display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-2); pointer-events: none; width: min(380px, calc(100vw - 32px)); }
.toast {
  position: relative; overflow: hidden; pointer-events: auto;
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 12px 12px 14px;
  border-radius: var(--border-radius-md); border: 1px solid var(--color-border);
  background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-lg);
  font-size: var(--text-sm); font-weight: 550;
  animation: toast-in 420ms var(--ease-spring) both;
}
.toast.is-leaving { animation: toast-out 260ms var(--ease-in-out) forwards; }
.toast-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; background: var(--color-success-soft); color: var(--color-success); }
.toast.error .toast-icon { background: var(--color-danger-soft); color: var(--color-danger); }
.toast.info .toast-icon { background: var(--color-accent-soft); color: var(--color-warning); }
.toast.loading .toast-icon::before { content: ''; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.toast.loading .toast-icon .icon { display: none; }
.toast-msg { flex: 1; min-width: 0; line-height: 1.4; }
.toast .icon-btn { width: 28px; height: 28px; }
.toast-progress { position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--color-success); transform-origin: left; animation: toast-progress linear forwards; opacity: .7; }
.toast.error .toast-progress { background: var(--color-danger); }
.toast.info .toast-progress { background: var(--color-accent); }
.toast:hover .toast-progress { animation-play-state: paused; }

/* =========== Skeletons =========== */
.skeleton, .sk {
  position: relative; overflow: hidden; border-radius: var(--border-radius-md);
  background: var(--color-surface-sunken);
}
.skeleton { height: 120px; }
.skeleton::after, .sk::after {
  content: ''; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  animation: shimmer 1.4s ease-in-out infinite;
}
[data-theme="dark"] .skeleton::after, [data-theme="dark"] .sk::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .05), transparent); }
.sk-line { height: 12px; border-radius: 6px; }
.sk-line.w-30 { width: 30%; } .sk-line.w-50 { width: 50%; } .sk-line.w-70 { width: 70%; } .sk-line.w-90 { width: 90%; }
.sk-circle { border-radius: 50%; }
.sk-card { padding: var(--space-4); display: grid; gap: 12px; }
.sk-row { display: flex; align-items: center; gap: 12px; }
.sk-media { aspect-ratio: 1; border-radius: 0; }
.skeleton-feed .card { padding: 0; overflow: hidden; }

/* =========== Empty & error states =========== */
.empty { display: grid; justify-items: center; text-align: center; gap: 6px; padding: var(--space-12) var(--space-6); color: var(--color-text-muted); }
.empty-art { position: relative; width: 84px; height: 84px; display: grid; place-items: center; margin-bottom: var(--space-3); border-radius: 26px; background: var(--color-primary-soft); color: var(--color-primary); }
.empty-art::before { content: ''; position: absolute; inset: -10px; border-radius: 32px; border: 1px dashed var(--color-primary-ring); animation: slow-spin 24s linear infinite; }
.empty-art.herb { background: var(--color-secondary-soft); color: var(--color-secondary); }
.empty-art.herb::before { border-color: rgba(63, 93, 69, .3); }
.empty > .icon { width: 44px; height: 44px; color: var(--color-primary); margin-bottom: 8px; }
.empty h3 { margin: 0; color: var(--color-text); font-family: var(--font-display); font-weight: 700; font-size: var(--text-lg); }
.empty p { max-width: 400px; margin: 0 auto; font-size: var(--text-sm); }
.empty .btn { margin-top: var(--space-4); }
.empty .row { margin-top: var(--space-4); justify-content: center; }
.empty .row .btn { margin-top: 0; }
.error-state .empty-art { background: var(--color-danger-soft); color: var(--color-danger); }
.error-state .empty-art::before { border-color: rgba(180, 35, 24, .25); }

.pagination { display: flex; justify-content: center; gap: var(--space-2); margin-top: var(--space-6); }
.load-sentinel { display: grid; place-items: center; padding: var(--space-6) 0; color: var(--color-text-subtle); font-size: var(--text-sm); }
.feed-end { display: flex; align-items: center; gap: 14px; margin: var(--space-8) 0 var(--space-4); color: var(--color-text-subtle); font-size: var(--text-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.feed-end::before, .feed-end::after { content: ''; flex: 1; height: 1px; background: var(--color-border); }

/* =========== Tables =========== */
.table-wrap { overflow-x: auto; margin: 0 calc(-1 * var(--space-5)); padding: 0 var(--space-5); }
table.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th, .table td { padding: 12px; border-bottom: 1px solid var(--color-border); text-align: left; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table th { font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-subtle); }
.table tbody tr, .table tr { transition: background var(--transition-fast); }
.table tr:hover td { background: var(--color-surface-hover); }
.inline-form { display: inline; }
.status-list li { display: flex; justify-content: space-between; gap: var(--space-3); padding: 10px 0; border-bottom: 1px solid var(--color-border); }
.status-list li:last-child { border-bottom: 0; }
.kpi { display: flex; align-items: center; gap: 14px; }
.kpi-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0; background: var(--color-primary-soft); color: var(--color-primary); }
.kpi b { display: block; font-size: 1.6rem; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi > div > span { display: block; }

/* =========================================================
   Feature components
   ========================================================= */

/* =========== Composer (home) =========== */
.composer { display: flex; align-items: center; gap: 14px; padding: 14px 14px 14px 16px; }
.composer-prompt { flex: 1; min-width: 0; height: 44px; display: flex; align-items: center; padding: 0 16px; border-radius: var(--border-radius-full); background: var(--color-surface-hover); color: var(--color-text-subtle); transition: background var(--transition-fast), color var(--transition-fast); }
a.composer:hover .composer-prompt { background: var(--color-surface-sunken); color: var(--color-text-muted); }
.composer-actions { display: flex; gap: 2px; }
.composer-actions span { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: var(--color-text-muted); }
.composer-actions .ai-dot { color: var(--color-primary); }
.feed-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin: var(--space-6) 0 var(--space-4); }
.feed-toolbar h2 { margin: 0; font-size: var(--text-lg); }

/* =========== Post card =========== */
.feed { display: flex; flex-direction: column; gap: var(--space-5); }
.post-card { padding: 0; overflow: hidden; transition: box-shadow var(--transition-normal), border-color var(--transition-normal); }
.post-card + .post-card { margin-top: 0; }
.post-card:hover { box-shadow: var(--shadow-md); }
.post-head { display: flex; align-items: center; gap: 12px; padding: 14px 12px 14px 16px; }
.post-author { flex: 1; min-width: 0; line-height: 1.3; }
.post-author .user-link { font-size: var(--text-sm); }
.post-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 2px; color: var(--color-text-muted); font-size: var(--text-xs); }
.post-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .5; }
.post-body { display: block; color: inherit; }
.post-body:hover { color: inherit; }
.post-content { padding: 14px 18px 4px; }
.post-title { margin: 0 0 6px; font-family: var(--font-display); font-weight: 700; font-size: 1.32rem; letter-spacing: -.015em; line-height: 1.25; }
.post-title a:hover { color: var(--color-primary); }
.caption { margin: 0 0 6px; color: var(--color-text); white-space: normal; overflow-wrap: anywhere; }
.caption.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.post-card .allergy-warn { margin: 10px 0 2px; }

/* Media + carousel */
.media { position: relative; background: var(--color-surface-sunken); overflow: hidden; }
.post-card .media { aspect-ratio: 1 / 1; }
.media img, .media video { width: 100%; height: 100%; object-fit: cover; transition: transform 900ms var(--ease-out), filter var(--transition-slow); }
.post-card .media:hover img { transform: scale(1.025); }
.media-count { position: absolute; top: 12px; right: 12px; padding: 4px 10px; border-radius: var(--border-radius-full); background: rgba(20, 14, 10, .62); color: #fff; font-size: 12px; font-weight: 600; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); font-variant-numeric: tabular-nums; }
.carousel { position: relative; }
.carousel-track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-slide { flex: 0 0 100%; height: 100%; scroll-snap-align: center; }
.carousel-btn { position: absolute; top: 50%; z-index: 2; width: 34px; height: 34px; margin-top: -17px; border: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 253, 250, .92); color: #1E1A16; box-shadow: var(--shadow-md); opacity: 0; transition: opacity var(--transition-fast), transform var(--transition-fast); }
.carousel-btn.prev { left: 12px; } .carousel-btn.next { right: 12px; }
.carousel:hover .carousel-btn:not([disabled]), .carousel-btn:focus-visible { opacity: 1; }
.carousel-btn:active { transform: scale(.92); }
.carousel-btn[disabled] { opacity: 0 !important; pointer-events: none; }
.carousel-dots { position: absolute; left: 0; right: 0; bottom: 12px; z-index: 2; display: flex; justify-content: center; gap: 5px; pointer-events: none; }
.carousel-dots span { width: 6px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .55); transition: width var(--transition-normal), background var(--transition-normal); }
.carousel-dots span.on { width: 18px; background: #fff; }
.media.full { background: transparent; border-radius: var(--border-radius-lg); }
.media.full .carousel-track, .media.full > img, .media.full > video { border-radius: var(--border-radius-lg); }
.media.full img, .media.full video { max-height: 640px; object-fit: cover; background: var(--color-surface-sunken); }

/* Recipe meta chips */
.recipe-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--color-text-muted); font-size: var(--text-xs); font-weight: 550; }
.recipe-meta span { display: inline-flex; align-items: center; gap: 5px; }
.recipe-meta .icon { color: var(--color-text-subtle); }
.recipe-meta .rating .icon { color: var(--color-accent); fill: var(--color-accent); }

/* Actions */
.post-actions { display: flex; align-items: center; gap: 2px; padding: 8px 10px 10px; }
.post-card .post-actions { margin-top: 6px; border-top: 1px solid var(--color-border); }
.act {
  position: relative; display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px;
  border: 0; border-radius: var(--border-radius-full); background: none; color: var(--color-text-muted);
  font-size: var(--text-sm); font-weight: 600; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.act:hover { background: var(--color-surface-hover); color: var(--color-text); }
.act:active .icon { transform: scale(.85); }
.act:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.act .icon { transition: transform var(--transition-normal) var(--ease-spring), fill var(--transition-fast), color var(--transition-fast); }
.act .count { font-variant-numeric: tabular-nums; min-width: 1ch; display: inline-block; }
.act.like.on { color: var(--color-like); }
.act.like.on .icon { fill: var(--color-like); }
.act.like.pop .icon { animation: heart-pop 520ms var(--ease-spring); }
.act.save.on { color: var(--color-primary); }
.act.save.on .icon { fill: var(--color-primary); }
.act.save.pop .icon { animation: bookmark-drop 480ms var(--ease-spring); }
.act.rate { padding: 0 4px; }
.act.rate.on .icon { fill: var(--color-accent); color: var(--color-accent); }
.act.rate:hover .icon { color: var(--color-accent); }
.count.bump { animation: count-bump 360ms var(--ease-out); }
.burst { position: absolute; left: 22px; top: 50%; width: 0; height: 0; pointer-events: none; }
.burst i { position: absolute; width: 5px; height: 5px; margin: -2.5px; border-radius: 50%; background: var(--color-like); animation: burst 620ms var(--ease-out) forwards; }
.burst i:nth-child(even) { background: var(--color-accent); width: 4px; height: 4px; }

/* =========== Tiles & recipe cards =========== */
.post-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
.grid-item { position: relative; display: block; aspect-ratio: 1; border-radius: var(--border-radius-md); overflow: hidden; background: var(--color-surface-sunken); isolation: isolate; }
.grid-item img, .grid-item video { width: 100%; height: 100%; object-fit: cover; transition: transform 700ms var(--ease-out); }
.grid-item:hover img { transform: scale(1.06); }
.grid-item::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(18, 12, 8, .78)); opacity: .9; transition: opacity var(--transition-normal); }
.grid-item:hover::after { opacity: 1; }
.grid-placeholder { display: grid; place-items: center; height: 100%; color: var(--color-primary); background: var(--gradient-ai-soft); }
.grid-label { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 12px; color: #fff; font-size: var(--text-sm); font-weight: 600; line-height: 1.3; }
.grid-label .t { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-stats { display: flex; gap: 10px; margin-top: 4px; font-size: 12px; font-weight: 600; opacity: .85; transform: translateY(4px); transition: transform var(--transition-normal), opacity var(--transition-normal); }
.grid-stats span { display: inline-flex; align-items: center; gap: 4px; }
.grid-item:hover .grid-stats { transform: none; opacity: 1; }
.grid-kind { position: absolute; top: 10px; left: 10px; z-index: 1; height: 24px; padding: 0 9px; display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; background: rgba(255, 253, 250, .9); color: #1E1A16; font-size: 11px; font-weight: 700; }
.play { position: absolute; inset: 0; z-index: 1; display: grid; place-items: center; color: #fff; }
.play .icon { filter: drop-shadow(0 2px 8px rgba(0,0,0,.4)); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: var(--space-5); }
.recipe-card { display: flex; flex-direction: column; border-radius: var(--border-radius-lg); background: var(--color-surface); border: 1px solid var(--color-border); overflow: hidden; color: inherit; transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal); }
.recipe-card:hover { color: inherit; transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--color-border-strong); }
.recipe-card .rc-media { position: relative; aspect-ratio: 4 / 3; background: var(--color-surface-sunken); overflow: hidden; }
.recipe-card .rc-media img, .recipe-card .rc-media video { width: 100%; height: 100%; object-fit: cover; transition: transform 700ms var(--ease-out); }
.recipe-card:hover .rc-media img { transform: scale(1.05); }
.recipe-card .rc-badges { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 6px; }
.recipe-card .rc-badges .pill { background: rgba(255, 253, 250, .92); color: #1E1A16; border: 0; }
.recipe-card .rc-badges .rc-rating { margin-left: auto; }
.recipe-card .rc-body { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 16px; }
.recipe-card h3 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.12rem; line-height: 1.25; letter-spacing: -.01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.recipe-card .rc-author { margin-top: auto; display: flex; align-items: center; gap: 8px; padding-top: 6px; font-size: var(--text-xs); color: var(--color-text-muted); }
.recipe-card .rc-author b { color: var(--color-text); font-weight: 600; }

/* =========== Discover =========== */
.discover-hero { position: relative; overflow: hidden; padding: var(--space-10) var(--space-8); border-radius: var(--border-radius-xl); background: var(--gradient-warm); color: #FBF4EC; margin-bottom: var(--space-8); }
.discover-hero::before { content: ''; position: absolute; right: -10%; top: -40%; width: 60%; height: 180%; background: radial-gradient(closest-side, rgba(231, 169, 63, .32), transparent); pointer-events: none; }
.discover-hero > * { position: relative; }
.discover-hero h1 { color: #FFF8F1; font-size: clamp(2rem, 4vw, 2.75rem); margin-bottom: 8px; max-width: 16ch; }
.discover-hero p { color: rgba(251, 244, 236, .78); max-width: 52ch; margin-bottom: var(--space-6); }
.discover-hero .search-field { max-width: 520px; border-color: transparent; height: 50px; }
.discover-hero .eyebrow { color: #F4C065; margin-bottom: 12px; }
.h-scroll { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 300px); gap: var(--space-4); overflow-x: auto; padding: 4px 4px 14px; margin: 0 -4px; scroll-snap-type: x mandatory; scrollbar-width: thin; scrollbar-color: var(--color-border-strong) transparent; }
.h-scroll > * { scroll-snap-align: start; }
.feature-card { position: relative; display: block; aspect-ratio: 4 / 5; border-radius: var(--border-radius-xl); overflow: hidden; color: #fff; background: var(--color-surface-sunken); isolation: isolate; }
.feature-card:hover { color: #fff; }
.feature-card > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; transition: transform 900ms var(--ease-out); }
.feature-card:hover > img { transform: scale(1.06); }
.feature-card::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(18,12,8,.0) 25%, rgba(18,12,8,.55) 55%, rgba(18,12,8,.94)); }
.feature-card .fc-rank { position: absolute; top: 14px; left: 16px; font-family: var(--font-display); font-size: 2.6rem; line-height: 1; font-weight: 500; color: rgba(255,255,255,.92); text-shadow: 0 2px 16px rgba(0,0,0,.35); }
.feature-card .fc-body { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px; }
.feature-card h3 { margin: 0 0 8px; font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; line-height: 1.2; color: #fff; }
.feature-card .recipe-meta { color: rgba(255,255,255,.82); }
.feature-card .recipe-meta .icon { color: rgba(255,255,255,.7); }
.cuisine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-3); }
.cuisine-tile { position: relative; display: flex; align-items: flex-end; height: 120px; padding: 14px; border-radius: var(--border-radius-lg); overflow: hidden; color: #fff; isolation: isolate; background: var(--gradient-warm); }
.cuisine-tile:hover { color: #fff; }
.cuisine-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; transition: transform 700ms var(--ease-out); }
.cuisine-tile::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(18,12,8,.0), rgba(18,12,8,.72)); }
.cuisine-tile:hover img { transform: scale(1.08); }
.cuisine-tile b { display: block; font-size: var(--text-base); }
.cuisine-tile span { font-size: var(--text-xs); opacity: .8; }
.mosaic { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 180px; gap: var(--space-3); }
.mosaic .grid-item { aspect-ratio: auto; height: 100%; }
.mosaic .grid-item:first-child { grid-column: span 2; grid-row: span 2; }
.creator-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-4); }
.creator-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: var(--space-6) var(--space-4) var(--space-5); }
.creator-card .avatar { margin-bottom: 8px; }
.creator-card .user-link { font-size: var(--text-base); }
.creator-card .stats-inline { display: flex; gap: 12px; margin: 6px 0 12px; font-size: var(--text-xs); color: var(--color-text-muted); }
.creator-card .stats-inline b { color: var(--color-text); }
.for-you { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: var(--space-5); }
.reason { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--color-text-muted); }
.reason .icon { color: var(--color-accent); }

/* =========== Profile =========== */
.profile-card { padding: 0; overflow: hidden; }
.profile-cover { position: relative; height: 200px; background: var(--gradient-warm); overflow: hidden; }
.profile-cover img { width: 100%; height: 100%; object-fit: cover; opacity: .55; filter: saturate(1.1); }
.profile-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 30%, rgba(18,12,8,.35)); }
.profile-info { display: flex; gap: var(--space-6); align-items: flex-end; flex-wrap: wrap; padding: 0 var(--space-8) var(--space-6); margin-top: -56px; position: relative; }
.profile-info .grow { padding-top: 64px; min-width: 240px; }
.profile-info h1 { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile-handle { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 4px; color: var(--color-text-muted); font-size: var(--text-sm); }
.profile-bio { margin: 12px 0 0; max-width: 60ch; }
.profile-actions { display: flex; gap: var(--space-2); padding-bottom: 4px; }
.stats { display: flex; gap: var(--space-2); margin-top: var(--space-5); flex-wrap: wrap; }
.stats > div { min-width: 92px; padding: 10px 16px; border-radius: var(--border-radius-md); background: var(--color-surface-hover); }
.stats b { display: block; font-size: 1.25rem; line-height: 1.2; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stats span { font-size: var(--text-xs); }

/* =========== Recipe detail =========== */
.recipe-hero { margin-bottom: var(--space-6); }
.recipe-hero h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin: var(--space-2) 0 var(--space-3); line-height: 1.12; }
.recipe-lede { font-size: var(--text-md); color: var(--color-text-muted); max-width: 62ch; line-height: 1.6; }
.recipe-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: var(--space-6) 0; border-radius: var(--border-radius-lg); overflow: hidden; background: var(--color-border); border: 1px solid var(--color-border); }
.recipe-facts > div { padding: 14px 16px; background: var(--color-surface); }
.recipe-facts span { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--color-text-muted); font-weight: 550; }
.recipe-facts b { display: block; margin-top: 4px; font-size: var(--text-md); font-weight: 650; }
.recipe-section { margin-top: var(--space-10); }
.recipe-section-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); }
.recipe-section-head h2 { margin: 0; font-size: var(--text-xl); }
.ingredients li { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--color-border); transition: opacity var(--transition-fast); }
.ingredients li:last-child { border-bottom: 0; }
.ingredients li label { display: flex; align-items: center; gap: 12px; flex: 1; margin: 0; font-weight: 500; font-size: var(--text-base); cursor: pointer; }
.ingredients li.done .ing { text-decoration: line-through; color: var(--color-text-subtle); }
.ingredients .sub-btn { margin-left: auto; opacity: .75; }
.ingredients li:hover .sub-btn { opacity: 1; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { position: relative; padding: 0 0 var(--space-6) 60px; font-size: var(--text-md); line-height: 1.65; }
.steps li::before { counter-increment: step; content: counter(step, decimal-leading-zero); position: absolute; left: 0; top: -2px; font-family: var(--font-display); font-size: 1.6rem; font-weight: 500; line-height: 1; color: var(--color-primary); }
.steps li::after { content: ''; position: absolute; left: 16px; top: 34px; bottom: 8px; width: 1px; background: var(--color-border); }
.steps li:last-child::after { display: none; }
.nutri { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-2); text-align: center; }
.nutri div { padding: 14px 6px; border-radius: var(--border-radius-md); background: var(--color-surface-hover); }
.nutri b { display: block; font-size: 1.2rem; letter-spacing: -.02em; color: var(--color-text); font-variant-numeric: tabular-nums; }
.nutri div:first-child b { color: var(--color-primary); }
.servings-ctl { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border-radius: var(--border-radius-full); border: 1px solid var(--color-border); background: var(--color-surface); font-size: var(--text-sm); }
.servings-ctl button { width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--color-surface-hover); color: var(--color-text); font-weight: 700; font-size: 1rem; transition: background var(--transition-fast), transform var(--transition-fast); }
.servings-ctl button:hover { background: var(--color-surface-sunken); }
.servings-ctl button:active { transform: scale(.88); }
.servings-ctl > span { padding: 0 8px; }
.creator-row { display: flex; align-items: center; gap: 12px; }
.sticky-actions { position: sticky; bottom: calc(var(--space-4)); z-index: 5; margin-top: var(--space-8); }
.sticky-actions .post-actions { padding: 6px; border-radius: var(--border-radius-full); background: var(--color-surface-glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--color-border); box-shadow: var(--shadow-md); }

/* =========== Cooking mode =========== */
.cook-mode { position: fixed; inset: 0; z-index: var(--z-modal); display: flex; flex-direction: column; padding: var(--space-6); background: #120E0B; color: #F7EFE6; animation: fade-in var(--transition-normal) both; }
.cook-mode::before { content: ''; position: absolute; inset: 0; background: radial-gradient(800px 400px at 80% -10%, rgba(212, 97, 44, .25), transparent), radial-gradient(600px 300px at 0% 110%, rgba(231, 169, 63, .14), transparent); pointer-events: none; }
.cook-mode > * { position: relative; }
.cook-mode .cm-top { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); }
.cook-mode .cm-progress { height: 3px; margin-top: var(--space-4); border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; }
.cook-mode .cm-progress span { display: block; height: 100%; background: var(--gradient-ai); transition: width var(--transition-slow); }
.cook-mode .cm-step { flex: 1; display: grid; place-items: center; text-align: center; padding: var(--space-6); max-width: 920px; margin: 0 auto; }
.cook-mode .cm-num { color: #F4C065; font-size: var(--text-sm); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.cook-mode .cm-text { font-family: var(--font-display); font-size: clamp(1.5rem, 3.6vw, 2.6rem); line-height: 1.3; font-weight: 450; animation: fade-up var(--transition-slow) both; }
.cook-mode .cm-bottom { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.cook-mode .timer { font-size: 2rem; font-weight: 600; font-variant-numeric: tabular-nums; color: #F4C065; letter-spacing: -.02em; }
.cook-mode .btn.ghost { --btn-bg: rgba(255,255,255,.06); --btn-fg: #F7EFE6; --btn-bd: rgba(255,255,255,.14); }
.cook-mode .btn.ghost:hover { --btn-bg: rgba(255,255,255,.12); }
.cook-mode .btn:not(.ghost) { --btn-bg: #EE7A4A; --btn-fg: #1a0c05; }

/* =========== Comments =========== */
.comment { display: flex; gap: 12px; padding: 14px 0; animation: fade-up var(--transition-normal) both; }
.comment + .comment { border-top: 1px solid var(--color-border); }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: center; gap: 8px; }
.comment-head .user-link { font-size: var(--text-sm); }
.comment-tools { margin-left: auto; display: flex; gap: 2px; opacity: .6; transition: opacity var(--transition-fast); }
.comment:hover .comment-tools, .comment:focus-within .comment-tools { opacity: 1; }
.comment-text { margin-top: 2px; font-size: var(--text-sm); line-height: 1.55; overflow-wrap: anywhere; }
.comment-form { display: flex; align-items: center; gap: 10px; }
.comment-form .input-pill { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 16px; border: 1px solid var(--color-border); border-radius: var(--border-radius-full); background: var(--color-surface); transition: border-color var(--transition-fast), box-shadow var(--transition-fast); }
.comment-form .input-pill:focus-within { border-color: var(--color-primary); box-shadow: var(--shadow-focus); }
.comment-form input { border: 0 !important; box-shadow: none !important; min-height: 38px; padding: 0; background: transparent; }
.comment-form .btn { border-radius: var(--border-radius-full); width: 38px; height: 38px; padding: 0; }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 18px 64px 16px 22px; border-bottom: 1px solid var(--color-border); }
.drawer-head h3 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: var(--text-lg); }
.drawer-body { flex: 1; overflow-y: auto; padding: 4px 22px; overscroll-behavior: contain; }
.drawer-foot { padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--color-border); background: var(--color-surface); }

/* =========== Share sheet =========== */
.share-preview { display: flex; gap: 14px; align-items: center; padding: 12px; border-radius: var(--border-radius-md); background: var(--color-surface-hover); margin-bottom: var(--space-5); }
.share-preview img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; }
.share-preview b { display: block; font-size: var(--text-sm); }
.share-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); margin-bottom: var(--space-5); }
.share-target { display: grid; justify-items: center; gap: 8px; padding: 12px 4px; border: 0; border-radius: var(--border-radius-md); background: none; color: var(--color-text); font-size: var(--text-xs); font-weight: 600; transition: background var(--transition-fast), transform var(--transition-fast); }
.share-target:hover { background: var(--color-surface-hover); color: var(--color-text); }
.share-target:active { transform: scale(.95); }
.share-target .st-icon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--color-surface-sunken); color: var(--color-text); transition: transform var(--transition-normal) var(--ease-spring); }
.share-target:hover .st-icon { transform: translateY(-2px); }
.copy-field { display: flex; gap: 8px; }
.copy-field input { font-size: var(--text-sm); color: var(--color-text-muted); }

/* =========== AI =========== */
.ai-hero { position: relative; overflow: hidden; padding: var(--space-8); margin-bottom: var(--space-6); border-radius: var(--border-radius-xl); border: 1px solid var(--color-border); background: var(--color-surface); }
.ai-hero::before { content: ''; position: absolute; inset: 0; background: var(--gradient-ai-soft); }
.ai-hero::after { content: ''; position: absolute; right: -80px; top: -120px; width: 360px; height: 360px; border-radius: 50%; background: radial-gradient(closest-side, rgba(231, 169, 63, .35), transparent); animation: ember 9s ease-in-out infinite alternate; pointer-events: none; }
.ai-hero > * { position: relative; z-index: 1; }
.ai-hero h1 { margin: 10px 0 6px; font-size: clamp(1.8rem, 3.4vw, 2.4rem); }
.ai-hero p { margin: 0; color: var(--color-text-muted); max-width: 56ch; }
.ai-mark { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--gradient-ai); color: #fff; box-shadow: 0 6px 18px -6px rgba(212, 97, 44, .55); }
.ai-mark.sm { width: 28px; height: 28px; border-radius: 9px; }
.ai-subnav { display: flex; gap: 6px; flex-wrap: wrap; margin-top: var(--space-6); }
.ai-subnav a { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: var(--border-radius-full); background: var(--color-surface-glass); border: 1px solid var(--color-border); font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted); transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast); }
.ai-subnav a:hover { color: var(--color-text); border-color: var(--color-border-strong); }
.ai-subnav a.active { color: var(--color-text); background: var(--color-surface); border-color: var(--color-primary-ring); box-shadow: var(--shadow-sm); }
.ai-subnav a.active .icon { color: var(--color-primary); }
.ai-usage { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: var(--border-radius-full); background: var(--color-surface); border: 1px solid var(--color-border); font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted); }
.ai-usage .live { width: 7px; height: 7px; border-radius: 50%; background: var(--color-success); box-shadow: 0 0 0 3px var(--color-success-soft); }
.ai-usage.off .live { background: var(--color-danger); box-shadow: 0 0 0 3px var(--color-danger-soft); }

/* Thinking indicator */
.ai-thinking { display: flex; align-items: center; gap: 14px; padding: var(--space-5); border-radius: var(--border-radius-lg); border: 1px solid var(--color-border); background: var(--color-surface); margin-bottom: var(--space-4); animation: fade-up var(--transition-normal) both; }
.ai-orb { position: relative; width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%; background: var(--gradient-ai); animation: orb 2.4s ease-in-out infinite; }
.ai-orb::after { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: var(--color-surface); opacity: .9; }
.ai-thinking-text { font-weight: 600; font-size: var(--text-sm); }
.ai-thinking-text .shimmer-text { background: linear-gradient(90deg, var(--color-text-muted) 0%, var(--color-text) 40%, var(--color-text-muted) 80%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: text-shimmer 1.8s linear infinite; }
.ai-thinking-sub { font-size: var(--text-xs); color: var(--color-text-subtle); font-weight: 500; }
.typing { display: inline-flex; gap: 4px; align-items: center; height: 18px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .4; animation: typing 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }

/* Ingredient chips */
.chips-input { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 58px; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: var(--border-radius-lg); background: var(--color-surface); cursor: text; transition: border-color var(--transition-fast), box-shadow var(--transition-fast); }
.chips-input:focus-within { border-color: var(--color-primary); box-shadow: var(--shadow-focus); }
.chips-input input { flex: 1; min-width: 160px; min-height: 34px !important; padding: 4px !important; border: 0 !important; box-shadow: none !important; background: transparent !important; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 6px 0 12px; border-radius: var(--border-radius-full); background: var(--color-secondary-soft); color: var(--color-secondary); font-weight: 600; font-size: var(--text-sm); text-transform: capitalize; animation: pop-in 260ms var(--ease-spring) both; }
.chip button { width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; display: grid; place-items: center; opacity: .7; transition: background var(--transition-fast), opacity var(--transition-fast); }
.chip button:hover { opacity: 1; background: rgba(63, 93, 69, .16); }
.prompt-suggestions { display: flex; flex-wrap: wrap; gap: 8px; }
.prompt-chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 1px dashed var(--color-border-strong); border-radius: var(--border-radius-full); background: transparent; color: var(--color-text-muted); font-size: var(--text-xs); font-weight: 600; transition: all var(--transition-fast); }
.prompt-chip:hover { border-style: solid; border-color: var(--color-primary-ring); color: var(--color-primary); background: var(--color-primary-soft); }

/* Generated recipes */
.recipe-result { position: relative; padding: var(--space-6); border-radius: var(--border-radius-lg); border: 1px solid var(--color-border); background: var(--color-surface); box-shadow: var(--shadow-sm); animation: ai-reveal 600ms var(--ease-out) both; }
.recipe-result + .recipe-result { margin-top: var(--space-4); }
.recipe-result::before { content: ''; position: absolute; left: 0; top: 18px; bottom: 18px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gradient-ai); }
.recipe-result h3 { font-family: var(--font-display); font-weight: 700; font-size: var(--text-lg); }
.recipe-result .rr-index { font-size: var(--text-xs); font-weight: 650; letter-spacing: .1em; text-transform: uppercase; color: var(--color-text-subtle); }
.recipe-result details { margin-top: var(--space-4); border-top: 1px solid var(--color-border); }
.recipe-result details summary { display: flex; align-items: center; gap: 8px; padding-top: var(--space-4); cursor: pointer; list-style: none; font-weight: 600; font-size: var(--text-sm); color: var(--color-primary); }
.recipe-result details summary::-webkit-details-marker { display: none; }
.recipe-result details summary .icon { transition: transform var(--transition-normal); }
.recipe-result details[open] summary .icon { transform: rotate(180deg); }
.recipe-result details[open] > div { animation: fade-up var(--transition-normal) both; }
.recipe-result .steps li { font-size: var(--text-base); padding-left: 48px; }
.recipe-result .steps li::before { font-size: 1.25rem; }
.recipe-result .steps li::after { left: 12px; top: 28px; }
.macro-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--space-3); }
.macro-chips span { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: var(--border-radius-full); background: var(--color-surface-hover); font-size: 12px; font-weight: 600; color: var(--color-text-muted); }
.macro-chips span b { color: var(--color-text); }

/* Chat */
.chat { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-height) - 260px); min-height: 460px; padding: 0; overflow: hidden; }
.chat-log { flex: 1; overflow-y: auto; padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); scroll-behavior: smooth; }
.msg-row { display: flex; gap: 12px; align-items: flex-end; animation: fade-up var(--transition-normal) both; }
.msg-row.user { flex-direction: row-reverse; }
.msg { max-width: min(80%, 620px); padding: 12px 16px; border-radius: 18px; overflow-wrap: anywhere; line-height: 1.6; font-size: var(--text-base); }
.msg p { margin: 0 0 .6em; } .msg p:last-child { margin: 0; }
.msg ul, .msg ol { margin: .2em 0 .6em; padding-left: 1.25em; }
.msg.user { background: var(--color-text); color: var(--color-background); border-bottom-right-radius: 6px; white-space: pre-wrap; }
.msg.assistant { background: var(--color-surface-hover); border: 1px solid var(--color-border); border-bottom-left-radius: 6px; }
.msg.assistant.error { background: var(--color-danger-soft); color: var(--color-danger); border-color: transparent; }
.chat-suggest { padding: 0 var(--space-6) var(--space-4); }
.chat-form { display: flex; align-items: center; gap: 8px; padding: 12px; border-top: 1px solid var(--color-border); background: var(--color-surface); }
.chat-form input { border-radius: var(--border-radius-full); padding-left: 18px; }
.chat-form .btn { width: 44px; height: 44px; padding: 0; border-radius: 50%; }
.chat-welcome { display: grid; justify-items: start; gap: 4px; }

/* =========== Health =========== */
.progress { height: 8px; border-radius: var(--border-radius-full); background: var(--color-surface-sunken); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--color-primary); transform-origin: left; animation: grow-x 900ms var(--ease-out) both; }
.progress.over > span { background: var(--color-danger); }
.progress.herb > span { background: var(--color-secondary); }
.progress.saffron > span { background: var(--color-accent); }
.macro { margin-bottom: var(--space-4); }
.macro .row { justify-content: space-between; margin-bottom: 6px; font-size: var(--text-sm); font-weight: 550; }
.ring { position: relative; width: 168px; height: 168px; margin: 0 auto; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-fg { animation: ring-draw 1.1s var(--ease-out) both; }
.ring .ring-label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .ring-label b { display: block; font-size: 2rem; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat-box { display: grid; gap: 2px; padding: var(--space-4) var(--space-5); }
.stat-box b { display: flex; align-items: center; gap: 6px; font-size: 1.5rem; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-box b .icon { color: var(--color-primary); }
.stat-box + .stat-box { margin-top: 0; }
.meal-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--color-border); }
.meal-item:last-child { border-bottom: 0; }
.chart { width: 100%; height: 200px; overflow: visible; }
.chart text { fill: var(--color-text-subtle); font-size: 10px; font-family: var(--font-sans); }
.chart rect { transform-origin: bottom; transform-box: fill-box; animation: bar-rise 700ms var(--ease-out) both; }

/* =========== Notifications =========== */
.notif-group { margin-bottom: var(--space-6); }
.notif-group h2 { margin: 0 0 var(--space-2); font-family: var(--font-sans); font-size: var(--text-xs); font-weight: 650; letter-spacing: .1em; text-transform: uppercase; color: var(--color-text-subtle); }
.notif-list { padding: 6px; }
.notif { position: relative; display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--border-radius-md); transition: background var(--transition-fast); }
.notif:hover { background: var(--color-surface-hover); color: inherit; }
.notif-avatar { position: relative; flex-shrink: 0; }
.notif-type { position: absolute; right: -4px; bottom: -4px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--color-surface); background: var(--color-primary); color: #fff; }
.notif-type.like { background: var(--color-like); } .notif-type.follow { background: var(--color-secondary); } .notif-type.rating { background: var(--color-accent); }
.notif-sys { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--color-primary-soft); color: var(--color-primary); }
.notif-msg { font-size: var(--text-sm); line-height: 1.45; }
.notif-time { font-size: var(--text-xs); color: var(--color-text-subtle); margin-top: 2px; }
.notif.unread { background: var(--color-primary-soft); }
.notif.unread .notif-msg { font-weight: 600; }
.notif .unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-primary); flex-shrink: 0; }

/* =========== Landing & auth =========== */
.hero { display: grid; grid-template-columns: 1fr 1.05fr; gap: var(--space-12); align-items: center; padding: var(--space-12) 0 var(--space-16); }
.hero h1 { font-size: var(--text-3xl); line-height: 1.04; letter-spacing: -.02em; margin: var(--space-5) 0; }
.hero h1 em { font-style: italic; color: var(--color-primary); }
.hero .lede { font-size: 1.125rem; color: var(--color-text-muted); max-width: 46ch; line-height: 1.6; }
.hero-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-8); }
.hero-proof { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-8); font-size: var(--text-sm); color: var(--color-text-muted); }
.hero-visual { position: relative; }
.hero-visual > img { width: 100%; aspect-ratio: 5 / 4; object-fit: cover; object-position: 70% 50%; border-radius: var(--border-radius-xl); box-shadow: var(--shadow-lg); }
.float-card { position: absolute; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--border-radius-lg); background: var(--color-surface-glass); -webkit-backdrop-filter: blur(16px) saturate(160%); backdrop-filter: blur(16px) saturate(160%); border: 1px solid var(--color-border); box-shadow: var(--shadow-lg); font-size: var(--text-sm); animation: float 6s ease-in-out infinite; }
.float-card b { display: block; }
.float-card.one { left: -28px; bottom: 36px; }
.float-card.two { right: -18px; top: 30px; animation-delay: -3s; }
.feature-band { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.feature { padding: var(--space-6); }
.feature .kpi-icon { margin-bottom: var(--space-4); }
.feature h3 { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; }
.feature p { margin: 0; color: var(--color-text-muted); font-size: var(--text-sm); }
.cta-band { margin: var(--space-16) 0 var(--space-8); padding: var(--space-12) var(--space-8); border-radius: var(--border-radius-xl); background: var(--gradient-warm); color: #FBF4EC; text-align: center; position: relative; overflow: hidden; }
.cta-band h2 { color: #FFF8F1; font-size: clamp(1.8rem, 3.5vw, 2.6rem); margin-bottom: var(--space-3); }
.cta-band p { color: rgba(251, 244, 236, .78); margin-bottom: var(--space-6); }

.auth-shell { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: calc(100vh - 68px - 2 * var(--space-6)); border-radius: var(--border-radius-xl); overflow: hidden; border: 1px solid var(--color-border); background: var(--color-surface); box-shadow: var(--shadow-md); max-width: 1080px; margin: 0 auto; }
.auth-art { position: relative; background: var(--gradient-warm); }
.auth-art img { width: 100%; height: 100%; object-fit: cover; }
.auth-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(18,12,8,.82)); }
.auth-quote { position: absolute; left: var(--space-8); right: var(--space-8); bottom: var(--space-8); z-index: 1; color: #FBF4EC; }
.auth-quote p { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.3; margin-bottom: 8px; color: #FFF8F1; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: var(--space-12) var(--space-8); }
.auth-wrap { width: 100%; max-width: 380px; }
.auth-wrap h2 { font-size: var(--text-2xl); margin-bottom: 6px; }
.auth-wrap .btn.block { height: 48px; margin-top: var(--space-2); }
.auth-alt { margin-top: var(--space-6); text-align: center; font-size: var(--text-sm); color: var(--color-text-muted); }
.auth-alt a { color: var(--color-primary); font-weight: 600; }
.auth-single { max-width: 460px; margin: var(--space-8) auto; }

/* =========== Error page =========== */
.error-page { min-height: 60vh; display: grid; place-items: center; }

/* ================= Page-level additions ================= */
.kpi-icon.sm { width: 36px; height: 36px; border-radius: 11px; }
.kpi-icon.herb { background: var(--color-secondary-soft); color: var(--color-secondary); }
.kpi-icon.saffron { background: var(--color-accent-soft); color: var(--color-warning); }
.kpi-icon.ai { background: var(--gradient-ai); color: #fff; }
.kpi-icon.danger { background: var(--color-danger-soft); color: var(--color-danger); }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--color-background); }
.avatar-stack .avatar + .avatar { margin-left: -10px; }
.btn.on-dark { --btn-bg: #FFF8F1; --btn-fg: #2A1A12; }
.btn.on-dark:hover { --btn-bg: #fff; }
.feed-greeting { margin: 0 0 var(--space-5); }
.feed-greeting h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin: 6px 0 0; }
.creator-list { display: grid; gap: 14px; }
.expiring { display: grid; gap: 10px; }
.side-card .card-title .ai-mark { width: 26px; height: 26px; border-radius: 8px; }
.ai-mark.sm { width: 30px; height: 30px; border-radius: 9px; }

/* Global search suggestions popover */
.global-search { position: relative; }
.search-pop { position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: var(--z-dropdown, 60); padding: 8px; border-radius: var(--border-radius-lg); background: var(--color-surface); border: 1px solid var(--color-border); box-shadow: var(--shadow-lg); max-height: min(70vh, 460px); overflow-y: auto; transform-origin: top center; animation: pop-in 180ms var(--ease-out) both; }
.search-pop[hidden] { display: none; }
.sp-label { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 6px; font-size: var(--text-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-subtle); }
.sp-label button { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--color-text-muted); background: none; border: 0; cursor: pointer; font-size: var(--text-xs); }
.sp-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: var(--border-radius-md); color: var(--color-text); font-size: var(--text-sm); text-align: left; background: none; border: 0; cursor: pointer; }
.sp-item .icon { color: var(--color-text-subtle); flex-shrink: 0; }
.sp-item:hover, .sp-item.is-active { background: var(--color-surface-hover); color: var(--color-text); }
.sp-item.is-active .icon { color: var(--color-primary); }
.sp-item mark { background: none; color: var(--color-primary); font-weight: 650; }
.sp-item .sp-hint { margin-left: auto; font-size: var(--text-xs); color: var(--color-text-subtle); }
.sp-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 8px 8px; }
.global-search.is-open .search-field { border-color: var(--color-primary-ring); box-shadow: var(--shadow-focus); }
@media (max-width: 767px) { .desktop-only { display: none !important; } .share-label { display: none; } }
@media (min-width: 768px) { .menu-mobile { display: none !important; } }
.search-field input[type], .search-field input[type]:hover, .search-field input[type]:focus { min-height: 0; height: 100%; border: 0; background: transparent; box-shadow: none; padding: 0; border-radius: 0; }
.card.composer { display: flex; }

.quick-row { display: none; margin: 0 -2px var(--space-4); }
.quick-row .chip-link .icon { color: var(--color-primary); }
.quick-row .chip-link.ai .icon { color: var(--color-accent); }
.composer-prompt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; line-height: 44px; }
@media (max-width: 479px) { .composer-actions span:not(.ai-dot) { display: none; } .composer { gap: 10px; padding: 10px 10px 10px 12px; } }
@media (max-width: 767px) { .announcement { padding: 14px 16px; } .announcement p { font-size: var(--text-xs); } .feed-greeting h1 { font-size: 1.5rem; } }
.chip-link.on-dark { background: rgba(255, 248, 241, .12); border-color: rgba(255, 248, 241, .22); color: #FFF8F1; }
.chip-link.on-dark:hover { background: rgba(255, 248, 241, .22); color: #fff; }
.rc-author.on-dark { display: flex; align-items: center; gap: 8px; color: rgba(255,255,255,.9); font-size: var(--text-xs); font-weight: 600; }
.ingredient-cloud { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip-link .count { font-size: var(--text-xs); color: var(--color-text-subtle); font-weight: 600; }
.section-title h2 { display: flex; align-items: center; gap: 10px; }
.section-title h2 .icon { color: var(--color-primary); }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rc-author > span:last-child { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.dh-plates { position: absolute !important; right: 5%; top: 50%; width: 300px; height: 300px; transform: translateY(-50%); pointer-events: none; }
.dh-plates img { position: absolute; border-radius: 50%; object-fit: cover; box-shadow: 0 18px 40px -12px rgba(0,0,0,.55), 0 0 0 6px rgba(255,248,241,.08); animation: float 9s ease-in-out infinite; }
.dh-plates .p0 { width: 190px; height: 190px; right: 40px; top: 10px; }
.dh-plates .p1 { width: 120px; height: 120px; left: 0; bottom: 20px; animation-delay: -3s; }
.dh-plates .p2 { width: 96px; height: 96px; right: 0; bottom: 0; animation-delay: -6s; }
@media (max-width: 1199px) { .dh-plates { display: none; } }
.creator-card { height: 100%; }
.creator-card .btn { margin-top: auto; }
.creator-card p { margin: 0 0 14px; }
[class*="grid"] > .card + .card, .feature-band > .card + .card, .for-you > .card + .card, .row > .card + .card, .h-scroll > .card + .card { margin-top: 0; }
.toast-action { font-size: var(--text-sm); font-weight: 650; color: var(--color-primary); padding: 4px 6px; border-radius: 6px; }
.toast-action:hover { background: var(--color-primary-soft); }
/* Recipe page */
.crumbs { display: flex; align-items: center; gap: 8px; margin-bottom: var(--space-4); font-size: var(--text-sm); color: var(--color-text-subtle); }
.crumbs a { display: inline-flex; align-items: center; gap: 6px; color: var(--color-text-muted); font-weight: 600; }
.crumbs a:hover { color: var(--color-primary); }
.recipe-hero .creator-row { margin-top: var(--space-5); padding-top: var(--space-5); border-top: 1px solid var(--color-border); }
.recipe-media { margin: 0 0 var(--space-2); border-radius: var(--border-radius-xl); overflow: hidden; box-shadow: var(--shadow-md); }
.recipe-media .media { border-radius: 0; }
.recipe-facts small { display: block; margin-top: 2px; }
.ingredients li label.check { margin: 0; }
.ingredients li .sub-btn { flex-shrink: 0; }
.cook-note { padding: var(--space-5) var(--space-6); border-radius: var(--border-radius-lg); background: var(--color-surface); border: 1px solid var(--color-border); border-left: 3px solid var(--color-accent); }
.cook-note h2 { margin: 0 0 8px; }
.cook-note p { margin: 0; line-height: 1.65; }
.sticky-actions .post-actions { border: 1px solid var(--color-border); box-shadow: var(--shadow-md); }
.rate-group { display: inline-flex; align-items: center; padding-left: 8px; margin-left: 4px; border-left: 1px solid var(--color-border); }
.rate-group .act { padding: 6px 3px; }
.comments-section .comment-form { margin-bottom: var(--space-4); }
.comments-section .recipe-section-head h2 span { font-family: var(--font-sans); font-size: var(--text-md); font-weight: 600; }
.comment-list .comment { padding: 14px 0; border-bottom: 1px solid var(--color-border); }
.comment-list .comment:last-child { border-bottom: 0; }
.post-single .post-head .creator-row { width: 100%; }
.caption.lg { font-size: var(--text-md); line-height: 1.6; }
.modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: var(--space-4); padding-right: 40px; }
.modal-head h3 { margin: 0; }
.sub-list { display: grid; gap: 10px; }
.sub-item { padding: 14px 16px; border-radius: var(--border-radius-md); background: var(--color-surface-hover); animation: fade-up 360ms var(--ease-out) both; animation-delay: var(--d, 0ms); }
.sub-item p { margin: 6px 0 0; }
.cook-mode .cm-title { font-family: var(--font-display); font-size: var(--text-md); margin-top: 4px; }
.cook-mode .btn:disabled { opacity: .35; }
@media (max-width: 767px) {
  .recipe-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rate-group .act { padding: 6px 1px; }
  .sticky-actions { bottom: calc(var(--bottom-nav-height) + 10px); }
  .cook-mode .cm-timer { order: -1; width: 100%; justify-content: center; }
}
.recipe-media .media img, .recipe-media .media video { width: 100%; aspect-ratio: 16 / 10; max-height: 580px; object-fit: cover; }
.ai-mark .icon, .ai-mark svg { color: #fff !important; stroke: #fff; }
/* Search page */
.badge:empty { display: none; }
.page-head .eyebrow { margin-bottom: 6px; color: var(--color-primary); }
.search-panel { padding: var(--space-4); margin-bottom: var(--space-6); }
.search-main { display: flex; align-items: center; gap: var(--space-2); }
.search-main .search-field { flex: 1; height: 52px; font-size: var(--text-md); }
.search-main .btn { flex-shrink: 0; height: 52px; margin: 0; }
.photo-btn { cursor: pointer; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--color-border); }
.filter-label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted); margin-right: 4px; }
.filter-select select { height: 36px; padding: 0 30px 0 14px; border-radius: var(--border-radius-full); font-size: var(--text-sm); font-weight: 550; width: auto; background-position: right 10px center; }
.filter-bar .chip-check { margin: 0; }
.filter-select.sort { margin-left: auto; }
.results-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.results-head h2 { margin: 0; font-size: var(--text-lg); }
.people-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-6); }
.person-chip { display: flex !important; align-items: center; gap: 12px; padding: 12px 14px; margin: 0 !important; }
.person-chip b { display: flex; align-items: center; gap: 4px; }
.center-row { justify-content: center; padding-bottom: var(--space-6); }
@media (max-width: 767px) {
  .search-main .btn .label { display: none; }
  .search-main .btn { width: 52px; padding: 0; }
  .filter-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--space-4) * -1); padding-inline: var(--space-4); }
  .filter-bar::-webkit-scrollbar { display: none; }
  .filter-bar > * { flex-shrink: 0; }
  .filter-select.sort { margin-left: 0; }
}
.filter-bar, .chip-row, .h-scroll { position: relative; } .chip-check, .filter-select { position: relative; }
/* Profile */
.avatar.xl { width: 136px; height: 136px; border: 4px solid var(--color-surface); box-shadow: var(--shadow-md); }
.profile-cover { height: 220px; }
.profile-cover img { opacity: .7; filter: saturate(1.05) blur(1px); transform: scale(1.04); }
.profile-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 0; border-top: 1px solid var(--color-border); background: var(--color-border); }
.profile-stats > div { min-width: 0; padding: 14px 20px; border-radius: 0; background: var(--color-surface); text-align: center; }
.profile-stats dt { font-size: var(--text-xs); color: var(--color-text-muted); font-weight: 550; }
.profile-stats dd { margin: 2px 0 0; font-size: 1.35rem; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.profile-stats > div { display: flex; flex-direction: column-reverse; }
.inline-form.new-collection { display: flex; gap: 8px; }
.new-collection input { width: 260px; }
.h-sub { margin: 0; font-size: var(--text-lg); display: flex; align-items: baseline; gap: 8px; }
@media (max-width: 767px) {
  .profile-cover { height: 140px; }
  .avatar.xl { width: 96px; height: 96px; }
  .profile-info { padding: 0 var(--space-4) var(--space-4); gap: var(--space-3); margin-top: -48px; }
  .profile-info .grow { padding-top: 0; min-width: 100%; }
  .profile-actions { width: 100%; }
  .profile-actions .btn { flex: 1; }
  .profile-stats > div { padding: 10px 6px; }
  .profile-stats dd { font-size: 1.1rem; }
  .profile-stats dt { font-size: 11px; }
  .inline-form.new-collection, .new-collection input { width: 100%; }
  .new-collection input { flex: 1; min-width: 0; }
}
.card.profile-card { padding: 0; }
.notif + .notif { margin-top: 2px; }
/* AI studio additions */
.ai-hero .eyebrow { color: var(--color-primary); }
.ai-hero .gap-sm { gap: 10px; }
.gen-card .field-error[hidden] { display: none; }
.chips-input.is-invalid { border-color: var(--color-danger); }
.divider { border: 0; border-top: 1px solid var(--color-border); margin: var(--space-5) 0; }
.gen-results:not(:empty) { margin-top: var(--space-6); scroll-margin-top: calc(var(--topbar-height) + 16px); }
.gen-results .results-head h2 { display: flex; align-items: center; gap: 10px; }
.gen-results .results-head h2 .icon { color: var(--color-accent); }
.recipe-result.is-in { animation: fade-up 480ms var(--ease-out) both; }
.sk-result::before { opacity: .35; }
.rr-ing { margin: 0; padding-left: 1.2em; line-height: 1.8; }
.how-list { list-style: none; counter-reset: how; margin: 0; padding: 0; display: grid; gap: 14px; }
.how-list li { counter-increment: how; position: relative; padding-left: 40px; font-size: var(--text-sm); }
.how-list li::before { content: counter(how); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--color-primary-soft); color: var(--color-primary); font-weight: 700; font-size: var(--text-xs); }
.how-list b { display: block; } .how-list span { color: var(--color-text-muted); }
.chat-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--color-border); }
.msg-row .avatar.xs, .msg-row .ai-mark { flex-shrink: 0; }
.msg-row .ai-mark.sm { width: 28px; height: 28px; border-radius: 9px; }
.chat .chat-form input[type] { border-radius: var(--border-radius-full); padding-left: 18px; }
.center { text-align: center; }
label.btn { margin: 0; }
.ai-hero.compact { padding: var(--space-5) var(--space-6); }
.ai-hero.compact h1 { font-size: 1.7rem; margin: 8px 0 2px; }
.ai-hero.compact p { display: none; }
.ai-hero.compact .ai-subnav { margin-top: var(--space-4); }
@media (max-width: 767px) { .ai-hero { padding: var(--space-5); } .ai-subnav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--space-5) * -1); padding-inline: var(--space-5); } .ai-subnav a { flex-shrink: 0; } }
/* Create */
.create-form .form-section + .form-section, .create-form #recipe-fields { margin-top: var(--space-4); }
.form-section-title { display: flex; align-items: center; gap: 10px; margin: 0 0 var(--space-4); font-size: var(--text-lg); }
.form-section-title span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--color-primary-soft); color: var(--color-primary); font: 700 var(--text-xs)/1 var(--font-sans); }
.span.label, .field > .label, fieldset legend { display: block; margin-bottom: 8px; font-size: var(--text-sm); font-weight: 600; color: var(--color-text); }
fieldset.field { border: 0; padding: 0; margin-inline: 0; }
.req { color: var(--color-danger); }
.seg-lg label span { height: 42px; padding: 0 20px; }
.input-wrap.unit { position: relative; }
.input-wrap.unit::after { content: attr(data-unit); position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: var(--text-xs); color: var(--color-text-subtle); pointer-events: none; }
.input-wrap.unit input { padding-right: 44px; }
.chip-check.warn input:checked + span { background: var(--color-warning-soft, #FBEBD0); border-color: var(--color-warning); color: var(--color-warning); }
.previews.existing figure { margin: 0; }
.publish-bar { position: sticky; bottom: var(--space-4); z-index: 6; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-4); padding: 10px 10px 10px 12px; border-radius: var(--border-radius-lg); background: var(--color-surface-glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--color-border); box-shadow: var(--shadow-md); }
@media (max-width: 767px) { .publish-bar { bottom: calc(var(--bottom-nav-height) + 10px); } .publish-bar .row { flex: 1; justify-content: flex-end; } }
.meal-item.is-removing { opacity: 0; transform: translateX(16px); transition: opacity 240ms, transform 240ms; }
.meal-form { border-top: 1px solid var(--color-border); padding-top: var(--space-4); }
.empty.compact { padding: var(--space-6) var(--space-4); }
.empty.compact .empty-art { width: 64px; height: 64px; border-radius: 20px; }
.sub-item + .sub-item { margin-top: 10px; }
.sub-item .row { margin-top: 8px; }
.progress.herb > span { background: var(--color-secondary); }
@keyframes ring-draw { from { stroke-dashoffset: var(--circ); } }
.pantry-list { display: grid; }
.pantry-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--color-border); transition: opacity 240ms, transform 240ms; }
.pantry-item:last-child { border-bottom: 0; }
.pantry-item.expired b { color: var(--color-text-muted); }
.pantry-item.is-removing { opacity: 0; transform: translateX(16px); }
/* Settings */
.settings-card { scroll-margin-top: calc(var(--topbar-height) + 16px); }
.settings-card .card-title { font-size: var(--text-md); }
.avatar-edit { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: var(--space-5); margin: var(--space-4) 0 var(--space-6); }
.avatar-edit-controls { min-width: 0; }
.avatar-edit .avatar-photo-help { margin: 8px 0 0; font-size: var(--text-sm); }
.avatar-edit .check { min-height: 44px; margin: 4px 0 0; }
.avatar-edit [data-avatar-status] { overflow-wrap: anywhere; }
.avatar-edit .avatar.lg { width: 96px; height: 96px; margin: 0; aspect-ratio: 1; box-shadow: none; border: 1px solid var(--color-border); }
.file-drop.compact { position: relative; display: flex; align-items: center; min-width: 0; flex-direction: row; justify-content: flex-start; text-align: left; gap: 14px; padding: 14px 16px; min-height: 0; }
.file-drop.compact .drop-icon { flex-shrink: 0; width: 42px; height: 42px; border-radius: 12px; margin: 0; }
.file-drop.compact > div { min-width: 0; overflow-wrap: anywhere; }
.file-drop.compact strong { display: block; font-size: var(--text-sm); }
.input-wrap.prefix { position: relative; }
.input-wrap.prefix::before { content: attr(data-prefix); position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--color-text-subtle); font-weight: 600; pointer-events: none; }
.input-wrap.prefix input { padding-left: 30px; }
.form-actions { display: flex; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-2); }
.danger-zone { border-color: rgba(180, 35, 24, .25); }
@media (max-width: 479px) {
  .avatar-edit { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
  .avatar-edit .avatar.lg { justify-self: center; }
  .avatar-edit .avatar-photo-help { text-align: center; }
}
.auth-title { font-size: clamp(1.8rem, 3vw, 2.3rem); margin: 6px 0 6px; }
.auth-quote .ai-mark { margin-bottom: 14px; }
.auth-form .btn.lg { margin-top: var(--space-3); }
body.is-auth .site-footer { display: none; }
.float-card.two { right: 16px; top: 24px; }
@media (max-width: 479px) { .hero-actions .btn { flex: 1 1 100%; } }
@media (max-width: 479px) {
  .sticky-actions .post-actions { gap: 0; padding: 4px; }
  .sticky-actions .act { padding-inline: 7px; }
  .sticky-actions .act.ml-auto { margin-left: 0; }
  .rate-group { margin-left: auto; padding-left: 4px; }
  .rate-group .act { padding: 6px 1px; }
  .rate-group .act svg { width: 17px; height: 17px; }
}
.rate-section { display: none; text-align: center; }
.rate-group.lg { border: 0; padding: 0; margin: 8px 0 0; }
.rate-group.lg .act { padding: 6px; }
@media (max-width: 767px) {
  .rate-section { display: block; }
  .sticky-actions .rate-group { display: none; }
  .sticky-actions .act.ml-auto { margin-left: auto; }
}
