/* ============================================================================
   HAPLY DESIGN SYSTEM — TOKENS
   Single source of truth for the web app today and the Flutter app next.
   Semantic names map 1:1 to Flutter ThemeData / ColorScheme / TextTheme.
   Drop-in: paste this :root into public/style.css (replacing the old :root).
   ========================================================================== */

/* Brand display face — self-hosted (OFL). Flutter: bundle the TTF.
   Place the woff2 next to your stylesheet (here: ./fonts/). */
@font-face {
  font-family: "Young Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/young-serif-v2-latin.woff2") format("woff2");
}

:root {
  /* ---- Colour · semantic (→ Flutter ColorScheme) -------------------------- */
  --color-bg:             #f6f3ee;  /* warm off-white page          → scaffoldBackground */
  --color-surface:        #ffffff;  /* cards / sheets               → surface */
  --color-surface-alt:    #efebe3;  /* admin / neutral back-office  → surfaceVariant */
  --color-surface-tint:   #fdf1e8;  /* warm peach wash (active/imp) → primaryContainer-ish */
  --color-ink:            #2a2622;  /* primary text (warm near-black) → onSurface */
  --color-muted:          #6f675c;  /* secondary text — AA on white  → onSurfaceVariant */
  --color-faint:          #9a9185;  /* tertiary / placeholders (large only) */
  --color-line:           #e7e1d7;  /* borders / dividers            → outlineVariant */
  --color-line-strong:    #d7cfc1;  /* stronger divider / input border */

  --color-primary:        #e07a3f;  /* brand orange (fills)          → primary */
  --color-primary-pressed:#c25f28;  /* hover / pressed               → primary (dark state) */
  --color-primary-ink:    #a8511d;  /* accent TEXT on white — AA     → (links) */
  --color-on-primary:     #ffffff;  /*                               → onPrimary */

  --color-success:        #2e7d4f;  /*                               → tertiary / success */
  --color-success-tint:   #e6f0e9;
  --color-danger:         #b83a2b;  /* destructive — AA on white     → error */
  --color-danger-tint:    #fbe9e6;
  --color-on-danger:      #ffffff;  /*                               → onError */

  /* labelled status palette (the consolidated chip variants) */
  --color-info:           #355f9e;  /* "shared / gedeeld"            (AA text on white) */
  --color-info-tint:      #eaf1fb;
  --color-ai:             #6b3fa0;  /* AI / category                 */
  --color-ai-tint:        #f0e6fc;

  --color-focus:          #1f6feb;  /* focus ring — distinct from brand */

  /* ---- Typography (→ Flutter TextTheme) ---------------------------------- */
  --font-display: "Young Serif", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-body:    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono:    ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* size · line-height · weight — referenced via the .t-* classes in components.css */
  --type-display-size: 2.5rem;   --type-display-lh: 1.08;  --type-display-weight: 400;  /* displayLarge  · serif */
  --type-title-size:   2rem;     --type-title-lh:   1.12;  --type-title-weight:   400;  /* headlineMedium· serif */
  --type-heading-size: 1.5rem;   --type-heading-lh: 1.18;  --type-heading-weight: 400;  /* headlineSmall · serif */
  --type-subhead-size: 1.125rem; --type-subhead-lh: 1.3;   --type-subhead-weight: 700;  /* titleMedium   · sans  */
  --type-body-size:    1rem;     --type-body-lh:    1.5;   --type-body-weight:    400;  /* bodyLarge     · sans  */
  --type-bodysm-size:  0.875rem; --type-bodysm-lh:  1.45;  --type-bodysm-weight:  400;  /* bodyMedium    · sans  */
  --type-caption-size: 0.75rem;  --type-caption-lh: 1.35;  --type-caption-weight: 600;  /* labelSmall    · sans  */

  /* ---- Spacing scale (→ Flutter SizedBox / EdgeInsets) ------------------- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* ---- Radius (→ Flutter BorderRadius) ----------------------------------- */
  --radius-sm:   10px;   /* controls: buttons, inputs, chips-square */
  --radius-md:   14px;   /* cards (today's --radius) */
  --radius-lg:   20px;   /* sheets, large media, cook cards */
  --radius-pill: 999px;  /* pills, chips, avatars */

  /* ---- Elevation (→ Flutter BoxShadow) ----------------------------------- */
  --elevation-flat: none;
  --elevation-card: 0 6px 18px rgba(42, 38, 34, 0.08);
  --elevation-pop:  0 8px 24px rgba(42, 38, 34, 0.12);
  --elevation-nav:  0 -2px 14px rgba(42, 38, 34, 0.06);   /* bottom nav (upward) */

  /* ---- Motion (→ Flutter Duration / Curve) ------------------------------- */
  --motion-fast: 120ms;
  --motion-base: 200ms;
  --motion-slow: 350ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);   /* standard ease-out */
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  /* import-stepper's bespoke eased-fill curve is documented as an exception */

  /* ---- Layout ------------------------------------------------------------ */
  --shell-max: 1080px;          /* desktop content column */
  --tap-min: 44px;              /* minimum touch target (48 preferred) */
  --topbar-h: 60px;
  --bottomnav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* density knob — admin back-office sets this tighter */
  --density: 1;
}

/* Back-office density variant: same tokens, denser surface + spacing.
   Apply by adding `data-density="compact"` to a subtree (e.g. the admin shell). */
[data-density="compact"] {
  --color-bg: var(--color-surface-alt);
  --space-5: 16px;
  --space-6: 24px;
  --radius-md: 12px;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-fast: 0ms;
    --motion-base: 0ms;
    --motion-slow: 0ms;
  }
}

/* ============================================================================
   LEGACY RULES (pre-rework) — kept until each screen is migrated, then deleted.
   New component/screen rules are appended AFTER these so they win the cascade.
   ========================================================================== */
* { box-sizing: border-box; }
/* The [hidden] attribute must win over any element's explicit display value
   (e.g. .menu-dropdown{display:grid}) — otherwise "hidden" elements stay visible. */
[hidden] { display: none !important; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--color-bg); color: var(--color-ink); line-height: 1.5; }
a { color: var(--color-primary-pressed); }
.muted { color: var(--color-muted); }
.small { font-size: 0.85rem; }
.error { color: var(--color-danger); }
.ok-text { color: var(--color-success); }

