/* DeskApp, Family Fitness. Giallo e nero: il giallo è il marchio, non un allarme.
   Per "da comprare", "in ritardo" e "scaduto" ci sono colori di stato, sempre con un'etichetta scritta. */

:root {
  --brand: #FECA09;
  --on-brand: #111111;
  --band: #0B0B0B;
  --band-text: #F3F3F1;
  --radius: 14px;
  --gap: 16px;
  --nav-h: 64px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

:root[data-theme="dark"] {
  --bg: #0B0B0B;
  --surface: #161616;
  --surface-2: #202020;
  --line: #2E2E2E;
  --line-strong: #4A4A4A;
  --text: #F3F3F1;
  --muted: #ABABA6;
  --link: #FECA09;
  --focus: #FECA09;
  --bad: #FF8A80;
  --bad-bg: #3A1414;
  --ok: #6EE7A0;
  --ok-bg: #0F2E1C;
  --info: #93C5FD;
  --info-bg: #13243D;
  --soon: #C4B5FD;
  --soon-bg: #251B45;
  --neutral: #D4D4CF;
  --neutral-bg: #2A2A2A;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #F4F4F1;
  --surface: #FFFFFF;
  --surface-2: #EFEFEB;
  --line: #D9D9D3;
  --line-strong: #A8A8A2;
  --text: #111111;
  --muted: #545450;
  --link: #111111;
  --focus: #111111;
  --bad: #A3241A;
  --bad-bg: #FDE8E6;
  --ok: #166534;
  --ok-bg: #E3F5E9;
  --info: #1E4FA8;
  --info-bg: #E3ECFB;
  --soon: #5B3BB0;
  --soon-bg: #EEE8FB;
  --neutral: #3F3F3C;
  --neutral-bg: #ECECE8;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  color-scheme: light;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  min-height: 100vh;
  overflow-wrap: anywhere;
}

h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.6rem; font-weight: 750; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0; }
ul { margin: 0; padding: 0; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.icon { width: 22px; height: 22px; flex: none; }

.muted { color: var(--muted); }
.small { font-size: 0.9rem; }
.strong { font-weight: 650; }
.center { text-align: center; }
.empty { padding: 8px 0; }
.ok-text { color: var(--ok); }

.stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.stack-tight { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-actions.wrap { gap: 10px; }

/* --------------------------------------------------- intestazione e marchio */

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: var(--band);
  color: var(--band-text);
  border-bottom: 1px solid #262626;
}

.brand-band { display: flex; align-items: center; gap: 12px; min-width: 0; }

.logo { height: 34px; width: auto; color: var(--brand); display: block; flex: none; }
.logo-large { height: 64px; }

.app-name {
  font-weight: 650;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--band-text);
  padding-left: 12px;
  border-left: 1px solid #3A3A3A;
  white-space: nowrap;
}

.header-actions { display: flex; align-items: center; gap: 8px; min-width: 0; }

.user-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid #3A3A3A;
  border-radius: 999px;
  background: transparent;
  color: var(--band-text);
  font-weight: 600;
  max-width: 44vw;
}
.user-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-button .icon { width: 18px; height: 18px; }

.btn.exit { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.btn.exit .icon { width: 18px; height: 18px; }

.brand-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0 calc(-1 * var(--gap)) 24px;
  padding: calc(28px + env(safe-area-inset-top)) var(--gap) 24px;
  background: var(--band);
  color: var(--band-text);
}
.brand-block .brand-band { flex-wrap: wrap; row-gap: 8px; }
.brand-block .muted { color: #BDBDB8; }

/* ------------------------------------------------------------ impaginazione */

.app-body { display: flex; min-height: calc(100vh - 60px); }

#view {
  flex: 1;
  min-width: 0;
  padding: 20px max(var(--gap), env(safe-area-inset-right)) calc(var(--nav-h) + 32px + env(safe-area-inset-bottom)) max(var(--gap), env(safe-area-inset-left));
}
#view.bare { padding-top: 0; padding-bottom: 40px; }

