/* Babuko's shared UI system: one type, space, control and motion scale.
   Feature-specific structures live in the shell and shopping-v2.css. */
:root {
  --ui-font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #11120f;
  --shell: #11120f;
  --surface: #1b1d19;
  --surface-2: #242722;
  --surface-3: #2c3029;
  --text: #f4f3ec;
  --text2: #b3b6ac;
  --text-inverse: #1d140f;
  --muted: #a1a69a;
  --accent: #fb8059;
  --accent-hover: #ff9878;
  --border: #3c4037;
  --border-soft: #30342c;
  --ui-input-border: #686d61;
  --green: #9ec5a2;
  --green-soft: #23352a;
  --red: #ffa497;
  --red-soft: #382723;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: none;
  --control-h: 46px;
  --bottom-nav-h: 60px;
  --ui-content-width: 1160px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --text-small: 13px;
  --text-control: 14px;
  --text-body: 16px;
  --text-card: 20px;
  --motion-fast: 120ms;
  --motion-panel: 180ms;
  --ease-out: cubic-bezier(.2,.8,.2,1);
}
html, body { background: var(--bg); color: var(--text); color-scheme: dark; }
body { font-family: var(--ui-font); font-size: var(--text-body); line-height: 1.5; }
body, button, input, textarea, select { -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font-family: var(--ui-font); }
input, select, textarea { color-scheme: dark; }
button, a, input, textarea, select, summary { touch-action: manipulation; }
button { transition: background-color var(--motion-fast) ease, border-color var(--motion-fast) ease, color var(--motion-fast) ease; }
button:not(:disabled):active { filter: brightness(.92); }
button[aria-busy="true"] { cursor: progress; }
input, textarea, select { font-size: var(--text-body); }
html { scrollbar-gutter: stable; }
button:disabled { cursor: not-allowed; }
[hidden] { display: none !important; }
:focus-visible {
  outline: 3px solid var(--accent) !important;
  outline-offset: 3px !important;
}
:where(button, a, input, textarea, select, summary) { scroll-margin: 90px 0; }
svg { flex-shrink: 0; }
:is(.btn, .ui-icon-button, .ui-import-link, .ui-sort-control, .ui-start-cooking, .plan-cook-icon, .ui-reorder-controls, .chat-tool-button, .rating-badge) svg {
  width: 20px; height: 20px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.mono, .serif { font-family: var(--ui-font); }
.app-content { width: 100%; max-width: none; background: var(--bg); min-height: 100dvh; padding-top: env(safe-area-inset-top, 0px); padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px)); }
.container { width: min(100%, var(--ui-content-width)); max-width: var(--ui-content-width); margin: 0 auto; padding: 24px 18px 36px; }

/* One shell. Settings no longer competes as a fifth, unlabeled bottom tab. */
.ui-app-header { position: sticky; top: 0; z-index: 100; background: var(--bg); border-bottom: 1px solid var(--border-soft); padding-top: env(safe-area-inset-top, 0px); }
.ui-app-header-inner { min-height: 64px; max-width: var(--ui-content-width); margin: auto; padding: 0 18px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.ui-brand { font: 760 27px/1 var(--ui-font); letter-spacing: -.055em; border: 0; background: transparent; color: var(--text); padding: 8px 0; min-height: 44px; }
.ui-brand span { color: var(--accent); }
.ui-app-header .account-button { width: auto; min-width: 44px; min-height: 44px; height: 44px; display: flex; align-items: center; gap: 8px; border: 0; background: transparent; color: var(--text2); padding: 0 2px 0 10px; border-radius: var(--radius-sm); }
.account-button span { font-size: 13px; font-weight: 550; }
.ui-app-header .account-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; top: auto; transform: none; width: 100%; max-width: none; height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px)); padding: 4px 8px calc(4px + env(safe-area-inset-bottom, 0px)); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; align-items: stretch; background: var(--bg); border: 0; border-top: 1px solid var(--border); border-radius: 0; box-shadow: none; }
.tabs .tab { font-family: var(--ui-font); font-size: 12px; font-weight: 550; letter-spacing: 0; text-transform: none; gap: 3px; color: var(--text2); border: 0; border-radius: 9px; min-height: 48px; }
.tabs .tab.active { color: var(--accent); background: transparent; }
.tabs .tab.active .tab-icon { filter: none; }
.tab-icon svg { width: 23px; height: 23px; stroke-width: 1.8; }
.tab-badge { background: var(--surface-3); color: var(--text); border-radius: 5px; min-width: 18px; height: 18px; font-size: 11px; font-weight: 650; margin-left: 3px; }
.ui-page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 var(--space-6); }
.ui-page-head > div { min-width: 0; }
.ui-page-head h1 { font-size: 28px; font-weight: 730; line-height: 1.15; letter-spacing: -.035em; margin: 0 0 6px; }
.ui-page-head p { font-size: 14px; color: var(--text2); line-height: 1.5; margin: 0; }
.ui-page-head .btn { flex-shrink: 0; }

/* Controls: strong primary, quiet secondary, destructive only when necessary. */
.btn, .outline-control, .sort-option, .btn-undo, .btn-cook, .ui-icon-button, .plan-cook-icon,
.cook-btn, .cook-chip, .chat-tool-button {
  min-height: 44px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-family: var(--ui-font);
  font-size: var(--text-control); font-weight: 600; letter-spacing: 0; text-transform: none;
  padding: 10px 14px; box-shadow: none; line-height: 1.3;
}
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn-primary, .btn-add, .cook-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--text-inverse); box-shadow: none; }
.btn-secondary, .outline-control, .btn-undo, .btn-cook, .cook-btn.secondary { background: var(--surface); color: var(--text); box-shadow: none; }
.btn-danger, .btn-remove { color: var(--red); background: transparent; border-color: var(--border); box-shadow: none; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text2); }
.btn-add.added, .btn-success { color: var(--green); border-color: var(--border); background: var(--surface-2); box-shadow: none; }
.ui-icon-button { display: inline-flex; align-items: center; justify-content: center; padding: 10px; min-width: 44px; }
.ui-icon-button:disabled { opacity: .35; }
.ui-title-button { display: block; text-align: left; padding: 0; border: 0; background: none; color: inherit; font: inherit; letter-spacing: inherit; }
.ui-row-link { background: transparent; border: 0; border-radius: 6px; color: inherit; font: inherit; padding: 0; text-align: left; }
.ui-segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 4px; gap: 4px; margin-bottom: 24px; }
.ui-segmented button { min-height: 44px; border: 0; border-radius: 7px; padding: 9px 12px; background: transparent; color: var(--text2); font-size: 14px; font-weight: 600; }
.ui-segmented button[aria-selected="true"] { background: var(--surface-3); color: var(--text); }

/* Keep intrinsic portrait sizes out of grid sizing, so object-fit uses the visible frame. */
.recipe-media, .recipe-media.preserve-photo, .recipe-media-sm, .recipe-list-thumbnail, .detail-media.detail-photo-hero { position: relative; display: block; overflow: hidden; }
.recipe-media > img, .recipe-media.preserve-photo > img, .recipe-media-sm > img, .recipe-list-thumbnail > img, .detail-media.detail-photo-hero > img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; transform: none; filter: none; }