button { font: inherit; cursor: pointer; border: none; border-radius: 10px; padding: 0.55rem 1rem; background: #efe9e1; color: var(--color-ink); font-weight: 600; transition: background 0.15s, transform 0.1s; }
button:hover { background: #e6ded2; }
button.primary { background: var(--color-primary); color: #fff; }
button.primary:hover { background: var(--color-primary-pressed); }
button:disabled { opacity: 0.5; cursor: default; }
button.link-btn { background: none; color: var(--color-primary-pressed); padding: 0; text-decoration: underline; }
.icon-btn { background: none; font-size: 1.3rem; padding: 0.2rem 0.5rem; }

input, textarea, select { font: inherit; width: 100%; padding: 0.55rem 0.7rem; border: 1px solid var(--color-line); border-radius: 10px; background: #fff; color: var(--color-ink); }

.card { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-md); padding: 1.5rem; margin-bottom: 1.2rem; }
.card h3 { margin-top: 0; }
.card label { display: grid; gap: 0.3rem; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.8rem; }

/* ---- Login ---- */

/* ---- Topbar ---- */
.brand { font-size: 1.25rem; font-weight: 800; text-decoration: none; color: var(--color-ink); white-space: nowrap; }
.topbar-search { flex: 1; max-width: 520px; }
.topbar-search input { border-radius: 999px; }
.topbar-actions { display: flex; align-items: center; gap: 0.6rem; margin-left: auto; }
.menu { position: relative; }

main { max-width: 1040px; margin: 0 auto; padding: 1.5rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.6rem; }
.section-head h2, .section-head h3 { margin: 0; }

/* ---- Folders ---- */

/* ---- Recipe grid ---- */
.recipe-card { background: #fff; border: 1px solid var(--color-line); border-radius: var(--radius-md); overflow: hidden; text-decoration: none; color: inherit; display: flex; flex-direction: column; transition: transform 0.12s, box-shadow 0.12s; }
.recipe-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.08); }
.recipe-card.dragging { opacity: 0.4; }

/* ---- Tag chips ---- */
.tag-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.tag-input { width: auto; min-width: 90px; padding: 0.25rem 0.5rem; border-radius: 999px; }

/* ---- Detail ---- */
.breadcrumb { font-size: 0.9rem; margin-bottom: 0.8rem; color: var(--color-muted); }
.breadcrumb a { text-decoration: none; }
.breadcrumb .sep { margin: 0 0.4rem; }
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.cover { width: 100%; max-height: 360px; object-fit: cover; border-radius: var(--radius-md); margin-bottom: 1rem; }
.source-link { margin: 0.4rem 0 0.8rem; }
.source-link a { display: inline-block; padding: 0.35rem 0.8rem; background: #fff3ec; border: 1px solid var(--color-line); border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.meta-edit { display: flex; gap: 1.5rem; flex-wrap: wrap; margin: 1rem 0; padding: 1rem; background: #fff; border: 1px solid var(--color-line); border-radius: var(--radius-md); }
.cb-select { max-width: 280px; }
.recipe-cols { display: grid; grid-template-columns: 1fr 1.6fr; gap: 2rem; margin-top: 1rem; }
@media (max-width: 700px) { .recipe-cols { grid-template-columns: 1fr; } }
.portions { display: flex; align-items: center; gap: 0.4rem; margin: 0.2rem 0 0.6rem; font-weight: 600; font-size: 0.9rem; }
.portions button { width: 32px; height: 32px; padding: 0; border-radius: 8px; font-size: 1.1rem; }
.portions input { width: 56px; text-align: center; padding: 0.35rem; font-weight: 700; }
.ingredients { list-style: none; padding: 0; margin: 0.5rem 0; }
.ingredients li { padding: 0.3rem 0; border-bottom: 1px dashed var(--color-line); display: flex; align-items: center; gap: 0.6rem; }
.ing-ic { width: 30px; height: 30px; flex-shrink: 0; display: grid; place-items: center; }
.ing-ic svg, .ing-ic img { width: 30px; height: 30px; object-fit: contain; }
.cook-ing-img img, .log-ic img, .ing-cell-img img, .cat-ic img { width: 100%; height: 100%; object-fit: contain; }
.ing-txt { flex: 1; }
.qty { font-weight: 700; color: var(--color-primary-pressed); margin-right: 0.3rem; }
.steps { padding-left: 1.2rem; display: grid; gap: 0.9rem; }
.step-img { width: 100%; max-width: 320px; border-radius: 10px; margin-top: 0.5rem; }
h4 { margin: 1rem 0 0.3rem; }

/* ---- Modal ---- */
.import-row { display: flex; gap: 0.6rem; margin-bottom: 1rem; }
.import-row input { flex: 1; }

/* ---- Import stepper ---- */
.imp-steps { display: grid; gap: 0.7rem; margin-top: 0.5rem; }
.imp-step { display: flex; align-items: center; gap: 0.8rem; opacity: 0.5; transition: opacity 0.3s; }
.imp-step.active, .imp-step.done, .imp-step.skipped, .imp-step.failed { opacity: 1; }
.imp-icon { width: 38px; height: 38px; flex-shrink: 0; color: var(--color-muted); border-radius: 50%; background: var(--color-bg); display: grid; place-items: center; }
.imp-step.active .imp-icon { color: var(--color-primary); background: #fff3ec; }
.imp-step.done .imp-icon { color: var(--color-success); }
.imp-step.failed .imp-icon { color: var(--color-danger); }
.imp-body { flex: 1; }
.imp-label { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.2rem; }
.imp-bar { height: 6px; background: var(--color-line); border-radius: 999px; overflow: hidden; }
.imp-fill { height: 100%; width: 0; background: var(--color-primary); border-radius: 999px; }
.imp-step.done .imp-fill { background: var(--color-success); }
.imp-step.skipped .imp-fill { background: var(--color-line); }
.imp-step.skipped { opacity: 0.7; }
.imp-state { font-weight: 700; width: 20px; text-align: center; }

/* ---- Category badge ---- */
.cat-badge { display: inline-flex; align-items: center; gap: 0.4rem; background: #fff3ec; border: 1px solid var(--color-line); border-radius: 999px; padding: 0.2rem 0.7rem 0.2rem 0.3rem; font-weight: 700; font-size: 0.85rem; text-transform: capitalize; }
.cat-ic { width: 26px; height: 26px; display: grid; place-items: center; }
.cat-ic svg { width: 26px; height: 26px; }

/* ---- Tag autocomplete + colour ---- */
.tag-ac-wrap { position: relative; display: inline-block; }
.tag-ac { position: absolute; left: 0; top: 110%; background: #fff; border: 1px solid var(--color-line); border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,0.1); z-index: 50; min-width: 160px; max-height: 200px; overflow: auto; }
.tag-ac button { display: flex; align-items: center; gap: 0.4rem; width: 100%; text-align: left; background: none; border: none; border-radius: 0; padding: 0.45rem 0.7rem; }
.tag-ac button:hover { background: var(--color-bg); }
.tag-ac .dot { width: 12px; height: 12px; border-radius: 50%; }
.tag-chip.editable { cursor: pointer; }
.tag-color-input { width: 0; height: 0; opacity: 0; position: absolute; }

/* ---- Cost + prompt ---- */
.usage-table td.cost { white-space: nowrap; }
.prompt-btn { font-size: 0.75rem; padding: 0.1rem 0.5rem; }
.prompt-pre { white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, Menlo, monospace; font-size: 0.8rem; background: var(--color-bg); padding: 1rem; border-radius: 10px; max-height: 60vh; overflow: auto; }

/* ---- AI usage chart ---- */
.chart-controls { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 0.8rem 0 0.4rem; }
.chart-controls label { display: inline-flex; align-items: center; gap: 0.3rem; font-weight: 600; }
.chart-controls input[type=date] { width: auto; }
.seg { display: inline-flex; border: 1px solid var(--color-line); border-radius: 999px; overflow: hidden; }
.seg button { background: #fff; border: none; border-radius: 0; padding: 0.35rem 0.8rem; font-size: 0.85rem; }
.seg button.active { background: var(--color-primary); color: #fff; }
.ai-chart { margin: 0.4rem 0 1rem; }
.chart-svg { width: 100%; height: auto; }

/* ---- Social platforms ---- */
.platform { border: 1px solid var(--color-line); border-radius: 12px; padding: 0.9rem 1.1rem; margin-bottom: 0.8rem; }
.platform-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.platform-head .switch-row { margin-bottom: 0 !important; }
.platform-config { margin-top: 0.6rem; display: grid; gap: 0.6rem; }
.platform-config label { display: grid; gap: 0.2rem; font-weight: 600; }
.pf-msg { margin: 0.4rem 0 0; }
.pf-help { margin-top: 0.6rem; font-size: 0.85rem; }
.pf-help summary { cursor: pointer; color: var(--color-primary-pressed); font-weight: 600; }
.pf-help pre { white-space: pre-wrap; background: var(--color-bg); padding: 0.7rem 0.9rem; border-radius: 8px; margin-top: 0.4rem; font-size: 0.82rem; line-height: 1.5; }
.err-tag { color: var(--color-danger); font-weight: 700; }

/* ---- AI admin page ---- */
.log-ic { display: inline-block; width: 26px; height: 26px; vertical-align: middle; margin-right: 0.4rem; }
.log-ic svg { width: 26px; height: 26px; }
.pg-out { margin-top: 0.8rem; }
.pg-img { max-width: 256px; border-radius: 12px; border: 1px solid var(--color-line); }
.ing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 0.8rem; max-height: 480px; overflow: auto; padding: 0.3rem; }
.ing-cell { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; border: 1px solid var(--color-line); border-radius: 12px; padding: 0.7rem 0.5rem; background: #fff; }
.ing-cell-img { width: 60px; height: 60px; display: grid; place-items: center; flex-shrink: 0; }
.ing-cell-img svg, .ing-cell-img img { width: 56px; height: 56px; object-fit: contain; display: block; }
.ing-cell-name { font-size: 0.8rem; font-weight: 600; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ing-cell-actions { display: flex; justify-content: center; gap: 0.5rem; }

/* ---- Admin dashboard tiles ---- */
.admin-tile { display: flex; align-items: center; gap: 0.9rem; background: #fff; border: 1px solid var(--color-line); border-radius: var(--radius-md); padding: 1.1rem 1.2rem; text-decoration: none; color: inherit; transition: transform 0.1s, box-shadow 0.1s; }
.admin-tile:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.08); }
#pg-model, #m-recipe, #m-icon, #m-cookbook { max-width: 360px; }

/* ---- Custom dialogs ---- */
.modal.dialog { width: min(420px, 95vw); }
.modal.dialog h2 { margin-top: 0; font-size: 1.2rem; }
.modal.dialog .dlg-input { margin: 0.6rem 0 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.6rem; }

/* ---- Cook mode: see the COOK MODE block in screens.css (legacy removed) ---- */

/* ---- Admin ---- */


/* ---- AI usage / admin extras ---- */
.ai-badge { display: inline-block; font-size: 0.78rem; background: #efe2ff; color: #6b3fa0; padding: 0.15rem 0.55rem; border-radius: 999px; font-weight: 700; }
.ai-steps { margin: 0.4rem 0 0.8rem; font-size: 0.85rem; color: var(--color-muted); }
.ai-steps .ai-badge { margin-right: 0.3rem; }
.stat-row { display: flex; flex-wrap: wrap; gap: 1.5rem; margin: 0.5rem 0 1rem; }
.stat { background: var(--color-bg); border-radius: 10px; padding: 0.6rem 1rem; }
.stat b { display: block; font-size: 1.4rem; }
.usage-table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
.usage-table th, .usage-table td { text-align: left; padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--color-line); font-size: 0.85rem; }
.usage-table th { color: var(--color-muted); font-size: 0.75rem; text-transform: uppercase; }

/* ---- Cookbook cover image (custom upload / AI) ---- */

/* Cookbook detail header: cover + title + actions on one line. */

/* legacy .appx-* removed — appearance now styled only by screens.css + POLISH below */

/* ---- Admin re-trigger actions on a recipe ---- */
.admin-actions { margin-top: 1.5rem; }
.admin-actions h3 { margin-bottom: 0.3rem; }
.admin-actions-btns { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 0.6rem; }
.admin-actions-btns button[disabled] { opacity: 0.5; cursor: default; }
.ok-text { color: var(--color-success); }

/* ---- Icon-add dialog with progress ---- */
.icon-add .ia-input-row { display: flex; gap: 0.5rem; }
.icon-add .ia-input-row input { flex: 1; }
.ia-progress { margin-top: 1rem; }
.ia-bar { height: 8px; background: var(--color-line); border-radius: 999px; overflow: hidden; }
.ia-fill { height: 100%; width: 0; background: var(--color-primary); border-radius: 999px; }
.ia-phase { margin: 0.5rem 0 0; }
.ia-result { display: grid; place-items: center; gap: 0.5rem; margin-top: 1rem; text-align: center; }
.ia-icon { width: 88px; height: 88px; display: grid; place-items: center; }
.ia-icon svg, .ia-icon img { width: 84px; height: 84px; object-fit: contain; }
.ia-footer { justify-content: space-between; align-items: center; }

/* ---- Source re-import log ---- */
.reimport-log { max-height: 50vh; overflow: auto; margin: 0.5rem 0; border: 1px solid var(--color-line); border-radius: 10px; padding: 0.5rem 0.8rem; }
.ri-row { padding: 0.3rem 0; border-bottom: 1px solid var(--color-line); font-size: 0.85rem; }
.ri-row:last-child { border-bottom: 0; }
.ri-row.done .ri-ic { color: var(--color-success); }
.ri-row.failed .ri-ic { color: var(--color-danger); }
.ri-summary { margin-top: 0.7rem; font-weight: 700; }

/* ---- Admin recipe inspector ---- */
.insp-ings { list-style: none; padding: 0; margin: 0.5rem 0; }
.insp-ings li { padding: 0.3rem 0; border-bottom: 1px dashed var(--color-line); }
.insp-canon { color: var(--color-muted); font-size: 0.8rem; margin-left: 0.4rem; }

/* ---- Category quick-filter (home) ---- */
.cat-filter { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 1rem; }

/* ---- Parse-method tag (admin) ---- */
.method-tag { font-size: 0.75rem; font-weight: 700; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--color-line); color: var(--color-ink); white-space: nowrap; }
.method-ai { background: #fff3ec; color: var(--color-primary-pressed); }
.method-eigen { background: #e7f0e9; color: var(--color-success); }
.method-structuur { background: #eef0f5; color: #3f6bb5; }
.method-handmatig { background: var(--color-line); color: var(--color-muted); }

/* ---- "New cookbook" tile (last in the cookbooks grid) ---- */

/* ---- Admin inspector link on the normal recipe page ---- */

/* ---- Shared recipes (account links) ---- */
/* "Gedeeld door X" badge on a recipe tile + a subtle tint so shared recipes
   read as not-quite-mine in the list. */
/* Keep the edit-title pencil next to the title; cook button stays on the right. */
.detail-head #edit-title-btn { margin-right: auto; margin-left: -0.4rem; }

/* ---- Account-link controls in settings ---- */
.link-group { margin-bottom: 0.8rem; }
.link-group h4 { margin: 0 0 0.3rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--color-muted); }
.link-add { display: flex; gap: 0.5rem; margin-top: 0.8rem; flex-wrap: wrap; }
.link-add select, .link-add input { padding: 0.5rem; }
.link-add input { flex: 1; min-width: 180px; }

/* ---- Notification bell + pending link-request pop-over ---- */
.bell-badge { position: absolute; top: -2px; right: -2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--color-danger); color: #fff; font-size: 0.66rem; font-weight: 700; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px #fff; }
.bell-popover { min-width: 300px; max-width: 360px; padding: 0.4rem 0; max-height: 70vh; overflow: auto; }
.bell-head { padding: 0.5rem 1rem; font-weight: 700; border-bottom: 1px solid var(--color-line); }
.bell-empty { padding: 0.8rem 1rem; margin: 0; }
.bell-item { padding: 0.7rem 1rem; border-bottom: 1px solid var(--color-line); display: grid; gap: 0.5rem; }
.bell-item:last-child { border-bottom: none; }
.bell-actions { display: flex; gap: 0.5rem; }
.bell-actions button { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
.bell-actions .bell-no { background: none; color: var(--color-danger); border: 1px solid var(--color-line); }

/* ---- Import step counter + multi-image steps ---- */
.imp-count { color: var(--color-primary-pressed); font-weight: 700; font-size: 0.85rem; }
/* Multiple step photos stack with spacing — do NOT use flex on the <li> (it
   removes the ordered-list number marker). */
.steps li .step-img + .step-img { margin-top: 0.4rem; }
.cook-step-img + .cook-step-img { margin-top: 0.6rem; }

/* ===== components.css (design system) ===== */
/* ============================================================================
   HAPLY DESIGN SYSTEM — COMPONENTS
   Plain CSS classes built only from tokens.css. No build step, no framework.
   Every component has a 1:1 Flutter widget equivalent (noted inline).
   ========================================================================== */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--type-body-size);
  line-height: var(--type-body-lh);
  background: var(--color-bg);
  color: var(--color-ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--color-primary-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ---- Focus ring (token-driven, on every focusable thing) ----------------- */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---- Type ramp (→ Flutter TextTheme) ------------------------------------- */
.t-display { font-family: var(--font-display); font-size: var(--type-display-size); line-height: var(--type-display-lh); font-weight: var(--type-display-weight); letter-spacing: -0.01em; }
.t-title   { font-family: var(--font-display); font-size: var(--type-title-size);   line-height: var(--type-title-lh);   font-weight: var(--type-title-weight); }
.t-heading { font-family: var(--font-display); font-size: var(--type-heading-size); line-height: var(--type-heading-lh); font-weight: var(--type-heading-weight); }
.t-subhead { font-size: var(--type-subhead-size); line-height: var(--type-subhead-lh); font-weight: var(--type-subhead-weight); }
.t-body    { font-size: var(--type-body-size); line-height: var(--type-body-lh); }
.t-bodysm  { font-size: var(--type-bodysm-size); line-height: var(--type-bodysm-lh); }
.t-caption { font-size: var(--type-caption-size); line-height: var(--type-caption-lh); font-weight: var(--type-caption-weight); letter-spacing: 0.02em; }
.muted  { color: var(--color-muted); }
.faint  { color: var(--color-faint); }
.danger-text { color: var(--color-danger); }
.ok-text     { color: var(--color-success); }
h1, h2, h3, h4 { margin: 0; }

/* ---- Icon (line set) ----------------------------------------------------- */
.icon { width: 24px; height: 24px; flex-shrink: 0; display: inline-grid; place-items: center; }
.icon svg { width: 100%; height: 100%; display: block; }
.icon-sm { width: 18px; height: 18px; }
.icon-lg { width: 32px; height: 32px; }

/* ===========================================================================
   BUTTON  (→ FilledButton / OutlinedButton / TextButton / IconButton)
   =========================================================================== */
.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--tap-min); padding: 0 var(--space-4);
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--color-surface-alt); color: var(--color-ink);
  transition: background var(--motion-fast) var(--ease-out),
              transform var(--motion-fast) var(--ease-out),
              border-color var(--motion-fast) var(--ease-out);
  white-space: nowrap;
}
.btn:hover { background: #e6e0d5; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn .icon { width: 20px; height: 20px; }

.btn-primary { background: var(--color-primary); color: var(--color-on-primary); }
.btn-primary:hover { background: var(--color-primary-pressed); }

.btn-secondary { background: var(--color-surface); border-color: var(--color-line-strong); color: var(--color-ink); }
.btn-secondary:hover { background: var(--color-surface-alt); border-color: var(--color-primary); }

.btn-danger { background: var(--color-danger); color: var(--color-on-danger); }
.btn-danger:hover { background: #9e3023; }

.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--color-surface-alt); }

.btn-text { background: none; min-height: 0; padding: var(--space-1) var(--space-2); color: var(--color-primary-ink); }
.btn-text:hover { background: var(--color-surface-tint); text-decoration: none; }
.btn-text.danger { color: var(--color-danger); }

.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 var(--space-3); font-size: var(--type-bodysm-size); }

/* Icon-only button — always meets the 44px target */
.icon-btn {
  display: inline-grid; place-items: center;
  width: var(--tap-min); height: var(--tap-min); padding: 0;
  border: none; border-radius: var(--radius-pill);
  background: transparent; color: var(--color-ink); cursor: pointer;
  position: relative;
  transition: background var(--motion-fast) var(--ease-out);
}
.icon-btn:hover { background: var(--color-surface-alt); }
.icon-btn .icon { width: 22px; height: 22px; }

/* ===========================================================================
   INPUT / SELECT / TEXTAREA / STEPPER  (→ TextField / DropdownButton)
   =========================================================================== */
.field { display: grid; gap: var(--space-2); margin-bottom: var(--space-4); }
.field > .label { font-size: var(--type-bodysm-size); font-weight: 700; color: var(--color-ink); }
.field .hint { font-size: var(--type-caption-size); color: var(--color-muted); }

.input, .select, .textarea {
  font: inherit; width: 100%; color: var(--color-ink);
  min-height: var(--tap-min); padding: 0 var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-line-strong); border-radius: var(--radius-sm);
  transition: border-color var(--motion-fast) var(--ease-out), box-shadow var(--motion-fast) var(--ease-out);
}
.textarea { padding: var(--space-3); min-height: 88px; line-height: 1.5; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-surface-tint);
}
.input.error, .select.error, .textarea.error { border-color: var(--color-danger); }
.input::placeholder { color: var(--color-faint); }
.select {
  appearance: none; padding-right: var(--space-7);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236f675c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right var(--space-3) center;
}

/* search field with leading icon */
.search-field { position: relative; display: flex; align-items: center; }
.search-field .icon { position: absolute; left: var(--space-3); color: var(--color-muted); pointer-events: none; }
.search-field .input { padding-left: 46px; border-radius: var(--radius-pill); }

/* Stepper (the +/- portions control as a first-class control) */
.stepper { display: inline-flex; align-items: center; gap: var(--space-1); }
.stepper button {
  width: var(--tap-min); height: var(--tap-min); padding: 0; cursor: pointer;
  display: grid; place-items: center;
  border: 1px solid var(--color-line-strong); border-radius: var(--radius-sm);
  background: var(--color-surface); color: var(--color-ink); font: inherit;
  transition: border-color var(--motion-fast) var(--ease-out), background var(--motion-fast) var(--ease-out);
}
.stepper button:hover { border-color: var(--color-primary); color: var(--color-primary-pressed); }
.stepper button .icon { width: 20px; height: 20px; }
.stepper input {
  width: 56px; height: var(--tap-min); text-align: center; font: inherit; font-weight: 700;
  border: 1px solid var(--color-line-strong); border-radius: var(--radius-sm);
  background: var(--color-surface); color: var(--color-ink);
}
.stepper input:focus { outline: none; border-color: var(--color-primary); }

/* Toggle / switch row */
.switch { --w: 46px; --h: 28px; position: relative; width: var(--w); height: var(--h); flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; background: var(--color-line-strong); border-radius: var(--radius-pill); transition: background var(--motion-base) var(--ease-out); }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform var(--motion-base) var(--ease-out); }
.switch input:checked + .track { background: var(--color-primary); }
.switch input:checked + .track::after { transform: translateX(18px); }

/* ===========================================================================
   CARD  (→ Card)  — base + recipe / cookbook tile / admin tile
   =========================================================================== */
.card {
  background: var(--color-surface); border: 1px solid var(--color-line);
  border-radius: var(--radius-md); padding: var(--space-5);
}
.card + .card { margin-top: var(--space-4); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }

/* recipe card */
.recipe-card {
  background: var(--color-surface); border: 1px solid var(--color-line);
  border-radius: var(--radius-md); overflow: hidden; color: inherit;
  display: flex; flex-direction: column; cursor: pointer;
  transition: transform var(--motion-base) var(--ease-out), box-shadow var(--motion-base) var(--ease-out);
}
.recipe-card:hover { transform: translateY(-3px); box-shadow: var(--elevation-card); text-decoration: none; }
.recipe-card .media {
  aspect-ratio: 16 / 11; background: var(--color-surface-tint) center/cover no-repeat;
  display: grid; place-items: center; position: relative;
}
.recipe-card .media .glyph-ic { width: 56%; height: 56%; opacity: 0.9; filter: saturate(0.95); }
.recipe-card .body { padding: var(--space-3) var(--space-4) var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); flex: 1; }
.recipe-card .title { font-weight: 700; font-size: var(--type-body-size); line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.recipe-card .meta { display: flex; align-items: center; gap: var(--space-1); color: var(--color-muted); font-size: var(--type-bodysm-size); margin-top: -2px; }
.recipe-card .meta .icon { width: 15px; height: 15px; }
.recipe-card .meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--color-line-strong); margin: 0 2px; }
.recipe-card .chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: auto; padding-top: var(--space-1); }
/* status accent strip on media (replaces colour-only inset shadow) */
.recipe-card .media .ribbon { position: absolute; top: var(--space-2); left: var(--space-2); }