.page { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.page.has-bar { padding-bottom: 80px; }
.narrow { max-width: 420px; width: 100%; margin: 0 auto; }

.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.today-head h1 { font-size: 1.5rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.today-card { display: flex; flex-direction: column; gap: 12px; }
.today-card .card-head .icon { width: 20px; height: 20px; color: var(--muted); }

.plain-list { list-style: none; display: flex; flex-direction: column; }
.line { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.line:first-child { border-top: 0; padding-top: 0; }

.loading { padding: 24px 0; }

/* ------------------------------------------------------------- navigazione */

.bottom-nav {
  position: fixed;
  z-index: 25;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 6px max(6px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
}

.nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 52px;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
}
.nav-item .icon { width: 40px; height: 28px; padding: 3px 9px; border-radius: 999px; }
.nav-item.active { color: var(--text); }
.nav-item.active .icon { background: var(--brand); color: var(--on-brand); }
.nav-label { white-space: nowrap; }
.nav-badge {
  position: absolute;
  top: 0;
  left: calc(50% + 10px);
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--bad-bg);
  color: var(--bad);
  border: 1px solid var(--bad);
  font-size: 0.72rem;
  line-height: 18px;
  text-align: center;
}

.side-nav { display: none; }

@media (min-width: 900px) {
  .bottom-nav { display: none; }
  .side-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 230px;
    flex: none;
    padding: 20px 12px;
    border-right: 1px solid var(--line);
    position: sticky;
    top: 61px;
    align-self: flex-start;
    height: calc(100vh - 61px);
  }
  .side-nav .nav-item { flex-direction: row; justify-content: flex-start; gap: 10px; font-size: 0.95rem; min-height: 44px; padding: 6px 10px; border-radius: 10px; }
  .side-nav .nav-item .icon { width: 40px; }
  .side-nav .nav-item.active { background: var(--surface-2); }
  .side-nav .nav-badge { position: static; margin-left: auto; }
  #view { padding-bottom: 48px; }
  .page.has-bar { padding-bottom: 90px; }
}

.more-list { display: flex; flex-direction: column; gap: 8px; }
.more-item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 60px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
}
.more-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); }
.more-go { margin-left: auto; color: var(--muted); }

.back-link { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; }
.back-link .icon { width: 18px; height: 18px; }

.subtabs { display: flex; flex-wrap: wrap; gap: 6px; }
.subtab {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
}
.subtab[aria-selected="true"] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.subtab .count { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--bad-bg); color: var(--bad); font-size: 0.75rem; }
.subtab[aria-selected="true"] .count { background: var(--on-brand); color: var(--brand); }

