:root {
  --bg: #f3f1ea;
  --surface: #ffffff;
  --surface-2: #eceae1;
  --ink: #1b2420;
  --muted: #5d6a63;
  --line: #dcd8cc;
  --primary: #1f3a30;
  --primary-ink: #f3f1ea;
  --accent: #c63f26;
  --accent-soft: #f8e3dc;
  --ok: #2f7a55;
  --warn: #9a5b00;
  --warn-soft: #fbefd9;
  --info-soft: #e3eee9;
  --focus: #c63f26;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(20 30 25 / 6%), 0 8px 24px rgb(20 30 25 / 6%);
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111513; --surface: #181e1b; --surface-2: #202824; --ink: #e8ece8; --muted: #9aa8a0;
    --line: #2c3631; --primary: #8fd0b1; --primary-ink: #0f1512; --accent: #f07a5f; --accent-soft: #3a211b;
    --ok: #7fcfa4; --warn: #f0b75e; --warn-soft: #33291a; --info-soft: #1d2b25; --focus: #f07a5f;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 25%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111513; --surface: #181e1b; --surface-2: #202824; --ink: #e8ece8; --muted: #9aa8a0;
  --line: #2c3631; --primary: #8fd0b1; --primary-ink: #0f1512; --accent: #f07a5f; --accent-soft: #3a211b;
  --ok: #7fcfa4; --warn: #f0b75e; --warn-soft: #33291a; --info-soft: #1d2b25; --focus: #f07a5f;
  --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 8px 24px rgb(0 0 0 / 25%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Modalità */
body[data-mode="casa"] .mode-pro { display: none !important; }
body[data-mode="pro"] .mode-casa { display: none !important; }

/* Barra superiore */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px max(16px, calc((100vw - 1240px) / 2));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font: 600 19px var(--serif); margin-right: auto; }
.brand b { color: var(--accent); font-weight: 700; }
.brand-mark { width: 28px; height: 28px; color: var(--accent); }
.mode-switch { display: flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.mode-switch button {
  border: 0; background: transparent; padding: 6px 16px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--muted);
}
.mode-switch button[aria-checked="true"] { background: var(--primary); color: var(--primary-ink); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lang-picker select { min-height: 36px; padding: 6px 30px 6px 12px; border-radius: 999px; font-size: 13.5px; width: auto; background-color: var(--surface); }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; }

/* Layout */
.layout {
  max-width: 1240px; margin: 0 auto; padding: 24px 16px 96px;
  display: grid; gap: 20px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "intro" "form" "ticket" "plan";
}
@media (min-width: 960px) {
  .layout {
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
    grid-template-areas: "intro intro" "form ticket" "plan plan";
    align-items: start;
    padding-bottom: 48px;
  }
  .ticket-wrap { align-self: stretch; }
  .ticket-wrap .ticket { position: sticky; top: 76px; }
  .dock { display: none !important; }
}
.intro { grid-area: intro; }
#form { grid-area: form; }
.ticket-wrap { grid-area: ticket; }
.plan { grid-area: plan; }

h1 { font: 700 clamp(28px, 4.2vw, 44px)/1.08 var(--serif); letter-spacing: -0.01em; margin: 8px 0 10px; max-width: 22ch; }
h1 em { font-style: italic; font-weight: 500; color: var(--accent); }
.lead { color: var(--muted); max-width: 60ch; margin: 0; font-size: 16px; }

/* Pannelli del form */
.panel-stack { display: grid; gap: 14px; }
.panel {
  margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  padding: 18px 18px 8px; min-width: 0;
}
.panel legend { float: left; width: 100%; padding: 0; margin-bottom: 14px; font: 600 18px var(--serif); display: flex; align-items: center; gap: 10px; }
.panel legend ~ * { clear: both; }
.n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--primary); color: var(--primary-ink); font: 600 13px var(--mono); }

.field { display: block; margin-bottom: 14px; min-width: 0; }
.label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; }
.label-row output { font: 500 20px var(--mono); color: var(--accent); }
.hint { color: var(--muted); font-size: 13px; margin: -6px 0 14px; }
.toggle-row .hint, .field .hint { margin: 4px 0 0; }