/* ---- cover-frame: aspect-aware image container ---- */
/* Default (landscape/square): foreground fills the slot edge-to-edge via cover-crop.
   Portrait images get the blurred-fill treatment: cf-bg injected by _cfImgLoad().
   Used by .recipe-card .media (aspect set there) and .recipe-detail (aspect below). */
.cover-frame { position: relative; overflow: hidden; background: var(--color-surface-tint); }
.cover-frame .cf-bg,
.cover-frame .cf-img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cover-frame .cf-bg { object-fit: cover; filter: blur(22px); transform: scale(1.12); z-index: 0; pointer-events: none; }
/* Default: cover-fill (landscape/square) — fills slot, no backdrop. */
.cover-frame .cf-img { object-fit: cover; z-index: 1; }
/* Portrait: full image contained on blurred backdrop (cf-bg injected on load). */
.cover-frame.is-portrait .cf-img { object-fit: contain; }
.cover-frame .ribbon { position: absolute; top: var(--space-2); left: var(--space-2); z-index: 2; }

/* cookbook tile */
.cookbook-tile {
  background: var(--color-surface); border: 1px solid var(--color-line);
  border-radius: var(--radius-md); overflow: hidden; color: inherit; cursor: pointer;
  display: flex; flex-direction: column;
  transition: transform var(--motion-base) var(--ease-out), box-shadow var(--motion-base) var(--ease-out);
}
.cookbook-tile:hover { transform: translateY(-3px); box-shadow: var(--elevation-card); text-decoration: none; }
.cookbook-tile .cover { aspect-ratio: 3 / 2; background: var(--color-primary) center/cover no-repeat; display: grid; place-items: center; }
.cookbook-tile .cover .icon { color: rgba(255,255,255,0.92); width: 34px; height: 34px; }
.cookbook-tile .body { padding: var(--space-3) var(--space-4); }
.cookbook-tile .name { font-weight: 700; }
.cookbook-tile.drop { outline: 2px dashed var(--color-primary); outline-offset: -2px; }
/* "new cookbook" tile */
.cookbook-tile.new { border-style: dashed; background: transparent; align-items: center; justify-content: center; min-height: 100%; }
.cookbook-tile.new .cover { background: var(--color-surface-alt); width: 100%; }
.cookbook-tile.new .cover .icon { color: var(--color-muted); }
.cookbook-tile.new:hover .cover .icon { color: var(--color-primary); }

