:root {
  --bg: #0B0B0C; --card: #161618; --card-2: #1E1E21; --line: #2A2A2E;
  --ink: #F5F3EF; --ink-2: #B9B4AC; --ink-3: #7D786F;
  --gold: #F2A61B; --gold-2: #FFC24D; --gold-soft: rgba(242,166,27,.14);
  --ok: #4CC38A; --ok-soft: rgba(76,195,138,.14);
  --bad: #F06A5E; --bad-soft: rgba(240,106,94,.14);
  --blue: #6EA8FF; --blue-soft: rgba(110,168,255,.14);
  --r: 18px; --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.35);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); }
body { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); font-size: 16px; line-height: 1.4; -webkit-font-smoothing: antialiased; min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--gold); }
.num { font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.muted { color: var(--ink-2); } .faint { color: var(--ink-3); } .small { font-size: 13px; }
.hidden { display: none !important; }
.gold { color: var(--gold); } .okc { color: var(--ok); } .badc { color: var(--bad); }

.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--gold); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.shell { max-width: 620px; margin: 0 auto; padding: calc(var(--safe-t) + 14px) 16px calc(var(--nav-h) + var(--safe-b) + 28px); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 2px 16px; }
.topbar h1 { font-size: 27px; margin: 0; letter-spacing: -.02em; font-weight: 760; }
.topbar .sub { font-size: 13.5px; color: var(--ink-2); margin-top: 2px; }
.brandbar { display: flex; align-items: center; gap: 10px; }
.brandbar img { height: 30px; }
.brandbar .t { font-weight: 800; letter-spacing: .14em; font-size: 14px; }
.brandbar .t span { color: var(--gold); }
.goldline { height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: .7; margin: 0 0 16px; }
.iconbtn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--card); color: var(--ink); border: 1px solid var(--line); flex: none; }
.iconbtn:disabled { opacity: .35; }
.syncdot { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.syncdot i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.syncdot.wait i { background: var(--gold); } .syncdot.off i { background: var(--ink-3); } .syncdot.err i { background: var(--bad); }

.card { background: var(--card); border-radius: var(--r); border: 1px solid var(--line); box-shadow: var(--shadow); }
.pad { padding: 16px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 24px 4px 10px; }
.section-title h2 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); margin: 0; font-weight: 700; }
.section-title .link { font-size: 14px; color: var(--gold); font-weight: 650; }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { padding: 14px 16px; text-align: left; width: 100%; }
.kpi .k { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.kpi .v { font-size: 26px; font-weight: 780; margin-top: 4px; letter-spacing: -.02em; }
.kpi .h { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.kpi.wide { grid-column: 1 / -1; }
.kpi.wide .v { font-size: 34px; }

.actions3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.act { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px 12px; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); font-size: 13px; font-weight: 650; line-height: 1.2; text-align: center; }
.act:active { transform: scale(.97); }
.act .ic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--gold); color: #111; }
.act.alt .ic { background: var(--card-2); color: var(--gold); border: 1px solid var(--line); }