input[type="number"], input[type="datetime-local"], select {
  width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
input:focus, select:focus { border-color: var(--primary); }
.unit { display: flex; align-items: stretch; }
.unit input { border-top-right-radius: 0; border-bottom-right-radius: 0; font-family: var(--mono); }
.unit span { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line); border-left: 0; border-radius: 0 10px 10px 0; background: var(--surface-2); color: var(--muted); font-size: 13px; }

.stepper { display: flex; }
.stepper input { text-align: center; border-radius: 0; font-family: var(--mono); -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button { appearance: none; }
.stepper button { width: 44px; border: 1px solid var(--line); background: var(--surface-2); font-size: 20px; cursor: pointer; }
.stepper button:first-child { border-radius: 10px 0 0 10px; border-right: 0; }
.stepper button:last-child { border-radius: 0 10px 10px 0; border-left: 0; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
@media (max-width: 520px) { .grid-3 { grid-template-columns: 1fr 1fr; } }

input[type="range"] { width: 100%; accent-color: var(--accent); margin: 6px 0 2px; height: 28px; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.seg button, .chips button {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; cursor: pointer; font-size: 13.5px;
}
.seg button small { color: var(--muted); margin-left: 4px; }
.seg button[aria-checked="true"] { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.seg button[aria-checked="true"] small { color: inherit; opacity: .75; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 14px; }
.chips button { padding: 4px 11px; font-size: 12.5px; color: var(--muted); }
.chips button:hover { color: var(--ink); border-color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 14px; }
.cards button { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.cards button b { display: block; font-weight: 600; }
.cards button span { color: var(--muted); font-size: 12.5px; }
.cards button[aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }

.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; margin-bottom: 10px; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); }
.toggle-row .label { margin: 0; }
.switch { position: relative; flex: none; width: 50px; height: 30px; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background .2s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgb(0 0 0 / 25%); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Schede farina / forno */
.spec-card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); padding: 12px 14px; margin: -4px 0 14px; font-size: 13.5px; }
.spec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px 14px; margin: 0; }
.spec-grid dt { font-size: 12px; color: var(--muted); }
.spec-grid dd { margin: 0; font: 500 15px var(--mono); }
.spec-card .hint { margin: 8px 0 0; }
.spec-used { margin: 10px 0 0; font-weight: 600; }
.spec-src { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.spec-src a { color: var(--primary); }
.spec-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; }
.badge { display: inline-block; font: 500 11px var(--mono); padding: 2px 7px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); vertical-align: 1px; }
.muted { color: var(--muted); }
.custom-box { border: 1px dashed var(--accent); border-radius: 12px; padding: 12px 14px 4px; margin: -4px 0 14px; }
.custom-title { font-weight: 600; margin: 0 0 10px; }
.custom-box .actions { margin: 0 0 12px; }
.custom-box .hint { margin: -4px 0 10px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 2px 0 14px; }
.checks label { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.checks input { width: 18px; height: 18px; accent-color: var(--accent); }
.spec-actions .btns { display: flex; gap: 6px; }
input[type="text"], input[type="email"], input[type="password"] { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }

/* Scheda risultati (ticket) */
.ticket {
  position: relative; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid var(--line); overflow: hidden;
}
.ticket-head { background: var(--primary); color: var(--primary-ink); padding: 18px 20px 16px; }
.ticket-head .eyebrow { font: 500 11.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.ticket-head h2 { font: 700 24px/1.15 var(--serif); margin: 4px 0 12px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpi { border-left: 2px solid color-mix(in srgb, var(--primary-ink) 30%, transparent); padding-left: 10px; }
.kpi .k { font-size: 11.5px; opacity: .8; }
.kpi .v { font: 500 22px/1.2 var(--mono); }
.kpi .v small { font-size: 13px; opacity: .8; margin-left: 2px; }
.perf { height: 14px; background: radial-gradient(circle at 7px 0, transparent 6px, var(--surface) 6.5px) 0 0 / 14px 14px repeat-x, var(--primary); }
.ticket-body { padding: 4px 20px 18px; }
.sec-title { font: 500 11.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 16px 0 6px; }
.ing { width: 100%; border-collapse: collapse; }
.ing td { padding: 9px 0; border-bottom: 1px dashed var(--line); vertical-align: baseline; }
.ing td.g { text-align: right; font: 500 16px var(--mono); white-space: nowrap; padding-left: 8px; }
.ing td.p { text-align: right; color: var(--muted); font: 12.5px var(--mono); width: 64px; white-space: nowrap; }
.ing .note { display: block; font-size: 12px; color: var(--muted); }
.ing tr.total td { border-bottom: 0; font-weight: 600; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; background: var(--c, var(--muted)); vertical-align: 1px; }

.callout { display: flex; gap: 10px; align-items: flex-start; border-radius: 10px; padding: 10px 12px; margin-top: 12px; font-size: 13.5px; background: var(--info-soft); }
.callout.warn { background: var(--warn-soft); }
.callout.error { background: var(--accent-soft); }
.callout .ic { flex: none; font: 600 13px var(--mono); width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); }
.callout.warn .ic { color: var(--warn); }
.callout b { font-family: var(--mono); font-weight: 500; }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.fact { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.fact .k { font-size: 12px; color: var(--muted); }
.fact .v { font: 500 17px var(--mono); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.btn { border: 1px solid var(--line); background: var(--surface); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-size: 13.5px; font-weight: 500; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn:hover { border-color: var(--muted); }

/* Programma */
.plan-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px; margin: 16px 0 8px; }
.plan-head h2 { font: 700 clamp(24px, 3vw, 32px) var(--serif); margin: 0; }
.plan-head p { margin: 4px 0 0; color: var(--muted); }
.gauge { display: flex; height: 10px; border-radius: 999px; overflow: hidden; margin: 12px 0 22px; background: var(--surface-2); }
.gauge i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); margin-top: -12px; margin-bottom: 18px; }

.steps { list-style: none; margin: 0; padding: 0; position: relative; }
.step { display: grid; grid-template-columns: 86px 1fr; gap: 0 16px; }
.step .when { text-align: right; padding-top: 14px; }
.step .when .t { font: 500 18px var(--mono); display: block; }
.step .when .d { font-size: 12px; color: var(--muted); }
.step .body { position: relative; border-left: 2px solid var(--line); padding: 12px 0 22px 22px; }
.step .body::before { content: ''; position: absolute; left: -8px; top: 18px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--c, var(--primary)); }
.step:last-child .body { border-left-color: transparent; }
.step details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.step summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.step summary::-webkit-details-marker { display: none; }
.step summary h3 { font: 600 17px var(--serif); margin: 0; }
.tag { font: 500 12px var(--mono); padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.tag.temp { background: color-mix(in srgb, var(--c) 18%, var(--surface)); color: var(--ink); }
.step summary::after { content: '+'; margin-left: auto; font: 500 18px var(--mono); color: var(--muted); }
.step details[open] summary::after { content: '–'; }
.step .lead-s { color: var(--muted); margin: 8px 0 4px; font-size: 14px; }
.step ol { margin: 8px 0 2px; padding-left: 20px; }
.step li { margin: 5px 0; }
.check { display: flex; gap: 8px; align-items: center; margin-top: 10px; font-size: 13px; color: var(--muted); }
.check input { width: 18px; height: 18px; accent-color: var(--ok); }
.step.done details { opacity: .6; }

.baker { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 14px; }
.baker th, .baker td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; }
.baker th:first-child, .baker td:first-child { text-align: left; }
.baker th { font: 500 11.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.baker td { font-family: var(--mono); }
.baker td:first-child { font-family: var(--sans); }
.pro-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin-top: 28px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.card h3 { font: 600 17px var(--serif); margin: 0 0 4px; }

/* Barra fissa mobile */
.dock {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 15;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--primary); color: var(--primary-ink); border-radius: 14px; padding: 10px 12px 10px 16px; box-shadow: var(--shadow);
}
.dock b { font: 500 17px var(--mono); }
.dock-k { font-size: 12.5px; opacity: .8; }
.dock-btn { background: var(--primary-ink); color: var(--primary); text-decoration: none; padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 14px; }
.dock.hidden { display: none; }

.foot { max-width: 1240px; margin: 0 auto; padding: 0 16px 110px; color: var(--muted); font-size: 12.5px; }
@media (min-width: 960px) { .foot { padding-bottom: 32px; } }

dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); padding: 0; width: min(440px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(0 0 0 / 40%); }
.dialog-body { padding: 18px; }
.dialog-body h2 { font: 600 20px var(--serif); margin: 0 0 10px; }
.saved-list { list-style: none; padding: 0; margin: 0 0 12px; }
.saved-list li { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.saved-list li span { flex: 1; }
.saved-list small { color: var(--muted); display: block; }
.dialog-actions { display: flex; justify-content: flex-end; }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none; transition: .25s; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 30; }
.toast.show { opacity: 1; transform: translateX(-50%); }