/* admin tile */
.admin-tile { display: flex; align-items: center; gap: var(--space-4); background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-md); padding: var(--space-4); color: inherit; cursor: pointer; transition: transform var(--motion-base) var(--ease-out), box-shadow var(--motion-base) var(--ease-out); }
.admin-tile:hover { transform: translateY(-2px); box-shadow: var(--elevation-card); text-decoration: none; }
.admin-tile .tile-ic { width: 48px; height: 48px; border-radius: var(--radius-sm); background: var(--color-surface-tint); color: var(--color-primary-pressed); display: grid; place-items: center; flex-shrink: 0; }
.admin-tile .tile-ic .icon { width: 26px; height: 26px; }

/* ===========================================================================
   CHIP / BADGE  (ONE component, variants) (→ Chip / FilterChip)
   =========================================================================== */
.chip {
  display: inline-flex; align-items: center; gap: var(--space-1);
  font-size: var(--type-caption-size); font-weight: 600; line-height: 1;
  padding: 6px var(--space-3); border-radius: var(--radius-pill);
  border: 1px solid transparent; white-space: nowrap;
}
.chip .icon, .chip .ing-ic { width: 16px; height: 16px; }
.chip .swatch { width: 9px; height: 9px; border-radius: 50%; background: var(--chip-c, currentColor); }

