/* Cantina, prototipo: lo stile comune di app, console e sito. Un solo aspetto, chiaro, come l'app vera: carta,
   inchiostro blu notte e il rosso del vino. Caratteri ospitati qui (la CSP non permette altri indirizzi). */
@font-face { font-family: "EB Garamond"; src: url(/assets/fonts/eb-garamond-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url(/assets/fonts/eb-garamond-latin-400-italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "EB Garamond"; src: url(/assets/fonts/eb-garamond-latin-500-normal.woff2) format("woff2"); font-weight: 500 700; font-style: normal; font-display: swap; }
@font-face { font-family: "IM Fell English"; src: url(/assets/fonts/im-fell-english-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IM Fell English"; src: url(/assets/fonts/im-fell-english-latin-400-italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "IM Fell English SC"; src: url(/assets/fonts/im-fell-english-sc-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #f2eee5; --surface: #faf8f3; --surface-2: #e8e3d8; --line: #d9d3c6; --line-field: #857e70;
  --ink: #1e2a45; --text: #24252c; --muted: #5f626e; --accent: #8a2232; --on-accent: #ffffff;
  --good: #2f6b48; --warn: #9a5d0f; --crit: #a8261e; --shade: #e4ddcf; --scrim: rgba(20,24,36,.42);
  --c-mi: #4d6378; --c-lt: #597249; --c-rm: #a55338; --c-vi: #6b4f86; --c-oc: #9a7a2c;
  --t-rosso: #7a1e2e; --t-bianco: #c4a948; --t-rosato: #d08690; --t-bollicine: #a3b072; --t-dolce: #ad6e2e; --t-orange: #c9792f;
  --f-display: "IM Fell English", "Iowan Old Style", Georgia, serif;
  --f-sc: "IM Fell English SC", "Iowan Old Style", Georgia, serif;
  --f-body: "EB Garamond", Garamond, "Iowan Old Style", Georgia, serif;
  --f-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --gut: max(16px, env(safe-area-inset-left, 0px));
  --gut-r: max(16px, env(safe-area-inset-right, 0px));
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.45 var(--f-body); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { color: var(--ink); font-weight: 400; margin: 0; text-wrap: balance; }
p { margin: 0; }
a { color: var(--ink); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.ic { width: 20px; height: 20px; flex: none; }

/* text */
.mu { color: var(--muted); }
.sm { font-size: 15px; }
.xs { font-size: 13.5px; }
.n { font-variant-numeric: lining-nums tabular-nums; }
.sc { font-family: var(--f-sc); letter-spacing: .04em; }
.h-disp { font: 400 28px/1.15 var(--f-display); color: var(--ink); }
.h-sec { font: 400 15.5px var(--f-sc); letter-spacing: .06em; color: var(--ink); display: flex; align-items: center; gap: 10px; }
.h-sec::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.code { font: 13px var(--f-mono); color: var(--muted); letter-spacing: 0; overflow-wrap: anywhere; }
.hint { font-size: 14.5px; color: var(--muted); }
.err { color: var(--crit); font-size: 15px; }

/* layout */
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 6px 10px; flex-wrap: wrap; }
.stack { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.stack6 { display: grid; gap: 6px; grid-template-columns: minmax(0, 1fr); }
.stack > *, .stack6 > *, .card > *, .pad > * { min-width: 0; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.wrap { flex-wrap: wrap; }

/* buttons */
.btn { all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 17px; text-align: center; line-height: 1.2; }
.btn:hover { border-color: var(--line-field); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.ink { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.wide { width: 100%; }
.btn.small { min-height: 40px; padding: 0 12px; font-size: 15.5px; border-radius: 8px; }
.btn.danger { color: var(--crit); }
.btn.dangerbg { background: var(--crit); border-color: var(--crit); color: var(--on-accent); }
.btn[disabled], .btn.off { opacity: .45; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.left { justify-content: flex-start; text-align: left; }
.link { all: unset; cursor: pointer; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.iconbtn { all: unset; cursor: pointer; position: relative; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--ink); }
.iconbtn svg { width: 22px; height: 22px; }
.iconbtn .unread { position: absolute; top: 8px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 13px; border: 1px solid var(--line-field); border-radius: 999px; background: var(--surface); font-size: 15.5px; color: var(--ink); cursor: pointer; white-space: nowrap; }
.chip[aria-pressed="true"], .chip.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: calc(-1 * var(--gut-r)); padding-right: var(--gut-r); }
.chips.scroll::-webkit-scrollbar { display: none; }

/* fields */
.fld { display: grid; gap: 5px; min-width: 0; }
.fld > span:not(.hint), .lbl { font: 400 14.5px var(--f-sc); letter-spacing: .04em; color: var(--muted); }
.inp { width: 100%; min-width: 0; min-height: 46px; padding: 0 12px; border: 1px solid var(--line-field); border-radius: 10px; background: var(--surface); font-size: 17px; color: var(--text); }
textarea.inp { padding: 10px 12px; min-height: 90px; resize: vertical; }
select.inp { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.inp:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 2px color-mix(in srgb, var(--ink) 18%, transparent); }
.inp[aria-invalid="true"] { border-color: var(--crit); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15.5px; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--ink); flex: none; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--line-field); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button { all: unset; cursor: pointer; text-align: center; min-height: 44px; padding: 0 4px; font-size: 15.5px; border-left: 1px solid var(--line); display: grid; place-items: center; }
.seg button:first-child { border-left: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-field); border-radius: 10px; background: var(--surface); }
.stepper b { min-width: 42px; text-align: center; font: 500 19px var(--f-body); }
.stepper button { all: unset; cursor: pointer; width: 44px; height: 44px; display: grid; place-items: center; font-size: 22px; color: var(--ink); }
.tgl { all: unset; cursor: pointer; flex: none; width: 48px; height: 30px; border-radius: 15px; background: var(--surface-2); border: 1px solid var(--line-field); position: relative; }
.tgl::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .15s; }
.tgl[aria-checked="true"] { background: var(--good); border-color: var(--good); }
.tgl[aria-checked="true"]::after { left: 21px; }
.trow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.trow > span { min-width: 0; display: grid; }

/* cards, badges, lists */
.card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 14px; display: grid; gap: 10px; }
.card.soft { background: transparent; }
.card.note { border-left: 3px solid var(--warn); }
.card.okc { border-left: 3px solid var(--good); }
.card.bad { border-left: 3px solid var(--crit); }
.badge { display: inline-flex; align-items: center; gap: 5px; font: 400 13.5px var(--f-sc); letter-spacing: .04em; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); background: var(--surface); white-space: nowrap; }
.badge.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.badge.acc { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.badge.crit { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 40%, transparent); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.divider { height: 1px; background: var(--line); }
.prog { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--good); border-radius: 3px; }
.prog.warn i { background: var(--warn); }
.prog.crit i { background: var(--crit); }
.list { display: grid; }
.wrow { all: unset; box-sizing: border-box; width: 100%; min-width: 0; cursor: pointer; display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 3px 12px; align-items: center; padding: 11px 2px; border-bottom: 1px solid var(--line); }
.wrow .nm { font: 500 17.5px/1.2 var(--f-body); color: var(--ink); overflow-wrap: anywhere; }
.wrow .sub { font-size: 14.5px; color: var(--muted); line-height: 1.3; grid-column: 2; }
.wrow .ct { font: 500 20px var(--f-body); color: var(--ink); text-align: right; font-variant-numeric: lining-nums tabular-nums; grid-row: span 2; }
.wrow .ct small { display: block; font: 12.5px var(--f-sc); color: var(--muted); letter-spacing: .03em; }
.wrow .dot { grid-row: span 2; }
.wrow.fin { opacity: .62; }
.lrow { all: unset; box-sizing: border-box; width: 100%; min-width: 0; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); min-height: 52px; }
.lrow.static { cursor: default; }
.lrow .tx { flex: 1; min-width: 0; display: grid; overflow-wrap: anywhere; }
.lrow .tx b { font-weight: 500; color: var(--ink); }
.lrow .tx span { font-size: 14.5px; color: var(--muted); }
.lrow .chev { color: var(--muted); width: 18px; height: 18px; }
.lrow .ic2 { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; color: var(--ink); flex: none; }
.lrow .ic2 svg { width: 18px; height: 18px; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; font-size: 15.5px; margin: 0; }
.kv dt { color: var(--muted); font: 14.5px var(--f-sc); letter-spacing: .03em; padding-top: 1px; }
.kv dd { margin: 0; color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; display: grid; gap: 10px; justify-items: center; }

/* overlays */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; animation: fin .15s ease-out; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; margin: 0 auto; width: min(100%, 620px); max-height: 92dvh; overflow-y: auto; overflow-x: hidden; background: var(--bg);
  border-radius: 22px 22px 0 0; z-index: 41; padding: 10px var(--gut-r) calc(18px + env(safe-area-inset-bottom, 0px)) var(--gut); display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr);
  box-shadow: 0 -10px 30px rgba(0,0,0,.18); animation: up .2s ease-out; align-content: start; }