@media (max-width: 520px) {
  .step { grid-template-columns: 64px 1fr; gap: 0 10px; }
  .step .when .t { font-size: 15px; }
  .step .body { padding-left: 16px; }
  .kpi .v { font-size: 18px; }
  .brand span { display: none; }
  .topbar { gap: 8px; }
  .mode-switch button { padding: 6px 10px; }
  .lang-picker select { max-width: 92px; padding-right: 26px; }
}

/* Gluten-free: no W, no catalogue of wheat flours, no preferments */
body:not([data-gf]) .gf-only { display: none !important; }
body[data-gf] .gf-hide { display: none !important; }

/* Free vs subscription */
body:not([data-pro]) [data-pro-block] { display: none !important; }
body[data-pro] [data-free-block] { display: none !important; }
.upsell { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 12px; background: var(--surface-2); font-size: 13.5px; color: var(--muted); }
.upsell span { flex: 1 1 220px; }
.account-btn { flex: none; display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; min-height: 36px; white-space: nowrap; }
.account-btn svg { width: 16px; height: 16px; }
.tips-btn { flex: none; display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; min-height: 36px; white-space: nowrap; text-decoration: none; color: inherit; }
.tips-btn svg { width: 16px; height: 16px; color: var(--accent); }
.account-btn.is-pro { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.locked { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.locked p { margin: 0; flex: 1 1 200px; color: var(--muted); font-size: 13.5px; }

dialog#paywall { width: min(560px, calc(100vw - 32px)); }
.btn.is-on { background: var(--info-soft); border-color: var(--ok); color: var(--ink); }

/* Bake diary */
dialog.wide { width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 32px); }
.diary-list { list-style: none; padding: 0; margin: 8px 0 12px; display: grid; gap: 10px; }
.diary-card { display: grid; grid-template-columns: 120px 1fr; gap: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface); }
.diary-card:not(:has(img)) { grid-template-columns: 1fr; }
.diary-card img { width: 120px; height: 120px; object-fit: cover; border-radius: 8px; }
.diary-card h3 { margin: 0; font-size: 16px; }
.diary-card p { margin: 6px 0 0; font-size: 14px; }
.diary-top { display: flex; gap: 10px; align-items: flex-start; }
.diary-top .hint { margin: 2px 0 0; }
.diary-pick input { width: 18px; height: 18px; margin-top: 2px; }
.diary-sum { color: var(--muted); }
.diary-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.diary-actions .btn { font-size: 13px; padding: 6px 10px; }
@media (max-width: 520px) { .diary-card { grid-template-columns: 1fr; } .diary-card img { width: 100%; height: 180px; } }
.stars { color: var(--warn); letter-spacing: 1px; margin-left: 4px; }
.stars .off { color: var(--line); }
.diary-compare-bar { margin: 4px 0 8px; }
.diary-cmp { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 12px; overflow-x: auto; }
.diary-cmp h3 { margin: 0 0 8px; font-size: 15px; }
.diary-cmp table.cmp th:first-child { text-align: left; color: var(--muted); font-weight: 500; }
.diary-cmp tr.diff td { background: var(--warn-soft); font-weight: 600; }
.cmp-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-size: 13.5px; color: var(--muted); }
.cmp-notes p { margin: 6px 0 0; }
.rating { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; }
.rating input { position: absolute; opacity: 0; pointer-events: none; }
.rating label { font-size: 28px; line-height: 1; color: var(--line); cursor: pointer; padding: 0 2px; }
.rating input:checked ~ label, .rating label:hover, .rating label:hover ~ label { color: var(--warn); }
.rating input:focus-visible + label { outline: 2px solid var(--focus); border-radius: 4px; }
.diary-preview { display: block; max-width: 100%; max-height: 220px; border-radius: 10px; margin: 6px 0; }
.diary-photo-row { display: flex; gap: 8px; flex-wrap: wrap; }
.diary-photo-row label.btn { cursor: pointer; }
#diary-form textarea { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); resize: vertical; }
.eyebrow-s { margin: 0 0 4px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.benefits { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 6px; }
.benefits li { position: relative; padding-left: 24px; font-size: 14px; }
.benefits li::before { content: ""; position: absolute; left: 4px; top: 5px; width: 10px; height: 6px; border-left: 2px solid var(--ok); border-bottom: 2px solid var(--ok); transform: rotate(-45deg); }
.plan-badge { position: absolute; top: -10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.plan-name { font-weight: 600; font-size: 14px; }
.plan-price { font: 600 22px var(--mono); }
.plan-per { font-size: 12px; color: var(--muted); }
.offer { position: relative; border: 2px solid var(--accent); background: var(--accent-soft); border-radius: 12px; padding: 20px 16px 16px; margin: 8px 0 12px; }
.offer .plan-badge { left: 16px; right: auto; }
.offer-price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.offer p { margin: 6px 0 12px; font-size: 13.5px; }
.offer-btn { width: 100%; padding: 12px; font-size: 15px; font-weight: 600; }
.dialog-actions { gap: 8px; }
.dialog-actions.stack { flex-wrap: wrap; justify-content: flex-start; margin: 12px 0; }
.captcha:not(:empty) { margin: 8px 0; }
.login-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 4px 0 8px; }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--accent); font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0; }
.foot-links a { color: var(--muted); }
@media (max-width: 520px) {
  .account-btn, .tips-btn { width: 36px; height: 36px; min-height: 36px; padding: 0; justify-content: center; }
  .account-label, .tips-btn span { display: none; }
}
@media (max-width: 400px) {
  .topbar { gap: 6px; padding-left: 12px; padding-right: 12px; }
  .lang-picker select { max-width: 78px; padding-left: 10px; }
  .mode-switch button { padding: 6px 8px; font-size: 13px; }
}