/* filter (toggle) */
.chip-filter { background: var(--color-surface); border-color: var(--color-line-strong); color: var(--color-muted); cursor: pointer; min-height: 36px; transition: all var(--motion-fast) var(--ease-out); }
.chip-filter:hover { border-color: var(--color-primary); color: var(--color-primary-pressed); }
.chip-filter.on { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); }
/* category */
.chip-category { background: var(--color-surface-tint); border-color: var(--color-line); color: var(--color-ink); text-transform: capitalize; }
/* label (user tag, custom colour via --chip-c) */
.chip-label { background: color-mix(in srgb, var(--chip-c, var(--color-primary)) 16%, white); border-color: color-mix(in srgb, var(--chip-c, var(--color-primary)) 30%, white); color: color-mix(in srgb, var(--chip-c, var(--color-primary)) 70%, black); }
.chip-label .swatch { background: var(--chip-c, var(--color-primary)); }
.chip-label .x { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: rgba(0,0,0,0.12); cursor: pointer; margin-left: 2px; border: none; color: inherit; font-size: 13px; line-height: 1; padding: 0; }
/* status variants */
.chip-status { background: var(--color-surface-alt); color: var(--color-muted); }
.chip-info   { background: var(--color-info-tint); color: var(--color-info); }
.chip-ai     { background: var(--color-ai-tint); color: var(--color-ai); }
.chip-success{ background: var(--color-success-tint); color: var(--color-success); }
.chip-danger { background: var(--color-danger-tint); color: var(--color-danger); }

/* ===========================================================================
   DIALOG / MODAL  (→ showDialog)
   =========================================================================== */
.scrim { position: fixed; inset: 0; background: rgba(34, 30, 26, 0.5); z-index: 100; display: grid; place-items: end center; padding: 0; animation: scrim-in var(--motion-base) var(--ease-out); }
@media (min-width: 600px) { .scrim { place-items: center; padding: var(--space-5); } }
@keyframes scrim-in { from { opacity: 0; } }
.dialog {
  background: var(--color-surface); width: 100%; max-width: 520px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: var(--space-5);
  position: relative; max-height: 92vh; overflow: auto;
  box-shadow: var(--elevation-pop);
  animation: sheet-up var(--motion-slow) var(--ease-out);
  padding-bottom: calc(var(--space-5) + var(--safe-bottom));
}
@media (min-width: 600px) { .dialog { border-radius: var(--radius-lg); animation: dialog-in var(--motion-base) var(--ease-out); padding-bottom: var(--space-5); } }
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0.6; } }
@keyframes dialog-in { from { transform: scale(0.97); opacity: 0; } }
.dialog.sm { max-width: 420px; }
.dialog .dialog-close { position: absolute; top: var(--space-3); right: var(--space-3); }
.dialog h2 { font-family: var(--font-display); font-weight: 400; font-size: var(--type-heading-size); margin-bottom: var(--space-3); }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-3); margin-top: var(--space-5); }
.dialog-actions.spread { justify-content: space-between; align-items: center; }
@media (max-width: 480px) { .dialog-actions:not(.spread) { flex-direction: column-reverse; } .dialog-actions:not(.spread) .btn { width: 100%; } }

/* ===========================================================================
   APP SHELL · TOPBAR (desktop) + BOTTOM NAV (phone)  (→ AppBar / BottomNavBar)
   =========================================================================== */
.appbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: var(--space-3);
  height: var(--topbar-h); padding: 0 var(--space-4);
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--color-line);
}
.brand { display: inline-flex; align-items: center; gap: var(--space-2); font-family: var(--font-display); font-size: 1.4rem; color: var(--color-ink); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 30px; height: 30px; border-radius: 9px; background: var(--color-primary); display: grid; place-items: center; color: #fff; }
.brand .mark .icon { width: 19px; height: 19px; }
.appbar .topbar-search { flex: 1; max-width: 520px; display: none; }
.appbar .topbar-actions { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; }
.appbar .desktop-only { display: none; }

/* bottom nav (phone) */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; align-items: stretch;
  height: calc(var(--bottomnav-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: var(--color-surface); border-top: 1px solid var(--color-line);
  box-shadow: var(--elevation-nav);
}
.bottomnav a, .bottomnav button {
  flex: 1; border: none; background: none; cursor: pointer; color: var(--color-muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 0.66rem; font-weight: 600; font-family: var(--font-body); padding: 6px 0;
  transition: color var(--motion-fast) var(--ease-out);
}
.bottomnav a.on { color: var(--color-primary-pressed); }
.bottomnav .icon { width: 24px; height: 24px; }
/* center "+ Toevoegen" raised action */
.bottomnav .nav-add { color: var(--color-on-primary); }
.bottomnav .nav-add .fab { width: 46px; height: 46px; border-radius: var(--radius-pill); background: var(--color-primary); display: grid; place-items: center; box-shadow: 0 4px 12px rgba(224,122,63,0.4); margin-top: -18px; transition: background var(--motion-fast) var(--ease-out), transform var(--motion-fast) var(--ease-out); }
.bottomnav .nav-add:active .fab { transform: scale(0.94); }
.bottomnav .nav-add span { color: var(--color-primary-pressed); }
.bottomnav .nav-add .fab .icon { width: 26px; height: 26px; }

/* content column */
.content { max-width: var(--shell-max); margin: 0 auto; padding: var(--space-5) var(--space-4) calc(var(--bottomnav-h) + var(--safe-bottom) + var(--space-6)); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }

/* DESKTOP ≥768 — show topbar search + primary action, hide bottom nav */
@media (min-width: 768px) {
  .appbar .topbar-search { display: block; }
  .appbar .desktop-only { display: inline-flex; }
  .appbar .menu-mobile { display: none; }
  .bottomnav { display: none; }
  .content { padding: var(--space-6) var(--space-5) var(--space-7); }
}

/* ===========================================================================
   POPOVER / MENU  (anchored, viewport-safe)  (→ PopupMenu / showMenu)
   =========================================================================== */
.popover {
  position: absolute; top: calc(100% + var(--space-2)); right: 0; z-index: 50;
  background: var(--color-surface); border: 1px solid var(--color-line);
  border-radius: var(--radius-md); box-shadow: var(--elevation-pop);
  min-width: 200px; max-width: min(360px, calc(100vw - var(--space-4) * 2)); overflow: hidden;
  animation: pop-in var(--motion-fast) var(--ease-out);
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } }
.popover .menu-item { display: flex; align-items: center; gap: var(--space-3); width: 100%; text-align: left; padding: var(--space-3) var(--space-4); min-height: var(--tap-min); background: none; border: none; cursor: pointer; color: var(--color-ink); font: inherit; }
.popover .menu-item:hover { background: var(--color-surface-alt); text-decoration: none; }
.popover .menu-item .icon { width: 20px; height: 20px; color: var(--color-muted); }
.popover .menu-item.danger { color: var(--color-danger); }
.popover hr { border: none; border-top: 1px solid var(--color-line); margin: 0; }
.menu { position: relative; }

/* ===========================================================================
   BELL / NOTIFICATIONS  (→ Badge + ListTile)
   =========================================================================== */
.bell-badge { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: var(--radius-pill); background: var(--color-danger); color: #fff; font-size: 0.66rem; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--color-surface); }
.bell-popover { width: 340px; }
.bell-head { padding: var(--space-3) var(--space-4); font-weight: 700; border-bottom: 1px solid var(--color-line); }
.bell-item { padding: var(--space-4); border-bottom: 1px solid var(--color-line); display: grid; gap: var(--space-3); }
.bell-item:last-child { border-bottom: none; }
.bell-item .who { display: flex; align-items: center; gap: var(--space-2); }
.bell-item .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--color-info-tint); color: var(--color-info); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.bell-actions { display: flex; gap: var(--space-2); }

/* ===========================================================================
   LIST / LIST-ROW  (→ ListTile) + responsive table
   =========================================================================== */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: var(--space-3); min-height: var(--tap-min); padding: var(--space-3) 0; border-bottom: 1px solid var(--color-line); }
.list-row:last-child { border-bottom: none; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .row-title { font-weight: 600; }
.list-row .row-sub { color: var(--color-muted); font-size: var(--type-bodysm-size); }

/* table that collapses to cards on phone */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: var(--space-3); border-bottom: 1px solid var(--color-line); font-size: var(--type-bodysm-size); }
.data-table th { color: var(--color-muted); font-size: var(--type-caption-size); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; }
.data-table tr:hover td { background: var(--color-surface-alt); }
@media (max-width: 640px) {
  .data-table.responsive thead { display: none; }
  .data-table.responsive tr { display: grid; gap: var(--space-1); padding: var(--space-3) 0; border-bottom: 1px solid var(--color-line); }
  .data-table.responsive td { display: flex; justify-content: space-between; gap: var(--space-4); border: none; padding: 2px var(--space-1); }
  .data-table.responsive td::before { content: attr(data-label); color: var(--color-muted); font-size: var(--type-caption-size); font-weight: 700; text-transform: uppercase; }
}

/* ===========================================================================
   EMPTY / LOADING / ERROR  (reusable pattern)
   =========================================================================== */
.state { display: grid; justify-items: center; text-align: center; gap: var(--space-4); padding: var(--space-7) var(--space-4); max-width: 380px; margin: 0 auto; }
.state .state-ic { width: 72px; height: 72px; border-radius: var(--radius-lg); background: var(--color-surface-tint); color: var(--color-primary); display: grid; place-items: center; }
.state .state-ic .icon { width: 36px; height: 36px; }
.state h3 { font-family: var(--font-display); font-weight: 400; font-size: var(--type-subhead-size); }
.state p { color: var(--color-muted); margin: 0; }
.state.error .state-ic { background: var(--color-danger-tint); color: var(--color-danger); }

/* skeleton loaders */
.skeleton { background: linear-gradient(100deg, var(--color-surface-alt) 30%, #f4f0ea 50%, var(--color-surface-alt) 70%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; border-radius: var(--radius-sm); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skeleton-card { border: 1px solid var(--color-line); border-radius: var(--radius-md); overflow: hidden; }
.skeleton-card .sk-media { aspect-ratio: 16 / 11; }
.skeleton-card .sk-body { padding: var(--space-3) var(--space-4) var(--space-4); display: grid; gap: var(--space-2); }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* ---- grids --------------------------------------------------------------- */
.grid-recipes { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
.grid-cookbooks { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
.grid-admin { display: grid; grid-template-columns: 1fr; gap: var(--space-3); }
@media (min-width: 480px) { .grid-recipes { grid-template-columns: repeat(2, 1fr); gap: var(--space-4); } .grid-cookbooks { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px) { .grid-recipes { grid-template-columns: repeat(3, 1fr); } .grid-cookbooks { grid-template-columns: repeat(4, 1fr); } .grid-admin { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-recipes { grid-template-columns: repeat(4, 1fr); } .grid-admin { grid-template-columns: repeat(3, 1fr); } }

/* AI ingredient/category icon slot (preserved brand texture) */
.ing-ic { display: grid; place-items: center; }
.ing-ic svg, .ing-ic img { width: 100%; height: 100%; object-fit: contain; }

/* ===== screens.css (design system) ===== */
/* ============================================================================
   HAPLY DESIGN SYSTEM — SCREEN LAYOUTS
   Screen-specific composition built from tokens + components.
   ========================================================================== */

/* ---- breadcrumb ---------------------------------------------------------- */
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-1); font-size: var(--type-bodysm-size); color: var(--color-muted); margin-bottom: var(--space-3); }
.breadcrumb a { color: var(--color-muted); }
.breadcrumb a:hover { color: var(--color-primary-ink); }
.breadcrumb .sep { color: var(--color-faint); }
.breadcrumb .cur { color: var(--color-ink); font-weight: 600; }

/* ===========================================================================
   RECIPE DETAIL
   =========================================================================== */
/* Cover-edit button — overlaid on the cover frame (bottom-right corner). */
.cover-edit-btn {
  position: absolute; bottom: var(--space-2); right: var(--space-2); z-index: 2;
  background: rgba(0, 0, 0, 0.48); color: #fff;
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity var(--motion-fast) var(--ease-out);
  border-radius: var(--radius-sm);
}
.cover-frame:hover .cover-edit-btn,
.cover-frame:focus-within .cover-edit-btn { opacity: 1; }

/* Cover editor dialog — wider than the default (canvas needs horizontal space). */
.cover-editor-dialog { max-width: 640px; }
.cover-editor-wrap { position: relative; margin-bottom: var(--space-3); border-radius: var(--radius-md); overflow: hidden; background: var(--color-surface-tint); }
.cover-editor-canvas { display: block; width: 100%; aspect-ratio: 16 / 9; cursor: grab; }
.cover-editor-loading {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: var(--color-surface-tint); color: var(--color-muted);
  font-size: var(--type-bodysm-size);
}
.cover-editor-zoom-row {
  display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-4);
}
.cover-editor-zoom-row .icon { flex-shrink: 0; width: 18px; height: 18px; color: var(--color-muted); }
.cover-editor-zoom { flex: 1; accent-color: var(--color-primary); }
.cover-editor-footer {
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
}
.cover-editor-error { margin-top: var(--space-3); }

.recipe-detail .cover-frame,
.recipe-detail .cover-fallback { width: 100%; aspect-ratio: 16 / 9; max-height: 380px; border-radius: var(--radius-lg); margin-bottom: var(--space-4); }
.recipe-detail .cover-fallback { display: grid; place-items: center; background: var(--color-surface-tint); }
.recipe-detail .cover-fallback .ing-ic { width: 38%; height: 60%; }
.detail-title { font-family: var(--font-display); font-weight: 400; font-size: var(--type-title-size); line-height: var(--type-title-lh); }
.detail-meta { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2) var(--space-3); color: var(--color-muted); margin: var(--space-2) 0 var(--space-4); }
.detail-meta .mi { display: inline-flex; align-items: center; gap: 6px; }
.detail-meta .mi .icon { width: 17px; height: 17px; }
.detail-meta .confidence { display: inline-flex; align-items: center; gap: 6px; }
.detail-meta .conf-dot { width: 8px; height: 8px; border-radius: 50%; }

.detail-actions-row { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-4); }
.source-link .btn { gap: var(--space-2); }

/* editor block (cookbook + labels) */
.meta-edit { display: grid; gap: var(--space-4); background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-md); padding: var(--space-4); margin-bottom: var(--space-5); }
@media (min-width: 560px) { .meta-edit { grid-template-columns: 1fr 1fr; } }
.meta-edit .label { font-size: var(--type-caption-size); text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-muted); font-weight: 700; margin-bottom: var(--space-2); }
.chip-editor { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }

/* two-column ingredients | steps */
.recipe-cols { display: grid; grid-template-columns: 1fr; gap: var(--space-5); margin-top: var(--space-4); }
@media (min-width: 760px) { .recipe-cols { grid-template-columns: 5fr 7fr; gap: var(--space-7); align-items: start; } }
.col-ing { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-md); padding: var(--space-4) var(--space-5); }
@media (min-width: 760px) { .col-ing { position: sticky; top: calc(var(--topbar-h) + var(--space-4)); } }
.portions { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin: var(--space-3) 0 var(--space-4); padding-bottom: var(--space-4); border-bottom: 1px solid var(--color-line); }
.portions .lbl { font-weight: 600; font-size: var(--type-bodysm-size); }

.ingredients { list-style: none; padding: 0; margin: 0; }
.ingredients li { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px dashed var(--color-line); }
.ingredients li:last-child { border-bottom: none; }
.ingredients .ing-ic { width: 34px; height: 34px; flex-shrink: 0; }
.ingredients .ing-txt { flex: 1; }
.ingredients .qty { font-weight: 700; color: var(--color-primary-pressed); }
.group-label { font-family: var(--font-body); font-weight: 700; font-size: var(--type-bodysm-size); text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-muted); margin: var(--space-4) 0 var(--space-2); }
.group-label:first-child { margin-top: 0; }

.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; gap: var(--space-4); }
.steps li { display: grid; grid-template-columns: 36px 1fr; gap: var(--space-3); }
.steps li::before { counter-increment: step; content: counter(step); width: 36px; height: 36px; border-radius: 50%; background: var(--color-surface-tint); color: var(--color-primary-pressed); font-weight: 700; display: grid; place-items: center; font-size: var(--type-bodysm-size); }
.steps .step-text { padding-top: 6px; }
.steps .step-img { width: 100%; max-width: 360px; border-radius: var(--radius-md); margin-top: var(--space-2); }

.notes-block { background: var(--color-surface-tint); border-radius: var(--radius-md); padding: var(--space-4) var(--space-5); margin-top: var(--space-5); }

