/*
 * APISARA V0.8.2 — Styles
 * ----------------------
 * Visual identity kept from V0.6.1: white cards on a very light green-white
 * background, soft green accents, rounded corners, generous spacing,
 * system fonts (no download, works offline).
 * Colours are CSS variables: change them here only.
 * Mobile first; ≥ 960 px adds the sidebar.
 */

:root {
  --text: #263b31;
  --text-muted: #566a5d;
  --bg: #f6f8f5;
  --surface: #ffffff;
  --surface-soft: #f1f7f2;
  --surface-softer: #f7fbf7;
  --border: #e3eae4;
  --border-strong: #cddbd0;
  /* V0.8.1 — validated chart: vert principal #0F5D32, vert clair #DFF1D9, or #D4A017 (decorative only:
     2.4:1 on white, never used for text). Contrasts checked in tests/test-v081-app.js. */
  --brand: #0F5D32;
  --primary: #0F5D32;
  --primary-strong: #0A4524;
  --primary-soft: #EEF7EB;
  --focus: #1E7A3E;
  --band: #DFF1D9;
  --gold: #D4A017;
  --leaf: #86B36B;
  --warning: #9a6514;
  --warning-bg: #fff9e9;
  --warning-border: #c18d36;
  --danger: #a32b2b;
  --danger-bg: #fff0f0;
  --info-bg: #f0f6fb;
  --info-border: #7aa6c8;
  --sat: #c18d36;
  --mono: #2F8A3E;
  --poly: #6a9bc3;
  --radius: 18px;
  --radius-small: 10px;
  --shadow: 0 3px 15px #183c2310;
  --bottom-nav-height: 64px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 70px; }
body { margin: 0; background: var(--bg); line-height: 1.45; }
h1 { font-size: clamp(25px, 5vw, 34px); margin: 0 0 8px; line-height: 1.15; }
h2 { font-size: 20px; margin: 0 0 14px; }
h3 { font-size: 16px; margin: 18px 0 8px; }
p { color: var(--text-muted); margin: 8px 0; }
a { color: var(--primary); }
select, input, button, textarea { font: inherit; color: inherit; }
select, input, textarea {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-small);
  padding: 11px 12px;
  max-width: 100%;
  min-width: 0;
  min-height: 44px;
}
textarea { width: 100%; resize: vertical; }
input[type=checkbox] { min-height: 0; width: 22px; height: 22px; accent-color: var(--primary); padding: 0; flex: none; }
select:focus, input:focus, textarea:focus, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
input[aria-invalid=true] { border-color: var(--danger); }
[hidden] { display: none !important; }
.hide { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { font-size: 13px; color: var(--text-muted); }
.icon { width: 20px; height: 20px; flex: none; }

.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip-link:focus { left: 8px; }

/* ------------------------------------------------------------------ header */
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--gold);
}
.brand { display: inline-flex; align-items: center; text-decoration: none; min-height: 44px; }
.brand img { display: block; height: 34px; width: auto; }
.app-header select { width: 165px; min-height: 40px; padding: 8px 10px; }
/* V0.8.3: a visible header navigation entry at narrow widths, even when
   browser emulation hides the fixed bottom bar. The existing sheet is reused. */
.header-actions { display: flex; align-items: center; gap: 8px; min-width: 0; }
.header-menu-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 44px; min-height: 44px; padding: 7px 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-small);
  background: var(--surface); color: var(--primary-strong); cursor: pointer;
}
.header-menu-button span[aria-hidden] { font-size: 21px; line-height: 1; }
@media (max-width: 540px) {
  .app-header { gap: 5px; padding-left: 9px; padding-right: 9px; }
  .brand img { height: 28px; max-width: 120px; }
  .app-header select { width: 105px; padding-left: 5px; padding-right: 5px; }
  .header-actions { gap: 5px; }
  #header-menu-label { display: none; }
}


/* ------------------------------------------------------------------ layout */
.layout { max-width: 1180px; margin: 0 auto; }
.view { max-width: 850px; margin: 0 auto; padding: 8px 16px 40px; outline: none; }
.app-footer { text-align: center; color: var(--text-muted); font-size: 13px; padding: 10px 16px calc(var(--bottom-nav-height) + 24px + env(safe-area-inset-bottom)); }
.page-header { margin: 8px 0 16px; }
.page-title:focus { outline: none; }
.page-intro { font-size: 15px; max-width: 62ch; }
.section-title { margin: 26px 4px 10px; font-size: 18px; }

/* ------------------------------------------------------------- navigation */
.side-nav { display: none; }
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px #183c230d;
}
.nav-link { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; border: 0; background: none; cursor: pointer; }
.nav-bottom { flex-direction: column; justify-content: center; gap: 3px; font-size: 11px; color: var(--text-muted); padding: 6px 2px; min-width: 0; }
.nav-bottom .nav-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-bottom[aria-current=page], .nav-more.active { color: var(--primary-strong); font-weight: 650; }
.nav-bottom[aria-current=page] .icon, .nav-more.active .icon { background: var(--primary-soft); border-radius: 12px; padding: 2px 10px; width: 44px; height: 26px; }
.nav-badge { margin-left: auto; font-size: 11px; color: var(--text-muted); background: var(--surface-soft); border-radius: 20px; padding: 1px 8px; white-space: nowrap; }

.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: #18302155; display: flex; align-items: flex-end; }
.sheet {
  width: 100%; max-height: 85vh; overflow: auto; background: var(--surface);
  border-radius: 22px 22px 0 0; padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 30px #183c2322;
}
.sheet-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet-header h2 { margin: 0; font-size: 17px; }
.sheet ul { list-style: none; margin: 0; padding: 0; }
.sheet-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.nav-sheet { padding: 14px 12px; border-radius: 14px; background: var(--surface-softer); border: 1px solid var(--border); min-height: 52px; font-size: 15px; }
.nav-sheet[aria-current=page] { background: var(--primary-soft); border-color: var(--focus); font-weight: 650; }
.nav-sheet { flex-wrap: wrap; row-gap: 2px; }
.nav-sheet .nav-label { flex: 1; min-width: 0; }
.nav-sheet .nav-badge { flex-basis: 100%; margin-left: 30px; max-width: max-content; }
body.sheet-open { overflow: hidden; }

@media (min-width: 960px) {
  .layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 24px; padding: 0 20px; }
  .side-nav { display: block; position: sticky; top: 72px; align-self: start; padding: 8px 0 24px; }
  .side-nav ul { list-style: none; margin: 0; padding: 0; }
  .nav-side { padding: 10px 12px; border-radius: 12px; font-size: 15px; margin: 2px 0; }
  .nav-side:hover { background: var(--surface-soft); }
  .nav-side[aria-current=page] { background: var(--surface); color: var(--primary-strong); font-weight: 650; box-shadow: var(--shadow); }
  .bottom-nav, .sheet-backdrop, .header-menu-button { display: none !important; }
  .view { margin: 0; padding-top: 8px; }
  .app-footer { padding-bottom: 28px; }
  .app-header { padding-left: 32px; padding-right: 32px; }
}

/* ------------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin: 14px 0; box-shadow: var(--shadow); }
.card-title { font-size: 20px; margin: 0 0 14px; }
details.card > summary { font-size: 17px; }
details { margin-top: 12px; }
summary { cursor: pointer; color: var(--brand); font-weight: 650; min-height: 32px; display: flex; align-items: center; }
summary::-webkit-details-marker { display: none; }
summary::before { content: '›'; display: inline-block; width: 18px; font-size: 20px; transition: transform .15s; }
details[open] > summary::before { transform: rotate(90deg); }

/* ------------------------------------------------------------------- forms */
.field-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin: 12px 0; }
.field-row > label { flex: 1; min-width: 0; }
.field-row input:not([type=checkbox]), .field-row select { width: 150px; }
.field-row.field-wide input, .field-row.field-wide select { width: min(420px, 62%); }
.field-row.compact { margin: 6px 0; }
.field-input { display: flex; align-items: center; gap: 6px; }
.field-input input { width: 120px; }
.field-hint { display: block; font-size: 12px; color: var(--text-muted); }
.suffix { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; min-height: 40px; }