/* ----------------------------------------------------------------- pulsanti */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 10px 18px;
  border: 1px solid var(--brand);
  border-radius: 12px;
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 700;
  text-align: center;
}
.btn .icon { width: 20px; height: 20px; }
.btn.compact { min-height: 42px; padding: 8px 14px; font-size: 0.95rem; }
.btn.full { width: 100%; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn.danger { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.btn:disabled, .btn.is-waiting { opacity: 0.6; }

.linkish {
  display: inline-flex;
  align-items: center;
  border: 0;
  padding: 6px 0;
  min-height: 36px;
  background: none;
  color: var(--link);
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ------------------------------------------------------------------- moduli */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field-label { font-weight: 650; font-size: 0.95rem; }
.hint { color: var(--muted); font-size: 0.85rem; }

.input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}
textarea.input { min-height: 96px; resize: vertical; }
textarea.lines { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9rem; }
.input.pin { letter-spacing: 0.3em; font-size: 1.2rem; max-width: 220px; }
select.input { appearance: auto; }

.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inline-field { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.inline-field .field { flex: 1 1 180px; }

.error { color: var(--bad); font-weight: 600; }

.chips, .day-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}
.chip[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.day-chips .chip { min-width: 52px; padding: 8px 10px; }

.toggle-list { display: flex; flex-direction: column; }
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 52px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
}
.toggle-row:first-child { border-top: 0; }
.toggle-row.locked { cursor: default; }

.switch {
  appearance: none;
  flex: none;
  width: 50px;
  height: 30px;
  margin: 0;
  border-radius: 999px;
  background: var(--neutral-bg);
  border: 1px solid var(--line-strong);
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.15s, background 0.15s;
}
.switch:checked { background: var(--brand); border-color: var(--brand); }
.switch:checked::after { transform: translateX(20px); background: var(--on-brand); }
.switch:disabled { opacity: 0.45; cursor: not-allowed; }

/* -------------------------------------------------------------------- stati */

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.status-bad { background: var(--bad-bg); color: var(--bad); }
.status-ok { background: var(--ok-bg); color: var(--ok); }
.status-info { background: var(--info-bg); color: var(--info); }
.status-soon { background: var(--soon-bg); color: var(--soon); }
.status-neutral { background: var(--neutral-bg); color: var(--neutral); }

.notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.push-notice { flex-wrap: nowrap; align-items: flex-start; }
.notice-icon { color: var(--muted); padding-top: 2px; }

/* --------------------------------------------------------- accesso e desk */

.name-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.name-tile {
  min-height: 88px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 1.15rem;
  font-weight: 700;
}
.name-tile:active { background: var(--brand); color: var(--on-brand); }

.proposed-list { display: flex; flex-direction: column; }
.proposed-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.proposed-row .input.pin { max-width: 130px; }

.people-list { display: flex; flex-direction: column; gap: 8px; }
.person-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
}
.person-row.inactive { opacity: 0.65; }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.perm-table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.perm-table th, .perm-table td { padding: 8px; border-bottom: 1px solid var(--line); text-align: center; }
.perm-table th[scope="row"] { text-align: left; white-space: nowrap; position: sticky; left: 0; background: var(--surface); }
.perm-table thead th { font-weight: 650; vertical-align: bottom; }
.perm-head { display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }
.perm-table input { width: 24px; height: 24px; accent-color: var(--brand); }

/* -------------------------------------------------------- scorte e check */

.group { display: flex; flex-direction: column; gap: 8px; }
.group > h2 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.check-row.done { border-color: var(--line-strong); }
.confirm { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; padding: 4px; border: 0; background: none; text-align: left; }
.confirm-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.confirm-mark, .task-item .confirm-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  color: transparent;
}
.confirm-mark svg { width: 16px; height: 16px; }
.check-row.done .confirm-mark, .task-item.done .confirm-mark { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.product-name { font-weight: 650; }
.product-unit { color: var(--muted); font-size: 0.88rem; }
.product-unit.is-late { color: var(--bad); }

.stepper { display: flex; align-items: center; flex: none; border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; }
.stepper button { width: 42px; height: 46px; border: 0; background: var(--surface-2); font-size: 1.3rem; font-weight: 700; }
.stepper input { width: 52px; height: 46px; border: 0; text-align: center; background: var(--surface); font-weight: 700; font-size: 1.05rem; }

.shelf { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; min-height: 12px; }
.shelf .box { width: 11px; height: 11px; border-radius: 3px; background: var(--brand); }
.shelf .box.empty { background: transparent; border: 1px solid var(--line-strong); }
.shelf .box.mark { box-shadow: 3px 0 0 -1px var(--text); }
.shelf.is-low .box:not(.empty) { background: var(--bad); }
.shelf .box.new { animation: pop 0.3s ease-out; }
.shelf-more { font-size: 0.75rem; color: var(--muted); }
@keyframes pop { from { transform: scale(0.4); } to { transform: scale(1); } }

.submit-bar {
  position: fixed;
  z-index: 15;
  left: 0;
  right: 0;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding: 10px max(var(--gap), env(safe-area-inset-right)) 10px max(var(--gap), env(safe-area-inset-left));
  background: linear-gradient(transparent, var(--bg) 30%);
}
.submit-bar .btn { max-width: 760px; margin: 0 auto; display: flex; }
@media (min-width: 900px) {
  .submit-bar { left: 230px; bottom: 0; }
}

.stock-row { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.stock-row.is-low { border-color: var(--bad); }
.stock-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border: 0; background: none; padding: 0; text-align: left; }
.stock-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.qty { font-weight: 700; }

.needs-check { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--focus); } 100% { box-shadow: 0 0 0 0 transparent; } }

/* -------------------------------------------------------------------- task */

.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
}
.task-item.done .product-name { text-decoration: line-through; text-decoration-thickness: 2px; color: var(--muted); }
.task-details { white-space: pre-line; color: var(--muted); font-size: 0.9rem; }
.task-assignee { font-size: 0.85rem; font-weight: 650; }
.task-assignee.is-mine { color: var(--text); }
.task-assignee.is-mine::before { content: "\2605 "; color: var(--brand); }

.progress { display: flex; gap: 4px; flex-wrap: wrap; }
.progress .tick { flex: 1; min-width: 8px; max-width: 40px; height: 8px; border-radius: 4px; background: var(--line); }
.progress .tick.on { background: var(--brand); }
.progress.small .tick { flex: none; width: 16px; height: 12px; }

/* ----------------------------------------------------------------- storico */