/* destructive zone — separated from content */
.danger-zone { margin-top: var(--space-7); padding-top: var(--space-5); border-top: 1px solid var(--color-line); display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.danger-zone .blurb { color: var(--color-muted); font-size: var(--type-bodysm-size); }

/* sticky Kookmodus CTA — always ≤1 tap on phone */
.cook-cta-bar { position: fixed; left: 0; right: 0; bottom: calc(var(--bottomnav-h) + var(--safe-bottom)); z-index: 35; padding: var(--space-3) var(--space-4) calc(var(--space-3)); background: color-mix(in srgb, var(--color-bg) 86%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--color-line); }
.cook-cta-bar .btn { width: 100%; height: 52px; font-size: var(--type-subhead-size); }
@media (min-width: 768px) { .cook-cta-bar { display: none; } }

/* cookbook detail header cover */
.cookbook-cover { width: 64px; height: 64px; border-radius: var(--radius-md); display: grid; place-items: center; flex-shrink: 0; }
.cookbook-cover .icon { color: rgba(255,255,255,0.92); }

/* inline (desktop) cook button — phone uses the sticky CTA instead */
.desktop-cook { display: none; }
@media (min-width: 768px) { .desktop-cook { display: inline-flex; } }

/* ===========================================================================
   COOK MODE
   =========================================================================== */
.cook-overlay { position: fixed; inset: 0; z-index: 200; background: var(--color-bg); display: flex; flex-direction: column; animation: scrim-in var(--motion-base) var(--ease-out); }
.cook-top { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); padding-top: calc(var(--space-3) + env(safe-area-inset-top, 0px)); }
.cook-top .progress-track { flex: 1; height: 8px; border-radius: var(--radius-pill); background: var(--color-line); overflow: hidden; }
.cook-top .progress-fill { height: 100%; background: var(--color-primary); border-radius: var(--radius-pill); transition: width var(--motion-slow) var(--ease-out); }
.cook-top .step-count { font-weight: 700; font-size: var(--type-bodysm-size); color: var(--color-muted); white-space: nowrap; min-width: 64px; text-align: right; }
.cook-stage { flex: 1; overflow: auto; padding: var(--space-4) var(--space-5) var(--space-6); max-width: 760px; margin: 0 auto; width: 100%; }
.cook-group { color: var(--color-primary-pressed); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; font-size: var(--type-caption-size); }
.cook-step-text { font-size: clamp(1.4rem, 4.2vw, 2.1rem); line-height: 1.4; margin: var(--space-3) 0 var(--space-4); }
.cook-step-img { width: 100%; max-width: 520px; border-radius: var(--radius-lg); }
.cook-ings { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--space-3); }
.cook-ing { display: flex; align-items: center; gap: var(--space-3); background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-md); padding: var(--space-3); }
.cook-ing .ing-ic { width: 42px; height: 42px; flex-shrink: 0; }
.cook-ing .qty { font-weight: 700; color: var(--color-primary-pressed); }
/* step check-off */
.cook-check { display: inline-flex; align-items: center; gap: var(--space-2); margin-top: var(--space-4); padding: var(--space-2) var(--space-4); border-radius: var(--radius-pill); border: 1px solid var(--color-line-strong); background: var(--color-surface); cursor: pointer; font: inherit; font-weight: 600; color: var(--color-muted); min-height: 44px; }
.cook-check.done { background: var(--color-success-tint); border-color: var(--color-success); color: var(--color-success); }
.cook-nav { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); padding-bottom: calc(var(--space-3) + var(--safe-bottom)); background: var(--color-surface); border-top: 1px solid var(--color-line); }
.cook-nav .btn { flex: 1; height: 52px; }
.cook-nav .keep-awake { flex: 0 0 auto; }

/* ===========================================================================
   IMPORT STEPPER  (signature animation — re-skinned, behaviour preserved)
   =========================================================================== */
.import-row { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-4); }
@media (min-width: 480px) { .import-row { flex-direction: row; } .import-row .input-wrap { flex: 1; } }
.import-examples { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-4); }
.import-examples .chip-status { cursor: default; }
.imp-steps { display: grid; gap: var(--space-3); margin-top: var(--space-2); }
.imp-step { display: flex; align-items: center; gap: var(--space-3); opacity: 0.45; transition: opacity var(--motion-slow) var(--ease-out); }
.imp-step.active, .imp-step.done, .imp-step.skipped, .imp-step.failed { opacity: 1; }
.imp-icon { width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; background: var(--color-surface-alt); color: var(--color-muted); display: grid; place-items: center; transition: background var(--motion-base) var(--ease-out), color var(--motion-base) var(--ease-out); }
.imp-icon svg { width: 22px; height: 22px; }
.imp-step.active .imp-icon { background: var(--color-surface-tint); color: var(--color-primary); }
.imp-step.done .imp-icon { background: var(--color-success-tint); color: var(--color-success); }
.imp-step.failed .imp-icon { background: var(--color-danger-tint); color: var(--color-danger); }
.imp-body { flex: 1; min-width: 0; }
.imp-label { font-weight: 600; font-size: var(--type-bodysm-size); margin-bottom: 5px; display: flex; align-items: center; gap: var(--space-2); }
.imp-count { color: var(--color-primary-pressed); font-weight: 700; font-size: var(--type-caption-size); }
.imp-skip { font-size: var(--type-caption-size); color: var(--color-muted); font-weight: 600; background: var(--color-surface-alt); padding: 1px var(--space-2); border-radius: var(--radius-pill); }
.imp-bar { height: 6px; background: var(--color-line); border-radius: var(--radius-pill); overflow: hidden; }
.imp-fill { height: 100%; width: 0; background: var(--color-primary); border-radius: var(--radius-pill); }
.imp-step.done .imp-fill { background: var(--color-success); }
.imp-step.skipped .imp-fill { background: var(--color-line-strong); }
.imp-state { width: 22px; text-align: center; color: var(--color-muted); }
.imp-step.done .imp-state { color: var(--color-success); }
.imp-step.failed .imp-state { color: var(--color-danger); }

/* ===========================================================================
   APPEARANCE DIALOG (tabbed)
   =========================================================================== */
.appx-preview { width: 132px; margin: 0 auto var(--space-4); position: relative; }
.appx-cover { width: 132px; aspect-ratio: 3/2; border-radius: var(--radius-md); display: grid; place-items: center; box-shadow: var(--elevation-card); transition: opacity var(--motion-base); }
.appx-cover .icon { color: rgba(255,255,255,0.92); width: 32px; height: 32px; }
.appx-tabs { display: flex; gap: var(--space-3); border-bottom: 1px solid var(--color-line); margin-bottom: var(--space-4); }
.appx-tab { position: relative; background: none; border: none; color: var(--color-muted); padding: var(--space-2) var(--space-1) var(--space-3); font: inherit; font-weight: 600; font-size: var(--type-bodysm-size); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.appx-tab:hover { color: var(--color-ink); }
.appx-tab.on { color: var(--color-primary-pressed); }
.appx-tab.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--color-primary); border-radius: 2px 2px 0 0; }
.appx-pane { min-height: 80px; }
.swatches { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.swatch { width: 40px; height: 40px; border-radius: var(--radius-sm); border: 2px solid transparent; cursor: pointer; padding: 0; position: relative; }
.swatch.on { border-color: var(--color-ink); box-shadow: inset 0 0 0 2px #fff; }
.swatch:hover { transform: scale(1.06); }

/* ===========================================================================
   AUTH (login / register)
   =========================================================================== */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 880px) { .auth-page { grid-template-columns: 1.1fr 1fr; } }
.auth-art { display: none; position: relative; background: linear-gradient(155deg, #f4dcc7, #fdf1e8 60%, #fff); overflow: hidden; }
@media (min-width: 880px) { .auth-art { display: block; } }
.auth-art .art-inner { position: absolute; inset: 0; display: grid; place-content: center; gap: var(--space-4); padding: var(--space-8); }
.auth-art .art-ings { display: flex; flex-wrap: wrap; gap: var(--space-4); max-width: 420px; }
.auth-art .art-ings .ing-ic { width: 84px; height: 84px; filter: drop-shadow(0 8px 16px rgba(0,0,0,0.08)); }
.auth-art .art-quote { font-family: var(--font-display); font-size: 1.9rem; line-height: 1.2; color: var(--color-ink); max-width: 440px; }
.auth-form-wrap { display: grid; place-items: center; padding: var(--space-6) var(--space-5); }
.auth-card { width: min(400px, 100%); display: grid; gap: var(--space-4); }
.auth-card .brand { display: flex; align-items: center; gap: var(--space-3); font-family: var(--font-display); font-weight: 400; font-size: 2rem; color: var(--color-ink); }
.auth-card .brand .mark { width: 48px; height: 48px; border-radius: var(--radius-md); background: var(--color-primary); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.auth-card .brand .mark svg { width: 28px; height: 28px; }
.auth-card .lede { color: var(--color-muted); margin: 0 0 var(--space-2); }
.auth-card .field { margin: 0; }
.auth-card .input { height: 52px; font-size: 1rem; }
.auth-card .btn-block { height: 52px; font-size: var(--type-subhead-size); margin-top: var(--space-2); }

/* ---- misc utilities ------------------------------------------------------ */
.row { display: flex; align-items: center; gap: var(--space-3); }
.row.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: var(--space-3); }
.mt-2 { margin-top: var(--space-2); } .mt-4 { margin-top: var(--space-4); } .mt-5 { margin-top: var(--space-5); }
.mb-4 { margin-bottom: var(--space-4); }
.stat-row { display: flex; flex-wrap: wrap; gap: var(--space-4); }
.stat { background: var(--color-surface-alt); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); min-width: 120px; }
.stat b { display: block; font-family: var(--font-display); font-size: 1.6rem; font-weight: 400; }
.stat span { color: var(--color-muted); font-size: var(--type-bodysm-size); }
.divider { border: none; border-top: 1px solid var(--color-line); margin: var(--space-5) 0; }
.tag-color-input { position: absolute; width: 1px; height: 1px; opacity: 0; }

/* ---- admin icon manager grid --------------------------------------------- */
.ing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: var(--space-3); }
.ic-cell { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); border: 1px solid var(--color-line); border-radius: var(--radius-md); padding: var(--space-3) var(--space-2); background: var(--color-surface); }
.ic-img { width: 56px; height: 56px; }
.ic-name { font-size: var(--type-bodysm-size); font-weight: 600; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ic-actions { display: flex; gap: var(--space-1); }
.icon-btn-sm { width: 34px; height: 34px; background: var(--color-surface-alt); }
.icon-btn-sm:hover { background: var(--color-line); }

/* ---- admin social platform cards ----------------------------------------- */
.platform { border: 1px solid var(--color-line); border-radius: var(--radius-md); padding: var(--space-4); }
.platform + .platform { margin-top: var(--space-3); }
.platform-head { display: flex; align-items: center; gap: var(--space-3); }
.platform-ic { width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--color-surface-alt); display: grid; place-items: center; flex-shrink: 0; }