.primary, .secondary, .danger, .button-link {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--radius-small); padding: 12px 16px; min-height: 44px;
  cursor: pointer; text-decoration: none; font-weight: 650; border: 0; line-height: 1.2;
}
.primary { background: var(--primary); color: #fff; }
.primary:hover { background: var(--primary-strong); }
.secondary { background: var(--primary-soft); color: #286340; }
.secondary:hover { background: #e3eee6; }
.danger { background: var(--danger-bg); color: var(--danger); }
.button-link { padding-left: 0; padding-right: 0; color: var(--primary); }
.button-link.primary, .button-link.secondary { padding-left: 16px; padding-right: 16px; }
.button-link.primary { color: #fff; }
.small { padding: 8px 12px; min-height: 38px; font-size: 14px; }
.icon-button { background: var(--surface); border: 1px solid #d8e1d9; border-radius: 9px; cursor: pointer; min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; }
.tools { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 4px; align-items: center; }
.add-row select { flex: 1 1 220px; }

/* ---------------------------------------------------------- calculator */
.oil, .oil-head { display: grid; grid-template-columns: minmax(0, 1fr) 110px 62px 40px; gap: 9px; margin: 10px 0; align-items: center; }
.oil-head { margin: 0 0 -4px; font-size: 12px; color: var(--text-muted); }
.oil input { width: 100%; }
.oil .share { font-size: 12px; color: var(--text-muted); text-align: right; }
.additive { grid-template-columns: minmax(0, 1fr) 150px 70px 40px; }
.additive .field-input input { width: 80px; }
.additive-name { font-weight: 600; text-decoration: none; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 18px; background: var(--surface-soft); border-radius: 12px; }
.stat small { color: #566e5d; display: block; }
.stat strong { display: block; font-size: clamp(22px, 4vw, 30px); color: var(--primary-strong); font-variant-numeric: tabular-nums; }
.stat-key { background: #e7f3ea; }
.stat-sub { font-size: 12px; color: var(--text-muted); }
.stats-compact .stat { padding: 12px; }
.stats-compact .stat strong { font-size: 22px; }
@media (min-width: 640px) { .stats-compact { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.result-extra p { margin: 6px 0; }
.error { color: var(--danger); background: var(--danger-bg); padding: 12px 14px; border-radius: 9px; margin-bottom: 12px; }
.error p { color: var(--danger); margin: 0 0 4px; font-weight: 600; }
.error ul { margin: 0; padding-left: 20px; }
.error-text { color: var(--danger); font-size: 13px; }
.note { background: var(--warning-bg); border-left: 4px solid var(--warning-border); padding: 13px; font-size: 14px; border-radius: 0 10px 10px 0; color: var(--text); margin: 16px 0; }

/* ------------------------------------------------------------- notices */
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; margin: 12px 0; border: 1px solid; }
.notice p { margin: 0; color: var(--text); }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.notice-body { min-width: 0; }
.notice-info, .notice-estimate { background: var(--info-bg); border-color: #cfe0ee; }
.notice-estimate { background: var(--surface-softer); border-color: var(--border-strong); }
.notice-warning { background: var(--warning-bg); border-color: #ecd6a8; }
.notice-warning .icon { color: var(--warning); }
.notice-error { background: var(--danger-bg); border-color: #f1c4c4; }
.notice-success { background: var(--surface-soft); border-color: var(--band); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--bottom-nav-height) + 16px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #23392d; color: #fff; padding: 12px 16px; border-radius: 12px; z-index: 60;
  display: flex; gap: 14px; align-items: center; max-width: calc(100vw - 32px); box-shadow: 0 6px 24px #0003;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast a { color: #bfe6cb; font-weight: 650; white-space: nowrap; }
@media (min-width: 960px) { .toast { bottom: 24px; } }

/* ---------------------------------------------------------- ingredients */
.search-box { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-small); padding: 0 0 0 12px; background: var(--surface); }
.search-box input { border: 0; flex: 1; min-width: 0; }
.search-box input:focus { outline: none; }
.search-box:focus-within { outline: 3px solid var(--focus); }
.search-box .icon { color: var(--text-muted); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.chip-button { flex: none; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 20px; padding: 8px 14px; min-height: 38px; cursor: pointer; white-space: nowrap; font-size: 14px; }
.chip-button[aria-pressed=true] { background: var(--primary); color: #fff; border-color: var(--primary); }
.toggles { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 14px; }
.filters-card { position: relative; }
.ingredient-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.ingredient-row { display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; color: inherit; text-decoration: none; box-shadow: var(--shadow); }
.ingredient-row:hover { border-color: var(--focus); }
.ingredient-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.ingredient-name { font-size: 16px; }
.inci { font-size: 12px; color: var(--text-muted); font-style: italic; overflow-wrap: anywhere; }
.inci-large { font-style: italic; }
.inci-large .label { font-style: normal; font-weight: 650; font-size: 12px; letter-spacing: .05em; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tag { font-size: 11px; background: var(--surface-soft); color: #4c6555; border-radius: 20px; padding: 2px 9px; }
.tag-custom { background: #fdf3df; color: #7a5413; }
.tag-in { background: var(--primary); color: #fff; }
.ingredient-side { display: flex; align-items: center; }
.sap { text-align: right; }
.sap small { display: block; font-size: 11px; color: var(--text-muted); }
.sap strong { font-variant-numeric: tabular-nums; color: var(--primary-strong); }
.mini-stack { display: flex; height: 6px; border-radius: 4px; overflow: hidden; margin-top: 6px; max-width: 220px; background: var(--surface-soft); }
.back-link { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; margin: 6px 0; min-height: 40px; }
.data-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.data-row { background: var(--surface-soft); border-radius: 12px; padding: 12px; }
.data-row dt { font-size: 12px; color: #566e5d; }
.data-row dd { margin: 4px 0 0; font-variant-numeric: tabular-nums; }
.data-row dd strong { font-size: 20px; color: var(--primary-strong); }
.profile-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
.profile-table th, .profile-table td { padding: 7px 4px; border-bottom: 1px solid var(--border); text-align: left; font-weight: normal; }
.profile-table thead th { font-size: 12px; color: var(--text-muted); }
.profile-table .num { text-align: right; width: 60px; font-variant-numeric: tabular-nums; }
.bar-cell { width: 40%; }
.mini-bar { display: block; height: 8px; border-radius: 4px; min-width: 2px; }
.notation { font-size: 11px; color: var(--text-muted); }
.auto-note { border-left: 3px solid var(--border-strong); padding-left: 10px; }
.profile-grid { display: grid; gap: 0 18px; }
@media (min-width: 640px) { .profile-grid { grid-template-columns: 1fr 1fr; } .profile-grid input { width: 90px !important; } }
.source-note { margin: 18px 4px; }
.empty { color: var(--text-muted); padding: 18px; text-align: center; }

/* --------------------------------------------------- saturation colours */
.stack-saturated { background: var(--sat); }
.stack-monounsaturated { background: var(--mono); }
.stack-polyunsaturated { background: var(--poly); }
.stack-bar { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: var(--surface-soft); }
.legend { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; }
.legend li { display: flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* -------------------------------------------------------------- quality */
.summary-line { font-size: 16px; color: var(--text); font-weight: 600; }
.indicator-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .indicator-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.indicator { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.indicator header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.indicator h3 { margin: 0; font-size: 15px; }
.indicator-value strong { font-size: 30px; color: var(--primary-strong); font-variant-numeric: tabular-nums; }
.indicator-help { font-size: 13px; margin: 8px 0 0; }
.band-text { font-size: 12px; margin: 6px 0 0; }
.heuristic-tag { font-size: 11px; margin: 6px 0 0; color: #7a5413; }
.range-bar { position: relative; height: 12px; border-radius: 6px; background: #edf1ee; margin: 10px 0 4px; }
.bar-band { position: absolute; top: 0; bottom: 0; background: var(--band); border-radius: 6px; }
.bar-fill { position: absolute; left: 0; top: 4px; height: 4px; background: #9bb5a3; border-radius: 2px; }
.bar-marker { position: absolute; top: -4px; width: 4px; height: 20px; margin-left: -2px; border-radius: 2px; background: var(--primary-strong); }
.status-low .bar-marker, .status-high .bar-marker { background: var(--warning); }
.chip { font-size: 12px; border-radius: 20px; padding: 2px 10px; white-space: nowrap; font-weight: 600; }
.chip-ok { background: var(--primary-soft); color: var(--primary-strong); }
.chip-low, .chip-high { background: var(--warning-bg); color: var(--warning); border: 1px solid #ecd6a8; }
.chip-moderate { background: var(--surface-soft); color: #4c6555; }
.chip-na { background: #f1f1f1; color: #666; }
.alert-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.alert-warning { background: var(--warning-bg); }
.alert-warning .icon { color: var(--warning); }
.alert-info { background: var(--info-bg); }
.alert-success { background: var(--surface-soft); }
.alert-success .icon { color: var(--primary); }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.technical h3 { margin-top: 22px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th, .data-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.data-table thead th { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.data-table tbody th { font-weight: 500; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.section-row th { background: var(--surface-soft); font-weight: 650 !important; font-size: 13px; }
.compare-table td.num { white-space: normal; }

/* -------------------------------------------------------------- recipes */
.recipe-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); } /* V2.0.0-tech1: never wider than the screen (WCAG 1.4.10 at 320 px) */
.recipe-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.recipe-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; }
.recipe-name { font-size: 17px; margin: 0; }
.composition { color: var(--text); font-size: 14px; }
.recipe-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.compare-check { margin-left: auto; font-size: 14px; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }

/* ---------------------------------------------------------------- costs */
.cost-lines { margin: 0; }
.cost-line { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.cost-line dt { color: var(--text); }
.cost-line dd { margin: 0; font-variant-numeric: tabular-nums; }
.cost-line.total dd strong, .cost-total { font-size: 22px; color: var(--primary-strong); font-weight: 750; }

/* ----------------------------------------------- planned modules, learn */
.planned-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.planned-list li { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--surface-softer); border-radius: 12px; border: 1px dashed var(--border-strong); }
.learn-topic summary { font-size: 17px; }
.learn-body p { color: var(--text); max-width: 68ch; }
.weigh-table .tick { width: 36px; }
.weigh-table .key-row th, .weigh-table .key-row td { font-weight: 700; color: var(--primary-strong); }
.weigh-table tfoot th, .weigh-table tfoot td { font-weight: 650; border-bottom: 0; }
.print-only { display: none; }

/* ------------------------------------------------------ V0.8 calculator */
.field-row.field-select select { width: auto; min-width: 150px; max-width: 62%; }
.result-row.result-wrap dd { white-space: normal; min-width: 0; }
.total-line { font-weight: 600; color: var(--text); margin: 10px 0 4px; font-variant-numeric: tabular-nums; }
.total-line.total-error { color: var(--danger); }
.liquid-list { margin: 8px 0; }
.liquid-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px 70px 40px; gap: 9px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.liquid-row .field-input input { width: 80px; }
.liquid-row .share { font-size: 12px; color: var(--text-muted); text-align: right; }
.liquid-water { grid-template-columns: minmax(0, 1fr) 70px 70px; }
.liquid-name { font-weight: 600; }
.liquid-stage-text { grid-column: 1 / -1; margin: 0; }
.row-options { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.inline-field { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.inline-field input, .inline-field select { width: 120px; padding: 8px 10px; }
.inline-wide input { width: 200px; }
.liquid-flags { grid-column: 1 / -1; margin: 0; padding-left: 18px; font-size: 12px; color: var(--warning); }
.liquid-summary p { margin: 6px 0; }
.result-table { margin: 8px 0 0; }
.result-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.result-row dt { color: var(--text-muted); min-width: 0; }
.result-row dd { margin: 0; font-weight: 600; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.result-sub dt { padding-left: 14px; font-size: 13px; }
.result-sub dd { font-weight: 400; font-size: 13px; }
.result-key dd { color: var(--primary-strong); }
.scale-panel { margin-top: 16px; padding: 16px; border: 1px solid var(--border-strong); border-radius: 14px; background: var(--surface-softer); }
.scale-panel h3 { margin-top: 0; }
.preset-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.scale-table .key-row th, .scale-table .key-row td { font-weight: 600; }
.legacy-note { font-size: 13px; color: var(--warning); margin: 4px 0; }
.sap-banner .notice-body button { margin-top: 8px; }
.premigration { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.sheet-flags { padding-left: 18px; margin: 6px 0; }

/* ------------------------------------------------------ V0.8.1 calculator */
.recipe-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 14px; border-radius: 12px; margin: 0 0 14px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 14px; }
.recipe-status .status-text { color: var(--text); flex: 1; min-width: 200px; }
.status-badge { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface-soft); color: var(--text); border: 1px solid var(--border-strong); white-space: nowrap; }
.status-draft .status-badge { background: #FFF6DC; border-color: var(--warning-border); color: #6E4A0C; }
.status-saved .status-badge { background: var(--band); border-color: var(--primary); color: var(--primary-strong); }
.status-modified .status-badge { background: #FFF6DC; border-color: var(--warning-border); color: #6E4A0C; }
.summary-card { border-top: 4px solid var(--primary); }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 6px; }
.summary-grid > div { background: var(--surface-soft); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.summary-grid dt { font-size: 12px; color: var(--text-muted); }
.summary-grid dd { margin: 2px 0 0; font-variant-numeric: tabular-nums; }
.summary-grid dd strong { font-size: 18px; color: var(--primary-strong); overflow-wrap: anywhere; }
@media (min-width: 640px) { .summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.summary-ok { display: flex; align-items: center; gap: 6px; color: var(--primary-strong); font-weight: 600; margin: 8px 0 0; }
.summary-warnings { margin: 6px 0 0; }
.summary-links { margin: 10px 0 0; }
details.help-tip { margin: -4px 0 8px; }
details.help-tip > summary { display: inline-flex; width: 28px; height: 28px; min-height: 28px; border-radius: 50%; align-items: center; justify-content: center; border: 1px solid var(--primary); color: var(--primary); font-weight: 800; font-size: 14px; }
details.help-tip > summary::before { content: none; }
details.help-tip[open] > summary { background: var(--primary); color: #fff; }
details.help-tip > p { margin: 6px 0 0; font-size: 13px; color: var(--text); background: var(--surface-soft); border-left: 3px solid var(--gold); padding: 8px 10px; border-radius: 0 8px 8px 0; }
.compare-bar { position: sticky; bottom: calc(var(--bottom-nav-height) + 8px + env(safe-area-inset-bottom)); z-index: 10; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface); border: 2px solid var(--primary); border-radius: 14px; padding: 10px 14px; box-shadow: var(--shadow); margin: 12px 0; }
@media (min-width: 960px) { .compare-bar { bottom: 12px; } }
.about-logo { display: block; width: min(320px, 80%); height: auto; margin: 4px auto 12px; }
.link-list { list-style: none; padding: 0; margin: 8px 0; }
.link-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.link-list .soon { color: var(--text-muted); font-size: 13px; }
/* V0.8.2 — complete About page */
.link-list li > span:first-child { font-weight: 600; color: var(--text); }
.link-list a, .term-list, .credit-template, .tech-list dd { overflow-wrap: anywhere; }
.soon { color: var(--text-muted); font-size: 13px; font-style: italic; }
.term-list { list-style: none; padding: 0; margin: 4px 0 8px; }
.term-list li { padding: 8px 0; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.term-list li:last-child { border-bottom: 0; }
.term-list strong { color: var(--text); }
.about-note { color: var(--text); background: var(--surface-soft); border-left: 3px solid var(--gold); padding: 8px 12px; border-radius: 0 8px 8px 0; }
.about-creator-line { font-size: 18px; color: var(--primary-strong); margin-bottom: 4px; }
.licence-badge { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; margin: 6px 0 12px; }
.licence-badge a { font-weight: 800; font-size: 17px; }
.licence-name { color: var(--text-muted); }
.licence-columns { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 24px; }
@media (min-width: 640px) { .licence-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.licence-columns h3 { margin-top: 8px; }
.check-list { margin: 0 0 8px; padding-left: 20px; color: var(--text-muted); }
.check-list li { padding: 3px 0; }
.about-details { margin: 10px 0; }
.about-details > summary { cursor: pointer; font-weight: 700; color: var(--primary); min-height: 40px; display: flex; align-items: center; }
.credit-template { color: var(--text); background: var(--surface-soft); border: 1px dashed var(--border-strong); border-radius: 8px; padding: 10px 12px; font-size: 14px; user-select: all; }
.tech-list { margin: 0; }
.tech-list dt { font-weight: 700; color: var(--text); margin-top: 10px; }
.tech-list dd { margin: 2px 0 0; color: var(--text-muted); }
a[target="_blank"] .ext-mark { font-size: 0.85em; }
#about-website { display: inline-flex; align-items: center; }

/* --------------------------------------------------------------- mobile */
@media (max-width: 520px) {
  .card { padding: 16px; border-radius: 16px; }
  .oil, .oil-head { grid-template-columns: minmax(0, 1fr) 82px 48px 40px; gap: 7px; }
  .additive { grid-template-columns: minmax(0, 1fr) 96px 40px; }
  .additive .share { display: none; }
  .additive .field-input input { width: 64px; }
  .field-row input:not([type=checkbox]), .field-row select { width: 120px; }
  .field-row.field-wide { flex-direction: column; align-items: stretch; gap: 6px; }
  .field-row.field-wide input, .field-row.field-wide select { width: 100%; }
  .field-input input { width: 96px; }
  .stats { gap: 8px; }
  .stat { padding: 12px; }
  .brand img { height: 28px; }
  .app-header select { width: auto; max-width: 52vw; padding-right: 6px; }
  .data-row dd strong { font-size: 18px; }
  .compare-check { margin-left: 0; }
  .field-row.field-select { flex-direction: column; align-items: stretch; gap: 6px; }
  .field-row.field-select select { width: 100%; max-width: none; }
  .liquid-row, .additive { grid-template-columns: minmax(0, 1fr) 132px 40px; gap: 7px; }
  .liquid-row .share, .additive .share { display: none; }
  .liquid-row .field-input input, .additive .field-input input { width: 68px; min-width: 60px; }
  .liquid-row .field-input .suffix, .additive .field-input .suffix { font-size: 12px; }
  .liquid-water { grid-template-columns: minmax(0, 1fr) 60px 80px; }
  .liquid-water .share { display: block; }
  .inline-field { flex-wrap: wrap; }
  .inline-field select { width: auto; max-width: 100%; }
  .inline-field input { width: 110px; }
  .inline-wide, .inline-wide input { width: 100%; }
}

/* ---------------------------------------------------------------- print */
@media print {
  body { background: #fff; }
  .app-header, .side-nav, .bottom-nav, .sheet-backdrop, .toast, .app-footer, .no-print, .tools, .back-link, .planned-card, .skip-link { display: none !important; }
  .layout { display: block; padding: 0; }
  .view { max-width: none; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; border-color: #ccc; }
  input, select { border: 0; background: transparent; }
  .print-only { display: block; }
  details { display: block; }
  details > summary { display: none; }
}

.app-footer .footer-name { font-weight: 700; color: var(--brand); }
.app-footer .footer-baseline { display: block; margin-top: 2px; }
.licence-list li { display: block; }

/* =====================================================================
   V1.0 — new components (workspace, undo, guide, bars, sliders, production,
   workshop mode, batches, stock, labels, fragrances, favourites, print)
   ===================================================================== */
.undo-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.undo-bar button[disabled] { opacity: .45; cursor: not-allowed; }
.undo-bar .undo-hint { flex: 1 1 200px; margin: 0; }
.start-links { margin: -6px 0 12px; }

/* guide */
.guide-card { border: 2px solid var(--primary); }
.guide-step { margin: 0; }
.guide-examples { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 8px; }
.guide-examples li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-softer); }
.guide-examples li p { margin: 2px 0 0; }
.guide-points { padding-left: 20px; }
.guide-points li { margin: 6px 0; color: var(--text); }
.guide-nav { justify-content: flex-start; }
.guide-skip { margin-left: auto; }

/* readable indicator bars (no colour needed) */
.ind-list { display: grid; gap: 10px; margin: 12px 0 4px; }
.ind-row { padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.ind-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.ind-label { flex: 1 1 140px; font-weight: 600; color: var(--text); }
.ind-value { font-size: 20px; color: var(--primary-strong); font-variant-numeric: tabular-nums; }
.ind-range { display: block; }
.chip-mark { font-size: 11px; }
.ind-legend summary { font-size: 14px; }
.plain-legend { list-style: none; padding: 0; margin: 6px 0; font-size: 13px; color: var(--text); display: grid; gap: 6px; }
.plain-legend li { display: flex; gap: 8px; align-items: flex-start; }
.legend-band { flex: none; width: 28px; height: 12px; border-radius: 6px; background: var(--band); border: 1px solid #b9d9b0; margin-top: 3px; }
.legend-marker { flex: none; width: 4px; height: 18px; border-radius: 2px; background: var(--primary-strong); margin: 0 12px; }
.quick-values { margin-bottom: 4px; }

/* water helper */
.water-help .water-modes { padding-left: 20px; }
.water-help .water-modes li { margin: 6px 0; color: var(--text); }
.water-help .formula { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; color: var(--text); background: var(--surface-soft); padding: 8px 10px; border-radius: 8px; overflow-wrap: anywhere; }
.water-live { color: var(--primary-strong); font-weight: 600; }

/* favourites and ingredient list */
.ingredient-item { display: flex; align-items: stretch; gap: 8px; }
.ingredient-item .ingredient-row { flex: 1; min-width: 0; }
.fav-button { flex: none; width: 44px; min-height: 44px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); color: var(--warning); font-size: 22px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.fav-button.on { background: #fff6dc; border-color: var(--warning-border); }
.detail-title { display: flex; align-items: center; gap: 10px; }
.detail-title h1 { flex: 1; min-width: 0; }
.tag-beginner { background: #e6f1fb; color: #2b557a; }
.tag-alert { background: var(--warning-bg); color: var(--warning); }
.tag-level { background: var(--primary-soft); color: var(--primary-strong); }
.fiche-source { font-style: italic; }
.fiche-facts { padding-left: 20px; }
.fiche-facts li { margin: 6px 0; color: var(--text); }

/* examples */
.example-adapt { font-size: 13px; color: var(--warning); font-weight: 600; }
.example-warnings { color: var(--warning); font-size: 13px; padding-left: 18px; }

/* sliders */
.slider-list { display: grid; gap: 12px; margin: 12px 0; }
.slider-row { padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-softer); }
.slider-row label { display: flex; flex-direction: column; }
.slider-row.disabled { opacity: .75; }
.slider-control { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.slider-control input[type=range] { flex: 1; min-height: 44px; accent-color: var(--primary); padding: 0; border: 0; background: none; }
.slider-control output { flex: 0 0 9.5em; font-size: 13px; color: var(--primary-strong); font-weight: 600; }
.candidate-list { list-style: none; padding: 0; margin: 6px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.candidate-list li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); font-size: 14px; }
.candidate-list .icon-button { min-width: 32px; min-height: 32px; border-radius: 16px; }

/* fragrances */
.fragrance-line { padding: 10px 0; border-bottom: 1px solid var(--border); }
.fragrance-main { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.fragrance-main .icon-button { margin-left: auto; }
.fragrance-out { margin: 6px 0 0; font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums; }
.fragrance-out.check-over { color: var(--danger); font-weight: 650; }
.fragrance-out.check-unchecked { color: var(--warning); }
.allergen-rows { display: grid; gap: 6px; margin: 6px 0; }
.allergen-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.allergen-row > input { flex: 1 1 160px; }

/* production: sheet, workshop, batches */
.sheet-kicker { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.sheet-ids { display: flex; flex-wrap: wrap; gap: 4px 24px; margin: 0 0 8px; font-size: 13px; }
.sheet-ids div { display: flex; gap: 6px; }
.sheet-ids dt { color: var(--text-muted); }
.sheet-ids dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.weigh-table .order { width: 32px; color: var(--text-muted); }
.write-in { display: inline-block; min-width: 70px; border-bottom: 1px solid var(--border-strong); height: 1.2em; }
.sheet-notes-title { font-weight: 650; color: var(--text); margin-bottom: 0; }
.write-lines { display: none; }
.workshop-top { margin: 4px 0 0; }
.workshop-recipe { font-size: 22px; margin: 4px 0 12px; }
.workshop-progress { font-size: 18px; font-weight: 700; color: var(--primary-strong); }
.workshop-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.workshop-stage h3 { font-size: 19px; margin: 0 0 8px; }
.workshop-warn { font-weight: 700; color: var(--warning); margin: 0 0 8px; font-size: 16px; }
.workshop-lines { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.workshop-line { width: 100%; display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 12px 16px; border: 2px solid var(--border-strong); border-radius: 16px; background: var(--surface); cursor: pointer; text-align: left; font-size: 18px; color: var(--text); }
.workshop-line .workshop-name { flex: 1; min-width: 0; }
.workshop-line .workshop-qty { font-size: 24px; color: var(--primary-strong); font-variant-numeric: tabular-nums; white-space: nowrap; }
.workshop-box { flex: none; width: 30px; height: 30px; border: 3px solid var(--primary); border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
.workshop-line.done { background: var(--primary-soft); border-color: var(--primary); }
.workshop-line.done .workshop-box::after { content: '✓'; font-weight: 900; color: var(--primary-strong); font-size: 20px; }
.workshop-line.done .workshop-name { text-decoration: line-through; color: var(--text-muted); }
.workshop-safety-list li { margin: 4px 0; color: var(--text); font-size: 16px; }
.workshop-tools .primary, .workshop-tools .secondary, .workshop-tools .button-link { min-height: 56px; font-size: 17px; }
body.workshop-mode .view { max-width: 980px; }
body.workshop-mode .app-footer { display: none; }
@media (min-width: 960px) {
  body.workshop-mode .layout { grid-template-columns: minmax(0, 1fr); }
  body.workshop-mode .side-nav { display: none; }
  body.workshop-mode .header-menu-button { display: inline-flex !important; }
  body.workshop-mode .sheet-backdrop:not([hidden]) { display: flex !important; }
  body.workshop-mode .sheet { max-width: 640px; margin: 0 auto; border-radius: 22px 22px 0 0; }
}
.batch-chip { background: var(--surface-soft); color: var(--text); border: 1px solid var(--border-strong); }
.batch-planned { background: #fff6dc; border-color: var(--warning-border); color: #6E4A0C; }
.batch-made { background: #e6f1fb; border-color: #9cc0dd; color: #2b557a; }
.batch-ready { background: var(--band); border-color: var(--primary); color: var(--primary-strong); }
.batch-discarded, .batch-cancelled { background: #f1f1f1; color: #555; }
.batch-table .field-input input { width: 100px; }
.deviation-big th, .deviation-big td { color: var(--warning); font-weight: 650; }
.warning-text { color: var(--warning); font-weight: 650; font-size: 14px; }
.restore-preview { margin-top: 12px; padding: 14px; border: 2px solid var(--primary); border-radius: 14px; background: var(--surface-softer); }
.restore-preview h3 { margin-top: 0; }
.restore-counts { padding-left: 20px; color: var(--text); }

/* stock */
.stock-qty { font-size: 20px; color: var(--primary-strong); font-variant-numeric: tabular-nums; }
.stock-qty.negative { color: var(--danger); }
.movement-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 0; padding: 10px; border-radius: 12px; background: var(--surface-softer); }
.movement-form select { flex: 1 1 150px; }
.movement-form .field-input input { width: 100px; }
.movement-form input[type=date] { flex: 0 1 160px; }
.movement-form input[maxlength] { flex: 2 1 160px; }
.movement-form > .muted { flex-basis: 100%; }
.material-card.archived { opacity: .7; }
tr.reversed td { text-decoration: line-through; color: var(--text-muted); }

/* V1.4 — workshop: life cycle, lots, finished goods, files, revisions, sharing */
.batch-inProgress { background: #fff6dc; border-color: var(--warning-border); color: #6E4A0C; }
.batch-curing, .batch-qcPending { background: #e6f1fb; border-color: #9cc0dd; color: #2b557a; }
.batch-released { background: var(--band); border-color: var(--primary); color: var(--primary-strong); }
.batch-blocked { background: var(--warning-bg); border-color: var(--warning-border); color: var(--warning); }
.batch-closed { background: #f1f1f1; color: #444; }
.status-actions { margin-top: 10px; }
.release-fields { border-left: 3px solid var(--primary); padding-left: 10px; margin: 8px 0; }
.incident-list, .trace-list, .file-list, .file-missing { padding-left: 20px; margin: 6px 0 10px; }
.incident-list li, .trace-list li, .file-list li { margin: 4px 0; overflow-wrap: anywhere; }
.file-item { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: space-between; }
.file-actions { display: inline-flex; gap: 6px; }
.file-add select { flex: 1 1 180px; }
.consumption-list { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 8px; }
.consumption-item { border: 1px solid var(--border-strong); border-radius: 12px; padding: 10px; background: var(--surface); }
.consumption-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.consumption-field { display: grid; grid-template-columns: minmax(6em, max-content) 1fr; gap: 6px; align-items: center; margin-top: 6px; }
.consumption-field select { width: 100%; min-width: 0; }
.consumption-after { margin: 6px 0 0; }
.finished-balance { font-size: 18px; }
.finished-balance strong { font-size: 22px; color: var(--primary-strong); font-variant-numeric: tabular-nums; }
.finished-summary { display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px; margin: 6px 0 10px; }
.finished-summary dt { color: var(--text-muted); }
.finished-summary dd { margin: 0; font-variant-numeric: tabular-nums; }
.fin-price { display: inline-flex; gap: 6px; }
input.short { width: 4.5em; text-transform: uppercase; }
.fin-price input[type=number] { width: 100px; }
tr.lot-blocked th, tr.lot-blocked td { color: var(--text-muted); }
.chip.lot-usable { background: var(--band); color: var(--primary-strong); }
.chip.lot-blocked { background: var(--warning-bg); color: var(--warning); }
.stock-links { margin: 6px 0 4px; }
.receive-form { margin-top: 12px; padding: 12px; border: 2px solid var(--primary); border-radius: 14px; background: var(--surface-softer); }
.receive-form h3 { margin-top: 0; }
.fav-recipe { min-width: 36px; min-height: 36px; font-size: 20px; line-height: 1; color: var(--text-muted); margin-left: auto; }
.fav-recipe.on { color: #a86a00; border-color: var(--warning-border); }
.share-panel { margin-top: 10px; padding: 12px; border: 2px solid var(--primary); border-radius: 14px; background: var(--surface-softer); }
.share-panel h3 { margin-top: 0; font-size: 17px; }
.revision-list { list-style: none; padding: 0; margin: 0; }
.revision.current { border-color: var(--primary); }
.rev-name { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.rev-name input { width: 12em; max-width: 100%; }

/* labels */
.label-preview { border: 2px dashed var(--border-strong); border-radius: 10px; padding: 16px; max-width: 420px; background: #fff; color: #111; font-size: 13px; line-height: 1.35; }
.label-preview p { color: #111; margin: 4px 0; }
.label-product { font-size: 18px; font-weight: 800; }
.label-weight { font-weight: 700; }
.inci-missing td:first-child { color: var(--warning); font-style: italic; }
.field-stack { flex-direction: column; align-items: stretch; }
.field-stack textarea { width: 100% !important; }

/* workspace */
.level-choices { display: grid; gap: 10px; }
.level-choice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: 14px; cursor: pointer; background: var(--surface); }
.level-choice.selected { border: 2px solid var(--primary); background: var(--primary-soft); }
.level-choice input { width: 22px; height: 22px; min-height: 0; flex: none; margin-top: 2px; accent-color: var(--primary); }
.level-choice > span { display: flex; flex-direction: column; gap: 2px; }
.module-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.module-choice { align-items: flex-start; }
.module-choice > span { display: flex; flex-direction: column; }
.sheet-customise { margin: 12px 0 0; text-align: center; }
.cost-detail { padding-left: 20px; font-size: 14px; color: var(--text); }
.cost-detail li { margin: 6px 0; }

/* accessibility: reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* mobile adjustments */
@media (max-width: 520px) {
  .workshop-line { font-size: 16px; padding: 10px 12px; }
  .workshop-line .workshop-qty { font-size: 20px; }
  .slider-control { flex-wrap: wrap; }
  .slider-control output { flex-basis: 100%; }
  .fragrance-main .inline-field { flex-wrap: wrap; }
  .batch-table .field-input input { width: 76px; }
  .movement-form .field-input input { width: 80px; }
}

/* print (V1.0): weighing sheet with blank lines for notes, label only when asked */
@media print {
  .undo-bar, .guide-card, .start-links, .fav-button, .workshop-top, .help-tip { display: none !important; }
  .write-lines { display: block; height: 0; }
  .write-lines::before { content: ''; display: block; height: 120px; background: repeating-linear-gradient(to bottom, transparent 0, transparent 23px, #999 23px, #999 24px); }
  .write-in { min-width: 90px; }
  .weighing-sheet .muted { color: #333; }
  body.workshop-mode .workshop-line { border: 1px solid #555; min-height: 0; }
  body.print-label .view > *:not(#labelPreviewCard):not(#blabelPrint) { display: none !important; }
  body.print-label #labelPreviewCard { border: 0; padding: 0; }
  body.print-label #labelPreviewCard .card-title { display: none; }
  @page { size: A4; margin: 14mm; }
}

/* ---------------------------------------------- V1.0.1 readability on phones
   On narrow screens the ingredient <select> of each composition row was ~100 px wide
   ("Huile d'…", "Beurre …"): a beginner could not tell the oils apart. The name now
   takes its own line and the quantity, share and remove button sit below it.
   Same for the substitute liquids, and for form rows holding a list or a text field
   (goal of "Create my ideal soap", name / INCI of a custom ingredient, currency…). */
@media (max-width: 520px) {
  .oil:not(.oil-head) { grid-template-columns: minmax(0, 1fr) 56px 44px; row-gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
  .oil:not(.oil-head) > select { grid-column: 1 / -1; width: 100%; }
  .oil-head { grid-template-columns: minmax(0, 1fr) 56px 44px; }
  .oil-head > span:first-child { display: none; }
  .liquid-row:not(.liquid-water) { grid-template-columns: minmax(0, 1fr) 44px; row-gap: 6px; }
  .liquid-row:not(.liquid-water) > select { grid-column: 1 / -1; width: 100%; }
  .field-row:has(> select), .field-row:has(> input[type=text]), .field-row:has(> input:not([type])),
  .field-row:has(> input[type=search]), .field-row:has(> input[type=email]), .field-row:has(> input[type=url]) {
    flex-direction: column; align-items: stretch; gap: 6px;
  }
  .field-row:has(> select) > select, .field-row:has(> input[type=text]) > input, .field-row:has(> input:not([type])) > input,
  .field-row:has(> input[type=search]) > input, .field-row:has(> input[type=email]) > input, .field-row:has(> input[type=url]) > input { width: 100%; max-width: none; }
}
/* weighing sheet: the boxes are ticked with wet or gloved fingers */
.weigh-table .tick input[type=checkbox] { width: 28px; height: 28px; }

/* ===================================================================== V1.1
   Simplicity and ergonomics: Home, guided recipe, clearer menus, navigation that
   stays usable with the keyboard open, on low screens and when the bottom is covered. */

/* header: the word "Menu" stays visible on phones; the language list is shortened */
@media (max-width: 540px) {
  #header-menu-label { display: inline; font-weight: 650; font-size: 14px; }
  .header-menu-button { padding: 7px 9px; }
  .app-header select#lang { width: 82px; padding-right: 4px; }
}
@media (max-width: 359px) {
  .brand img { max-width: 104px; }
  .app-header select#lang { width: 80px; padding-left: 4px; padding-right: 2px; }
}

/* menus: full wording + one-line description */
.nav-sheet .nav-label { display: flex; flex-direction: column; gap: 2px; }
.nav-title { font-weight: 600; line-height: 1.25; }
.nav-desc { font-size: 12.5px; color: var(--text-muted); font-weight: 400; line-height: 1.3; }
.sheet-grid { grid-template-columns: 1fr; gap: 6px; }
@media (min-width: 560px) { .sheet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.nav-sheet { align-items: flex-start; padding: 11px 12px; }
.nav-sheet .icon { margin-top: 1px; }
.nav-hidden-tools { margin-top: 14px; }
.nav-group-title { font-size: 12.5px; color: var(--text-muted); margin: 0 4px 6px; font-weight: 600; }
.nav-hidden-tools ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.nav-sheet-small { padding: 9px 12px; min-height: 44px; border-radius: 12px; border: 1px dashed var(--border-strong); background: var(--surface); font-size: 14px; color: var(--text); }
.side-nav .nav-hidden-tools .nav-side { font-size: 14px; color: var(--text-muted); }
.sheet-backdrop.from-top { align-items: flex-start; }
.sheet-backdrop.from-top .sheet { border-radius: 0 0 22px 22px; padding-top: calc(14px + env(safe-area-inset-top)); max-height: 75vh; }

/* bottom bar: hidden while the on-screen keyboard is open and on very low screens;
   the header Menu (sticky) is then the way to every section */
body.keyboard-open .bottom-nav { display: none; }
body.keyboard-open .app-footer, body.keyboard-open .toast { padding-bottom: 16px; }
@media (max-height: 430px) and (max-width: 959px) {
  .bottom-nav { display: none; }
  .app-footer { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(16px + env(safe-area-inset-bottom)); }
  .app-header { padding-top: calc(6px + env(safe-area-inset-top)); padding-bottom: 6px; }
}

/* ------------------------------------------------------------------ Home */
.home-choices { display: grid; gap: 14px; margin: 18px 0; }
@media (min-width: 640px) { .home-choices { grid-template-columns: 1fr 1fr; } }
.home-choice {
  display: flex; gap: 14px; align-items: flex-start; text-align: left; width: 100%;
  padding: 20px; border-radius: var(--radius); border: 2px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; box-shadow: var(--shadow); font: inherit; min-height: 0;
}
.home-choice:hover { border-color: var(--focus); }
.home-choice:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.home-beginner { background: var(--primary-soft); }
.home-choice.is-current { border-color: var(--primary); }
.home-choice-icon { flex: none; width: 46px; height: 46px; border-radius: 14px; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; color: var(--primary); border: 1px solid var(--border); }
.home-choice-icon .icon { width: 26px; height: 26px; }
.home-choice-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.home-choice-title { font-size: 20px; font-weight: 700; color: var(--primary-strong); }
.home-choice-text { font-size: 15.5px; line-height: 1.45; }
.home-current { align-self: flex-start; font-size: 12.5px; font-weight: 650; color: var(--primary-strong); background: var(--band); border-radius: 20px; padding: 2px 10px; }
.home-recipes {
  display: flex; gap: 12px; align-items: center; padding: 16px 18px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; box-shadow: var(--shadow); min-height: 56px;
}
.home-recipes:hover { border-color: var(--focus); }
.home-recipes .icon { color: var(--primary); width: 24px; height: 24px; }
.home-recipes-body { display: flex; flex-direction: column; gap: 2px; }
.home-recipes-title { font-weight: 650; font-size: 16.5px; color: var(--primary-strong); text-decoration: underline; text-underline-offset: 3px; }
.home-recipes-count { font-size: 13px; color: var(--text-muted); }
.home-more { margin: 18px 4px 6px; }
.home-note { margin: 8px 4px; max-width: 62ch; }
.home-resume { border: 2px solid var(--gold); }

/* --------------------------------------------------------- guided recipe */
.guided-progress { margin: 4px 0 8px; }
.guided-count { margin: 0 0 6px; font-weight: 650; color: var(--primary-strong); }
.guided-bar { height: 8px; background: var(--border); border-radius: 8px; overflow: hidden; }
.guided-bar span { display: block; height: 100%; background: var(--primary); border-radius: 8px; }
.guided-steps { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.guided-steps li { min-width: 0; }
.step-link { display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none; color: var(--text-muted); font-size: 12px; text-align: center; min-height: 44px; justify-content: flex-start; }
.step-num { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--border-strong); background: var(--surface); font-weight: 700; font-size: 13px; }
.step-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-done .step-num { background: var(--primary); border-color: var(--primary); color: #fff; }
.step-done .step-link { color: var(--primary-strong); }
.step-current .step-num { border-color: var(--primary); color: var(--primary-strong); background: var(--band); }
.step-current .step-link { color: var(--text); font-weight: 650; }
.guided-card .card-title { font-size: 21px; }
.guided-explain { margin: 0 0 12px; }
.guided-explain p { margin: 8px 0; line-height: 1.5; }
.guided-label { display: block; font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--primary); margin-bottom: 2px; }
.guided-why { color: var(--text-muted); }
.guided-explain .guided-why { background: var(--surface-softer); border-left: 3px solid var(--leaf); padding: 8px 12px; border-radius: 0 10px 10px 0; color: var(--text); }
.guided-sub { font-size: 16.5px; margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.guided-oils { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
@media (min-width: 640px) { .guided-oils { grid-template-columns: 1fr 1fr; } }
.guided-oil { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; min-height: 52px; }
.guided-oil:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.guided-oil input[type=checkbox] { width: 24px; height: 24px; }
.guided-oil-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.guided-oil-name { font-weight: 600; }
.guided-oil-role { font-size: 13px; color: var(--text-muted); }
.guided-chosen { font-weight: 600; margin: 10px 0 0; }
.guided-other { margin-top: 14px; }
.guided-qtys { list-style: none; margin: 0; padding: 0; }
.guided-qty { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name input" "share share"; gap: 2px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.guided-qty-name { grid-area: name; font-weight: 600; }
.guided-qty .field-input { grid-area: input; }
.guided-qty .field-input input { width: 110px; }
.guided-share { grid-area: share; }
.guided-block { margin-top: 6px; }
.guided-choices { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
.guided-choice { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; min-height: 48px; background: var(--surface); }
.guided-choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.guided-choice input[type=radio] { width: 22px; height: 22px; accent-color: var(--primary); flex: none; margin: 0; }
.weigh-list { margin: 0; }
.weigh-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.weigh-row dt { min-width: 0; }
.weigh-row dd { margin: 0; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.weigh-key dt, .weigh-key dd { font-size: 17px; color: var(--primary-strong); font-weight: 700; }
.weigh-group { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); padding: 14px 0 2px; }
.guided-safety { margin: 16px 0; padding: 12px 16px; border-radius: 12px; background: var(--warning-bg); border: 1px solid var(--warning-border); }
.guided-safety .guided-sub { margin-top: 4px; color: var(--warning); }
.guided-safety ul { margin: 0; padding-left: 20px; }
.guided-safety li { margin: 4px 0; }
.plain-props { list-style: none; margin: 0; padding: 0; }
.plain-props li { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); line-height: 1.45; }
.plain-mark { flex: none; width: 20px; text-align: center; font-weight: 700; color: var(--primary); }
.plain-low .plain-mark, .plain-high .plain-mark { color: var(--warning); }
.guided-technical { margin-top: 16px; }
.guided-message:focus { outline: none; }
.guided-nav { margin: 0 0 8px; }
.guided-nav-buttons { display: flex; gap: 10px; justify-content: space-between; position: sticky; bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom)); z-index: 5; background: color-mix(in srgb, var(--bg) 94%, transparent); padding: 10px 0; }
.guided-nav-buttons .primary { margin-left: auto; min-width: 140px; }
.guided-leave { display: inline-block; margin-top: 10px; font-size: 14px; }
body.keyboard-open .guided-nav-buttons { position: static; }
@media (max-height: 430px), (min-width: 960px) { .guided-nav-buttons { bottom: 0; } }
@media (max-height: 560px) { .guided-nav-buttons { position: static; } }
@media (max-width: 420px) {
  .guided-steps .step-label { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .step-link { min-height: 32px; }
}
.guided-actions { margin-top: 12px; }
.calc-guided-link { margin: 0 0 8px; }
.plain-line { margin: 4px 0 0; font-size: 14px; color: var(--text); }
.plain-weigh { font-size: 15px; margin: 8px 0 4px; }
@media print { .guided-nav, .guided-progress { display: none !important; } }
/* very narrow phones: the bottom labels keep their full words (e.g. "Ingredientes") */
@media (max-width: 349px) { .nav-bottom { font-size: 10px; padding-left: 0; padding-right: 0; } }

/* ===================================================================== V1.2 */
/* additive rows on phones: name on its own line, then the dose with its unit and ✕
   (the suffix "% of oils" used to overflow the card on 320–430 px screens) */
@media (max-width: 520px) {
  .oil.additive:not(.oil-head) { grid-template-columns: minmax(0, 1fr) 44px; }
  .oil.additive:not(.oil-head) > .additive-name { grid-column: 1 / -1; }
  .oil.additive .field-input { min-width: 0; flex-wrap: wrap; }
}
.more-actions { flex-basis: 100%; margin-top: 4px; }
.more-actions > summary { min-height: 44px; }
.more-actions > .recipe-actions { margin-top: 6px; }
/* the toast used to cover the sticky Back / Continue buttons of the guided recipe */
body[data-section="guided"] .toast { bottom: calc(var(--bottom-nav-height) + 84px + env(safe-area-inset-bottom)); }
@media (min-width: 960px), (max-height: 430px) { body[data-section="guided"] .toast { bottom: 90px; } }

/* ===================================================================== V1.3 */
.guided-note { margin: 4px 0 10px; }
.guided-fix { margin-top: 8px; }

/* ===================================================================== V1.3.1 */
/* footer: explicit link to the main website (the logo opens the app home) */
.app-footer a.footer-name { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; text-decoration: underline; text-underline-offset: 3px; }
/* step 5: status line and grouped actions */
.save-status { margin: 10px 0 4px; padding: 8px 12px; border-radius: 10px; background: var(--surface-soft); font-size: 15px; }
.save-status.status-saved { border-left: 4px solid var(--primary); }
.save-status.status-modified, .save-status.status-draft { border-left: 4px solid #a86a00; }
.guided-group { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); }
.guided-group h3 { margin: 0 0 4px; font-size: 16px; }
.guided-group .tools { margin-top: 6px; }
/* Recipes: where the recipes are kept */
.data-explain { margin-top: 14px; padding: 10px 14px; border-radius: 12px; background: var(--surface-soft); }
.data-explain h3 { margin: 0 0 6px; font-size: 15px; }
.data-explain ul { margin: 0; padding-left: 20px; }
.data-explain li { margin: 4px 0; font-size: 14px; line-height: 1.45; }
@media (max-width: 539px) {
  .app-footer a.footer-name { display: flex; justify-content: center; width: fit-content; margin: 0 auto; }
  .app-footer .footer-sep:first-of-type { display: none; }
}

/* ===================================================================== V1.3.2 */
/* footer: at the bottom of short pages, no large empty band (the fixed bar keeps its own space) */
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body > .layout { flex: 1 0 auto; width: 100%; }
.view { padding-bottom: 20px; }
.app-footer { padding: 4px 16px calc(var(--bottom-nav-height) + 10px + env(safe-area-inset-bottom)); line-height: 1.5; }
.app-footer a.footer-name { min-height: 44px; }
.app-footer a.footer-name:focus:not(:focus-visible) { outline: none; }
@media (min-width: 960px) { .app-footer { padding-bottom: 20px; } }
@media (max-height: 430px) and (orientation: landscape) { .app-footer { padding-bottom: calc(14px + env(safe-area-inset-bottom)); } }
/* touch screens: compact buttons keep a 44 px touch target */
@media (pointer: coarse) { .small { min-height: 44px; } }

/* "?" help: a 44 px touch target around a 28 px circle; the text opens under the heading */
.help-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; min-height: 44px; padding: 0; margin: -8px 0;
  background: transparent; border: 0; border-radius: 50%; cursor: pointer; flex: none; }
.help-button > span { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid var(--primary); color: var(--primary); font-weight: 800; font-size: 14px; background: var(--surface); }
.help-button[aria-expanded="true"] > span { background: var(--primary); color: #fff; }
.help-button:hover > span { background: var(--primary-soft); }
.help-button[aria-expanded="true"]:hover > span { background: var(--primary); }
.help-panel { margin: 0 0 8px; font-size: 14px; line-height: 1.5; color: var(--text); background: var(--surface-soft); border-left: 3px solid var(--gold); padding: 8px 10px; border-radius: 0 8px 8px 0; }
.guided-sub-row { display: flex; align-items: center; gap: 2px; margin: 14px 0 2px; }
.guided-sub-row .guided-sub { margin: 0; }
.guided-block > .guided-why { margin: 2px 0 8px; font-size: 15px; line-height: 1.45; }

/* compact choices: value + short note, side by side */
.guided-choices.choices-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.guided-choices.choices-3 .guided-choice { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 6px; row-gap: 0; padding: 8px; min-height: 56px; }
.guided-choices.choices-3 .guided-choice input[type=radio] { width: 20px; height: 20px; }
.choice-text { display: contents; }
.choice-value { font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.choice-note { grid-column: 1 / -1; font-size: 13px; color: var(--text-muted); font-weight: 400; line-height: 1.3; hyphens: manual; overflow-wrap: normal; }
.guided-choice:has(input:checked) .choice-note { color: var(--text); }
.guided-choices > p { grid-column: 1 / -1; margin: 2px 0 0; }
.field-row.field-compact { margin: 8px 0 0; }
.guided-later { font-size: 13.5px; margin: 14px 0 0; }

/* step 5: status, one main action, compact secondary actions, folded backup advice */
.save-line { margin: 6px 0 10px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 15px; }
.save-status { margin: 0; padding: 0 0 0 10px; border-radius: 0; background: none; border-left: 4px solid var(--border); font-size: 15px; }
.save-status.status-saved { border-left-color: var(--primary); }
.save-status.status-modified, .save-status.status-draft { border-left-color: #a86a00; }
.guided-main-action .primary { width: 100%; max-width: 420px; }
.guided-secondary { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--border); }
.guided-secondary .small { font-size: 14px; }
@media (max-width: 599px) {
  .guided-secondary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .guided-secondary .small { justify-content: center; text-align: center; padding: 8px 8px; line-height: 1.25; }
}
@media (max-width: 399px) { .guided-secondary .small .icon { display: none; } }
details.guided-backup { margin-top: 12px; }
details.guided-backup > summary { font-size: 14.5px; font-weight: 600; color: var(--primary-strong); }
details.guided-backup > p { margin: 6px 0 0; font-size: 14px; color: var(--text-muted); }

/* My saved recipes: the recipes first, the tools folded */
.page-header details.data-explain { margin: 4px 0 0; padding: 0; background: none; border-radius: 0; }
.page-header details.data-explain > summary { font-size: 14.5px; font-weight: 600; color: var(--primary-strong); }
.page-header details.data-explain ul { margin: 6px 0 0; padding: 10px 14px 10px 30px; border-radius: 12px; background: var(--surface-soft); }
.recipes-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 10px 0 12px; }
.recipes-top p { margin: 0; }
details.recipes-tools > summary { font-size: 16px; }
details.recipes-tools .tools:first-of-type { margin-top: 10px; }
/* keyboard navigation: a focused control is never scrolled under the fixed bottom bar (or the sticky
   Back / Continue bar of the guided recipe) */
@media (max-width: 959px) {
  html { scroll-padding-bottom: calc(var(--bottom-nav-height) + 12px + env(safe-area-inset-bottom)); }
  html:has(body[data-section="guided"]) { scroll-padding-bottom: calc(var(--bottom-nav-height) + 80px + env(safe-area-inset-bottom)); }
  html:has(body.keyboard-open) { scroll-padding-bottom: 16px; }
}
@media (max-width: 959px) and (max-height: 430px) and (orientation: landscape) {
  html { scroll-padding-bottom: 12px; }
  html:has(body[data-section="guided"]) { scroll-padding-bottom: 76px; }
}

/* V2.0 — label of a batch: preview at real size, checklist */
.blabel-scroll { overflow-x: auto; max-width: 100%; padding: 4px 0; }
.blabel-preview { position: relative; box-sizing: border-box; background: #fff; color: #000; border: 1px dashed #275e36; font-family: Helvetica, Arial, sans-serif; overflow: hidden; }
.blabel-preview.bw { border-color: #000; }
.blabel-line { white-space: pre; color: #000; }
.blabel-line.b { font-weight: 700; }
.blabel-line.draft { color: #9e1f1a; }
.blabel-preview.bw .blabel-line.draft { color: #000; }
.blabel-qr { position: absolute; right: 2.5mm; bottom: 2.5mm; width: 15mm; height: 15mm; }
.checklist { list-style: none; padding: 0; margin: 8px 0; }
.check-item { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; border-bottom: 1px solid var(--border, #e3e8e4); }
.check-mark { font-weight: 800; width: 1.2em; flex: none; text-align: center; }
.check-item.ok .check-mark { color: var(--primary); }
.check-item.missing .check-mark, .check-item.missing strong { color: var(--danger, #9e1f1a); }
.check-item.tocheck .check-mark { color: var(--warning); }
.radio-group { border: 0; padding: 0; margin: 8px 0; }
.radio-group legend { font-weight: 650; margin-bottom: 4px; }
.section-title { font-size: 18px; margin: 18px 0 6px; }
body.print-label .blabel-scroll { overflow: visible; }
@media print {

  /* V2.0: only the label preview is printed, at real size, from the top left of the page */
  body.print-label #blabelPrint { visibility: hidden; border: 0; box-shadow: none; padding: 0; margin: 0; }
  body.print-label #blabelPreview, body.print-label #blabelPreview * { visibility: visible; }
  body.print-label #blabelPreview { position: absolute; left: 0; top: 0; }
}

/* V2.0 — dashboard charts (SVG + data table), economics */
.chart { margin: 8px 0; }
.bar-chart { width: 100%; max-width: 560px; height: auto; display: block; }
.bar-chart .bar { fill: var(--primary); }
.bar-chart .bar.warn { fill: var(--warning); }
.chips.chips-wrap { flex-wrap: wrap; overflow-x: visible; }
.bar-chart .bar-label, .bar-chart .bar-value { font-size: 14px; fill: var(--text, #1d2420); }
.chart-data summary { cursor: pointer; color: var(--primary); }
.visually-hidden-table caption { text-align: left; font-weight: 650; }
.total-row th, .total-row td { font-weight: 750; border-top: 2px solid var(--border-strong); }

/* V2.0 — lexicon */
.glossary { margin: 1rem 0; }
.glossary dt { font-weight: 700; margin-top: 1rem; }
.glossary dd { margin: .25rem 0 0; padding-bottom: .75rem; border-bottom: 1px solid var(--border, #ddd); }
.glossary dd p { margin: .25rem 0; }
#glossarySearch { width: 100%; max-width: 32rem; }

/* RC5 — 3 explicit creation paths, discreet save state, history behind disclosure. */
.recipe-start { padding: 15px 17px; margin: 10px 0 15px; border: 1px solid var(--border-strong); border-radius: 16px; background: var(--surface); }
.recipe-start-title { margin: 0 0 10px; font-weight: 700; color: var(--brand); }
.recipe-start-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.recipe-start-actions .primary, .recipe-start-actions .secondary { flex: 1 1 185px; text-align: center; }
.recipe-start-example { flex: 1 1 100%; font-size: 14px; padding: 6px 2px; }
.recipe-status { display: block; padding: 0; margin: 9px 0 2px; border: 0; border-radius: 0; background: none; color: var(--text-muted); font-size: 13px; }
.recipe-status .status-text { color: var(--text-muted); min-width: 0; }
.recipe-history-tools { margin-top: 14px; }
.recipe-history-tools .undo-bar { margin: 9px 0; }
@media (max-width: 520px) {
  .recipe-start { padding: 13px; }
  .recipe-start-actions .primary, .recipe-start-actions .secondary { flex-basis: 100%; }
  .recipe-start-example { text-align: center; }
}

/* RC5: novice tips no longer push the real creation buttons off screen. */
.calc-optional-guide { margin: 0 0 10px; }
.calc-optional-guide > .guide-card { margin: 10px 0 0; }

/* V2.0.0-rc.6 — language flags as SVG images (decorative; the list announces the language name) */
.lang-picker { position: relative; display: inline-flex; align-items: center; min-width: 0; }
.lang-picker .lang-flag { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 20px; height: 14px;
  pointer-events: none; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .18); }
.lang-picker select, .app-header .lang-picker select#lang { padding-left: 36px; }
.lang-with-flag { display: inline-flex; align-items: center; gap: 7px; }
.lang-with-flag .lang-flag { flex: none; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .18); }
@media (max-width: 540px) { .app-header .lang-picker select#lang { width: 88px; padding-left: 34px; } .lang-picker .lang-flag { left: 8px; } }
@media (max-width: 359px) { .app-header .lang-picker select#lang { width: 84px; padding-left: 32px; } .lang-picker .lang-flag { left: 7px; width: 18px; height: 12.6px; } }

/* V2.0.0-rc.6 — free resources banner (discreet, last on Home, end of Learn) */
.resources-banner { position: relative; margin: 18px 0 8px; padding: 11px 44px 11px 14px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); font-size: 14px; line-height: 1.45; }
.resources-banner p { margin: 0; }
.resources-banner .resources-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 6px; }
.resources-banner .resources-link { display: inline-flex; align-items: center; min-height: 36px; font-weight: 650; }
.resources-banner .resources-offline { margin-top: 4px; font-size: 13px; }
.resources-banner .resources-close { position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-muted); font-size: 22px; line-height: 1; cursor: pointer; }
.resources-banner .resources-close:hover, .resources-banner .resources-close:focus-visible { background: var(--border); color: var(--text); }
#learnResources { padding-right: 14px; }
/* V2.0.0-rc.6 — marker of the test copy (/app-test/) */
.channel-badge { display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 6px; background: #8a3b00; color: #fff;
  font-size: 12px; font-weight: 800; letter-spacing: .04em; }
@media (max-width: 400px) {
  .app-header { position: relative; }
  /* the marker leaves the room of the header to the menu and the language list */
  .channel-badge { position: absolute; left: 12px; top: 3px; padding: 0 5px; font-size: 9.5px; line-height: 15px; border-radius: 4px; }
}

/* APISARA V3.5: readable direct-to-Substack link, language-aware, in the test app header.
   No changes to the calculator's features or data storage. */
.articles-header-cta {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 7px 13px; border: 1px solid #13643a;
  background: #f0f7f1; color: #115a34; border-radius: 10px;
  text-decoration: none; text-align: center; font-size: 13px;
  font-weight: 750; line-height: 1.25; white-space: nowrap;
}
.articles-header-cta:hover { background: #dceee0; color: #0c4228; }
.articles-header-cta:focus-visible { outline: 3px solid #d7a53d; outline-offset: 2px; }
.articles-header-short { display: none; }
@media (max-width: 1100px) {
  .articles-header-full { display: none; }
  .articles-header-short { display: inline; }
  .articles-header-cta { padding: 6px 9px; font-size: 12px; }
}
@media (max-width: 540px) {
  .articles-header-cta { padding: 4px 5px; min-height: 30px; font-size: 10px; border-radius: 6px; }
}
@media (max-width: 359px) {
  .articles-header-cta { font-size: 9px; padding: 3px; }
}
