/* Portale Dipendenti Sinergia — design system
   Petrolio + arancio Compass. Display: Space Grotesk. Mobile-first. */

@font-face { font-family: 'Space Grotesk'; src: url('../font/SpaceGrotesk-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Space Grotesk'; src: url('../font/SpaceGrotesk-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Space Grotesk'; src: url('../font/SpaceGrotesk-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --ink: #16242D; --ink2: #33424D; --mut: #5B6B7A;
  --line: #E0E6EA; --bg: #EDF0F2; --card: #FFFFFF;
  --brand: #E8500A; --brand-d: #C24106; --brand-t: #FDEBE0;
  --ferie: #0B8A5C;    --ferie-t: #E2F4EC;
  --permesso: #C56A00; --permesso-t: #FBEEDC;
  --malattia: #C42B2B; --malattia-t: #FAE6E6;
  --altro: #5B6B7A;    --altro-t: #EAEEF1;
  --r: 14px; --disp: 'Space Grotesk', system-ui, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --sh: 0 1px 2px rgba(22,36,45,.06), 0 4px 14px rgba(22,36,45,.05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--body);
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
body.auth { padding-bottom: 0; display: grid; min-height: 100dvh;
  place-items: center; background:
  radial-gradient(1200px 500px at 50% -10%, #24404F 0%, var(--ink) 60%); }

a { color: var(--brand-d); text-decoration: none; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--ink); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
}
.brand { font-family: var(--disp); font-weight: 700; font-size: 19px;
  letter-spacing: .01em; color: #fff; display: flex; align-items: center; gap: 8px; }
.brand-sub { font-weight: 400; font-size: 12px; color: #9FB3BF; margin-left: 8px;
  border-left: 1px solid #35505F; padding-left: 8px; letter-spacing: .04em; }
.brand-dot { width: 12px; height: 12px; border-radius: 4px 12px 12px 12px;
  background: var(--brand); display: inline-block; }
.brand-dot.big { width: 26px; height: 26px; border-radius: 8px 26px 26px 26px; }
.topbar-user { font-size: 13px; color: #C9D5DC; }

/* ---------- layout */
.wrap { max-width: 640px; margin: 0 auto; padding: 18px 16px 8px; }
.page-title { font-family: var(--disp); font-weight: 700; font-size: 26px;
  letter-spacing: -.01em; margin: 2px 0 12px; }
.section-title { font-family: var(--disp); font-size: 15px; font-weight: 500;
  color: var(--mut); text-transform: uppercase; letter-spacing: .08em; margin: 22px 4px 8px; }
.eyebrow { font-family: var(--disp); font-size: 12px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--mut); margin: 4px 0 0; }
.muted { color: var(--mut); } .center { text-align: center; }
.mt { margin-top: 14px; }
.version { text-align: center; color: #9AA8B2; font-size: 11px; margin: 22px 0 6px; }

/* ---------- cards */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--sh);
  padding: 14px 16px; margin: 0 0 14px; }
.card.pad { padding: 16px; }
.card-title { font-family: var(--disp); font-size: 15px; font-weight: 700;
  margin: 0 0 10px; }
.card-note { background: #FFF9F0; border: 1px solid #F3DEC2; box-shadow: none;
  color: #6B4A12; font-size: 13.5px; }
.card.empty { text-align: center; padding: 30px 20px; }

/* ---------- flash */
.flash { border-radius: 12px; padding: 11px 14px; margin: 0 0 12px; font-size: 14px; }
.flash-ok { background: var(--ferie-t); color: #08633F; border: 1px solid #BFE5D4; }
.flash-err { background: var(--malattia-t); color: #8F1F1F; border: 1px solid #EFC1C1; }

/* ---------- buttons */
.btn { font-family: var(--disp); font-weight: 500; font-size: 16px;
  border: 0; border-radius: 12px; padding: 13px 18px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .06s ease, background .15s ease; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-d); }
.btn-ghost { background: #fff; color: var(--ink2); border: 1.5px solid var(--line); }
.btn-block { width: 100%; }
.btn-mini { font-size: 13px; padding: 7px 12px; background: var(--bg);
  color: var(--ink2); border-radius: 9px; }
.del { border: 0; background: none; color: #B6C2CA; font-size: 15px;
  padding: 6px 8px; cursor: pointer; } .del:hover { color: var(--malattia); }

/* ---------- CTA segna assenza */
.cta { display: flex; align-items: center; gap: 14px; background: var(--ink);
  color: #fff; border-radius: var(--r); padding: 16px; margin: 0 0 14px;
  box-shadow: var(--sh); }
.cta small { color: #A9BAC4; }
.cta-plus { width: 44px; height: 44px; border-radius: 12px; background: var(--brand);
  font: 700 26px/44px var(--disp); text-align: center; flex: none; }

/* ---------- stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { border-radius: 12px; padding: 10px 6px 8px; text-align: center; }
.stat b { font-family: var(--disp); font-weight: 700; font-size: 22px; display: block;
  font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; letter-spacing: .02em; }
.st-ferie { background: var(--ferie-t); color: var(--ferie); }
.st-permesso { background: var(--permesso-t); color: var(--permesso); }
.st-malattia { background: var(--malattia-t); color: var(--malattia); }
.st-altro { background: var(--altro-t); color: var(--altro); }

/* ---------- liste righe */
.rowlist { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 10px; padding: 9px 0;
  border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 0; }
.row-side { color: var(--mut); font-size: 12.5px; white-space: nowrap;
  font-variant-numeric: tabular-nums; }
.row-note { color: var(--mut); font-size: 12.5px; padding: 0 0 8px 2px;
  border-bottom: 1px solid var(--line); margin-top: -4px; }
.row form { margin: 0; }
.doc-ic { font-size: 20px; }
.pill { font-family: var(--disp); font-size: 11.5px; font-weight: 700;
  padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.pill-ferie { background: var(--ferie-t); color: var(--ferie); }
.pill-permesso { background: var(--permesso-t); color: var(--permesso); }
.pill-malattia { background: var(--malattia-t); color: var(--malattia); }
.pill-altro { background: var(--altro-t); color: var(--altro); }
.tag-est, .tag-off { font-style: normal; font-size: 11px; color: var(--mut);
  background: var(--bg); border-radius: 6px; padding: 2px 6px; }
.notice { display: block; margin-top: 10px; background: var(--brand-t);
  color: var(--brand-d); border-radius: 10px; padding: 10px 12px;
  font-weight: 600; font-size: 14px; }
.linkline { display: block; margin: 4px 2px 16px; font-weight: 600; font-size: 14px; }
.badge { background: var(--brand); color: #fff; border-radius: 999px;
  font-size: 11px; padding: 2px 7px; margin-left: 6px; }

/* ---------- form */
.form label { display: block; margin: 0 0 12px; font-weight: 600; font-size: 13.5px;
  color: var(--ink2); }
.form label small { font-weight: 400; color: var(--mut); }
.form input:not([type=checkbox]):not([type=radio]), .form select {
  width: 100%; margin-top: 5px; font: 16px var(--body); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 11px; padding: 12px;
  background: #fff; appearance: none; }
.form input:focus, .form select:focus { border-color: var(--brand); outline: none; }
.form .check { display: flex; gap: 9px; align-items: flex-start; font-weight: 500; }
.form .check input { width: 19px; height: 19px; margin-top: 1px; accent-color: var(--brand); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { color: var(--mut); font-size: 12.5px; margin: 6px 0 0; }
.lbl { font-weight: 600; font-size: 13.5px; color: var(--ink2); display: block;
  margin-bottom: 8px; }
.filepick { position: relative; display: block; border: 1.5px dashed #C3CDD4;
  border-radius: 12px; padding: 20px 14px; text-align: center; color: var(--mut);
  background: #FAFBFC; font-weight: 500; }
.filepick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.filepick.picked { border-color: var(--ferie); color: var(--ferie);
  background: var(--ferie-t); border-style: solid; }

/* ---------- tessere tipo assenza (firma del design) */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 14px; }
.tile { position: relative; display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 2px solid var(--line); border-radius: var(--r);
  padding: 15px 14px; cursor: pointer; box-shadow: var(--sh);
  transition: border-color .12s ease, background .12s ease; }
.tile input { position: absolute; opacity: 0; }
.tile-mark { width: 10px; height: 30px; border-radius: 6px; flex: none; }
.tile-name { font-family: var(--disp); font-weight: 700; font-size: 16px; }
.tile-ferie .tile-mark { background: var(--ferie); }
.tile-permesso .tile-mark { background: var(--permesso); }
.tile-malattia .tile-mark { background: var(--malattia); }
.tile-altro .tile-mark { background: var(--altro); }
.tile-ferie:has(input:checked) { border-color: var(--ferie); background: var(--ferie-t); }
.tile-permesso:has(input:checked) { border-color: var(--permesso); background: var(--permesso-t); }
.tile-malattia:has(input:checked) { border-color: var(--malattia); background: var(--malattia-t); }
.tile-altro:has(input:checked) { border-color: var(--altro); background: var(--altro-t); }
.tile:has(input:focus-visible) { outline: 3px solid var(--brand); outline-offset: 2px; }

/* ---------- segmenti e chips */
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg);
  border-radius: 11px; padding: 4px; gap: 4px; margin-bottom: 12px; }
.seg label { position: relative; margin: 0; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; text-align: center; padding: 9px 4px; border-radius: 8px;
  font-family: var(--disp); font-weight: 500; font-size: 14px; color: var(--mut); }
.seg input:checked + span { background: #fff; color: var(--ink);
  box-shadow: 0 1px 3px rgba(22,36,45,.12); }
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chips label { position: relative; margin: 0; }
.chips input { position: absolute; opacity: 0; }
.chips span { display: block; text-align: center; border: 1.5px solid var(--line);
  border-radius: 11px; padding: 10px 6px; font-family: var(--disp); font-weight: 500;
  font-size: 14px; }
.chips small { display: block; font: 11px var(--body); color: var(--mut); }
.chips input:checked + span { border-color: var(--permesso);
  background: var(--permesso-t); color: var(--permesso); }
.chips input:checked + span small { color: var(--permesso); }
.chips label.dis { opacity: .4; pointer-events: none; }

/* ---------- calendario */
.month-nav { display: flex; align-items: center; justify-content: space-between;
  margin: 2px 0 12px; }
.month-title { font-family: var(--disp); font-weight: 700; font-size: 22px; margin: 0; }
.month-title span { color: var(--mut); font-weight: 400; }
.mn-btn { width: 40px; height: 40px; border-radius: 12px; background: #fff;
  box-shadow: var(--sh); display: grid; place-items: center;
  font: 700 20px var(--disp); color: var(--ink2); }
.cal { padding: 10px; }
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center;
  font-family: var(--disp); font-size: 11px; color: var(--mut); letter-spacing: .06em;
  padding: 2px 0 6px; }
.cal-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px;
  margin-bottom: 3px; }
.cal-day { min-height: 52px; border-radius: 10px; padding: 4px 3px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--ink); background: #fff; }
.cal-day .n { font-family: var(--disp); font-size: 13px; font-weight: 500; }
.cal-day.off { background: #F5F7F8; color: #A6B2BB; }
.cal-day.dim { opacity: .35; }
.cal-day.today .n { background: var(--ink); color: #fff; border-radius: 8px;
  padding: 1px 6px; }
.cal-day.sel { outline: 2px solid var(--brand); }
.dots { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; }
.dot { width: 7px; height: 7px; border-radius: 999px; display: inline-block; }
.dot-ferie { background: var(--ferie); } .dot-permesso { background: var(--permesso); }
.dot-malattia { background: var(--malattia); } .dot-altro { background: var(--altro); }
.chip { font: 700 9px/1 var(--disp); color: #fff; border-radius: 6px;
  padding: 3px 4px; font-style: normal; }
.chip-ferie { background: var(--ferie); } .chip-permesso { background: var(--permesso); }
.chip-malattia { background: var(--malattia); } .chip-altro { background: var(--altro); }
.chip.est { box-shadow: inset 0 0 0 1.5px #fff, 0 0 0 1.5px currentColor; }
.chip.more { background: var(--bg); color: var(--mut); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px;
  color: var(--mut); margin: -4px 4px 14px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- selettori anno / persone */
.yearchips { display: flex; gap: 8px; overflow-x: auto; padding: 2px;
  margin: 0 0 12px; -webkit-overflow-scrolling: touch; }
.ychip { font-family: var(--disp); font-weight: 500; white-space: nowrap;
  background: #fff; border: 1.5px solid var(--line); color: var(--ink2);
  border-radius: 999px; padding: 8px 15px; font-size: 14px; }
.ychip.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- profilo / menu */
.profile { display: flex; align-items: center; gap: 13px; }
.avatar { width: 46px; height: 46px; border-radius: 14px; background: var(--ink);
  color: #fff; display: grid; place-items: center;
  font: 700 17px var(--disp); flex: none; }
.avatar.sm { width: 36px; height: 36px; font-size: 13px; border-radius: 11px; }
.menulist { list-style: none; margin: 0; padding: 0; }
.menulist a { display: flex; align-items: center; gap: 4px; padding: 13px 2px;
  color: var(--ink); font-weight: 600; border-bottom: 1px solid var(--line); }
.menulist li:last-child a { border-bottom: 0; }

/* ---------- login */
.auth-card { width: min(92vw, 380px); background: #fff; border-radius: 20px;
  padding: 30px 26px; box-shadow: 0 20px 60px rgba(0,0,0,.35); text-align: center; }
.auth-logo { margin-bottom: 8px; }
.auth-title { font-family: var(--disp); font-weight: 700; font-size: 30px;
  margin: 0; letter-spacing: -.01em; }
.auth-sub { color: var(--mut); margin: 2px 0 20px; }
.auth-card .form { text-align: left; }
.auth-note { font-size: 12.5px; color: var(--mut); margin-top: 16px; }
.auth .flash { width: min(92vw, 380px); position: fixed; top: 14px; left: 50%;
  transform: translateX(-50%); z-index: 30; }

/* ---------- tab bar */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 5px 2px 2px; color: #8795A1; font-family: var(--disp); font-size: 10.5px;
  font-weight: 500; letter-spacing: .02em; }
.tab svg { width: 23px; height: 23px; fill: currentColor; }
.tab svg .s { fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; }
.tab svg rect { fill: none; stroke: currentColor; stroke-width: 2; }
.tab svg path:not(.s) { fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linejoin: round; }
.tab.on { color: var(--ink); }
.tab-add { justify-content: center; }
.add-btn { width: 52px; height: 52px; border-radius: 17px; background: var(--brand);
  display: grid; place-items: center; margin-top: -22px;
  box-shadow: 0 6px 16px rgba(232,80,10,.4); }
.add-btn svg { width: 26px; height: 26px; }
.add-btn .s { stroke: #fff; stroke-width: 2.6; }

@media (min-width: 700px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .chips { grid-template-columns: repeat(4, 1fr); }
}