@media print {
  .topbar, #form, .dock, .actions, .foot, .intro, .check, .chips, .upsell, .locked { display: none !important; }
  body { background: #fff; color: #000; }
  .layout { display: block; padding: 0; }
  .ticket { box-shadow: none; }
  .step details { break-inside: avoid; }
  .step summary::after { display: none; }
}

/* Pagine informative (prezzi, termini, privacy, rimborsi) */
.doc { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; }
.doc h1 { font: 700 clamp(28px, 4vw, 38px) var(--serif); margin: 0 0 8px; }
.doc h2 { font: 600 21px var(--serif); margin: 32px 0 8px; }
.doc h3 { font-size: 15px; margin: 20px 0 6px; }
.doc p, .doc li { line-height: 1.6; }
.doc .updated { color: var(--muted); font-size: 13px; }
.doc .todo { background: var(--warn-soft); border-radius: 4px; padding: 0 4px; }
.doc .lang-nav { display: flex; gap: 12px; font-size: 14px; margin-bottom: 20px; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 48px 0 8px; }
.doc a { color: var(--accent); }

/* Pagina consigli */
.tips .lead { font-size: 17px; color: var(--muted); }
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin: 20px 0 8px; }
.toc p { margin: 0 0 6px; font-weight: 600; }
.toc ol { margin: 0; padding-left: 20px; }
.toc li { margin: 3px 0; }
.tips section { scroll-margin-top: 70px; }
.tip-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.tip-steps li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tip-steps h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; font-size: 16px; }
.tip-steps p { margin: 0; }
.tip-steps .num { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); display: grid; place-items: center; font: 600 13px var(--mono); }
.tip-note { margin-top: 8px !important; padding: 8px 10px; border-radius: 8px; background: var(--info-soft); font-size: 14px; }
.tip-cards { display: grid; gap: 8px; }
.tip-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 16px; }
.tip-card summary { cursor: pointer; list-style: none; padding: 14px 24px 14px 0; position: relative; }
.tip-card summary::-webkit-details-marker { display: none; }
.tip-card summary::after { content: "+"; position: absolute; right: 0; top: 12px; font: 600 18px var(--mono); color: var(--muted); }
.tip-card[open] summary::after { content: "−"; }
.tip-card h3 { margin: 0; font-size: 16px; }
.tip-card p { margin: 0 0 12px; }
.glossary { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 8px 18px; margin: 0; }
.glossary dt { font-weight: 600; }
.glossary dd { margin: 0; color: var(--ink); }
@media (max-width: 560px) { .glossary { grid-template-columns: 1fr; } .glossary dd { margin-bottom: 8px; } }
.tips-link { margin: 10px 0 0; font-size: 14px; }
.tip-filters { position: sticky; top: 56px; z-index: 5; background: var(--bg); padding: 12px 0 4px; margin: 16px 0 8px; border-bottom: 1px solid var(--line); }
.filter-row .label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.filter-row .seg { margin-bottom: 8px; }
.filter-row .seg button { font-size: 13px; padding: 5px 10px; }
@media (max-width: 560px) { .tip-filters { position: static; } .filter-row .seg { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; } .filter-row .seg button { flex: none; } }
.tips h2 { display: flex; align-items: center; gap: 10px; }
.phase-n { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); display: grid; place-items: center; font: 600 14px var(--mono); }
.tip-badge { font: 600 11px var(--sans); color: var(--ok); border: 1px solid currentColor; border-radius: 999px; padding: 1px 8px; margin-left: 4px; white-space: nowrap; }
.problems-title { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 18px 0 8px; }
.tips-link a, a.tips-link { color: var(--accent); font-weight: 500; }