/* Cookbook: photos draw the eye, metadata and actions no longer compete. */
.recipe-toolbar { margin-bottom: 12px; gap: 12px; }
.control-input { height: 48px; border: 1px solid var(--ui-input-border); background: var(--surface); color: var(--text); font-family: var(--ui-font); font-size: var(--text-body); padding-left: 42px; border-radius: 10px; box-shadow: none; }
.control-input::placeholder { color: var(--muted); }
.search-icon { left: 14px; color: var(--text2); }
.control-clear { min-width: 40px; min-height: 40px; right: 4px; top: 4px; color: var(--text2); }
.recipe-filter-toolbar { display: flex; flex-wrap: wrap; flex-direction: row; align-items: center; gap: 8px; margin: 0 0 20px; }
.recipe-filter-toolbar .category-bar { display: contents; flex-wrap: wrap; overflow: visible; gap: 6px; margin: 0; padding: 0; }
.cat-chip { min-height: 38px; height: auto; padding: 8px 11px; font: 550 13px/1.2 var(--ui-font); letter-spacing: 0; text-transform: none; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text2); box-shadow: none; }
.cat-chip.active { background: var(--surface-3); border-color: #7f8875; color: var(--text); box-shadow: none; }
.cat-chip .cat-count, .cat-chip.active .cat-count { padding: 0; background: transparent; border-radius: 0; color: var(--muted); font-size: 12px; }
.cat-chip.archive { opacity: 1; }
.recipe-filter-toolbar .ui-sort-control { display: inline-flex; height: auto; position: static; margin-left: auto; align-items: center; gap: 8px; width: auto; align-self: flex-end; padding: 7px 10px; min-height: 40px; font-size: 13px; background: transparent; border-color: transparent; }
.recipe-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-6); align-items: stretch; }
.recipe-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); box-shadow: none; overflow: hidden; }
.recipe-card-inner { display: block; min-height: 0; }
.recipe-media, .recipe-media.preserve-photo { width: 100%; height: 216px; min-height: 216px; aspect-ratio: auto; border: 0; background: var(--surface-2); }
.recipe-media.preserve-photo::before, .recipe-media.preserve-photo::after, .recipe-media::after { display: none; }
.recipe-media img, .recipe-media.preserve-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center center; transform: none; filter: none; }
.recipe-media-fallback, .recipe-media-sm .recipe-media-fallback { background: var(--surface-2); }
.recipe-media.no-photo { height: 132px; min-height: 132px; }
.recipe-media.no-photo .recipe-media-fallback { font-size: 2.5rem; }
.recipe-card { transition: border-color var(--motion-fast) ease; }
.recipe-card:focus-within { border-color: var(--ui-input-border); }
.recipe-card:has(.btn-add[aria-busy="true"]) { border-color: var(--accent); }
.recipe-body { padding: var(--space-4); align-items: stretch; display: flex; flex-direction: column; gap: var(--space-2); }
.recipe-title { font: 680 var(--text-card)/1.3 var(--ui-font); text-transform: none; letter-spacing: -.022em; margin: 0 0 8px; overflow-wrap: break-word; }
.recipe-meta { font: 400 var(--text-small)/1.5 var(--ui-font); color: var(--text2); gap: 6px var(--space-3); margin: 0; }
.cooked-inline { color: var(--text2); font-weight: 500; }
.tags { gap: 6px; margin: 0; }
.tag, .tag:nth-child(n+4), .discover-pill { display: inline-flex; height: auto; min-height: 23px; padding: 3px 7px; border-radius: 5px; border: 0; background: var(--surface-2); color: var(--text2); font: 500 12px/1.3 var(--ui-font); text-transform: none; letter-spacing: 0; }
.tag:is(.low-carb,.vegan,.vegetarisch,.pescatarisch,.fisch,.batch-friendly,.schnell,.favorit), .discover-pill.green { background: var(--surface-2); color: var(--text2); border: 0; }
.rating-badge { display: flex; align-items: center; gap: 5px; font: 500 13px/1.5 var(--ui-font); color: var(--text2); margin: 0; }
.rating-badge svg { width: 15px; height: 15px; color: var(--accent); }
.rating-badge.no-rating { color: var(--muted); }
.recipe-actions { width: 100%; align-self: stretch; display: flex; gap: 8px; padding: 5px 0 0; margin-top: auto; }
.recipe-actions .btn-add { width: 100%; min-height: 44px; }
.recipe-card > .recipe-actions { padding: 0 16px 16px; }
.recipe-fav, .recipe-fav.is-active, .recipe-fav.active { width: 44px; height: 44px; top: 12px; right: 12px; border: 1px solid rgba(255,255,255,.3); background: rgba(17,18,15,.84); box-shadow: none; filter: none; color: var(--text); }
.recipe-fav[aria-pressed="true"] { color: var(--accent); }
.recipe-fav svg { width: 22px; height: 22px; }
.recipe-image-meta { left: 12px; bottom: 12px; }
.meta-pill { font: 500 12px/1.4 var(--ui-font); background: rgba(17,18,15,.88); border: 1px solid var(--border); color: var(--text); box-shadow: none; }
.source-badge { font: 500 12px/1.4 var(--ui-font); color: var(--text2); border: 0; padding: 0; margin: 0; text-transform: none; }
.plan-empty, .shop-empty { padding: 40px 24px; border: 1px dashed var(--ui-input-border); border-radius: var(--radius); background: transparent; color: var(--text); grid-column: 1/-1; }
.plan-empty h2 { font-size: 20px; line-height: 1.25; margin-bottom: 10px; }
.plan-empty .hint { font: 400 14px/1.6 var(--ui-font); color: var(--text2); margin: 0 0 20px; }

