@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(fonts/atkinson-next.woff2) format('woff2');
}
@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url(fonts/bricolage.woff2) format('woff2');
}

/* ---------- tokens ---------- */
:root {
  --bg: #F6F4F1;
  --surface: #FFFFFF;
  --ink: #1E1A1B;
  --muted: #5E5557;
  --line: #E4DEDA;
  --field: #8C8285;
  --empty: #E6DFDB;
  --accent: #7B1E3A;
  --accent-ink: #7B1E3A;
  --on-accent: #FFFFFF;
  --accent-soft: #F6E9ED;
  --danger: #B3261E;
  --shadow: 0 1px 2px rgba(30, 26, 27, .06), 0 2px 8px rgba(30, 26, 27, .04);
  --s1: #E3A33B; /* pranzo */
  --s2: #C8642A; /* pomeriggio */
  --s3: #7B1E3A; /* cena */
  --s4: #2B2440; /* dopo cena */
  --font: 'Atkinson Hyperlegible Next', 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Bricolage Grotesque', var(--font);
  --open: #2E8B57;
  color-scheme: light;
}
:root[data-app="campoblenio"] {
  --bg: #F4F5F1;
  --line: #DEE3DC;
  --empty: #E1E6DF;
  --accent: #2F5D46;
  --accent-ink: #2F5D46;
  --accent-soft: #E4EEE7;
}
:root[data-app="pub"] {
  --bg: #F7F3EC;
  --line: #E6DED2;
  --empty: #E9E1D4;
  --accent: #9A5B14;
  --accent-ink: #8A4F0E;
  --accent-soft: #F5E8D4;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141112;
    --surface: #211C1D;
    --ink: #F3ECEC;
    --muted: #B9ADAF;
    --line: #3A3233;
    --field: #857A7C;
    --empty: #3A3233;
    --accent: #A8405C;
    --accent-ink: #F0A3B5;
    --accent-soft: #3A2129;
    --danger: #FF8A80;
    --shadow: none;
    --s3: #D0587A;
    --s4: #8F82D6;
    --open: #4CC38A;
    color-scheme: dark;
  }
  :root[data-app="campoblenio"] {
    --bg: #111412;
    --surface: #1C211E;
    --line: #313A34;
    --empty: #313A34;
    --accent: #3B7558;
    --accent-ink: #94D3B1;
    --accent-soft: #20342A;
  }
  :root[data-app="pub"] {
    --bg: #14110D;
    --surface: #211C16;
    --line: #3A3128;
    --empty: #3A3128;
    --accent: #B8731F;
    --accent-ink: #F2B866;
    --accent-soft: #3A2A17;
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 17px/1.45 var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
a { color: var(--accent-ink); }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.015em; line-height: 1.15; }
h1 { font-size: 28px; margin: 4px 0 14px; }
h2 { font-size: 20px; margin: 22px 0 10px; }
.muted { color: var(--muted); }
.pad { padding: 16px 20px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent-ink); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.skip { position: absolute; left: 12px; top: -60px; background: var(--surface); color: var(--ink); padding: 10px 14px; border-radius: 10px; z-index: 50; }
.skip:focus { top: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 6px max(16px, env(safe-area-inset-left));
  background: var(--bg);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-height: 44px; min-width: 0; }
.brand img { border-radius: 8px; flex: none; }
.brand span { font-family: var(--display); font-weight: 700; font-size: 21px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#nav { display: flex; gap: 6px; align-items: center; flex: none; }
.navbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 44px; height: 44px; padding: 0 12px; border-radius: 22px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 700 15px var(--font); text-decoration: none;
}
.navbtn.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.navbtn svg { flex: none; }

main { max-width: 640px; margin: 0 auto; padding: 0 12px 24px; outline: none; }

/* ---------- controls ---------- */
button, .btn {
  font: 600 16px var(--font); border-radius: 14px; border: 1.5px solid var(--field); background: var(--surface); color: var(--ink);
  padding: 0 18px; cursor: pointer; min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
button.primary, .btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700; }
button.big, .btn.big { min-height: 56px; font-size: 17px; border-radius: 16px; width: 100%; }
button.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
button.ghost { border-color: transparent; background: transparent; }
button:disabled { opacity: .55; cursor: default; }
.iconbtn { width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 12px; background: transparent; color: var(--ink); }

input, textarea, select {
  font: 400 17px var(--font); width: 100%; min-height: 52px; padding: 12px 14px; border-radius: 14px;
  border: 1.5px solid var(--field); background: var(--surface); color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent-ink); box-shadow: 0 0 0 1.5px var(--accent-ink); }
textarea { min-height: 80px; resize: vertical; }
label, .label { display: block; margin: 16px 0 6px; font-weight: 600; font-size: 15px; }
legend.label { padding: 16px 0 0; margin: 0 0 6px; }
.opt { font-weight: 400; color: var(--muted); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 0 0 auto; }
.grow { flex: 1 1 0; min-width: 0; }
.err { color: var(--danger); margin-top: 12px; min-height: 1em; font-weight: 600; }
.err:empty { margin: 0; min-height: 0; }

.card { background: var(--surface); border-radius: 20px; padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.narrow { max-width: 440px; margin: 12px auto; }

/* toggle chips (real checkboxes) */
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.toggle { position: relative; display: block; margin: 0; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.toggle span {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 14px; border-radius: 14px;
  border: 1.5px solid var(--field); background: var(--surface); font-weight: 600; font-size: 16px; cursor: pointer;
}
.toggle span::before { content: ''; width: 12px; height: 12px; border-radius: 6px; background: var(--c, var(--accent)); flex: none; }
.toggle span::after { content: ''; margin-left: auto; width: 10px; height: 18px; border: solid transparent; border-width: 0 3px 3px 0; transform: rotate(45deg) translate(-2px, -2px); }
.toggle input:checked + span { border: 2px solid var(--accent-ink); background: var(--accent-soft); }
.toggle input:checked + span::after { border-color: var(--accent-ink); }
.toggle input:focus-visible + span { outline: 3px solid var(--accent-ink); outline-offset: 2px; }
.toggle input:disabled + span { opacity: .6; cursor: default; }
.toggle.all { grid-column: 1 / -1; }
.toggle.all span { justify-content: center; font-weight: 700; border-style: dashed; }
.toggle.all span::before { width: 28px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--s1), var(--s2), var(--s3), var(--s4)); }
.toggle.all span::after { margin-left: 0; }
.toggle.all input:checked + span { border-style: solid; }

/* switch */
.switch { display: flex; align-items: center; gap: 12px; min-height: 48px; margin: 12px 0 0; font-weight: 600; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; min-height: 0; padding: 0; border-radius: 15px; background: var(--field); border: 0; position: relative; flex: none; cursor: pointer; transition: background .15s; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 12px; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(20px); }
.switch input:focus-visible { outline: 3px solid var(--accent-ink); outline-offset: 2px; }