.sheet > * { min-width: 0; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); justify-self: center; }
.shead { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.shead h2 { font: 400 25px/1.15 var(--f-display); }
.x { all: unset; cursor: pointer; width: 44px; height: 44px; border: 1.5px solid var(--ink); border-radius: 50%; display: grid; place-items: center; color: var(--ink); flex: none; font-size: 15px; }
.x svg { width: 18px; height: 18px; }
.sfoot { position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom, 0px)); margin: 0 calc(-1 * var(--gut-r)) calc(-18px - env(safe-area-inset-bottom, 0px)) calc(-1 * var(--gut)); padding: 12px var(--gut-r) calc(16px + env(safe-area-inset-bottom, 0px)) var(--gut); background: var(--bg); border-top: 1px solid var(--line); display: grid; gap: 8px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(92px + env(safe-area-inset-bottom, 0px)); width: min(calc(100% - 32px), 560px); z-index: 60; background: var(--ink); color: var(--surface);
  border-radius: 12px; padding: 12px 14px; font-size: 15.5px; display: flex; gap: 12px; align-items: center; justify-content: space-between; animation: fin .18s ease-out; }
.toast button { all: unset; cursor: pointer; color: var(--surface); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; min-height: 36px; display: inline-flex; align-items: center; flex: none; }
@keyframes fin { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--accent); animation: spin 1s linear infinite; display: inline-block; flex: none; }
.loading { display: grid; place-items: center; min-height: 40vh; }