/* Il mio setup */
.setup-bar { padding-bottom: 6px; }
.setup-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.setup-row .field { flex: 1 1 200px; margin-bottom: 0; }
.setup-row .btn { min-height: 44px; }
.setup-bar .hint { margin: 8px 0 0; }

/* Condimenti */
.batch-card { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px 8px; }
.batch-card .hint { margin: 0 0 8px; }
.batch-card th { font-size: 12px; font-weight: 600; text-align: right; color: var(--muted); }
.mixer-max, .oven-load { margin-top: 12px; max-width: 360px; }
.top-card { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; }
.top-card summary { cursor: pointer; padding: 10px 0; font-weight: 600; font-size: 14px; }
.top-card .hint { margin: 0 0 8px; }
.top-card table { margin-bottom: 8px; }
.top-card th { font-size: 12px; color: var(--muted); font-weight: 500; text-align: right; }

/* Strumenti del programma */
.plan-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.plan-tools .tips-link { margin: 0; }

/* Cambio di programma */
.late-opt { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.late-opt h3 { margin: 0 0 4px; font-size: 15px; }
.late-opt p { margin: 0 0 8px; font-size: 14px; }

/* Modalità cucina */
body.cooking { overflow: hidden; }
.cook { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; }
.cook-top { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.cook-top span { margin-right: auto; font: 500 14px var(--mono); color: var(--muted); }
.cook-body { flex: 1; overflow-y: auto; padding: 20px 16px 24px; max-width: 760px; width: 100%; margin: 0 auto; }
.cook-body h2 { font: 700 clamp(28px, 6vw, 40px) var(--serif); margin: 4px 0 8px; border-left: 6px solid var(--c, var(--accent)); padding-left: 12px; }
.cook-when { margin: 0; color: var(--muted); font: 500 15px var(--mono); }
.cook-timer { font: 600 clamp(26px, 7vw, 40px) var(--mono); margin: 8px 0 16px; color: var(--primary); }
.cook-timer.over { color: var(--accent); }
.cook-body ol { padding-left: 24px; }
.cook-body li { font-size: 19px; line-height: 1.55; margin-bottom: 12px; }
.cook-body .lead-s { font-size: 17px; }
.cook-nav { display: flex; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.cook-nav .btn { flex: 1; min-height: 52px; font-size: 16px; }
.cook-nav .btn.primary { flex: 1.4; font-weight: 600; }
@media (max-width: 520px) { .cook-nav { flex-wrap: wrap; } .cook-nav [data-action="late"] { order: -1; flex-basis: 100%; min-height: 44px; } }
@media print { .cook, .setup-bar, .plan-tools, .top-card { display: none !important; } }

/* Codici sconto e codici amico */
.code-box { margin: 4px 0 8px; font-size: 14px; }
.code-box summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.code-row { display: flex; gap: 8px; margin-top: 8px; }
.code-row input { flex: 1; min-width: 0; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-family: var(--mono); text-transform: uppercase; }
.code-row .btn { min-height: 44px; }

/* Pagina amministratore */
.admin h2 { margin-top: 28px; }
.admin-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.admin-form input[type="text"], .admin-form input[type="date"], .admin-form input[type="number"] { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.code-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.code-card header { display: flex; align-items: center; gap: 10px; }
.code-card .code { font: 600 17px var(--mono); }
.code-card p { margin: 6px 0; }
.code-card table { margin-top: 10px; font-size: 13.5px; }
.badge { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--info-soft); }
.badge.ok { background: var(--info-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.callout.ok { background: var(--info-soft); }

/* Sign-in dialog: tabs, password shown/hidden, the two passwords compared */
.login-tabs { margin: 4px 0 8px; }
.login-tabs button[aria-selected="true"] { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.pw-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pw-label .link-btn { font-size: 13px; padding: 0; }
.pw-match { display: block; min-height: 1.3em; font-size: 13px; margin-top: 4px; }
.pw-match.ok { color: var(--ok); }
.pw-match.bad { color: var(--accent); }
.login-submit { width: 100%; margin: 8px 0 4px; padding: 10px; font-weight: 600; }
.login-alt { margin: 4px 0 8px; font-size: 14px; }
#login-google { width: 100%; margin-top: 4px; }

/* Account page */
.account-page .acc-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 16px 0; }
.account-page .acc-card h2 { margin: 0 0 8px; font-size: 19px; }
.acc-plan { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.acc-plan-name { margin: 0; font-weight: 600; font-size: 17px; }
.acc-plan .hint { margin: 2px 0 0; }
.badge.muted { background: var(--surface-2); color: var(--muted); }
.acc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.acc-actions .btn { text-decoration: none; }
.acc-pw summary { cursor: pointer; font-weight: 600; margin: 8px 0; }
.acc-pw form { display: grid; gap: 4px; max-width: 360px; }
.acc-pw .btn { justify-self: start; margin-top: 6px; }
.account-page .code-row { display: flex; gap: 8px; max-width: 420px; }
.account-page .code-row input { flex: 1; min-width: 0; }
#acc-code-continue { margin-top: 8px; }
.login-tabs { display: grid; grid-template-columns: repeat(3, 1fr); }
.login-tabs button { padding: 7px 6px; font-size: 13px; text-align: center; }
.doc a.btn { text-decoration: none; }
.doc a.btn:not(.primary) { color: var(--ink); }

/* Sign-out: red, so it is easy to find */
.btn.danger { display: inline-flex; align-items: center; gap: 6px; color: #b3261e; border-color: #e4a39d; background: #fdecea; font-weight: 600; }
.btn.danger:hover { background: #b3261e; border-color: #b3261e; color: #fff; }
.btn.danger svg { width: 16px; height: 16px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.danger { color: #ff8a80; border-color: #7a2e28; background: #3a1c1a; } }
:root[data-theme="dark"] .btn.danger { color: #ff8a80; border-color: #7a2e28; background: #3a1c1a; }
.acc-who-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.acc-who-row .lead-s { margin: 0; }

/* Links: quiet text with a thin accent underline instead of red underlined text;
   "back" links and calls to action as pills. */
.doc a:not(.btn):not(.back-link), .spec-src a {
  color: var(--ink); font-weight: 500;
  text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  transition: color .15s, text-decoration-color .15s;
}
.doc a:not(.btn):not(.back-link):hover, .spec-src a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.link-btn {
  color: var(--ink); font-weight: 500;
  text-decoration-thickness: 1.5px; text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  transition: color .15s, text-decoration-color .15s;
}
.link-btn:hover { color: var(--accent); text-decoration-color: var(--accent); }
.back-link, .doc .back-link {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px 6px 12px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--muted); font-size: 14px; font-weight: 500; text-decoration: none;
  box-shadow: 0 1px 2px rgb(20 30 25 / 5%); transition: color .15s, border-color .15s, background .15s;
}
.back-link:hover, .doc .back-link:hover { color: var(--ink); border-color: var(--muted); background: var(--surface-2); }
.tips-link a, a.tips-link {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--ink); font-weight: 500; font-size: 14px; text-decoration: none;
  box-shadow: 0 1px 2px rgb(20 30 25 / 5%); transition: color .15s, border-color .15s;
}
.tips-link a::before, a.tips-link::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.tips-link a:hover, a.tips-link:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }

/* Logo: on hover (or keyboard focus) the pie turns a little, the slice slides out and the toppings bounce. */
.brand-mark { overflow: visible; transition: transform .35s cubic-bezier(.34, 1.56, .64, 1); }
.brand-mark .mark-slice { transform-box: fill-box; transform-origin: 0% 100%; transition: transform .35s cubic-bezier(.34, 1.56, .64, 1); }
.brand-mark .mark-dots circle { transform-box: fill-box; transform-origin: center; transition: transform .3s ease; }
.brand:hover .brand-mark, .brand:focus-visible .brand-mark { transform: rotate(-14deg) scale(1.06); }
.brand:hover .mark-slice, .brand:focus-visible .mark-slice { transform: translate(2.2px, -2.2px) rotate(8deg); }
.brand:hover .mark-dots circle, .brand:focus-visible .mark-dots circle { animation: mark-bounce .45s ease; }
.brand:hover .mark-dots circle:nth-child(2) { animation-delay: .06s; }
.brand:hover .mark-dots circle:nth-child(3) { animation-delay: .12s; }
.brand:active .brand-mark { transform: rotate(-14deg) scale(.96); }
@keyframes mark-bounce { 40% { transform: scale(1.45); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .brand-mark, .brand-mark .mark-slice { transition: none; }
  .brand:hover .brand-mark, .brand:focus-visible .brand-mark, .brand:hover .mark-slice { transform: none; }
  .brand:hover .mark-dots circle { animation: none; }
  .brand:hover .brand-mark { opacity: .8; }
}

/* Phones: date and time fields one per row, so the time isn't cut off */
@media (max-width: 560px) {
  .grid-dates { grid-template-columns: 1fr; }
  input[type="datetime-local"] { font-size: 16px; }
}

/* Brand and model menus: one per row on phones (names are long), full width when the second is hidden */
.grid-picks:has(> [hidden]) { grid-template-columns: 1fr; }
@media (max-width: 560px) { .grid-picks { grid-template-columns: 1fr; } }
/* Language menu on phones: only the code is visible in the closed menu */
@media (max-width: 520px) { .lang-picker select { width: 58px; max-width: 58px; padding-left: 12px; padding-right: 22px; text-overflow: clip; } }