/* ---------- month view ---------- */
.month-head { display: flex; align-items: center; gap: 2px; padding: 4px 0 8px 8px; }
.month-head h1 { margin: 0; flex: 1; font-size: 24px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 6px; border-radius: 20px;
  background: var(--surface); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; font-weight: 700; font-size: 15px; white-space: nowrap; line-height: 1;
}
.chip b { min-width: 28px; height: 28px; padding: 0 6px; border-radius: 14px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-size: 14px; }
.chip.c-inv b { background: var(--open); color: #fff; }
.chip.c-shop b { background: #C77D12; color: #fff; }
.chip.late b { background: var(--danger); color: #fff; }
.chip:active { transform: scale(.97); }
.cta:not([hidden]) { animation: enter .2s ease-out; }
.month-head h1 .y { color: var(--muted); font-weight: 600; }
.month-head .today { font-size: 14px; min-height: 36px; padding: 0 12px; border-radius: 18px; border-width: 1px; margin-right: 4px; }
.calcard { background: var(--surface); border-radius: 22px; padding: 10px 6px 12px; box-shadow: var(--shadow); }
.dows, .week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); column-gap: 2px; }
.dows abbr { text-decoration: none; text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); padding: 4px 0 6px; }
.week { row-gap: 3px; padding-bottom: 3px; }
.day {
  grid-row: 1; height: 54px; min-height: 0; padding: 0; border: 0; border-radius: 14px; background: transparent; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; font: 500 17px/1 var(--font);
}
.day.other { color: var(--muted); opacity: .75; }
.day { position: relative; }
.day .num { width: 30px; height: 30px; margin-bottom: -4px; border-radius: 15px; display: grid; place-items: center; }
.stays .day .num { margin-bottom: 0; }
.day.mine .num { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.day.joined .num { background: var(--open); color: #fff; font-weight: 700; }
.legend li.lg-joined::before { width: 14px; height: 14px; border-radius: 7px; background: var(--open); }
.pill.rel.joined { background: var(--open); color: #fff; }
.item.joined { box-shadow: inset 5px 0 0 var(--open), var(--shadow); }
.day.ask::after {
  content: ''; position: absolute; inset: 1px; border-radius: 14px; border: 2.5px solid var(--open); pointer-events: none;
  animation: ask-pulse 1.8s ease-in-out infinite;
}
@keyframes ask-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .25; transform: scale(.9); } }
@media (prefers-reduced-motion: reduce) { .day.ask::after { animation: none; border-style: dashed; } }
.legend li.lg-mine::before { width: 14px; height: 14px; border-radius: 7px; background: var(--accent); }
.legend li.lg-ask::before { width: 12px; height: 12px; border-radius: 4px; background: transparent; border: 2.5px solid var(--open); animation: ask-pulse 1.8s ease-in-out infinite; }
.pill.rel::before { display: none; }
.pill.rel.mine { background: var(--accent); color: var(--on-accent); }
.pill.rel.ask { background: var(--open); color: #fff; }
.item.mine { box-shadow: inset 5px 0 0 var(--accent), var(--shadow); }
.item.ask { box-shadow: inset 0 0 0 2.5px var(--open), var(--shadow); }
.day.today { box-shadow: inset 0 0 0 1.5px var(--ink); font-weight: 700; }
.day[aria-pressed="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent-ink); font-weight: 700; }
.ind { display: flex; gap: 2px; height: 5px; }
.ind i { width: 8px; height: 5px; border-radius: 3px; background: var(--empty); }
.day.other .ind i { background: transparent; }
.ind i.on { background: var(--c); }
.ind i.tent { opacity: .45; }
.ind.full i { display: none; }
.ind.full::before { content: ''; width: 38px; height: 5px; border-radius: 3px; background: linear-gradient(90deg, var(--s1), var(--s2), var(--s3), var(--s4)); }
.ind.full.tent::before { opacity: .45; }
.stays .day { height: 42px; gap: 0; }
.bar {
  height: 20px; border-radius: 10px; background: var(--c); color: #fff; font-size: 12px; font-weight: 700; line-height: 20px;
  padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 0; min-height: 0; justify-content: flex-start;
}
.bar.cont-l { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.bar.cont-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.bar.tent { background: repeating-linear-gradient(135deg, var(--c) 0 6px, color-mix(in srgb, var(--c) 70%, #fff) 6px 12px); }
.stays .week .day, .stays .week .bar { position: relative; z-index: 1; }
.band { z-index: 0; border-radius: 14px 14px 10px 10px; background: color-mix(in srgb, var(--c) 26%, transparent); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 55%, transparent); pointer-events: none; }
.band.cont-l { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.band.cont-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.band.tent { background: color-mix(in srgb, var(--c) 14%, transparent); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 8px 10px 0; font-size: 12px; color: var(--muted); margin: 0; list-style: none; }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend li::before { content: ''; width: 16px; height: 6px; border-radius: 3px; background: var(--c); }
.legend li.full::before { width: 26px; background: linear-gradient(90deg, var(--s1), var(--s2), var(--s3), var(--s4)); }

.agenda { padding: 18px 4px 0; }
.agenda h2 { margin: 0; min-width: 0; }
.dayhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 4px 10px; min-height: 44px; }
.daynew { display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 40px; padding: 0 16px 0 12px; border-radius: 20px; font-weight: 700; font-size: 15px; box-shadow: var(--shadow); animation: enter .2s ease-out; }
.daynew svg { width: 18px; height: 18px; }
.dayfull { flex: none; font-size: 14px; font-weight: 600; color: var(--muted); }
.list { display: grid; gap: 10px; }
.item {
  display: flex; gap: 14px; align-items: stretch; text-align: left; width: 100%;
  background: var(--surface); border: 0; border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow);
  font: inherit; color: inherit; min-height: 0; justify-content: flex-start;
}
.item .stripe { width: 6px; border-radius: 3px; background: var(--c); flex: none; }
.item .what { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.item .t { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.item .who { color: var(--muted); font-size: 15px; }
.item .who b.host { color: var(--ink); font-weight: 700; }
.item .who.maybe { font-size: 14px; }
.item .note { color: var(--muted); font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); }
.pill::before { content: ''; width: 8px; height: 8px; border-radius: 4px; background: var(--c); }
.pill.full::before { width: 18px; background: linear-gradient(90deg, var(--s1), var(--s2), var(--s3), var(--s4)); }
.pill.tent { background: transparent; border: 1.5px dashed var(--field); color: var(--muted); }
.pill.tent::before { display: none; }
.pill.open { background: var(--accent); color: var(--on-accent); }
.pill.open::before { display: none; }
.empty { color: var(--muted); padding: 4px 4px 0; }
.monthlist { margin-top: 26px; }
.monthlist summary { cursor: pointer; font-family: var(--display); font-weight: 700; font-size: 18px; padding: 10px 4px; min-height: 44px; list-style-position: inside; }

.cta {
  position: sticky; bottom: 0; z-index: 4; margin: 18px -12px 0;
  padding: 12px max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: linear-gradient(to bottom, transparent, var(--bg) 22%);
}

/* read-only booking */
.details { padding-top: 10px; }
.details .dt { font-size: 22px; font-weight: 700; margin: 12px 0 6px; overflow-wrap: anywhere; }
.details dl { margin: 0; display: grid; gap: 2px; }
.details dt { font-size: 14px; font-weight: 700; color: var(--muted); margin-top: 12px; }
.details dd { margin: 0; font-size: 17px; }
.details .note { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- dialog: bottom sheet on phones ---------- */
dialog {
  border: 0; padding: 0; width: min(520px, calc(100vw - 24px)); max-height: calc(var(--vvh, 100dvh) * .92); border-radius: 24px;
  background: var(--surface); color: var(--ink); box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
}
dialog::backdrop { background: rgba(20, 16, 17, .5); }
#dlg-body { padding: 10px 20px 20px; max-height: calc(var(--vvh, 100dvh) * .92); overflow: auto; overscroll-behavior: contain; scroll-padding: 24px 0 96px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 6px 0 2px; }
.sheet-head h2 { margin: 0; font-size: 24px; }
.sheet-head .iconbtn { background: color-mix(in srgb, var(--ink) 7%, transparent); border-radius: 22px; flex: none; }
.actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.actions > * { flex: 1 1 0; }
.actions .primary { flex-grow: 2; }
.actions .danger { flex-basis: 100%; }
@media (max-width: 600px) {
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 var(--kb, 0px); border-radius: 24px 24px 0 0; transition: margin-bottom .15s; }
  dialog::before { content: ''; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 10px auto 0; }
  #dlg-body { padding-bottom: max(20px, env(safe-area-inset-bottom)); }
}

#toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 600;
  opacity: 0; transition: opacity .2s; pointer-events: none; max-width: calc(100vw - 32px); z-index: 60;
}
#toast.show { opacity: 1; }

/* ---------- login ---------- */
.hero {
  margin: 0 -12px; padding: max(56px, calc(env(safe-area-inset-top) + 40px)) 28px 34px; border-radius: 0 0 32px 32px;
  background: var(--accent); color: var(--on-accent); display: flex; flex-direction: column; gap: 10px;
}
.hero img { width: 64px; height: 64px; border-radius: 18px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .25); }
.hero h1 { margin: 6px 0 0; font-size: 36px; }
.hero p { margin: 0; font-size: 17px; opacity: .95; }
.login { padding: 12px 12px 0; max-width: 440px; margin: 0 auto; }
.pw { position: relative; }
.pw input { padding-right: 56px; }
.pw .iconbtn { position: absolute; right: 4px; top: 4px; color: var(--muted); }
.hint { text-align: center; color: var(--muted); font-size: 15px; margin: 18px 0 0; }
.install { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); margin-top: 22px; font-size: 15px; }
.install svg { color: var(--accent-ink); flex: none; }
.install .grow { line-height: 1.35; }
.install button { min-height: 44px; padding: 0 14px; font-size: 15px; }

/* ---------- admin ---------- */
.tabs { display: flex; gap: 6px; margin: 0 4px 16px; padding: 4px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); }
.tabs a { flex: 1; text-align: center; min-height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 12px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 15px; }
.tabs a.on { background: var(--accent); color: var(--on-accent); }
.hist { background: var(--surface); border-radius: 16px; padding: 12px 16px; box-shadow: var(--shadow); border-left: 5px solid var(--accent); display: flex; flex-direction: column; gap: 3px; overflow-wrap: anywhere; }
.hist.delete { border-left-color: var(--danger); }
.hist.create { border-left-color: #3F7D4E; }
.hist .meta { color: var(--muted); font-size: 14px; }
.diff { margin: 6px 0 0; padding-left: 18px; font-size: 15px; display: grid; gap: 2px; }
.users { display: grid; gap: 10px; }
.user { background: var(--surface); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.user .name { font-size: 18px; font-weight: 700; }
.user .meta { color: var(--muted); font-size: 15px; }
.user .acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.user .acts button { min-height: 44px; font-size: 15px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); vertical-align: 2px; margin-left: 6px; }
.badge.off { background: transparent; border: 1px solid var(--field); color: var(--muted); }
.checks { display: grid; gap: 8px; }
.linkbox { word-break: break-all; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 15px; user-select: all; }

@media (min-width: 700px) {
  main { padding: 0 20px 32px; }
  .day { height: 64px; }
  .stays .day { height: 48px; }
  .top { padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
}

/* ---------- admin mode ---------- */
:root[data-admin] { --accent: #B3261E; --accent-ink: #9C1F18; --accent-soft: #FBE7E5; --bg: #FBF3F2; }
.adminbar {
  display: flex; align-items: center; gap: 10px;
  margin: 0 12px 8px; padding: 8px 8px 8px 14px; border-radius: 14px;
  background: #B3261E; color: #FFFFFF; font-size: 15px;
}
.adminbar svg { flex: none; }
.adminbar button { min-height: 40px; padding: 0 14px; border-radius: 12px; border: 0; background: #FFFFFF; color: #9C1F18; font: 700 14px var(--font); cursor: pointer; }
.adminbar button:focus-visible { outline: 3px solid #FFFFFF; outline-offset: 2px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"])[data-admin] { --accent: #C9372C; --accent-ink: #FF9C92; --accent-soft: #3D1E1C; --bg: #1C1515; }
}

/* ---------- year list ---------- */
.yearcount { margin: -4px 4px 12px; }
.yearmonth { margin-bottom: 18px; }
.yearmonth h2 { font-family: var(--display); font-weight: 700; font-size: 19px; margin: 0 4px 10px; }
.yearmonth h2 .muted { font-family: var(--font); font-size: 15px; font-weight: 600; margin-left: 4px; }

/* ---------- bottom tab bar ---------- */
:root { --tabbar: 0px; }
body.tabs-on { --tabbar: calc(64px + max(16px, env(safe-area-inset-bottom))); }
body.tabs-on main { padding-bottom: calc(var(--tabbar) + 24px); }
body.tabs-on .cta { bottom: var(--tabbar); padding-bottom: 12px; }
body.tabs-on #toast { bottom: calc(var(--tabbar) + 90px); }
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; display: flex; justify-content: center;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 0 env(safe-area-inset-right) max(16px, env(safe-area-inset-bottom)) env(safe-area-inset-left);
}
#tabs[hidden] { display: none; }
#tabs a {
  flex: 1 1 0; max-width: 128px; height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 12.5px; font-weight: 600;
}
#tabs a.on { color: var(--accent-ink); font-weight: 700; }
#tabs a.on svg { background: var(--accent-soft); border-radius: 12px; }
#tabs svg { width: 44px; height: 28px; padding: 3px 0; }

/* ---------- notes ---------- */
.notecard { background: var(--surface); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.notecard h2 { margin: 0; font-size: 19px; overflow-wrap: anywhere; }
.nbody { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 16px; line-height: 1.45; }
.nfoot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }
.nfoot .edit { min-height: 40px; padding: 0 10px; color: var(--accent-ink); font-weight: 700; }
.photos { display: flex; flex-wrap: wrap; gap: 8px; }
.photos .ph { position: relative; width: 96px; height: 96px; padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: var(--empty); min-height: 0; }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos .rm { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; min-height: 32px; padding: 0; border: 0; border-radius: 16px; background: rgba(0, 0, 0, .6); color: #fff; }
.photos .rm svg { width: 16px; height: 16px; }
.photos.edit:empty { display: none; }
.addph { margin-top: 8px; width: 100%; }
.bigphoto { width: 100%; height: auto; border-radius: 14px; display: block; margin-top: 10px; }

/* ---------- to-dos ---------- */
.todo { display: flex; align-items: flex-start; gap: 4px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 6px 8px; }
.todo .tick { width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0; background: transparent; flex: none; margin-top: 2px; }
.todo .tick svg { width: 28px; height: 28px; border-radius: 14px; border: 2px solid var(--field); padding: 3px; color: transparent; box-sizing: border-box; }
.todo .tick[aria-checked="true"] svg { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.todo .tick:disabled { opacity: .45; }
.shoprow { align-items: center; }
.shoprow .tbody { padding: 10px 6px; }
.shoprow .sdel { width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--muted); flex: none; }
.shopadd { display: flex; gap: 8px; margin: 0 0 10px; }
.shopadd input { flex: 1; min-width: 0; margin: 0; }
.shopadd button { width: 52px; min-width: 52px; padding: 0; flex: none; }
.ideas { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
.ideas .idea { min-height: 36px; padding: 0 12px; border-radius: 18px; font-size: 14px; font-weight: 600; border: 1px dashed var(--field); background: transparent; color: var(--ink); }
.ideas .ideaedit { display: inline-flex; align-items: center; gap: 4px; border: 0; background: var(--accent); color: #fff; }
.ideabox { border: 1px solid var(--field); border-radius: 14px; padding: 10px 12px 12px; margin: 0 0 10px; }
.ideabox .muted { margin: 0 0 8px; font-size: 14px; }
.ideas .idea.editing, .ideas .ideanew { display: inline-flex; align-items: center; gap: 6px; border-style: solid; }
.ideas .idea.editing svg { color: var(--muted); }
.ideas .ideanew { color: var(--accent-ink); border-color: currentColor; }
.ideas .ideanew svg { width: 16px; height: 16px; }
.ideabox .big { margin-top: 12px; width: 100%; }
.tbadge.shopb { background: #C77D12; color: #fff; }
.shoprow.pending { box-shadow: inset 0 0 0 1.5px var(--field); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--field) 70%, transparent); }
.shoprow .wait { color: #A35F00; font-weight: 700; }
@media (prefers-color-scheme: dark) { .shoprow .wait { color: #F0B35A; } }
.shopwait { margin: 10px 4px 0; padding: 10px 12px; border-radius: 12px; background: var(--accent-soft); color: var(--ink); font-size: 14px; }
.sect { font-size: 18px; margin: 18px 4px 10px; }
.navrow { display: flex; align-items: center; gap: 12px; margin: 14px 0 0; padding: 14px 14px 14px 12px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; min-height: 64px; }
.navrow:active { transform: scale(.98); }
.navrow .navico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); flex: none; }
.navrow .navtxt { flex: 1; min-width: 0; display: grid; gap: 2px; }
.navrow .navtxt b { font-size: 17px; }
.navrow .navtxt .muted { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.navrow .navn { min-width: 28px; height: 28px; padding: 0 8px; border-radius: 14px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 14px; flex: none; }
.navrow > svg { color: var(--muted); flex: none; }
.backlink { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0 8px 0 0; color: var(--accent-ink); font-weight: 700; text-decoration: none; }
.todo .tbody { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; border: 0; background: transparent; padding: 10px 6px; min-height: 0; }
.todo .t { font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.todo .who, .todo .note { color: var(--muted); font-size: 15px; font-weight: 400; }
.todo .note { white-space: pre-wrap; overflow-wrap: anywhere; }
.todo.done .t { text-decoration: line-through; color: var(--muted); }
.donehead { font-size: 18px; margin: 26px 4px 10px; }
.icsbox { display: grid; gap: 10px; }
.icsbox .btn { display: flex; align-items: center; justify-content: center; text-decoration: none; }
.icsbox p { margin: 6px 0 0; }
.linkbtn { background: none; border: 0; padding: 0; min-height: 0; color: var(--accent-ink); text-decoration: underline; font: inherit; cursor: pointer; }
.donehead .count { color: var(--muted); font-weight: 600; font-size: 15px; margin-left: 4px; }
.searchbox { position: relative; margin: 0 4px 6px; }
.searchbox svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.searchbox input { padding-left: 46px; border-radius: 18px; -webkit-appearance: none; appearance: none; }
#res > .donehead:first-child { margin-top: 18px; }
mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: inherit; border-radius: 4px; padding: 0 1px; }

/* sheet buttons stay reachable while typing */
#dlg-body .actions { position: sticky; bottom: calc(-1 * max(20px, env(safe-area-inset-bottom))); z-index: 2; background: var(--surface); margin: 20px -20px 0; padding: 12px 20px max(20px, env(safe-area-inset-bottom)); box-shadow: 0 -1px 0 var(--line); }
@media (min-width: 601px) { #dlg-body .actions { bottom: -20px; padding-bottom: 20px; } }

/* ---------- upcoming bookings under the calendar ---------- */
.upcoming { margin-top: 26px; }
.upcoming h2 { font-family: var(--display); font-weight: 700; font-size: 20px; margin: 0 4px 12px; }
.upcoming #more { margin-top: 12px; }

.yearmonth { scroll-margin-top: 76px; }

.updbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabbar, 0px) + 12px); z-index: 61; max-width: 616px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 16px;
  background: var(--ink); color: var(--bg); font-weight: 600; box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
}
.updbar button { min-height: 40px; border: 0; background: var(--accent); color: var(--on-accent); font-weight: 700; }

/* ---------- to-do deadlines + home banner ---------- */
.todo .due { font-size: 14px; font-weight: 700; color: var(--muted); }
.todo .due.soon { color: #A35F00; }
.todo .due.late { color: var(--danger); }
.todo.late { box-shadow: inset 4px 0 0 var(--danger), var(--shadow); }
.todobanner {
  display: flex; align-items: center; gap: 14px; margin: 4px 0 6px; padding: 12px 14px; border-radius: 18px;
  background: var(--surface); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; font-size: 16px; line-height: 1.3;
}
.todobanner .bignum {
  flex: none; width: 44px; height: 44px; border-radius: 22px; display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent); font: 700 20px var(--display);
}
.todobanner.late .bignum { background: var(--danger); }
.todobanner.late span span { color: var(--danger); font-weight: 700; }
.todobanner svg { color: var(--muted); flex: none; }
.todobanner.invite .bignum { background: var(--open); color: #fff; }
.todobanner.invite span span { color: var(--muted); }
article.invite { background: var(--surface); box-shadow: var(--shadow); border-radius: 18px; padding: 14px 16px; margin: 0 0 12px; }
article.invite .dt { font: 700 20px var(--display); margin: 0; }
article.invite .when { margin: 2px 0 8px; color: var(--muted); font-weight: 600; }
article.invite dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0 0 12px; }
article.invite dt { color: var(--muted); }
article.invite dd { margin: 0; }
.answers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.answers button { min-height: 48px; border-radius: 14px; font-weight: 700; padding: 0 6px; }
.answers button.on { color: #fff; border-color: transparent; }
.answers button.yes.on { background: #2E8B57; }
.answers button.maybe.on { background: #C98A1B; }
.answers button.no.on { background: var(--muted); }
.answers button:disabled { opacity: .45; }
.answers button.on:disabled { opacity: 1; }
article.invite { overflow: hidden; transition: height .5s ease, opacity .4s ease, margin .5s ease, padding .5s ease, transform .5s ease, background .3s; }
article.invite.a-yes { background: color-mix(in srgb, #2E8B57 14%, var(--surface)); }
article.invite.a-no { background: color-mix(in srgb, var(--muted) 14%, var(--surface)); }
article.invite .done { margin: 10px 0 0; font-weight: 700; text-align: center; animation: enter .25s ease-out; }
article.invite.a-yes .done { color: #2E8B57; }
article.invite.leaving { opacity: 0; transform: translateX(24px); margin-bottom: 0; padding-top: 0; padding-bottom: 0; }
.opensw { margin: 6px 0 2px; }
.opensw p { margin: 2px 0 0; }
#tabs a { position: relative; }
.tbadge {
  position: absolute; top: 6px; left: calc(50% + 6px); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; line-height: 20px; text-align: center;
}
.tbadge.late { background: var(--danger); }
@media (prefers-color-scheme: dark) { .todo .due.soon { color: #F0B35A; } }

/* ---------- motion ---------- */
@keyframes enter { from { opacity: 0; transform: translateY(10px); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop { 40% { transform: scale(1.25); } }
main.enter > * { animation: enter .24s cubic-bezier(.2, .8, .2, 1) both; }
main.enter > *:nth-child(2) { animation-delay: .03s; }
main.enter > *:nth-child(3) { animation-delay: .06s; }
dialog[open] { animation: fade-in .18s ease-out; }
dialog[open]::backdrop { animation: fade-in .2s ease-out; }
@media (max-width: 600px) { dialog[open] { animation: sheet-up .28s cubic-bezier(.2, .8, .2, 1); } }
.todo .tick.pop svg { animation: pop .3s ease-out; background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.todo .tick svg { transition: background .15s, border-color .15s; }
#tabs a svg { transition: background .2s; }
button:active:not(:disabled), .btn:active, #tabs a:active, .item:active, .todobanner:active { transform: scale(.97); }
button, .btn, .item, .todobanner { transition: transform .1s; }
.gone { display: none !important; }
.snack {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabbar, 0px) + 88px); z-index: 62; max-width: 616px; margin: 0 auto; overflow: hidden;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 16px;
  background: var(--ink); color: var(--bg); font-weight: 600; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); animation: enter .2s ease-out;
}
.snack button { min-height: 40px; border: 0; background: transparent; color: var(--bg); font-weight: 700; text-decoration: underline; }
.snack i { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--accent); transform-origin: left; animation: snack-time 5s linear forwards; }
@keyframes snack-time { to { transform: scaleX(0); } }
.todo .who b.anyone { color: var(--open); }
.archrow { margin-top: 14px; }
.shoprow.archived { align-items: flex-start; }
.archdot { width: 28px; height: 28px; margin: 2px 0 0; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--open); color: #fff; }
.archdot svg { width: 16px; height: 16px; }

/* Conteggi */
.countcard h2 { margin: 0 0 12px; font-size: 1.1rem; }
.countlist { display: grid; gap: 14px; margin-bottom: 10px; }
.countrow .ctop { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.countrow .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 8px; }
.countrow .cbar { height: 10px; border-radius: 6px; background: color-mix(in srgb, var(--c) 18%, transparent); margin-top: 6px; overflow: hidden; }
.countrow .cbar span { display: block; height: 100%; border-radius: 6px; background: var(--c); }
.countrow.srow { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 0; border-bottom: 1px solid color-mix(in srgb, currentColor 10%, transparent); }
.countrow.srow strong { grid-column: 2; grid-row: 1 / 3; align-self: center; font-size: 1.05rem; }
.countlist.split { margin-top: 14px; gap: 0; }
.ctot { margin: 8px 0 0; }
.small { font-size: .88rem; }
.countcard .field { display: grid; gap: 6px; font-weight: 600; }
.extbox { grid-column: 1 / -1; margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--c) 12%, transparent); }
.extbox p { display: flex; justify-content: space-between; gap: 10px; margin: 0; }
.extbox p + p { margin-top: 4px; opacity: .8; }

/* ---------- pub: lights and heating ---------- */
#tabs a:first-child:nth-last-child(6), #tabs a:first-child:nth-last-child(6) ~ a { font-size: 11.5px; }
.pubtemp { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pubtemp b { font: 700 44px/1 var(--display); letter-spacing: -0.02em; }
.pubhead { display: flex; align-items: center; gap: 10px; }
.pubhead h2 { margin: 0; flex: 1; font-size: 20px; }
.pubico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--empty); color: var(--muted); flex: none; transition: background .2s, color .2s; }
.pubico.lit { background: var(--accent-soft); color: var(--accent-ink); }
.pill.dead { background: var(--empty); color: var(--muted); }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 16px 0 6px; }
.stepper .iconbtn { width: 56px; height: 56px; border-radius: 28px; background: var(--accent-soft); color: var(--accent-ink); }
.stepper .iconbtn:disabled { opacity: .4; }
.stepval { display: grid; justify-items: center; gap: 2px; }
.stepval b { font: 700 36px/1 var(--display); }
.stepval .muted { font-size: 14px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; margin-top: 12px; border-radius: 14px; background: var(--empty); }
.seg button { min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); font-weight: 600; }
.seg button[aria-checked="true"] { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.pubrow { margin: 0; padding: 8px 0; border-top: 1px solid var(--line); }
.pubheat .pubrow:first-of-type { margin-top: 14px; }
.publights .pubrow:first-child { border-top: 0; }
.pubrow .grow { display: grid; gap: 1px; }
.pubrow.dead { opacity: .6; cursor: default; }
.pubsub { font-size: 13px; font-weight: 500; }
.publog summary { cursor: pointer; min-height: 32px; }
.publog ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; font-size: 15px; }

/* ---------- pub theme "Bancone pieno di adesivi": dark wood counter, cream cards stuck on it, Irish green accent ----------
   One theme for light and dark mode. Text on the wood is cream; every surface (card, sheet, field, button) switches back to dark ink. */
@font-face { font-family: 'Uncial Antiqua'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/uncial-antiqua.woff2) format('woff2'); }
@font-face { font-family: 'Anton'; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/anton.woff2) format('woff2'); }
@font-face { font-family: 'Archivo'; font-style: normal; font-weight: 400 800; font-display: swap; src: url(fonts/archivo.woff2) format('woff2'); }
:root[data-app="pub"], :root[data-app="pub"][data-admin] {
  --bg: #24140C;
  --surface: #F3E4C6;
  --ink: #F3E4C6;
  --muted: #CDB08E;
  --line: #4A2E1C;
  --field: #9A7D5A;
  --empty: #E7D5B0;
  --accent: #1F7A4C;
  --accent-ink: #F0B05A;
  --on-accent: #FFFFFF;
  --accent-soft: #3A2414;
  --danger: #FF8A7A;
  --shadow: 3px 4px 0 rgba(0, 0, 0, .45);
  --open: #9A5208;
  --s1: #E3A33B;
  --s2: #C8642A;
  --s3: #8C1C24;
  --s4: #4A2414;
  --amber: #F0B05A;
  --wine: #8C1C24;
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Anton', 'Archivo', sans-serif;
  --celtic: 'Uncial Antiqua', serif;
  color-scheme: dark;
}
/* Admin mode keeps its red warning, on a redder wood. */
:root[data-app="pub"][data-admin] { --bg: #2C0F0E; --accent: #B3261E; --line: #5A2420; }
/* Surfaces: cream paper with dark ink. */
:root[data-app="pub"] :is(.card, .calcard, .item, .todo, .notecard, .navrow, .todobanner, .hist, .user, article.invite, .install, .chip, .tabs, dialog, .linkbox,
  input, textarea, select, .navbtn, .skip, button:not(.ghost, .iconbtn, .linkbtn, .day, .tbody, .tick, .sdel, .rm, .bar, .primary, .danger, .idea, .ideaedit, .tape)) {
  --ink: #24140C;
  --muted: #6E5034;
  --line: #E0CCA4;
  --accent-ink: #1F5A3C;
  --accent-soft: #D5E6CF;
  --danger: #A3241C;
  --open: #9A5208;
  color: var(--ink);
}
:root[data-app="pub"][data-admin] :is(.card, .calcard, .item, .todo, .notecard, .navrow, .todobanner, .hist, .user, article.invite, .install, .chip, .tabs, dialog) { --accent-ink: #9C1F18; --accent-soft: #F6D9D3; }
:root[data-app="pub"] :is(h1, h2, h3) { font-weight: 400; letter-spacing: .01em; }
:root[data-app="pub"] h1 { font-family: var(--celtic); color: var(--amber); letter-spacing: 0; }
:root[data-app="pub"] h2 { text-transform: uppercase; color: var(--amber); }
:root[data-app="pub"] :is(.card, .notecard, dialog, article.invite) h2 { color: var(--wine); }
:root[data-app="pub"] .month-head h1 .y { color: var(--muted); font-weight: 400; }
:root[data-app="pub"] :is(.monthlist summary, .yearmonth h2, .upcoming h2) { font-weight: 400; text-transform: uppercase; color: var(--amber); }
:root[data-app="pub"] .yearmonth h2 .muted { text-transform: none; }
:root[data-app="pub"] :is(.details .dt, article.invite .dt) { font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: .01em; }
:root[data-app="pub"] .todobanner .bignum { font-weight: 400; }
:root[data-app="pub"] mark { background: #F0B05A; color: #24140C; }

/* header */
:root[data-app="pub"] .brand span { font-family: var(--celtic); font-weight: 400; font-size: 17px; line-height: 1.05; white-space: normal; color: var(--amber); letter-spacing: 0; }
:root[data-app="pub"] .navbtn { border-color: transparent; box-shadow: 2px 3px 0 rgba(0, 0, 0, .45); }
:root[data-app="pub"] .navbtn.on { box-shadow: inset 0 0 0 2px var(--accent), 2px 3px 0 rgba(0, 0, 0, .45); }

/* cards stuck slightly crooked on the counter, hard shadow */
:root[data-app="pub"] :is(.card, .calcard, .item, .todo, .notecard, .navrow, .todobanner, .hist, .user, article.invite, .install) { border-radius: 12px; }
:root[data-app="pub"] :is(.card, .notecard) { transform: rotate(-.6deg); }
:root[data-app="pub"] :is(.card, .notecard):nth-of-type(2n) { transform: rotate(.5deg); }
:root[data-app="pub"] .calcard { transform: rotate(-.25deg); }
:root[data-app="pub"] :is(.list, .users) > :nth-child(3n+1):not(:active) { transform: rotate(-.35deg); }
:root[data-app="pub"] :is(.list, .users) > :nth-child(3n+2):not(:active) { transform: rotate(.3deg); }
:root[data-app="pub"] .narrow.card { transform: none; }

/* controls */
:root[data-app="pub"] :is(button.primary, .btn.primary) { box-shadow: 2px 3px 0 rgba(0, 0, 0, .45); }
:root[data-app="pub"] :is(input, textarea)::placeholder { color: #8A6E50; }
:root[data-app="pub"] .switch input { background: #5A3D28; }
:root[data-app="pub"] .switch input::after { background: #F3E4C6; }
:root[data-app="pub"] .switch input:checked { background: var(--accent); }
:root[data-app="pub"] .switch input:disabled { background: #B9A27C; }
:root[data-app="pub"] .seg { background: #E7D5B0; }
:root[data-app="pub"] .seg button { color: #24140C; }
:root[data-app="pub"] .seg button[aria-checked="true"] { color: #fff; }
:root[data-app="pub"] .ind i { background: #D2BC90; }
:root[data-app="pub"] .day.other { opacity: 1; color: var(--muted); }
:root[data-app="pub"] .tbadge.late { background: #A3241C; color: #fff; }
:root[data-app="pub"] .todo .who b.anyone { color: #1F5A3C; }
:root[data-app="pub"] .linkbox { background: #E7D5B0; border-color: #D2BC90; }
:root[data-app="pub"] :is(.chip.c-shop b, .tbadge.shopb) { background: #F0B05A; color: #24140C; }
:root[data-app="pub"] .shopwait { background: #3A2414; color: #F3E4C6; }
:root[data-app="pub"] :is(.shoprow .wait, .todo .due.soon) { color: #9A5208; }
:root[data-app="pub"] :is(.pw .iconbtn, .searchbox svg) { color: #6E5034; }
:root[data-app="pub"] :is(#toast, .updbar, .snack) { background: #F3E4C6; color: #24140C; box-shadow: 3px 4px 0 rgba(0, 0, 0, .5); }
:root[data-app="pub"] .snack button { color: #24140C; }
:root[data-app="pub"] dialog { box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
:root[data-app="pub"] dialog::backdrop { background: rgba(10, 5, 2, .65); }

/* bottom tab bar: darker wood, amber when on */
:root[data-app="pub"] #tabs { background: #160C07; border-top: 0; }
:root[data-app="pub"] #tabs a { color: #BFA080; }
:root[data-app="pub"] #tabs a.on { color: var(--amber); font-weight: 800; }
:root[data-app="pub"] #tabs a.on svg { background: #3A2414; }
:root[data-app="pub"] .tbadge { box-shadow: 0 0 0 2px #160C07; }

/* login / setup: the sign over the counter, with stickers */
:root[data-app="pub"] .hero { background: transparent; color: var(--ink); padding-bottom: 22px; border-radius: 0; }
:root[data-app="pub"] .hero img { box-shadow: 2px 3px 0 rgba(0, 0, 0, .5); }
:root[data-app="pub"] .hero h1 { font-size: 34px; line-height: 1.1; }
.stk {
  position: absolute; z-index: 2; font: 800 11px/1 'Archivo', sans-serif; text-transform: uppercase; letter-spacing: .06em; padding: 6px 10px;
  border-radius: 999px; border: 2px solid #24140C; white-space: nowrap; pointer-events: none; box-shadow: 1px 2px 0 rgba(0, 0, 0, .35);
}
.stk.sq { border-radius: 4px; }
.stk.lab { border-radius: 3px 3px 14px 14px; }
.stk.g { background: #1F7A4C; color: #fff; }
.stk.a { background: #F0B05A; color: #24140C; }
.stk.w { background: #8C1C24; color: #fff; }
/* Pub tab: stickers under the title */
.pubstk { display: flex; justify-content: space-between; align-items: center; margin: 0 6px 14px; padding: 2px 0; }
.hero .pubstk { margin: 10px 0 0; }
/* One line always; when the three don't fit, app.js slides them over each other (and stacks them in a random order). */
.pubstk .stk { position: relative; flex: none; white-space: nowrap; font-size: 10px; line-height: 1.1; letter-spacing: .03em; padding: 5px 8px; }
.pubstk .stk.g { transform: rotate(-4deg); }
.pubstk .stk.a { transform: rotate(5deg); }
.pubstk .stk.w { transform: rotate(-2deg); }

/* Pub tab: big temperature in Anton, wine red */
:root[data-app="pub"] .pubtemp { transform: rotate(-.8deg); }
:root[data-app="pub"] .pubtemp .muted { font-size: 12px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; }
:root[data-app="pub"] .pubtemp b { font: 400 64px/1 var(--display); color: var(--wine); letter-spacing: 0; }
:root[data-app="pub"] .pubheat { transform: rotate(.7deg); }
:root[data-app="pub"] .publights { transform: rotate(-.4deg); }
:root[data-app="pub"] .pubhead h2 { font-size: 22px; }
:root[data-app="pub"] .stepval b { font: 400 40px/1 var(--display); letter-spacing: 0; }
:root[data-app="pub"] .stepper .iconbtn { background: transparent; border: 2px solid var(--accent); color: #1F5A3C; }
:root[data-app="pub"] .pubico { background: #E7D5B0; color: #24140C; box-shadow: inset 0 0 0 1.5px #9A7D5A; }
:root[data-app="pub"] .pubico.lit { background: #F0B05A; color: #24140C; box-shadow: none; }
:root[data-app="pub"] .pill.dead { background: transparent; color: #24140C; box-shadow: inset 0 0 0 1.5px #6E5034; }
:root[data-app="pub"] .pubrow.dead { opacity: 1; }
:root[data-app="pub"] .pubrow.dead .pubico { color: #6E5034; }
:root[data-app="pub"] .pubsub { color: var(--wine); font-weight: 700; }
:root[data-app="pub"] .pubtemp b.na { font: 700 18px/1.2 var(--font); color: #6E5034; }
@media (prefers-reduced-motion: reduce) { :root[data-app="pub"] :is(.card, .notecard, .calcard, .list > *, .users > *) { transform: none !important; } }

/* ---------- pub: cash box ---------- */
.cboxes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cbox { display: grid; gap: 2px; align-content: start; min-width: 0; }
.cbox .muted { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.cbox b { white-space: nowrap; font: 400 26px/1.05 var(--display); color: var(--wine, var(--accent-ink)); overflow-wrap: anywhere; }
.cbox b.small { font-size: 22px; }
.cbox b.neg, .csaldi b.neg, .camt.neg { color: var(--danger); }
.cbox .csub { font-size: 13px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.csaldi { padding-top: 8px; padding-bottom: 12px; }
.csrow { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.csrow:first-child { border-top: 0; }
.csrow .grow { display: grid; gap: 1px; }
.csrow .muted { font-size: 13px; }
.csrow > b { flex: none; font-size: 16px; }
.cfilters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 12px; }
.cfilters select { min-height: 44px; padding: 8px 10px; font-size: 15px; border-radius: 12px; }
.ctot { margin: -4px 4px 12px; }
.cmov .what, .erow .what { min-width: 0; }
.cnote { font-weight: 500; }
.camt { flex: none; align-self: center; text-align: right; font-weight: 800; font-size: 16px; white-space: nowrap; display: grid; gap: 2px; }
.camt.entrata { color: #1F5A3C; }
.camt.uscita { color: #8C1C24; }
.camt .csub { font-size: 12px; font-weight: 600; }
.erow:disabled { opacity: 1; cursor: default; }
.cseg { margin-top: 6px; }
.cchart { width: 100%; height: auto; display: block; margin-top: 4px; }
.cchart .cv { font: 700 10px var(--font); fill: #24140C; }
.cchart .cl { font: 600 10px var(--font); fill: #6E5034; }
:root[data-app="pub"] .month-head h1 { font-size: 23px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
:root[data-app="pub"] .month-head .iconbtn { width: 40px; flex: none; }

/* ---------- pub: Bancone ---------- */
.ctabs a { font-size: 14px; padding: 0 2px; }
.verbale summary { cursor: pointer; display: grid; gap: 2px; min-height: 44px; list-style: none; }
.verbale summary::-webkit-details-marker { display: none; }
.verbale summary b { font: 400 20px/1.15 var(--display); text-transform: uppercase; color: var(--wine, var(--accent-ink)); }
.vbody h3 { margin: 16px 0 4px; font: 400 17px/1.2 var(--display); text-transform: uppercase; letter-spacing: .02em; color: var(--wine, var(--accent-ink)); }
.vbody p { margin: 6px 0; }
.vbody ul { margin: 4px 0 8px; padding-left: 20px; display: grid; gap: 3px; }
.vedit { margin-top: 10px; min-height: 40px; padding: 0 10px; color: var(--accent-ink); font-weight: 700; }
.pill.doing { background: #F0B05A; color: #24140C; vertical-align: 2px; margin-left: 4px; }
.pill.doing::before { display: none; }
.invrow { align-items: center; }
.invrow.short { box-shadow: inset 4px 0 0 #C8642A, var(--shadow); }
.invstep { display: flex; align-items: center; gap: 2px; flex: none; }
.invstep b { min-width: 46px; text-align: center; font-size: 18px; }
.invstep b .muted { font-size: 13px; font-weight: 600; }
.invstep .iconbtn { width: 40px; height: 40px; min-height: 40px; border-radius: 20px; border: 2px solid var(--accent); color: var(--accent-ink); }
.invstep .iconbtn:disabled { opacity: .35; }

/* Pub: the app runs full screen, and on phones with rounded corners and gesture navigation the system
   reports no safe area, so the tab bar keeps its own margin from the bottom corners. */
:root[data-app="pub"] body.tabs-on { --tabbar: calc(66px + max(14px, calc(env(safe-area-inset-bottom) + 8px))); }
:root[data-app="pub"] #tabs { padding: 2px max(18px, env(safe-area-inset-right)) max(14px, calc(env(safe-area-inset-bottom) + 8px)) max(18px, env(safe-area-inset-left)); }
:root[data-app="pub"] #tabs a { font-size: 12px; letter-spacing: 0; }

/* ---------- pub: next evening and quick arrivals ---------- */
.pubev { display: grid; gap: 2px; margin: 8px 0 0; }
.pubev b { font-size: 17px; }
.arrh { margin: 14px 0 8px; font: 400 16px var(--display); text-transform: uppercase; color: var(--wine, var(--accent-ink)); }
.arrbtns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.arrbtns button { min-height: 44px; padding: 0 4px; font-size: 14px; border-radius: 12px; }
.arrat input { min-height: 44px; padding: 6px 4px; font-size: 14px; border-radius: 12px; text-align: center; }
.arrlist { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.arrlist li { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.notice { display: grid; gap: 2px; }
.notice p { margin: 4px 0 0; white-space: pre-wrap; }

/* ---------- pub: home strip, buttons, Spegni tutto ---------- */
:root[data-app="pub"] .btn:not(.primary):not(.iconbtn) { --ink: #24140C; --muted: #6E5034; color: #24140C; background: var(--surface); border-color: transparent; box-shadow: 2px 3px 0 rgba(0, 0, 0, .45); }
:root[data-app="pub"] .month-head .btn.iconbtn { color: var(--ink); }
/* ---------- pub: sticker-like controls on the newer pages ---------- */
:root[data-app="pub"] .arrbtns { filter: drop-shadow(3px 4px 0 #0A0503); gap: 10px; }
:root[data-app="pub"] .arrbtns button { border: 0; border-radius: 0; box-shadow: none; min-height: 48px; font: 400 18px/1 var(--display); letter-spacing: .05em; text-transform: uppercase;
  clip-path: polygon(0 12%, 4% 0, 9% 10%, 14% 2%, 100% 0, 97% 22%, 100% 46%, 96% 70%, 100% 100%, 88% 92%, 80% 100%, 0 100%, 3% 74%, 0 50%, 4% 28%); }
:root[data-app="pub"] .arrbtns button:nth-child(1) { background: #1F7A4C; color: #fff; transform: rotate(-2deg); }
:root[data-app="pub"] .arrbtns button:nth-child(2) { background: #F0B05A; color: #24140C; transform: rotate(1.5deg); }
:root[data-app="pub"] .arrbtns button:nth-child(3) { background: #8C1C24; color: #fff; transform: rotate(-1deg); }
:root[data-app="pub"] .cfilters select { border-radius: 999px; border: 2px solid #24140C; box-shadow: 2px 3px 0 rgba(0, 0, 0, .45); font-weight: 700; }
:root[data-app="pub"] .cfilters select:nth-child(odd) { transform: rotate(-.6deg); }
:root[data-app="pub"] .cfilters select:nth-child(even) { transform: rotate(.6deg); }
:root[data-app="pub"] .ctabs { transform: rotate(-.4deg); }
:root[data-app="pub"] .alllights b { font: 400 18px var(--display); text-transform: uppercase; color: var(--wine); }

/* Desktop: the header lines up with the page column */
:root[data-app="pub"] .top { max-width: 664px; margin: 0 auto; }
@media (min-width: 700px) { :root[data-app="pub"] .top { max-width: 680px; } }
:root[data-app="pub"] .adminbar { max-width: 640px; margin-left: auto; margin-right: auto; }

@media (min-width: 700px) { :root[data-app="pub"] #tabs { padding-left: max(18px, calc((100vw - 680px) / 2)); padding-right: max(18px, calc((100vw - 680px) / 2)); } }

/* ---------- pub: proposal A "Il bancone" ---------- */
/* readings on a cream receipt, torn along the top */
.ticket { display: grid; grid-template-columns: 1fr 1fr 1.25fr; margin: 0 0 12px; padding: 8px 6px 9px; background: #F3E4C6; color: #24140C;
  transform: rotate(-.8deg); filter: drop-shadow(3px 4px 0 rgba(0, 0, 0, .5));
  clip-path: polygon(0 4%, 3% 0, 7% 3%, 11% 0, 15% 3%, 19% 0, 23% 3%, 27% 0, 31% 3%, 35% 0, 39% 3%, 43% 0, 47% 3%, 51% 0, 55% 3%, 59% 0, 63% 3%, 67% 0, 71% 3%, 75% 0, 79% 3%, 83% 0, 87% 3%, 91% 0, 95% 3%, 100% 0, 100% 100%, 0 100%); }
.ticket > :is(div, a) { display: grid; padding: 0 10px; min-width: 0; color: inherit; text-decoration: none; }
.ticket > :is(div, a) + :is(div, a) { border-left: 2px dashed #D2BC90; }
.ticket > a { position: relative; }
.ticket > a::after { content: '›'; position: absolute; right: 6px; bottom: 2px; font: 800 15px var(--font); color: #B39A70; }
.ticket > a:active { background: rgba(140, 28, 36, .08); }
.ticket small { font: 800 10px var(--font); letter-spacing: .16em; text-transform: uppercase; color: #6E5034; }
.ticket b { font: 400 26px/1.05 var(--display); color: #8C1C24; font-variant-numeric: tabular-nums; }
.ticket em { font: 600 11.5px var(--font); font-style: normal; color: #6E5034; }
.homelive { margin: -2px 4px 12px; }
.homelive .stk { position: static; display: inline-block; transform: rotate(-2deg); font-size: 11px; }
/* today's evenings: one small crooked slip each */
.today { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 0 0 12px; padding: 9px 12px; background: #F3E4C6; color: #24140C;
  border-radius: 4px; box-shadow: 3px 4px 0 rgba(0, 0, 0, .45); transform: rotate(.5deg); }
.today b { font: 400 18px var(--display); text-transform: uppercase; color: #8C1C24; letter-spacing: .02em; }
.today span { font-weight: 700; }
.today small { color: #6E5034; font-size: 14px; }
/* Arrivo / Spegni tutto: strips of gaffer tape torn by hand */
.taperow { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 2px 0 16px; filter: drop-shadow(3px 4px 0 #0A0503); }
.taperow.one { grid-template-columns: 1fr; margin-bottom: 8px; }
button.tape { min-height: 48px; padding: 0 12px; border: 0; border-radius: 0; color: #fff; cursor: pointer;
  font: 400 20px/1 var(--display); letter-spacing: .06em; text-transform: uppercase;
  clip-path: polygon(0 12%, 4% 0, 9% 10%, 14% 2%, 100% 0, 97% 22%, 100% 46%, 96% 70%, 100% 100%, 88% 92%, 80% 100%, 0 100%, 3% 74%, 0 50%, 4% 28%);
  background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, .06) 0 1px, transparent 1px 5px), repeating-linear-gradient(-30deg, rgba(0, 0, 0, .12) 0 1px, transparent 1px 11px); }
button.tape.go { background-color: #1F7A4C; transform: rotate(-2deg); }
button.tape.off { background-color: #8C1C24; transform: rotate(1.6deg); }
.taperow.one button.tape.off { transform: rotate(-1deg); }
button.tape:active:not(:disabled) { transform: rotate(0) scale(.97); }
button.tape:focus-visible { outline: 3px solid #F0B05A; outline-offset: 4px; }
/* the home block keeps its height while it loads, so the page doesn't shift under you */
#pubhome { min-height: 150px; }
#pubhome:empty { min-height: 150px; }
:root[data-app="pub"] .publights .alllights { background: transparent; box-shadow: none; transform: none; border-radius: 0; margin: 4px 0 0; padding: 10px 0 6px; min-height: 48px; border-top: 1px solid #E0CCA4; }
:root[data-app="pub"] .publights .alllights .muted { font-size: 13px; }
:root[data-app="pub"] .arrbtns.big3 { grid-template-columns: repeat(3, 1fr); }

/* ---------- pub: climate statistics (hourly, from Home Assistant) ---------- */
.taperow.three { grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
.taperow.three button.tape { min-height: 44px; padding: 0 4px; font-size: min(18px, 4.6vw); background-color: #5A3A26; color: #E7D5B0; }
.taperow.three button.tape:nth-child(1) { transform: rotate(-1.6deg); }
.taperow.three button.tape:nth-child(2) { transform: rotate(.9deg); }
.taperow.three button.tape:nth-child(3) { transform: rotate(-.7deg); }
.taperow.three button.tape.on { background-color: #1F7A4C; color: #fff; }
.crange { margin: 0 4px 12px; font: 400 17px var(--display); letter-spacing: .03em; text-transform: uppercase; color: var(--amber); }
.month-head .iconbtn.dim { opacity: .35; pointer-events: none; }
.climacard { margin: 0 0 18px; padding: 14px 12px 10px; background: #F3E4C6; color: #24140C; filter: drop-shadow(3px 4px 0 rgba(0, 0, 0, .5));
  clip-path: polygon(0 1.6%, 3% 0, 7% 1.2%, 11% 0, 15% 1.2%, 19% 0, 23% 1.2%, 27% 0, 31% 1.2%, 35% 0, 39% 1.2%, 43% 0, 47% 1.2%, 51% 0, 55% 1.2%, 59% 0, 63% 1.2%, 67% 0, 71% 1.2%, 75% 0, 79% 1.2%, 83% 0, 87% 1.2%, 91% 0, 95% 1.2%, 100% 0, 100% 100%, 0 100%); }
.climacard.temp { transform: rotate(-.5deg); }
.climacard.umid { transform: rotate(.4deg); }
.climacard.loading { min-height: 290px; }
.climacard .muted { color: #6E5034; }
.chead { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding: 2px 4px 6px; border-bottom: 2px dashed #D2BC90; }
:root[data-app="pub"] .chead h2 { margin: 0; font: 400 22px var(--display); color: #8C1C24; }
.climacard.umid .chead h2 { color: #1F5A3C !important; }
.chead span { display: grid; justify-items: end; }
.chead small, .cstats small { font: 800 10px var(--font); letter-spacing: .16em; text-transform: uppercase; color: #6E5034; }
.chead b { font: 400 30px/1 var(--display); color: #24140C; font-variant-numeric: tabular-nums; }
.cchart { display: block; width: 100%; height: auto; margin: 8px 0 4px; overflow: visible; }
.cchart .cg { stroke: #D2BC90; stroke-width: 1; stroke-dasharray: 3 4; }
.cchart .cg.m { stroke: #B39A70; stroke-dasharray: none; }
.cchart .cx text { font: 600 10px var(--font); fill: #6E5034; }
.cchart .cx text.m { font-weight: 800; fill: #24140C; text-transform: uppercase; }
.cchart .cnone { font: 600 13px var(--font); fill: #6E5034; }
.cstats { display: grid; grid-template-columns: 1fr .8fr 1fr; padding-top: 8px; border-top: 2px dashed #D2BC90; }
.cstats > div { display: grid; align-content: start; padding: 0 8px; min-width: 0; }
.cstats > div + div { border-left: 2px dashed #D2BC90; }
.cstats b { font: 400 22px/1.1 var(--display); color: #24140C; font-variant-numeric: tabular-nums; }
.cstats em { font: 600 11.5px var(--font); font-style: normal; color: #6E5034; }

/* ---------- pub: rolling 3-week calendar ---------- */
.day.past { opacity: .45; }
.day .mtag { position: absolute; top: 1px; left: 50%; transform: translateX(-50%) rotate(-4deg); font: 800 8.5px/1 var(--font); letter-spacing: .08em; text-transform: uppercase; background: #F0B05A; color: #24140C; padding: 2px 4px; border-radius: 2px; }
.day.first .num { margin-top: 6px; }
.monthtape { display: flex; justify-content: center; margin: 6px 0 4px; }
.monthtape span { font: 400 15px/1 var(--display); text-transform: uppercase; letter-spacing: .08em; color: #fff; background: #8C1C24; padding: 5px 16px 4px; transform: rotate(-1.5deg);
  clip-path: polygon(0 14%, 5% 0, 100% 6%, 96% 50%, 100% 94%, 92% 100%, 0 100%, 4% 52%); }
/* "Oggi" in the calendar header: an amber sticker, text centred */
:root[data-app="pub"] .month-head .btn.today { display: inline-grid; place-items: center; height: 34px; min-height: 34px; padding: 0 12px; margin-right: 6px; line-height: 1;
  font: 400 16px/1 var(--display); letter-spacing: .05em; text-transform: uppercase; background: #F0B05A; color: #24140C; border: 2px solid #24140C;
  border-radius: 3px; transform: rotate(-3deg); box-shadow: 2px 3px 0 rgba(0, 0, 0, .6); }
/* "Prenota" next to a tapped day: a green tape strip like Arrivo */
:root[data-app="pub"] .dayhead .daynew { border: 0; border-radius: 0; box-shadow: none; min-height: 42px; padding: 0 16px; background-color: #1F7A4C; color: #fff;
  font: 400 17px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; transform: rotate(-2deg); filter: drop-shadow(3px 4px 0 #0A0503);
  clip-path: polygon(0 12%, 4% 0, 9% 10%, 14% 2%, 100% 0, 97% 22%, 100% 46%, 96% 70%, 100% 100%, 88% 92%, 80% 100%, 0 100%, 3% 74%, 0 50%, 4% 28%); }
:root[data-app="pub"] .dayhead .daynew svg { display: none; }
:root[data-app="pub"] .month-head h1 { font-size: min(23px, 4.9vw); }

/* ---------- pub: photos on the TV ---------- */
.tvstatus { margin: 0 6px 12px; }
.tvsum { margin: 0; font-size: 16px; }
.tvnote { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.tvgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
@media (min-width: 560px) { .tvgrid { grid-template-columns: repeat(4, 1fr); } }
.tvt { position: relative; aspect-ratio: 1; min-height: 0; padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: var(--empty); animation: enter .24s ease-out backwards; }
.tvgrid.still .tvt:not(.sk) { animation: none; }
.tvt img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .2s ease-out, filter .2s ease-out; }
.tvt:active img { opacity: .8; }
.tvt.wait img { filter: saturate(.5); }
.tvt.del img { opacity: .35; filter: grayscale(1); }
.tvt.up img { opacity: .55; }
.tvt.sk { display: block; background: linear-gradient(100deg, var(--empty) 40%, var(--line) 50%, var(--empty) 60%) 0 0 / 300% 100%; animation: tv-shimmer 1.4s linear infinite; }
.tvb { position: absolute; top: 6px; left: 6px; width: 26px; height: 26px; border-radius: 13px; display: grid; place-items: center; background: rgba(0, 0, 0, .55); color: #fff; }
.tvtag { position: absolute; left: 6px; right: 6px; bottom: 6px; padding: 3px 6px; border-radius: 8px; background: rgba(0, 0, 0, .62); color: #fff; font-size: 12px; font-weight: 700; text-align: center; }
.tvspin { position: absolute; top: calc(50% - 16px); left: calc(50% - 16px); width: 32px; height: 32px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .35); border-top-color: var(--accent); animation: tv-spin .9s linear infinite; }
.tvmeta { margin: 10px 2px 0; }
#tvadd.busy { opacity: .8; pointer-events: none; }
@keyframes tv-spin { to { transform: rotate(360deg); } }
@keyframes tv-shimmer { to { background-position: -300% 0; } }
@media (prefers-reduced-motion: reduce) { .tvt, .tvt.sk, .tvspin { animation-duration: .01ms; animation-iteration-count: 1; } }

/* Spegni tutto in progress: full-screen pint + checklist, nothing underneath can be touched (2.11) */
.pubpint { --pp-cream: #F3E4C6; --pp-ink: #24140C; --pp-amber: #F0B05A; --pp-gold: #C97E22; --pp-wine: #8C1C24; --pp-green: #1F7A4C; --pp-muted: #CDB08E;
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; touch-action: none;
  padding: max(20px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background: rgba(12, 6, 3, .93); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); opacity: 0; transition: opacity .25s ease-out; }
.pubpint.on { opacity: 1; }
.pp-box { width: min(100%, 380px); display: grid; gap: 16px; justify-items: center; }
.pp-head { display: grid; gap: 2px; text-align: center; }
.pp-head b { font: 400 30px/1.05 var(--display, 'Anton', Impact, sans-serif); letter-spacing: .03em; text-transform: uppercase; color: var(--pp-amber); }
.pp-head span { font: 700 13px/1.2 var(--font); text-transform: uppercase; letter-spacing: .14em; color: var(--pp-muted); }
.pp-head.nudge { animation: pp-nudge .4s ease-in-out; }
@keyframes pp-nudge { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.pp-duo { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: center; }
.pp-glass { position: relative; width: 96px; height: 150px; }
.pp-pint { position: absolute; inset: 0; overflow: hidden; background: rgba(243, 228, 198, .06); clip-path: polygon(0 0, 100% 0, 88% 100%, 12% 100%); }
.pp-beer { position: absolute; left: 0; right: 0; bottom: 0; height: 100%; transition: height .8s cubic-bezier(.22, 1, .36, 1);
  background: linear-gradient(180deg, #F7ECD0 0 12px, var(--pp-amber) 12px, var(--pp-gold)); }
.pp-pint i { position: absolute; bottom: 0; width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, .55); animation: pp-rise 2.3s linear infinite; }
@keyframes pp-rise { to { transform: translateY(-140px); opacity: 0; } }
.pp-rim { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pp-rim polyline { fill: none; stroke: var(--pp-cream); stroke-width: 4; stroke-linejoin: round; }
.pp-pct { margin-top: 8px; text-align: center; font: 400 17px/1 var(--display, 'Anton', Impact, sans-serif); color: var(--pp-cream); font-variant-numeric: tabular-nums; }
.pp-list { list-style: none; margin: 0; padding: 12px 14px; display: grid; gap: 8px; min-width: 0; background: var(--pp-cream); color: var(--pp-ink);
  border-radius: 12px; box-shadow: 4px 4px 0 #000; transform: rotate(-1deg); }
.pp-list li { display: flex; justify-content: space-between; gap: 8px; font: 600 15px/1.2 var(--font); }
.pp-list em { font-style: normal; font-size: 13px; color: #9A7D5A; white-space: nowrap; }
.pp-list li.ok em { color: var(--pp-green); font-weight: 800; }
.pp-list li.retry em { color: var(--pp-gold); font-weight: 800; }
.pp-list li.ko em { color: var(--pp-wine); font-weight: 800; }
.pp-list li.stop em { color: #6E5034; }
.pp-time { font: 600 14px var(--font); color: var(--pp-muted); font-variant-numeric: tabular-nums; }
.pubpint.end .pp-time { display: none; }
.pp-res { width: 100%; display: grid; gap: 6px; padding: 16px; text-align: center; border-radius: 12px; box-shadow: 4px 4px 0 #000; transform: rotate(-1.5deg); animation: pp-pop .4s cubic-bezier(.34, 1.56, .64, 1); }
.pp-res b { font: 400 26px/1.1 var(--display, 'Anton', Impact, sans-serif); letter-spacing: .03em; text-transform: uppercase; }
.pp-res p { margin: 0; font: 500 15px/1.4 var(--font); }
.pubpint .pp-res .pp-ok { justify-self: center; margin-top: 6px; min-width: 120px; min-height: 44px; font: 800 15px var(--font); text-transform: uppercase; letter-spacing: .08em;
  border: 0; border-radius: 999px; background: var(--pp-cream); color: var(--pp-ink); box-shadow: 2px 2px 0 #000; cursor: pointer; }
.pubpint .pp-res .pp-ok:focus-visible { outline: 3px solid var(--pp-amber); outline-offset: 3px; }
.pp-res.ok { background: var(--pp-green); color: var(--pp-cream); }
.pp-res.ko { background: var(--pp-wine); color: var(--pp-cream); }
.pp-res.stop { background: var(--pp-amber); color: var(--pp-ink); }
.pubpint .pp-res.stop .pp-ok { background: var(--pp-ink); color: var(--pp-cream); }
@keyframes pp-pop { from { transform: rotate(-1.5deg) scale(.85); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pp-pint i, .pp-head.nudge, .pp-res { animation: none; } .pp-beer { transition: none; } }