/* the mark */
.mark { color: var(--ink); }
/* The written logo of The Wine Door (Marco, 2/11/2026): «the» in italics, WINE DOOR in small capitals, then the
   line with the vine leaf. Same drawing as marchio/the-wine-door-logo.svg; colours follow the theme. */
.wd { display: inline-grid; justify-items: center; line-height: 1; color: var(--ink); }
.wd i { font: italic 400 .6em/1 var(--f-display); color: inherit; }
.wd b { font: 400 1em/1.05 var(--f-sc); letter-spacing: .09em; color: inherit; margin-right: -.09em; }
.wd .wd-riga { width: 5.3em; height: .7em; margin-top: .12em; }
.seal { display: grid; justify-items: center; gap: 4px; }
.seal > svg { width: 96px; height: 76px; }
.seal > b { font: 400 19px var(--f-sc); letter-spacing: .12em; color: var(--ink); font-weight: 400; }
.seal > i { font: italic 16px var(--f-display); color: var(--muted); }

/* tables (console, piani) */
.tw { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
table.t { border-collapse: collapse; width: 100%; font-size: 15px; }
table.t th { text-align: left; font: 400 13.5px var(--f-sc); letter-spacing: .04em; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--bg); position: sticky; top: 0; }
table.t td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: lining-nums tabular-nums; }
table.t tr.cl { cursor: pointer; }
table.t tr.cl:hover td { background: color-mix(in srgb, var(--ink) 4%, var(--surface)); }