.list { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 13px 14px; }
.row + .row { border-top: 1px solid var(--line); }
.row .ic { flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--card-2); color: var(--gold); border: 1px solid var(--line); font-weight: 750; font-size: 14px; }
.row .body { flex: 1; min-width: 0; }
.row .t { display: block; font-weight: 650; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .d { display: block; font-size: 13px; color: var(--ink-2); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .v { flex: none; text-align: right; font-weight: 750; font-size: 15.5px; }
.row .v small { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 600; }

.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.pill.gold { background: var(--gold-soft); color: var(--gold); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.neutral { background: var(--card-2); color: var(--ink-2); border: 1px solid var(--line); }
.slot { display: inline-block; font-size: 11px; font-weight: 800; padding: 3px 7px; border-radius: 7px; letter-spacing: .02em; }
.slot.mattina { background: var(--gold-soft); color: var(--gold-2); }
.slot.pomeriggio { background: var(--blue-soft); color: var(--blue); }
.slot.giornata { background: var(--ok-soft); color: var(--ok); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: none; margin-bottom: 4px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: 14px; font-weight: 600; color: var(--ink-2); }
.chip.on { background: var(--gold); color: #111; border-color: var(--gold); }
.search { width: 100%; height: 44px; border-radius: 13px; border: 1px solid var(--line); background: var(--card); padding: 0 14px; margin-bottom: 10px; outline: none; }
.search:focus { border-color: var(--gold); }

.empty { text-align: center; padding: 30px 22px; }
.empty .ic { width: 60px; height: 60px; border-radius: 18px; background: var(--gold-soft); color: var(--gold); display: grid; place-items: center; margin: 0 auto 12px; }
.empty h3 { margin: 0 0 6px; font-size: 17px; }
.empty p { margin: 0 0 14px; color: var(--ink-2); font-size: 14.5px; }

.day { margin-top: 14px; }
.day-h { display: flex; justify-content: space-between; align-items: baseline; margin: 0 6px 6px; font-size: 13.5px; font-weight: 700; color: var(--ink-2); text-transform: capitalize; }
.day-h.today { color: var(--gold); }
.day-empty { font-size: 13px; color: var(--ink-3); padding: 0 6px 4px; }

.money { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; }
.money > div { padding: 12px 6px; }
.money > div + div { border-left: 1px solid var(--line); }
.money .k { font-size: 11.5px; color: var(--ink-3); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.money .v { font-size: 19px; font-weight: 780; margin-top: 3px; }
.split { border-top: 1px solid var(--line); padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; font-size: 14.5px; }
.split div { display: flex; justify-content: space-between; }
.split .tot { font-weight: 750; border-top: 1px dashed var(--line); padding-top: 6px; }

.field { margin-bottom: 15px; }
.field > label, .lbl { display: block; font-size: 13px; font-weight: 650; color: var(--ink-2); margin: 0 2px 7px; }
.input { width: 100%; height: 50px; padding: 0 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card-2); outline: none; font-size: 16px; -webkit-appearance: none; appearance: none; color: var(--ink); }
select.input { background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 20px) 22px, calc(100% - 15px) 22px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.input:focus { border-color: var(--gold); }
textarea.input { height: 80px; padding: 12px 14px; resize: none; }
.euro { position: relative; }
.euro .input { padding-left: 34px; font-weight: 700; }
.euro::before { content: "€"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-weight: 700; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { font-size: 12.5px; color: var(--ink-3); margin: 6px 2px 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 52px; padding: 0 22px; border-radius: 15px; font-weight: 750; font-size: 16px; }
.btn:active { transform: scale(.98); }
.btn.block { width: 100%; }
.btn.primary { background: var(--gold); color: #111; }
.btn.ghost { background: var(--card-2); color: var(--ink); border: 1.5px solid var(--line); }
.btn.danger { background: var(--bad-soft); color: var(--bad); }
.btn.sm { height: 40px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.btn:disabled { opacity: .4; pointer-events: none; }
.btnrow { display: flex; gap: 10px; } .btnrow > * { flex: 1; }
.linkbtn { color: var(--gold); font-weight: 650; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--card-2); border: 1.5px solid var(--line); border-radius: 14px; padding: 3px; gap: 3px; }
.seg button { min-height: 40px; border-radius: 11px; font-size: 14px; font-weight: 650; color: var(--ink-2); padding: 4px; }
.seg button.on { background: var(--gold); color: #111; }
.pick { display: flex; flex-wrap: wrap; gap: 8px; }
.pick button { padding: 9px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card-2); font-weight: 650; font-size: 14.5px; }
.pick button.on { border-color: var(--gold); background: var(--gold-soft); color: var(--gold-2); }
.preview { border-radius: 14px; padding: 12px 14px; background: var(--card-2); border: 1.5px dashed var(--line); margin-bottom: 15px; font-size: 14.5px; }
.preview b { color: var(--gold); }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }

/* sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 50; opacity: 0; transition: opacity .2s; }
.sheet-bg.show { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; max-height: 92vh; overflow-y: auto; -webkit-overflow-scrolling: touch; background: var(--card); border-top: 1px solid var(--line); border-radius: 24px 24px 0 0; padding: 8px 18px calc(var(--safe-b) + 20px); transform: translateY(100%); transition: transform .28s cubic-bezier(.2,.8,.2,1); max-width: 620px; margin: 0 auto; }
.sheet.show { transform: translateY(0); }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 12px; }
.sheet-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sheet-h h3 { margin: 0; font-size: 20px; }
.close { width: 34px; height: 34px; border-radius: 50%; background: var(--card-2); display: grid; place-items: center; color: var(--ink-2); }

/* pagina di dettaglio */
.page-h { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; }
.page-h h1 { font-size: 22px; margin: 0; flex: 1; min-width: 0; line-height: 1.2; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--ink-2); } .kv .v { font-weight: 650; text-align: right; }
.contact { display: flex; gap: 8px; margin-top: 10px; }

.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: rgba(14,14,15,.92); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.nav-in { max-width: 620px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--nav-h); }
.nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; font-weight: 650; color: var(--ink-3); }
.nav button.on { color: var(--gold); }

.auth { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; max-width: 420px; margin: 0 auto; padding: calc(var(--safe-t) + 24px) 22px calc(var(--safe-b) + 24px); }
.brand-big { text-align: center; margin-bottom: 26px; }
.brand-big img { width: 230px; max-width: 80%; }
.brand-big .imp { color: var(--gold); letter-spacing: .5em; font-size: 13px; font-weight: 700; margin-top: 12px; padding-left: .5em; }
.err-msg { background: var(--bad-soft); color: var(--bad); padding: 11px 14px; border-radius: 12px; font-size: 14px; margin-bottom: 14px; font-weight: 600; }
.banner { font-size: 13px; font-weight: 600; text-align: center; padding: 8px 10px; border-radius: 12px; margin-bottom: 12px; background: var(--gold-soft); color: var(--gold-2); }
.banner.err { background: var(--bad-soft); color: var(--bad); }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: right; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: 11px 6px 7px; }
.table td { text-align: right; padding: 10px 6px; border-top: 1px solid var(--line); }
.table th:first-child, .table td:first-child { text-align: left; padding-left: 14px; }
.table th:last-child, .table td:last-child { padding-right: 14px; }
.table tr.total td { font-weight: 750; border-top: 2px solid var(--line); }

#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); transform: translate(-50%, 20px); background: var(--ink); color: #111; padding: 11px 18px; border-radius: 14px; font-size: 14.5px; font-weight: 650; opacity: 0; pointer-events: none; transition: all .25s; z-index: 60; max-width: calc(100% - 40px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--bad); color: #fff; }

/* pagina operaio */
.op-call { padding: 14px 16px; }
.op-call + .op-call { border-top: 1px solid var(--line); }
.op-call .t { font-weight: 700; font-size: 16px; margin-top: 6px; }
.op-call .a { font-size: 14.5px; color: var(--ink-2); margin-top: 2px; }
.op-call .n { font-size: 14px; margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: var(--card-2); color: var(--ink-2); }
a.btn { text-decoration: none; color: var(--ink); }