/* ---- toast --------------------------------------------------------------- */
#toast { position: fixed; left: 50%; bottom: calc(var(--bottomnav-h) + var(--safe-bottom) + var(--space-4)); transform: translate(-50%, 12px); z-index: 300; background: var(--color-ink); color: #fff; padding: var(--space-3) var(--space-5); border-radius: var(--radius-pill); font-size: var(--type-bodysm-size); font-weight: 600; box-shadow: var(--elevation-pop); opacity: 0; pointer-events: none; transition: opacity var(--motion-base) var(--ease-out), transform var(--motion-base) var(--ease-out); max-width: calc(100vw - var(--space-5) * 2); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 768px) { #toast { bottom: var(--space-6); } }

/* ===========================================================================
   UI POLISH (2026-06-08 feedback pass)
   =========================================================================== */
/* Destructive secondary button: white surface, danger-tinted text (#3). */
.btn.tone-danger { color: var(--color-danger); }
.btn.tone-danger:hover { background: var(--color-danger-tint); border-color: var(--color-danger); }
.btn.tone-danger .icon { color: var(--color-danger); }

/* Cook-mode "keep screen awake" control — a sun toggle with a hint (#2). */
.cook-awake-btn { flex: 0 0 auto; width: 52px; height: 52px; border-radius: 50%; border: none; background: none; color: var(--color-faint); display: grid; place-items: center; cursor: pointer; transition: color var(--motion-fast) var(--ease-out), background var(--motion-fast) var(--ease-out); }
.cook-awake-btn .icon { width: 24px; height: 24px; }
.cook-awake-btn:hover { color: var(--color-muted); }
.cook-awake-btn.on { background: var(--color-surface-tint); color: var(--color-primary); }

/* Recipe detail on phones must clear the fixed Kookmodus bar + bottom nav (#7). */
@media (max-width: 767px) { .recipe-detail { padding-bottom: calc(var(--bottomnav-h) + var(--safe-bottom) + 92px); } }

/* Import dialog explanation line (#4/#6). */
.dialog-sub { margin: 0 0 var(--space-4); }

/* Social platform card: white surface + revealed token area + status (#16). */
.platform { background: var(--color-surface); }
.platform-head .row-sub.pf-status { color: var(--color-faint); }
.platform-head .row-sub.pf-status.on { color: var(--color-success); }
.pf-body { margin-top: var(--space-4); display: grid; gap: var(--space-3); }
.pf-save-row { display: flex; align-items: center; gap: var(--space-3); }

/* ===========================================================================
   UI POLISH ROUND 2 (2026-06-08)
   =========================================================================== */
/* Wider add-recipe dialog. */
.dialog.import-dialog { max-width: 540px; }

/* "+ Label" pill in the recipe tag editor. */
.chip-add { display: inline-flex; align-items: center; gap: var(--space-1); padding: 6px var(--space-3); border: 1px solid var(--color-line-strong); border-radius: var(--radius-pill); background: var(--color-surface); color: var(--color-muted); font: inherit; font-size: var(--type-caption-size); font-weight: 600; line-height: 1; cursor: pointer; }
.chip-add:hover { border-color: var(--color-primary); color: var(--color-primary-pressed); }
.chip-add .icon { width: 14px; height: 14px; }

/* Cookbook appearance: upload drop-zone + AI sparkle box. */
.appx-drop { display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-5); border: 1.5px dashed var(--color-line-strong); border-radius: var(--radius-md); text-align: center; cursor: pointer; transition: border-color var(--motion-fast) var(--ease-out), background var(--motion-fast) var(--ease-out); }
.appx-drop:hover, .appx-drop.drag { border-color: var(--color-primary); background: var(--color-surface-tint); }
.appx-drop-ic { width: 44px; height: 44px; border-radius: var(--radius-md); background: var(--color-surface-tint); color: var(--color-primary); display: grid; place-items: center; }
.appx-drop-ic .icon { width: 22px; height: 22px; }
.appx-del { margin: var(--space-3) auto 0; display: block; }
.appx-pane .appx-ai-ic { width: 56px; height: 56px; margin: 0 auto var(--space-3); border-radius: var(--radius-md); background: var(--color-surface-tint); color: var(--color-primary); display: grid; place-items: center; }
.appx-pane .appx-ai-ic .icon { width: 26px; height: 26px; }
.appx-pane { text-align: center; }
.appx-pane .swatches, .appx-pane .appx-drop { text-align: left; }

/* ===========================================================================
   AI-INSTELLINGEN (admin) — design pass (2026-06-08)
   =========================================================================== */
.appx-preview.busy .appx-cover { opacity: 0.45; }
.ai-chart { margin: var(--space-4) 0; overflow-x: auto; }
.ai-chart svg { max-width: 100%; height: auto; display: block; }
.chart-controls { display: flex; align-items: flex-end; gap: var(--space-3); flex-wrap: wrap; margin: var(--space-4) 0 var(--space-2); }
.chart-controls .field { margin: 0; gap: var(--space-1); }
.chart-controls .field .input { height: 40px; }
.seg { display: inline-flex; border: 1px solid var(--color-line-strong); border-radius: var(--radius-pill); overflow: hidden; align-self: center; }
.seg button { background: var(--color-surface); border: none; border-radius: 0; padding: var(--space-2) var(--space-4); font: inherit; font-size: var(--type-bodysm-size); font-weight: 600; color: var(--color-muted); cursor: pointer; }
.seg button.active { background: var(--color-primary); color: #fff; }
.ai-badge { display: inline-block; font-size: var(--type-caption-size); background: var(--color-ai-tint); color: var(--color-ai); padding: 2px 10px; border-radius: var(--radius-pill); font-weight: 700; }
.usage-table { width: 100%; }
.usage-table td.cost { white-space: nowrap; }
.usage-err td { background: var(--color-danger-tint); }
.err-tag { color: var(--color-danger); font-weight: 700; }
.pg-type { display: flex; align-items: center; gap: var(--space-4); margin-bottom: var(--space-3); }
.pg-radio { display: inline-flex; align-items: center; gap: var(--space-1); font-weight: 500; }
.pg-out { margin-top: var(--space-3); }
#pg-prompt { min-height: 96px; resize: vertical; line-height: 1.5; }

/* ---- Import-log admin page ---- */
.il-filters { display: flex; flex-wrap: wrap; gap: var(--space-4); margin-bottom: var(--space-4); align-items: flex-end; }
.il-filters .field { margin: 0; min-width: 160px; }
.il-row { cursor: pointer; }
.il-row:hover td { background: var(--color-surface-alt); }
/* Detail dialog */
dl.il-detail { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-1) var(--space-4); margin: var(--space-3) 0; font-size: var(--type-bodysm-size); }
dl.il-detail dt { color: var(--color-muted); font-weight: 700; font-size: var(--type-caption-size); text-transform: uppercase; letter-spacing: 0.04em; align-self: start; padding-top: 2px; }
dl.il-detail dd { word-break: break-all; }
.il-url { word-break: break-all; font-family: var(--font-mono, monospace); font-size: var(--type-caption-size); }
.il-error-label { font-weight: 700; font-size: var(--type-caption-size); text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-danger); margin-top: var(--space-3); margin-bottom: var(--space-1); }
.il-error-pre { background: var(--color-surface-tint); border: 1px solid var(--color-line); border-radius: var(--radius-sm); padding: var(--space-3); font-size: var(--type-caption-size); white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow-y: auto; }