/* Weekly plan: read the whole recipe, choose cooking vs completion explicitly. */
.plan-toolbar { gap: 12px; margin: 0 0 20px; padding: 0; }
.kw-nav { gap: 6px; }
.kw-nav button { min-width: 44px; min-height: 44px; height: auto; padding: 8px 12px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); font: 600 14px/1.3 var(--ui-font); }
.plan-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.plan-card, .plan-grid.sort-mode .plan-card { display: flex; flex-direction: column; align-items: stretch; gap: 16px; min-height: 0; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.plan-card-link, .cooked-item-info { display: flex; gap: 14px; align-items: center; width: 100%; }
.recipe-media-sm { width: 76px; height: 82px; min-height: 82px; border: 0; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.recipe-media-sm img { width: 100%; height: 100%; object-fit: cover; object-position: center center; }
.plan-card-title { font: 650 16px/1.35 var(--ui-font); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; }
.plan-card-meta { white-space: normal; overflow: visible; text-overflow: clip; font: 400 13px/1.45 var(--ui-font); color: var(--text2); margin-top: 6px; }
.plan-tag { margin-top: 7px; }
.plan-card-controls, .plan-grid.sort-mode .plan-card-controls { display: flex; align-items: center; justify-content: flex-start; align-self: stretch; margin: 0; flex-wrap: wrap; gap: 8px; min-height: 0; padding: 0; border: 0; grid-template-rows: none; }
.plan-cook-icon { display: inline-flex; justify-content: center; align-items: center; gap: 7px; width: auto; height: auto; min-height: 44px; border-radius: var(--radius-sm); }
.plan-card-controls .btn-remove { width: 44px; min-width: 44px; height: 44px; min-height: 44px; margin-left: auto; padding: 10px; border-radius: var(--radius-sm); box-shadow: none; }
.ui-reorder-controls { display: none; gap: 8px; width: 100%; padding-top: 10px; border-top: 1px solid var(--border-soft); }
.plan-grid.sort-mode .ui-reorder-controls { display: flex; }
.plan-grid.sort-mode .plan-card .drag-handle { display: inline-grid; place-items: center; width: 44px; min-height: 44px; margin-left: auto; color: var(--text2); }
.ui-chevron-up { display: flex; transform: rotate(-90deg); }
.ui-chevron-down { display: flex; transform: rotate(90deg); }
.cooked-section { margin-top: 30px; }
.cooked-header { font: 600 15px/1.5 var(--ui-font); color: var(--text2); margin-bottom: 12px; }
.cooked-list { display: grid; gap: 10px; }
.cooked-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 76px; min-height: 76px; max-height: 76px; padding: 10px 14px; border: 1px solid var(--border-soft); background: transparent; border-radius: var(--radius-sm); box-sizing: border-box; box-shadow: none; }
.cooked-item-info { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; height: 100%; }
.cooked-item .recipe-media-sm { width: 56px; height: 56px; min-height: 56px; min-width: 56px; border-radius: 8px; flex-shrink: 0; overflow: hidden; }
.cooked-title { font: 600 15px/1.35 var(--ui-font); color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; text-align: left; }
.cooked-item .btn-undo { flex-shrink: 0; margin-left: auto; align-self: center; background: transparent; font-size: 13px; min-height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text2); cursor: pointer; }
.shopping-actions { margin: 0 0 20px; }
.shopping-actions:has(#generateBtn[style*="display: none"]):not(:has(.plan-generation-error:not([hidden]))) { display: none; }

/* Discovery: independent entry points with room for content, not fixed-height cards. */
#tab-discovery .container { padding-top: 24px; }
#tab-discovery .discover-shell { width: 100%; max-width: none; margin: 0; }
#tab-discovery .discover-chat-import { display: block; margin: 0; }
#tab-discovery .discover-chat-import[hidden] { display: none; }
.chat-import-panel, .chat-composer, .discover-panel { background: var(--surface); border: 1px solid var(--border); box-shadow: none; border-radius: var(--radius); }
.chat-import-panel { padding: 20px; }
.chat-import-head { display: block; gap: 12px; margin-bottom: 18px; }
.chat-import-mark { display: none; }
.chat-import-head h3 { font: 650 19px/1.3 var(--ui-font); letter-spacing: -.02em; text-transform: none; margin-bottom: 8px; }
.chat-import-head p { font: 400 14px/1.6 var(--ui-font); color: var(--text2); }
.chat-composer { padding: 0; background: var(--bg); border-color: var(--ui-input-border); border-radius: 10px; }
.chat-import-text { min-height: 130px; height: auto; padding: 14px; font: 400 16px/1.6 var(--ui-font); background: transparent; color: var(--text); }
.chat-import-text::placeholder { color: var(--muted); }
.chat-composer-footer { display: flex; flex-direction: column; gap: 10px; padding: 12px; align-items: stretch; border-top: 1px solid var(--border-soft); }
.chat-tool-row { display: flex; gap: 8px; }
.chat-tool-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: auto; height: 44px; padding: 9px 12px; color: var(--text2); font-size: 13px; }
.chat-import-actions, .chat-import-actions .btn { width: 100%; }
.chat-import-actions .btn { min-height: 44px; font-size: 14px; }
.chat-import-recent { margin-top: 26px; border-top: 1px solid var(--border-soft); padding-top: 20px; }
.chat-import-recent-title { font: 600 14px/1.5 var(--ui-font); color: var(--text2); margin-bottom: 12px; text-transform: none; letter-spacing: 0; }
.chat-import-recent-row { grid-template-columns: 76px minmax(0,1fr) 20px; gap: 12px; padding: 12px 0; border: 0; border-bottom: 1px solid var(--border-soft); border-radius: 0; background: transparent; box-shadow: none; }
.chat-recent-thumb { width: 30px; height: 43px; border: 2px solid var(--surface); border-radius: 6px; }
.chat-recent-copy strong { font-size: 14px; font-weight: 600; line-height: 1.4; }
.chat-recent-copy small { font-size: 12px; color: var(--text2); line-height: 1.4; }
.discover-panel, .discover-panel.dark { padding: 24px; background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.discover-state { text-align: left; padding: 30px 24px; }
.discover-state-icon { display: flex; color: var(--text2); font-size: 28px; margin-bottom: 20px; }
.discover-state-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.discover-state h3, .discover-card-title, .discover-review-title { font: 650 22px/1.25 var(--ui-font); text-transform: none; letter-spacing: -.025em; margin-bottom: 12px; }
.discover-state p, .discover-copy { font: 400 15px/1.6 var(--ui-font); color: var(--text2); }
.discover-state .btn { margin-top: 20px; }
.ui-setup-help { color: var(--text2); font-size: 14px; margin-top: 20px; }
.ui-setup-help summary { min-height: 44px; padding: 11px 0; color: var(--text); cursor: pointer; }
.ui-setup-help p { margin: 8px 0; overflow-wrap: anywhere; font-size: 13px; }
#tab-discovery .ui-page-head.discovery-page-head { margin-bottom: 16px; }
#tab-discovery.discovery-card-mode .discovery-page-subtitle { display: none; }
#tab-discovery.discovery-card-mode .discovery-page-head h1 { font-size: clamp(24px, 7vw, 28px); margin-bottom: 0; }
#tab-discovery .discover-shell.is-card { width: 100%; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
#tab-discovery .discover-progress { display: grid; gap: 6px; margin: 0; }
#tab-discovery .discover-progress-row { min-height: 18px; font: 600 13px/1.3 var(--ui-font); color: var(--text2); }
#tab-discovery .discover-track { height: 4px; border: 0; background: var(--surface-3); }
#tab-discovery .discover-track-fill { background: var(--accent); }
#tab-discovery .discover-card { display: block; min-height: 0; padding: 0; overflow: visible; border: 0; background: transparent; box-shadow: none; }
#tab-discovery .discover-card-swipe { min-height: 0; overflow: hidden; border-radius: 16px; touch-action: pan-y; will-change: transform; transition: transform var(--motion-fast) var(--ease-out), box-shadow var(--motion-fast) ease; }
#tab-discovery .discover-card-swipe.is-dragging { transition: none; }
#tab-discovery .discover-card-swipe[data-swipe="like"] { box-shadow: 0 0 0 2px rgba(100, 212, 95, .45); }
#tab-discovery .discover-card-swipe[data-swipe="pass"] { box-shadow: 0 0 0 2px rgba(255, 70, 20, .45); }
#tab-discovery .discover-photo { position: relative; width: 100%; height: clamp(420px, calc(100dvh - 260px), 680px); min-height: 280px; aspect-ratio: auto; overflow: hidden; border: 0; border-radius: 16px; background: var(--surface-2); }
#tab-discovery .discover-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center center; transform: none; }
#tab-discovery .discover-photo-gradient { position: absolute; inset: 25% 0 0; z-index: 1; pointer-events: none; background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, .22) 30%, rgba(0, 0, 0, .9) 100%); }
#tab-discovery .discover-photo-copy { position: absolute; z-index: 2; left: 20px; right: 20px; bottom: 20px; color: #fff; }
#tab-discovery .discover-card-title { display: -webkit-box; max-width: 100%; margin: 0 0 7px; overflow: hidden; color: #fff; font: 750 clamp(20px, 4vw, 26px)/1.08 var(--ui-font); letter-spacing: -.025em; text-transform: none; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
#tab-discovery .discover-card-metrics { color: rgba(255,255,255,.9); font: 550 14px/1.35 var(--ui-font); }
#tab-discovery .discover-info-button { position: absolute; z-index: 3; top: 16px; right: 16px; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; min-width: 44px; padding: 10px; border: 1px solid rgba(255,255,255,.28); border-radius: 10px; background: rgba(0,0,0,.5); color: #fff; backdrop-filter: blur(8px); }
#tab-discovery .discover-info-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#tab-discovery .discover-photo-missing { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px; color: var(--text); text-align: center; background: radial-gradient(circle at 50% 30%, var(--surface-3), var(--surface) 72%); }
#tab-discovery .discover-photo-missing strong { font-size: 48px; line-height: 1; }
#tab-discovery .discover-photo-missing span { max-width: 220px; color: var(--text2); font: 550 14px/1.4 var(--ui-font); text-transform: none; }
#tab-discovery .discover-card-body { display: none; }
#tab-discovery .discover-actions { display: grid; grid-template-columns: 1fr 1fr 1.35fr; gap: 8px; margin-top: 12px; padding: 0; border: 0; background: transparent; }
#tab-discovery .discover-action { min-height: 52px; padding: 10px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: 600 14px/1.25 var(--ui-font); text-transform: none; }
#tab-discovery .discover-action.pass, #tab-discovery .discover-action.like { color: var(--text); }
#tab-discovery .discover-action.try { border-color: var(--accent); background: var(--accent); color: var(--text-inverse); }
#tab-discovery .discover-action small { display: none; }
.discovery-details-sheet { padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
.discovery-details-sheet .sheet-title { max-width: calc(100% - 60px); overflow-wrap: anywhere; }
.discover-details-content { display: grid; gap: 22px; }
.discover-details-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.discover-details-metric { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.discover-details-metric span, .discover-details-section h3 { color: var(--text2); font: 600 12px/1.3 var(--ui-font); letter-spacing: .02em; text-transform: uppercase; }
.discover-details-metric strong { color: var(--text); font: 650 15px/1.35 var(--ui-font); overflow-wrap: anywhere; }
.discover-details-section { display: grid; gap: 9px; }
.discover-details-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.discover-details-tags .tag { margin: 0; }
.discover-details-ingredients { display: grid; gap: 7px; padding: 0; list-style: none; }
.discover-details-ingredients li { padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); font: 400 15px/1.45 var(--ui-font); overflow-wrap: anywhere; }
.discover-details-why, .discover-details-muted { color: var(--text2); font: 400 15px/1.6 var(--ui-font); }
.discover-note, .discover-status-row, .discover-score, .discover-next-item { background: var(--surface-2); border: 1px solid var(--border); box-shadow: none; color: var(--text); font-family: var(--ui-font); }
.discover-note { border-left-width: 3px; }
.discover-feedback { background: var(--bg); color: var(--text); border: 1px solid var(--ui-input-border); font-family: var(--ui-font); }
.discover-chip { background: var(--surface); color: var(--text); border: 1px solid var(--border); min-height: 44px; font: 500 14px/1.4 var(--ui-font); text-transform: none; }
.discover-chip.active { background: var(--surface-3); color: var(--text); border-color: var(--accent); }
#tab-discovery.chat-idea-results-mode .chat-idea-results { height: auto; min-height: 0; padding: 0; }
#tab-discovery .chat-idea-carousel { min-height: 0; height: auto; }
#tab-discovery .chat-idea-card { min-height: 0; height: auto; max-height: none; background: var(--surface); border: 1px solid var(--border); box-shadow: none; }
#tab-discovery .chat-idea-media { height: 210px; min-height: 0; max-height: none; aspect-ratio: auto; background: var(--surface-2); }
#tab-discovery .chat-idea-title { display: block; -webkit-line-clamp: unset; max-height: none; overflow: visible; font: 650 22px/1.25 var(--ui-font); text-transform: none; letter-spacing: -.02em; }
#tab-discovery .chat-idea-body { padding: 18px; overflow: visible; }
#tab-discovery .chat-idea-summary { display: block; color: var(--text2); font: 400 14px/1.55 var(--ui-font); }
.chat-idea-actions .btn { font: 600 14px/1.3 var(--ui-font); min-height: 44px; box-shadow: none; }
.chat-idea-dot { min-width: 32px; min-height: 32px; padding: 10px; background-clip: content-box; border-radius: 50%; }

/* Shopping shares tokens, geometry and type with the rest of the product. */
.bsv2-root { --bsv2-bg: var(--bg); --bsv2-panel: var(--surface); --bsv2-panel-raised: var(--surface-2); --bsv2-line: var(--border); --bsv2-line-soft: var(--border-soft); --bsv2-text: var(--text); --bsv2-muted: var(--text2); --bsv2-dim: var(--muted); --bsv2-accent: var(--accent); --bsv2-accent-strong: var(--accent); --bsv2-green: var(--green); --bsv2-danger: var(--red); --bsv2-radius: var(--radius); --bsv2-font: var(--ui-font); }
.bsv2-shell { max-width: none; gap: 0; }
.bsv2-tabs { border: 1px solid var(--border); border-radius: 11px; padding: 4px; gap: 4px; background: var(--surface); margin-bottom: 14px; }
.bsv2-tab { min-height: 44px; font-size: 14px; color: var(--text2); border-radius: 7px; font-weight: 550; }
.bsv2-tab.is-active { border-bottom-color: transparent; background: var(--surface-3); color: var(--text); box-shadow: none; }
.bsv2-tab span { color: var(--text2); background: transparent; }
.bsv2-toolbar { display: flex; flex-direction: column-reverse; align-items: stretch; gap: 12px; margin: 0 0 12px; }
.bsv2-toolbar[hidden] { display: none !important; margin: 0; }
.bsv2-toolbar-actions { display: flex; gap: 8px; width: 100%; flex-wrap: wrap; }
.bsv2-toolbar-actions .bsv2-add-button { margin-left: auto; }
.bsv2-status { font-size: 13px; line-height: 1.4; color: var(--text2); }
.bsv2-add-button, .bsv2-primary-button, .bsv2-secondary-button { min-height: 44px; border-radius: var(--radius-sm); padding: 10px 13px; font-size: 14px; font-weight: 600; line-height: 1.35; box-shadow: none; }
.bsv2-primary-button, .bsv2-add-button { color: var(--text-inverse); background: var(--accent); border-color: var(--accent); }
.bsv2-secondary-button { color: var(--text); background: var(--surface); border: 1px solid var(--border); }
.bsv2-toolbar-actions .bsv2-secondary-button { width: auto; font-size: 13px; padding: 10px; }
.bsv2-toolbar-actions svg { width: 18px; height: 18px; }
.bsv2-fab { position: fixed; right: max(18px, calc((100vw - min(100%, var(--ui-content-width))) / 2 + 18px)); bottom: calc(var(--bottom-nav-h) + max(0px, calc(env(safe-area-inset-bottom, 0px) - 12px)) + 16px); z-index: 100; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 18px 0 14px; border: 1px solid rgba(255, 255, 255, .15); border-radius: 999px; background: var(--accent); color: var(--text-inverse, #fff); font: 700 14px/1 var(--ui-font); box-shadow: 0 8px 24px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .25); cursor: pointer; transition: transform .12s ease, opacity .15s ease, box-shadow .12s ease; user-select: none; -webkit-tap-highlight-color: transparent; }
.bsv2-fab svg, .bsv2-fab .bsv2-icon { width: 18px; height: 18px; stroke-width: 2.4; }
.bsv2-fab:active { transform: scale(0.95); box-shadow: 0 4px 12px rgba(0, 0, 0, .35); }
html.bsv2-sheet-open .bsv2-fab { opacity: 0; pointer-events: none; transform: scale(0.9); }
@media (min-width: 960px) { .bsv2-fab { bottom: 24px; } }
.bsv2-store-filter { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding-top: 0; border: 0; flex-wrap: wrap; }
.bsv2-store-filter label { color: var(--text2); font-size: 14px; }
.bsv2-store-filter select { flex: 1; min-width: 160px; min-height: 44px; padding: 8px 12px; color: var(--text); background: var(--surface); border: 1px solid var(--ui-input-border); border-radius: var(--radius-sm); font: 500 14px/1.4 var(--ui-font); }
.bsv2-store-filter > span { color: var(--text2); font-size: 13px; }
.bsv2-intro { padding: 0 0 18px; margin: 0; border: 0; background: transparent; }
.bsv2-intro strong { font-size: 17px; font-weight: 600; line-height: 1.35; }
.bsv2-intro p { color: var(--text2); font-size: 14px; line-height: 1.55; margin: 0; max-width: 62ch; }
.bsv2-group { margin-bottom: 24px; border: 0; border-radius: 0; background: transparent; overflow: visible; }
.bsv2-group-head { background: transparent; padding: 0 0 10px; border: 0; }
.bsv2-group-head h3 { color: var(--text); font-size: 15px; font-weight: 600; }
.bsv2-group-head span { font-size: 12px; color: var(--text2); }
.bsv2-list { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); }
.bsv2-swipe-row { position: relative; overflow: hidden; background: var(--bsv2-danger, #df2c18); }
.bsv2-swipe-row .bsv2-item { background: var(--surface, #1b1d19); touch-action: pan-y; position: relative; z-index: 2; will-change: transform; }
.bsv2-swipe-row .bsv2-item.is-active { background: #202b21; }
.bsv2-item { min-height: 76px; padding: 12px 10px 12px 6px; grid-template-columns: 44px minmax(0,1fr) auto 36px; gap: 8px; background: transparent; }
.bsv2-state-button { width: 44px; height: 44px; min-width: 44px; border-radius: 8px; border: 0; background: transparent; position: relative; }
.bsv2-state-button::before { content: ''; position: absolute; width: 24px; height: 24px; border: 1.5px solid var(--ui-input-border); border-radius: 6px; }
.bsv2-state-button[aria-checked="true"] { background: transparent; color: var(--green); border: 0; }
.bsv2-state-button[aria-checked="true"]::before { border-color: var(--green); background: var(--green-soft); }
.bsv2-state-button svg { width: 18px; height: 18px; position: relative; z-index: 1; }
.bsv2-item-copy { min-height: 44px; }
.bsv2-item-name { font-size: 15px; font-weight: 550; line-height: 1.4; }
.bsv2-item-name em { border: 0; background: transparent; color: var(--green); font-size: 11px; padding: 0; }
.bsv2-item-context { font-size: 12px; color: var(--text2); line-height: 1.5; margin-top: 4px; }
.bsv2-item-amount { color: var(--text); font-size: 13px; line-height: 1.4; max-width: 82px; text-align: right; }
.bsv2-more-button { width: 36px; min-height: 44px; color: var(--text2); }
.bsv2-item.is-active { background: #202b21; }
.bsv2-item.is-active .bsv2-item-name { color: var(--text2); }
.bsv2-empty { min-height: 260px; padding: 38px 24px; background: transparent; border: 1px dashed var(--ui-input-border); border-radius: var(--radius); }
.bsv2-empty strong { font-size: 20px; font-weight: 650; }
.bsv2-empty p { font-size: 14px; line-height: 1.6; color: var(--text2); }
.bsv2-history-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; }
.bsv2-capture-tabs { gap: 4px; padding: 4px; background: var(--surface-2); border: 0; border-radius: 10px; grid-template-columns: repeat(4,minmax(0,1fr)); }
.bsv2-capture-tabs button { display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 64px; padding: 8px 3px; border: 0; border-radius: 7px; font-size: 12px; color: var(--text2); background: transparent; }
.bsv2-capture-tabs button.is-active { background: var(--surface-3); color: var(--text); box-shadow: none; }
.bsv2-field { gap: 7px; }
.bsv2-field > span { color: var(--text2); font-size: 13px; font-weight: 550; }
.bsv2-field input, .bsv2-field textarea { min-height: 46px; padding: 11px 12px; background: var(--bg); color: var(--text); border: 1px solid var(--ui-input-border); border-radius: var(--radius-sm); font-size: 16px; line-height: 1.5; }
.bsv2-form { gap: 20px; }
.bsv2-field-grid { gap: 16px 12px; }
.bsv2-store-checks { gap: 8px; }
.bsv2-store-checks label { min-height: 40px; font-size: 13px; }
.bsv2-store-checks legend { font-size: 14px; margin-bottom: 10px; color: var(--text2); }
.bsv2-form-hint { font-size: 13px; line-height: 1.55; color: var(--text2); }
.bsv2-capture-inbox { border: 0; padding-top: 12px; }
.bsv2-capture-inbox header { display: block; }
.bsv2-capture-inbox header small { display: block; margin-top: 4px; font-size: 12px; color: var(--text2); }

/* Dialogs: one bounded, scrollable surface; no off-screen headings. */
html.ui-dialog-open { overflow: hidden; }
.sheet-backdrop, .bsv2-sheet-backdrop { background: rgba(0,0,0,.66); backdrop-filter: none; }
.sheet-backdrop { z-index: 500; }
.bottom-sheet { z-index: 510; width: min(100%, 600px); max-height: calc(100dvh - 32px - env(safe-area-inset-top, 0px)); overflow-y: auto; overscroll-behavior: contain; bottom: 0; left: 50%; padding: 16px 20px calc(24px + env(safe-area-inset-bottom,0px)); border: 1px solid var(--border); border-bottom: 0; border-radius: 18px 18px 0 0; background: var(--surface); color: var(--text); box-shadow: none; }
.bottom-sheet { transition: transform var(--motion-panel) var(--ease-out); }
.bottom-sheet:not(.active) { visibility: hidden; pointer-events: none; }
.bottom-sheet.active { visibility: visible; transform: translateX(-50%) translateY(0); }
.sheet-handle, .bsv2-sheet-handle { width: 34px; height: 4px; background: var(--ui-input-border); margin: 0 auto 16px; border-radius: 3px; }
.ui-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.sheet-title, .bsv2-sheet-head h3 { font: 650 22px/1.25 var(--ui-font); text-transform: none; letter-spacing: -.02em; margin: 0; }
.ui-dialog-head .ui-icon-button { border: 0; background: transparent; }
.sheet-copy, .bsv2-sheet-head p { color: var(--text2); font-size: 14px; line-height: 1.55; margin-bottom: 18px; }
.sort-options { margin-top: 12px; gap: 8px; }
.sort-option { text-align: left; width: 100%; min-height: 50px; font-size: 15px; padding: 12px 16px; background: transparent; }
.sort-option.active { background: var(--surface-3); border-color: var(--accent); color: var(--text); }
.account-shopping-panel, .account-prompt-panel { padding: 20px 0; margin: 0; border-top: 1px solid var(--border); }
.account-shopping-panel .sheet-title { font-size: 16px; margin-bottom: 16px; }
.account-shopping-copy strong { font-size: 15px; }
.account-shopping-copy span, .account-shopping-note { font-size: 13px; color: var(--text2); line-height: 1.5; }
.ui-settings-section summary { min-height: 48px; padding-right: 26px; position: relative; cursor: pointer; list-style: none; }
.ui-settings-section summary::-webkit-details-marker { display: none; }
.ui-settings-section summary::after { content: '+'; position: absolute; right: 0; top: 8px; color: var(--text2); font-size: 23px; }
.ui-settings-section[open] summary::after { content: '−'; }
.ui-settings-section summary strong { display: block; font-size: 16px; font-weight: 600; }
.ui-settings-section summary span { display: block; font-size: 13px; color: var(--text2); margin-top: 4px; }
.ui-settings-section[open] summary { margin-bottom: 18px; }
.account-prompt-meta { font: 400 12px/1.6 var(--ui-font); text-transform: none; color: var(--text2); margin: 14px 0; }
.account-prompt-textarea { background: var(--bg); color: var(--text); border: 1px solid var(--ui-input-border); font: 400 var(--text-body)/1.55 var(--ui-font); min-height: 200px; padding: 12px; border-radius: var(--radius-sm); }
.confirm-actions { gap: 10px; margin-top: 18px; }
.bsv2-sheet-layer { z-index: 500; }
.bsv2-sheet { width: min(100%,600px); max-height: calc(100dvh - 32px - env(safe-area-inset-top,0px)); background: var(--surface); border: 1px solid var(--border); border-radius: 18px 18px 0 0; padding: 16px 20px calc(24px + env(safe-area-inset-bottom,0px)); box-shadow: none; overscroll-behavior: contain; }
.bsv2-sheet { animation-duration: var(--motion-panel); }
.bsv2-sheet-head { align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.bsv2-sheet-head p { margin: 8px 0 0; }
.bsv2-sheet-close { min-width: 44px; min-height: 44px; background: transparent; border: 0; color: var(--text2); }

/* Recipe details and hands-free cooking use the same readable typography. */
.detail-shell, .cook-shell { width: min(100%, 800px); max-width: 800px; background: var(--bg); color: var(--text); margin: 0 auto; box-shadow: none; }
.detail-shell { min-height: 100dvh; padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 16px); }
.detail-hero { padding: calc(env(safe-area-inset-top, 0px) + 16px) 0 0; background: var(--bg); }
.detail-topbar { margin: 0 18px 16px; }
.detail-back, .cook-back { min-height: 44px; padding: 8px 0; background: transparent; border: 0; color: var(--text2); font: 550 14px/1.4 var(--ui-font); text-transform: none; }
.detail-media.detail-photo-hero { height: 240px; min-height: 0; margin: 0 18px 22px; border-radius: var(--radius); background: var(--surface); }
.detail-media.detail-photo-hero img { object-fit: cover; object-position: center center; transform: none; }
.detail-media.detail-photo-hero::after { display: none; }
.detail-hero h1 { font: 700 27px/1.18 var(--ui-font); letter-spacing: -.03em; text-transform: none; margin: 0 18px 12px; }
.detail-hero-meta { font: 400 14px/1.5 var(--ui-font); color: var(--text2); margin: 0 18px; }
.detail-hero-tags { gap: 6px; margin: 14px 18px; }
.detail-source-link { margin-left: 18px; font-size: 14px; font-weight: 550; }
.detail-rating-section { padding: 18px 0 0; margin: 18px 18px 0; border-top: 1px solid var(--border); }
.detail-rating-label { font: 550 13px/1.4 var(--ui-font); text-transform: none; min-width: 50px; }
.detail-rating-stars { gap: 2px; }
.detail-rating-stars .flame { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 10px; background: transparent; border: 0; color: var(--accent); border-radius: 7px; }
.detail-rating-stars .flame svg { width: 23px; height: 23px; stroke: currentColor; stroke-width: 1.6; fill: none; }
.detail-rating-stars .flame.filled svg { fill: currentColor; }
.detail-rating-stars .flame.empty { color: var(--text2); opacity: 1; filter: none; }
.detail-rating-avg { font: 400 13px/1.4 var(--ui-font); color: var(--text2); }
.detail-tabs { margin: 24px 18px 0; border-bottom: 1px solid var(--border); grid-template-columns: repeat(4,minmax(0,1fr)); gap: 0; }
.detail-tabs button { min-height: 48px; height: auto; padding: 11px 2px; font: 550 14px/1.3 var(--ui-font); color: var(--text2); text-transform: none; }
.detail-tabs button.active { color: var(--text); border-bottom-color: var(--accent); background: transparent; }
.detail-content { max-width: none; border-radius: 0; padding: 24px 18px; background: var(--bg); color: var(--text); }
.detail-section-title { font: 600 18px/1.4 var(--ui-font); text-transform: none; letter-spacing: -.015em; margin-bottom: 14px; }
.detail-overview-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.detail-overview-stat { background: transparent; border: 0; border-right: 1px solid var(--border); border-radius: 0; padding: 8px; min-height: 74px; }
.detail-overview-stat:last-child { border: 0; }
.detail-overview-stat strong { font-size: 24px; font-weight: 650; }
.detail-overview-stat span { font-size: 13px; color: var(--text2); }
.detail-ingredients, .detail-steps, .detail-tips { padding: 0; margin: 0; }
.detail-ingredients li, .detail-tips li { background: transparent; border: 0; border-bottom: 1px solid var(--border-soft); padding: 13px 0; margin: 0; border-radius: 0; color: var(--text); font-size: 15px; line-height: 1.6; }
.detail-steps li { font: 400 16px/1.7 var(--ui-font); padding: 14px 0 18px 44px; border-color: var(--border-soft); }
.detail-steps li::before { top: 15px; background: var(--surface-3); color: var(--text2); border-radius: 50%; font: 600 13px/1 var(--ui-font); }
.detail-nutrition-item { padding: 20px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.detail-nutrition-value { font-size: 27px; font-weight: 650; color: var(--text); }
.detail-nutrition-label { font: 400 13px/1.4 var(--ui-font); color: var(--text2); text-transform: none; }
.detail-notes { padding: 16px; color: var(--text2); background: var(--surface); font: 400 15px/1.6 var(--ui-font); }
.detail-actions { position: static; bottom: auto; background: transparent; margin: 24px 0 0; padding: 20px 0 0; border-top: 1px solid var(--border); gap: 10px; }
.detail-overview-actions { margin-top: 24px; gap: 10px; }
.cook-shell { min-height: 100dvh; padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 16px); }
.cook-topbar { padding: calc(env(safe-area-inset-top, 0px) + 16px) 18px 16px; background: var(--bg); border-bottom: 1px solid var(--border); }
.cook-recipe-name { font: 550 13px/1.4 var(--ui-font); color: var(--text2); text-transform: none; }
.cook-progress { font: 500 13px/1.4 var(--ui-font); color: var(--text2); }
.cook-main { padding: 20px 18px; max-width: none; }
.cook-card { padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: none; }
.cook-step-label, .cook-queue-title, .cook-timer-meta { color: var(--text2); font: 550 14px/1.4 var(--ui-font); text-transform: none; letter-spacing: 0; }
.cook-step-text { margin: 16px 0; font: 620 25px/1.4 var(--ui-font); text-transform: none; letter-spacing: -.02em; }
.cook-subtext { color: var(--text2); font: 400 14px/1.6 var(--ui-font); }
.cook-ingredients, .cook-queue, .cook-timer-box { background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 18px; padding: 18px; font: 400 15px/1.6 var(--ui-font); }
.cook-ingredients summary { min-height: 44px; cursor: pointer; font: 600 15px/1.5 var(--ui-font); text-transform: none; color: var(--text); }
.cook-ingredients li { color: var(--text2); }
.cook-timer-value { font: 650 38px/1.4 var(--ui-font); font-variant-numeric: tabular-nums; color: var(--text); }
.cook-actions { gap: 10px; margin-top: 24px; }
.swipe-hint-row { color: var(--text2); font: 400 12px/1.4 var(--ui-font); margin-bottom: 14px; text-transform: none; }
.cook-finish h1 { font: 680 30px/1.2 var(--ui-font); text-transform: none; }

/* Focused entry/return pages are part of the same product, not a separate theme. */
.ui-standalone .wrap { padding: 36px 20px; min-height: 100dvh; }
.ui-standalone main { width: min(100%,600px); }
.ui-standalone .brand { font: 750 27px/1 var(--ui-font); letter-spacing: -.055em; margin-bottom: 24px; }
.ui-standalone .brand span { color: var(--accent); }
.ui-standalone .panel, .ui-login form { padding: 28px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: none; }
.ui-standalone h1 { font: 700 30px/1.2 var(--ui-font); letter-spacing: -.03em; text-transform: none; margin-bottom: 14px; }
.ui-standalone p, .ui-standalone .hint { color: var(--text2); font-size: 15px; line-height: 1.6; }
.ui-standalone input, .ui-standalone textarea { background: var(--bg); color: var(--text); border: 1px solid var(--ui-input-border); border-radius: var(--radius-sm); font: 400 16px/1.5 var(--ui-font); min-height: 48px; padding: 12px; }
.ui-standalone .btn, .ui-login button { background: var(--accent); color: var(--text-inverse); border: 1px solid var(--accent); font: 600 15px/1.4 var(--ui-font); min-height: 46px; padding: 11px 16px; border-radius: var(--radius-sm); text-transform: none; letter-spacing: 0; box-shadow: none; }
.ui-standalone .btn.secondary { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.ui-login form { max-width: 420px; }
.ui-login label { color: var(--text2); font-size: 14px; font-weight: 550; text-transform: none; letter-spacing: 0; margin: 20px 0 8px; }
.ui-login .err { color: var(--red); font-size: 14px; }

/* Loading/error states reserve useful space without flashing the entire page. */
.ui-loading-card { grid-column: 1/-1; display: grid; place-items: center; gap: var(--space-4); min-height: 180px; padding: var(--space-6); background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); color: var(--text2); font-size: var(--text-control); text-align: center; }
.ui-loading-card::before { content: ''; width: 28px; height: 28px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: ui-progress 900ms linear infinite; }
@keyframes ui-progress { to { transform: rotate(360deg); } }
.ui-load-notice { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); width: min(calc(100% - 36px),1124px); margin: var(--space-4) auto 0; padding: var(--space-4); border: 1px solid var(--red); border-radius: var(--radius-sm); background: var(--red-soft); }
.ui-load-notice p { flex: 1 1 240px; color: var(--text); font-size: var(--text-control); line-height: 1.5; }
.ui-load-notice .btn { flex-shrink: 0; }
.cook-ingredients ul { list-style: none; padding: 0; margin: var(--space-3) 0 0; }
.cook-ingredients li { padding: var(--space-2) 0; border-bottom: 1px solid var(--border-soft); }
.cook-ingredients li:last-child { border-bottom: 0; }

@media (hover: hover) {
  .btn-primary:hover, .btn-add:not(.added):hover, .bsv2-primary-button:hover, .bsv2-add-button:hover { background: var(--accent-hover); color: var(--text-inverse); border-color: var(--accent-hover); }
  .btn-secondary:hover, .outline-control:hover, .cat-chip:hover, .ui-icon-button:not(:disabled):hover, .bsv2-secondary-button:hover { background: var(--surface-3); color: var(--text); }
  .ui-title-button:hover { color: var(--accent); }
  .tab:hover, .account-button:hover { background: var(--surface); }
}
@media (min-width: 700px) {
  .recipe-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .recipe-card-inner { height: 100%; display: flex; flex-direction: column; align-items: stretch; }
  .recipe-body { flex: 1; }
  .recipe-filter-toolbar { flex-direction: row; align-items: flex-start; }
  .recipe-filter-toolbar .category-bar { display: flex; flex: 1; }
  .ui-sort-control { flex-shrink: 0; align-self: flex-start; }
  .detail-media.detail-photo-hero { height: 340px; }
  .chat-composer-footer { flex-direction: row; align-items: center; justify-content: space-between; }
  .chat-import-actions, .chat-import-actions .btn { width: auto; }
  .bsv2-toolbar { flex-direction: row; align-items: center; justify-content: space-between; }
  .bsv2-toolbar-actions { width: auto; }
  .bsv2-store-filter select { flex: 0 1 280px; }
  .bsv2-item { grid-template-columns: 44px minmax(0,1fr) 120px 44px; padding: 14px 18px; gap: 16px; }
  .bsv2-more-button { width: 44px; }
  .bsv2-item-amount { max-width: none; }
  .bottom-sheet { bottom: auto; top: 50%; max-height: calc(100dvh - 80px); border: 1px solid var(--border); border-radius: 16px; padding: 24px; }
  .bottom-sheet.active { transform: translate(-50%,-50%); }
  .sheet-handle, .bsv2-sheet-handle { display: none; }
  .bsv2-sheet { max-height: calc(100dvh - 80px); border-radius: 16px; padding: 24px; }
}
@media (min-width: 960px) {
  :root { --bottom-nav-h: 0px; }
  .container { padding: 40px 28px; }
  .ui-app-header-inner { min-height: 76px; padding: 0 28px; }
  .tabs { top: 0; left: 50%; right: auto; bottom: auto; transform: translateX(-50%); width: 510px; height: 76px; padding: 12px 0; border: 0; background: transparent; gap: 6px; }
  .tabs .tab { flex-direction: row; gap: 8px; min-height: 48px; font-size: 14px; }
  .tab-icon svg { width: 20px; height: 20px; }
  .tabs .tab.active { background: var(--surface-2); color: var(--text); }
  .tabs .tab.active .tab-icon { color: var(--accent); }
  .ui-page-head { margin-bottom: 30px; }
  .ui-page-head h1 { font-size: 34px; }
  .ui-page-head p { font-size: 15px; }
  .recipe-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 24px; }
  .recipe-media:not(.no-photo), .recipe-media.preserve-photo { height: 214px; min-height: 214px; }
  #tab-weekplan .container, #tab-shopping .container { max-width: 940px; }
  #tab-discovery .container { max-width: 880px; padding-top: 40px; }
  #tab-discovery .discover-photo { height: 360px; }
  .discovery-mode-tabs { max-width: 420px; }
  .chat-import-panel { padding: 28px; }
  .plan-card, .plan-grid.sort-mode .plan-card { flex-direction: row; align-items: center; padding: 20px; }
  .plan-card-link { flex: 1; }
  .plan-card-controls { flex: 0 0 auto; }
  .cooked-item-info { flex: 1; min-width: 0; }
  .bsv2-sheet { align-self: center; margin: auto; }
}
@media (max-width: 370px) {
  .container { padding-left: 14px; padding-right: 14px; }
  .ui-page-head { gap: 10px; }
  .ui-page-head h1 { font-size: 25px; }
  .ui-page-head .btn { padding-left: 10px; padding-right: 10px; font-size: 13px; }
  .bsv2-toolbar-actions { gap: 6px; }
  .bsv2-toolbar-actions .bsv2-add-button { font-size: 13px; padding: 10px; }
  .bsv2-toolbar-actions .bsv2-secondary-button { padding: 10px 8px; }
  .bsv2-item { grid-template-columns: 40px minmax(0,1fr) auto 32px; gap: 6px; padding-right: 6px; }
  .bsv2-item-amount { max-width: 62px; font-size: 12px; }
  .detail-rating-stars .flame { width: 40px; padding: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

#tab-discovery.active.discovery-card-mode { min-height: calc(100dvh - var(--bottom-nav-h) - env(safe-area-inset-bottom, 0px) - env(safe-area-inset-top, 0px)); }
#tab-discovery.active.discovery-card-mode .container { min-height: inherit; padding-bottom: max(12px, env(safe-area-inset-bottom, 0px)); }
#tab-discovery.active.discovery-card-mode .discover-shell.is-card { min-height: 0; }
@media (max-width: 700px) and (orientation: portrait) and (min-height: 620px) {
  #tab-discovery.active.discovery-card-mode { height: calc(100dvh - var(--bottom-nav-h) - env(safe-area-inset-bottom, 0px) - env(safe-area-inset-top, 0px)); overflow: hidden; }
  #tab-discovery.active.discovery-card-mode .container { height: 100%; display: flex; flex-direction: column; overflow: hidden; }
  #tab-discovery.active.discovery-card-mode .discover-shell.is-card { flex: 1; overflow: hidden; }
  #tab-discovery.active.discovery-card-mode .discover-card { flex: 1; display: flex; flex-direction: column; overflow: visible; }
  #tab-discovery.active.discovery-card-mode .discover-card-swipe { flex: 1; }
  #tab-discovery.active.discovery-card-mode .discover-photo { height: 100%; min-height: 280px; }
}
@media (max-width: 700px) and (max-height: 619px), (max-width: 700px) and (orientation: landscape) {
  #tab-discovery.active.discovery-card-mode { height: auto; overflow: visible; }
  #tab-discovery.active.discovery-card-mode .container { height: auto; display: block; overflow: visible; }
  #tab-discovery.active.discovery-card-mode .discover-shell.is-card { display: flex; overflow: visible; }
  #tab-discovery.active.discovery-card-mode .discover-card { display: block; flex: none; }
  #tab-discovery.active.discovery-card-mode .discover-card-swipe { display: block; }
  #tab-discovery.active.discovery-card-mode .discover-photo { height: clamp(280px, 70vw, 420px); min-height: 280px; }
}
@media (min-width: 701px) {
  #tab-discovery .discover-shell.is-card { max-width: 560px; }
  #tab-discovery .discover-photo { height: clamp(420px, calc(100dvh - 260px), 680px); }
}

.detail-hero > .detail-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; margin: 20px 18px 0; padding: 0; border: 0; }
.detail-hero > .detail-actions .btn { min-width: 0; min-height: 46px; padding: 10px 7px; font-size: 13px; }
.detail-hero > .detail-actions .btn-cookmode-start { grid-column: auto; }
.detail-hero > .detail-actions.archived { grid-template-columns: 1fr; }
.detail-content .detail-rating-section { margin: 24px 0; padding-top: 20px; }
.ui-rating-label { font: 600 15px/1.5 var(--ui-font); color: var(--text2); margin-bottom: 12px; }
@media (max-width: 370px) { .detail-hero > .detail-actions .btn { font-size: 12px; gap: 4px; } }

/* Focused recipe views keep their own back action, not a second brand header. */
.ui-recipe-view > .ui-app-header { display: none; }
.bsv2-field input::placeholder, .bsv2-field textarea::placeholder { color: var(--text2); opacity: 1; }

/* Compact recipe library: selected design, September 2026. */
.ui-page-head > .ui-settings-button { order: 2; margin-left: auto; }
.ui-settings-button { width: 44px; height: 44px; min-width: 44px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text2); }
.ui-settings-button svg { width: 21px; height: 21px; }
.ui-page-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
#tab-recipes .container { padding-top: 12px; padding-bottom: 16px; }
#tab-recipes .ui-page-head { gap: 8px; margin-bottom: 16px; }
.ui-recipe-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.ui-recipe-heading h1 { margin: 0; }
.ui-recipe-heading p { white-space: nowrap; }
#tab-recipes .recipe-toolbar { margin-bottom: 12px; }
#tab-recipes .recipe-filter-toolbar { flex-wrap: nowrap; margin-bottom: 12px; }
#tab-recipes .category-bar { display: block; min-width: 0; }
.ui-category-select { max-width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font: 550 14px var(--ui-font); }
#tab-recipes .ui-sort-control { min-height: 44px; white-space: nowrap; align-self: center; }
#recipeGrid { grid-template-columns: minmax(0,1fr); gap: 0; }
#recipeGrid .recipe-card { position: relative; border: 0; border-bottom: 1px solid var(--border-soft); border-radius: 0; background: transparent; padding: 8px 0; box-shadow: none; }
#recipeGrid .recipe-card-inner { display: grid; grid-template-columns: 100px minmax(0,1fr); gap: 12px; align-items: center; min-height: 100px; padding-right: 44px; }
.recipe-list-thumbnail { width: 100px; height: 100px; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
#recipeGrid .recipe-body { display: block; padding: 0; min-width: 0; }
#recipeGrid .recipe-title { margin: 0; font-size: 17px; line-height: 1.3; letter-spacing: -.025em; }
#recipeGrid .ui-title-button { min-height: 44px; }
#recipeGrid .recipe-meta, #recipeGrid .tags, #recipeGrid .rating-badge, #recipeGrid .source-badge, #recipeGrid .recipe-body .recipe-actions, #recipeGrid .recipe-card-top > .icon-btn { display: none; }
#recipeGrid .recipe-fav { position: absolute; top: 50%; right: 0; transform: translateY(-50%); border: 0; background: transparent; backdrop-filter: none; box-shadow: none; }
#recipeGrid .archive-card .recipe-card-inner { padding-right: 0; }
#recipeGrid .archive-card > .recipe-actions { padding: 8px 0 0 112px; }
@media (max-width: 370px) {
  #tab-recipes .ui-page-head h1 { font-size: 23px; }
  .ui-page-actions { gap: 5px; }
  #recipeGrid .recipe-card-inner { grid-template-columns: 82px minmax(0,1fr); gap: 10px; min-height: 90px; }
  .recipe-list-thumbnail { width: 82px; height: 90px; }
  #recipeGrid .recipe-title { font-size: 16px; }
}
@media (min-width: 700px) {
  #recipeGrid { grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 28px; }
}
@media (min-width: 960px) {
  .app-content { padding-top: 76px; }
  .tabs { background: var(--bg); }
}

.recipe-list-thumbnail img { object-fit: cover; object-position: center; }

/* Recovery remains legible in the shared dark theme, including historical error states. */
#tab-discovery .discover-error .discover-copy { color: var(--text2); }
#tab-discovery .discover-status-row span:first-child { color: var(--text2); }
#tab-discovery .discover-recovery { border-color: var(--border); }
#tab-discovery .discover-recovery .discover-state-icon { color: var(--accent); margin-bottom: 12px; }
#tab-discovery .discover-recovery h3 { line-height: 1.3; overflow-wrap: anywhere; }
#tab-discovery .discover-recovery-actions { display: grid; gap: 10px; margin-top: 20px; }
#tab-discovery .discover-recovery-actions .btn { margin-top: 0; min-height: 46px; white-space: normal; }
#tab-discovery .discover-preserved-note { color: var(--text); font-size: 14px; }
#tab-discovery .discover-billing-help { margin-top: 18px; color: var(--text2); font-size: 14px; }
#tab-discovery .discover-billing-help summary { min-height: 44px; padding: 10px 0; cursor: pointer; color: var(--text); }
#tab-discovery .discover-billing-help p { margin-top: 8px; font-size: 14px; }
#tab-discovery .discover-billing-help a { margin-top: 12px; }
#tab-discovery .discover-recovery-note, #tab-discovery .discover-connection-note { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text2); font-size: 13px; flex-shrink: 0; }
#tab-discovery .discover-recovery-note .btn, #tab-discovery .discover-connection-note .btn { flex-shrink: 0; min-height: 44px; font-size: 13px; padding: 8px 10px; }
#tab-discovery .discover-connection-note { flex-wrap: wrap; }