.history { display: flex; flex-direction: column; gap: 8px; }
.history details { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.history summary { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 14px; cursor: pointer; }
.history-list { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; padding: 0 14px 12px; }
.history-list.flat { padding: 0; }
.history-list.log { margin-top: 12px; }
details.card > summary { cursor: pointer; min-height: 32px; }
.history-list > span:nth-child(even) { text-align: right; }

/* ------------------------------------------------------- finestre e avvisi */

dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  padding: 22px 18px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.65); }
.dialog-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--muted);
}
.dialog-form { display: flex; flex-direction: column; gap: 14px; }
.dialog-form h2 { padding-right: 40px; }
.dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }

.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  box-shadow: var(--shadow);
}
@media (min-width: 900px) { .toast { bottom: 24px; } }

.copy-text { min-height: 160px; }

@media (max-width: 380px) {
  :root { --gap: 12px; }
  h1 { font-size: 1.4rem; }
  .logo { height: 28px; }
  .app-name { padding-left: 8px; font-size: 0.85rem; }
  .user-button { max-width: 34vw; }
  .two-fields { grid-template-columns: 1fr; }
  .stepper button { width: 36px; }
  .stepper input { width: 44px; }
  .nav-item .icon { width: 36px; padding: 3px 7px; }
}

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

/* ---------------------------------------------------- merchandising e liste */

.merch-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
}
.merch-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.size-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.size-pill { display: inline-flex; gap: 6px; align-items: baseline; padding: 2px 10px; border-radius: 8px; background: var(--surface-2); font-size: 0.88rem; }
.size-pill strong { font-weight: 750; }
.size-pill.is-out { background: var(--bad-bg); color: var(--bad); }

.move-list { display: flex; flex-direction: column; gap: 6px; }
.move-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  text-align: left;
}
.move-row .status { flex: none; }

.size-lines { display: flex; flex-direction: column; gap: 8px; }
.size-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.size-line:first-child { border-top: 0; }
.count-input input { width: 90px; height: 46px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); text-align: center; font-size: 1.1rem; font-weight: 700; }
.total { display: flex; align-items: center; min-height: 48px; font-size: 1.2rem; font-weight: 750; }
.bad-text { color: var(--bad); font-weight: 600; }

.size-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.size-table th, .size-table td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: right; }
.size-table th[scope="row"], .size-table thead th:first-child { text-align: left; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.stat-value { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.01em; }
.stat-value.small-value { font-size: 1.2rem; }

.photo-row { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-row img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.photo-button { align-self: flex-start; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.card.is-today { border-color: var(--brand); }
.line.mine .strong::before { content: "\2605 "; color: var(--brand); }
:root[data-theme="light"] .line.mine .strong::before { color: var(--text); }

/* Foglio Google, in Impostazioni */
.steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.sheet-code { font-size: 1.6rem; font-weight: 700; letter-spacing: 0.18em; font-variant-numeric: tabular-nums; margin: 0; }
.sheet-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sheet-list li { display: grid; gap: 2px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.sheet-list li:last-child { border-bottom: 0; padding-bottom: 0; }
details > summary { cursor: pointer; font-weight: 600; }

a { color: var(--link); text-underline-offset: 2px; }

/* Inventario: una voce sotto l'altra, numeri grandi */
.count-sheet .group { gap: 8px; }
.group-title { margin: 6px 0 0; font-size: 1rem; color: var(--muted); font-weight: 650; }
.count-card { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.count-card.done { border-color: var(--brand); box-shadow: inset 4px 0 0 var(--brand); }
.count-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.count-lines { display: flex; flex-direction: column; gap: 6px; }
.count-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.count-label { font-weight: 650; font-size: 1.05rem; min-width: 3ch; }
.count-line .stepper input::placeholder { color: var(--muted); }
.sheet-list.pad { padding: 0 14px 12px; }

/* Permessi: una scheda per persona, un pulsante per permesso */
.perm-person { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px; }
.perm-person h3 { margin: 0; }
.perm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.perm-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px 6px 8px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); font-weight: 600; font-size: 0.9rem; cursor: pointer; user-select: none; }
.perm-mark { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); color: transparent; flex: none; }
.perm-mark svg { width: 13px; height: 13px; }
.perm-chip:has(input:checked) { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.perm-chip:has(input:checked) .perm-mark { border-color: var(--on-brand); background: var(--on-brand); color: var(--brand); }
.perm-chip:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.perm-chip.locked { opacity: 0.55; cursor: not-allowed; }
.warn-text { color: var(--bad); }

