/* Presenze Ufficio — Dr System Code */
:root {
  --bg: #f1f5f9; --card: #ffffff; --ink: #0f172a; --muted: #64748b; --line: #e2e8f0; --soft: #f8fafc;
  --brand: #1e3a8a; --brand2: #2563eb; --ok: #16a34a; --err: #dc2626; --warn: #f59e0b;
  --radius: 16px; --shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 16px rgba(15,23,42,.06);
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
/* Tema scuro: la classe "dark" su <html> la mette l'app (automatico, chiaro o scuro a scelta dell'operatore) */
html.dark {
  --bg: #0b1220; --card: #131c2e; --ink: #e6edf7; --muted: #94a3b8; --line: #23304a; --soft: #0f1829;
  --brand: #3b82f6; --brand2: #60a5fa; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  color-scheme: dark;
}
html:not(.dark) { color-scheme: light; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
body.noscroll { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .92em; background: var(--soft); padding: 1px 5px; border-radius: 6px; border: 1px solid var(--line); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.foot { text-align: center; color: var(--muted); font-size: 12px; margin: 16px 0 0; }
.hint { color: var(--muted); font-size: 13px; text-align: center; margin: 14px 0; }
.empty { color: var(--muted); font-size: 14px; margin: 6px 0; }
h1, h2, h3 { margin: 0 0 6px; letter-spacing: -.01em; }
h2 { font-size: 19px; } h3 { font-size: 16px; }

/* ---- Bottoni ---- */
.btn { border: 0; border-radius: 12px; padding: 11px 16px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; transition: transform .08s, filter .15s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.primary { background: var(--brand2); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--soft); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--brand2); }
.btn.danger { background: #fee2e2; color: #b91c1c; }
html.dark .btn.danger { background: #3b1219; color: #fca5a5; }
.btn.block { width: 100%; margin-top: 10px; }
.btn.sm { padding: 6px 11px; min-height: 34px; font-size: 13px; border-radius: 10px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); font-size: 20px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.icon-btn.sm { width: 32px; height: 32px; font-size: 12px; }
.icon-btn:disabled { opacity: .35; }
.link { background: none; border: 0; color: var(--brand2); font-weight: 600; cursor: pointer; padding: 0; font-size: 13px; }
.spin { width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: sp .7s linear infinite; }
.spin.big { width: 38px; height: 38px; color: var(--brand2); }
@keyframes sp { to { transform: rotate(360deg); } }
.loading { min-height: 50vh; display: grid; place-items: center; }

/* ---- Form ---- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 12px 0 0; }
input, select, textarea { width: 100%; margin-top: 5px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); min-height: 44px; outline: none; font-weight: 500; }
input:focus, select:focus { border-color: var(--brand2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand2) 20%, transparent); }
label.check { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 500; font-size: 14px; }
label.check input { width: 20px; height: 20px; min-height: 0; margin: 0; accent-color: var(--brand2); }
.pwd { display: flex; gap: 6px; align-items: center; }
.pwd input { flex: 1; }
.eye { margin-top: 5px; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--soft); cursor: pointer; flex: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.alert { border-radius: 12px; padding: 10px 12px; margin: 12px 0; font-size: 14px; }
.alert.err { background: #fee2e2; color: #991b1b; }
.alert.info { background: color-mix(in srgb, var(--brand2) 12%, var(--card)); color: var(--ink); line-height: 1.7; }
.alert.warn { background: color-mix(in srgb, var(--warn) 18%, var(--card)); font-weight: 600; text-align: center; }

/* ---- Login ---- */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px 16px; background: radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--brand2) 30%, transparent), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border-radius: 24px; padding: 28px 22px; box-shadow: var(--shadow); text-align: center; }
.auth-card form { text-align: left; }
.auth-logo { width: 76px; height: 76px; border-radius: 20px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 24px; margin-top: 10px; }

/* ---- Topbar ---- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: calc(10px + var(--safe-t)) 16px 10px; background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.brand img { width: 36px; height: 36px; border-radius: 10px; }
.brand b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11.5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(22,163,74,.6); animation: pulse 2s infinite; }
.dot.off { background: var(--warn); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.5); } 70% { box-shadow: 0 0 0 7px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }
.topnav { display: none; gap: 4px; }
.topnav button { border: 0; background: none; padding: 9px 14px; border-radius: 10px; font-weight: 600; color: var(--muted); cursor: pointer; }
.topnav button:hover { background: var(--soft); color: var(--ink); }
.topnav button.active { background: color-mix(in srgb, var(--brand2) 14%, transparent); color: var(--brand2); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.user-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 3px 12px 3px 3px; cursor: pointer; font-weight: 600; }
.user-chip .un { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av { width: 36px; height: 36px; border-radius: 50%; color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.av.lg { width: 52px; height: 52px; font-size: 18px; }
.av.sm { width: 24px; height: 24px; font-size: 10px; margin-right: 8px; vertical-align: middle; }
.demo-bar { background: #fef3c7; color: #92400e; text-align: center; font-size: 12px; font-weight: 700; padding: 5px; }

/* ---- Bottom nav (mobile) ---- */
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-b)); }
.bottomnav button { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 0; border-radius: 12px; cursor: pointer; color: var(--muted); }
.bottomnav button span { font-size: 21px; line-height: 1.1; filter: grayscale(.6); opacity: .8; }
.bottomnav button small { font-size: 11px; font-weight: 600; }
.bottomnav button.active { color: var(--brand2); }
.bottomnav button.active span { filter: none; opacity: 1; transform: translateY(-1px); }

/* ---- Vista ---- */
.view { max-width: 1100px; margin: 0 auto; padding: 14px 16px calc(96px + var(--safe-b)); }
.panel { background: var(--card); border-radius: var(--radius); padding: 18px 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.daynav { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.daytitle { flex: 1; text-align: center; position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.daytitle b { font-size: 16.5px; text-transform: capitalize; }
.daytitle input[type=date] { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; min-height: 0; height: 100%; }
.daytitle .link, .daytitle .tag { position: relative; z-index: 2; }
.tag { background: color-mix(in srgb, var(--brand2) 14%, transparent); color: var(--brand2); font-size: 11.5px; font-weight: 700; padding: 1px 9px; border-radius: 999px; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 12px 8px; text-align: center; box-shadow: var(--shadow); border-top: 4px solid var(--g); }
.stat b { display: block; font-size: 30px; line-height: 1.1; color: var(--g); font-weight: 800; }
.stat span { font-size: 12.5px; color: var(--muted); font-weight: 600; }

/* il mio stato */
.mine { background: linear-gradient(135deg, var(--brand), var(--brand2)); color: #fff; border-radius: var(--radius); padding: 14px; margin-bottom: 14px; box-shadow: var(--shadow); }
.mine-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; }
.mine .muted { color: rgba(255,255,255,.85); font-size: 13px; font-weight: 600; }
.quick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.qbtn { border: 0; border-radius: 12px; background: rgba(255,255,255,.14); color: #fff; padding: 8px 2px; font-size: 11.5px; font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; min-height: 58px; }
.qbtn span { font-size: 20px; }
.qbtn.on { background: #fff; color: var(--g); box-shadow: 0 2px 8px rgba(0,0,0,.2); }

/* gruppi */
.groups { display: grid; gap: 12px; }
.group { background: var(--card); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); border-left: 5px solid var(--g); }
.group h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; margin: 2px 4px 8px; }
.group .gi { font-size: 18px; }
.group .count { margin-left: auto; background: var(--g); color: #fff; border-radius: 999px; min-width: 26px; padding: 0 8px; height: 24px; display: inline-grid; place-items: center; font-size: 13px; }
.person { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 6px; border: 0; background: none; text-align: left; border-radius: 12px; cursor: pointer; }
.person:hover:not(:disabled) { background: var(--soft); }
.person:disabled { cursor: default; opacity: 1; }
.pinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pinfo b { font-size: 15px; }
.pinfo small { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.chip { background: color-mix(in srgb, var(--g) 14%, transparent); color: var(--g); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
html.dark .chip { background: color-mix(in srgb, var(--g) 24%, transparent); filter: brightness(1.25); }
.chip.nd { --g: #94a3b8; }

/* sheet modale */
#modal { position: fixed; inset: 0; z-index: 50; display: none; }
#modal.open { display: block; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(2,6,23,.5); animation: fade .2s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh; overflow: auto; background: var(--card); border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + var(--safe-b)); animation: up .22s ease-out; }
.sheet::before { content: ''; display: block; width: 42px; height: 5px; border-radius: 9px; background: var(--line); margin: -6px auto 12px; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }
.sheet-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.sheet-actions .btn { flex: 1; min-width: 100px; }
.user-head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.user-head .muted { font-size: 13px; text-transform: none; }
.menu-list { display: grid; gap: 4px; }
.help { padding-left: 20px; line-height: 1.6; }
.help li { margin-bottom: 6px; }
.stati-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.sbtn { border: 2px solid var(--line); background: var(--soft); border-radius: 14px; padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12.5px; font-weight: 700; cursor: pointer; color: var(--ink); margin: 0; text-align: center; }
.sbtn span { font-size: 22px; }
.sbtn.on, .sbtn.radio:has(input:checked) { border-color: var(--g); background: color-mix(in srgb, var(--g) 14%, var(--card)); color: var(--g); }
.sbtn.radio input { position: absolute; opacity: 0; width: 0; height: 0; min-height: 0; }
.preview { font-size: 13px; margin-top: 10px; }

/* calendario */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i, .cal i { font-style: normal; color: #fff; font-weight: 800; font-size: 10.5px; border-radius: 6px; min-width: 22px; height: 22px; display: inline-grid; place-items: center; padding: 0 3px; }
.cal-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); -webkit-overflow-scrolling: touch; }
.cal { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.cal th, .cal td { border-bottom: 1px solid var(--line); text-align: center; padding: 5px 2px; min-width: 32px; }
.cal thead th { font-weight: 700; color: var(--muted); }
.cal thead th small { display: block; font-size: 10px; font-weight: 600; }
.cal .sticky { position: sticky; left: 0; background: var(--card); z-index: 2; text-align: left; padding: 6px 10px; white-space: nowrap; min-width: 130px; font-weight: 700; color: var(--ink); border-right: 1px solid var(--line); }
.cal .off { background: var(--soft); }
.cal th.today { color: #fff; background: var(--brand2); border-radius: 8px 8px 0 0; }
.cal td.today { background: color-mix(in srgb, var(--brand2) 9%, transparent); }
.cal td { cursor: pointer; }
.cal i.pres { opacity: .3; }

/* report */
.rep-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.rep-actions { display: flex; gap: 6px; }
.mnav { display: flex; gap: 6px; align-items: center; }
.mnav input { margin-top: 5px; }
.mnav .icon-btn { margin-top: 5px; height: 44px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.kpi { background: var(--soft); border: 1px solid var(--line); border-radius: 14px; padding: 12px; border-top: 4px solid var(--g, var(--brand2)); }
.kpi span { display: block; font-size: 12px; color: var(--muted); font-weight: 700; }
.kpi b { font-size: 28px; color: var(--g, var(--brand2)); font-weight: 800; }
.kpi small { display: block; font-size: 11px; color: var(--muted); }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 130px 1fr 30px; align-items: center; gap: 10px; font-size: 13.5px; }
.bt { height: 12px; background: var(--soft); border-radius: 9px; overflow: hidden; border: 1px solid var(--line); }
.bt i { display: block; height: 100%; border-radius: 9px; }
.bar b { text-align: right; }
.sub { margin-top: 18px; }
.daylist { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.dl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 7px 10px; border: 1px solid var(--line); border-radius: 12px; }
.dl.off { background: var(--soft); }
.dl .dd { font-weight: 700; width: 46px; }
.dl small { width: 100%; font-size: 12px; color: var(--muted); padding-left: 54px; }
.table-wrap { overflow-x: auto; margin-top: 14px; }
.rep { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rep th, .rep td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
.rep tbody th { text-align: left; }
.rep tbody tr { cursor: pointer; }
.rep tbody tr:hover { background: var(--soft); }
.rep .colh { color: var(--g); font-size: 12px; }
.print-only { display: none; }

/* admin */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; scrollbar-width: none; }
.tabs button { flex: none; border: 1px solid var(--line); background: var(--card); padding: 9px 14px; border-radius: 999px; font-weight: 700; font-size: 13.5px; cursor: pointer; color: var(--muted); }
.tabs button.on { background: var(--brand2); color: #fff; border-color: var(--brand2); }
.clist { display: grid; gap: 8px; margin-top: 12px; }
.crow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.crow input { flex: 1; min-width: 130px; margin: 0; }
.crow > span:not(.av) { flex: 1; }
.crow.inactive { opacity: .55; }
.cbtns { display: flex; gap: 6px; align-items: center; }
.addrow { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.addrow input { flex: 1; min-width: 140px; margin: 0; }
.grid-form { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
.grid-form .btn { margin-top: 16px; }
.acc-list { display: grid; gap: 10px; margin-top: 12px; }
.acc { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; padding: 12px; border: 1px solid var(--line); border-radius: 14px; }
.acc.inactive { opacity: .6; }
.acc-i { flex: 1; min-width: 200px; }
.acc-i .muted { font-size: 13px; margin-top: 3px; }
.acc-b { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; width: 100%; }
.role { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); }
.r-admin { background: #ede9fe; color: #6d28d9; border-color: #ddd6fe; }
.r-capo { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.r-operatore { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.r-off { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.log { margin-top: 12px; display: grid; }
.li { display: flex; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); font-size: 14px; }
.li small { display: block; margin-top: 2px; }
.lt { font-size: 18px; width: 26px; flex: none; text-align: center; }

/* toast */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + var(--safe-b)); z-index: 60; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: #0f172a; color: #fff; padding: 12px 16px; border-radius: 14px; font-weight: 600; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: up .2s; transition: opacity .4s, transform .4s; }
.toast.err { background: #b91c1c; } .toast.info { background: var(--brand2); }
.toast.out { opacity: 0; transform: translateY(10px); }
.center-box { max-width: 420px; margin: 20vh auto; text-align: center; padding: 20px; }

/* ---- Telefono stretto ---- */
@media (max-width: 380px) {
  .quick { grid-template-columns: repeat(3, 1fr); }
  .stati-grid { grid-template-columns: repeat(2, 1fr); }
  .user-chip .un { display: none; }
  .user-chip { padding: 3px; }
  .bar { grid-template-columns: 105px 1fr 26px; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .kpi { padding: 10px 8px; } .kpi b { font-size: 24px; } .kpi small { display: none; }
  .user-chip .un { max-width: 70px; }
}

/* ---- PC / tablet ---- */
@media (min-width: 900px) {
  .topnav { display: flex; }
  .bottomnav { display: none; }
  .view { padding: 22px 24px 40px; }
  #toasts { bottom: 24px; }
  .groups { grid-template-columns: repeat(3, 1fr); align-items: start; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .stat b { font-size: 36px; }
  .quick { grid-template-columns: repeat(5, 1fr); max-width: 640px; }
  .mine { display: flex; align-items: center; gap: 20px; }
  .mine-head { flex-direction: column; align-items: flex-start; margin: 0; min-width: 170px; }
  .quick { flex: 1; }
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: 520px; border-radius: 22px; animation: fade .2s; }
  .sheet::before { display: none; }
  .grid-form { grid-template-columns: 1fr 1fr 1fr; align-items: end; }
  .acc-b { width: auto; }
  .panel { padding: 22px; }
  .daytitle b { font-size: 19px; }
}

/* ---- Stampa (report) ---- */
@media print {
  .topbar, .bottomnav, .demo-bar, .no-print, #toasts, .hint { display: none !important; }
  .print-only { display: block; }
  body, .view, .panel { background: #fff !important; color: #000; box-shadow: none; padding: 0; }
  .view { max-width: none; }
  .chip, .bt i, .kpi { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---- v1.1: voci Excel, da confermare, import ---- */
.q { color: #b45309; font-weight: 800; font-size: .9em; }
.cal i.qc { outline: 2px dashed #b45309; outline-offset: 1px; }
.cogn { color: var(--muted); font-weight: 500; font-size: .88em; }
.stats.s4 { grid-template-columns: repeat(4, 1fr); }
.stats.s4 .stat b { font-size: 26px; }
.stats.s4 .stat span { font-size: 11.5px; }
.kpis.k4 { grid-template-columns: repeat(4, 1fr); }
.rep .tot { background: var(--soft); }
.filebox { display: block; margin-top: 12px; border: 2px dashed var(--line); border-radius: 14px; padding: 18px; text-align: center; cursor: pointer; color: var(--ink); font-size: 15px; }
.filebox:hover { border-color: var(--brand2); }
.filebox input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.map { display: grid; gap: 8px; margin-top: 8px; }
.maprow { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; }
.maprow select { grid-column: 1 / -1; margin-top: 4px; }
.crow input[data-cogn] { color: var(--muted); }
@media (min-width: 700px) { .maprow { grid-template-columns: 160px 80px 1fr; } .maprow select { grid-column: auto; margin: 0; } }
@media (max-width: 560px) {
  .kpis.k4 { grid-template-columns: 1fr 1fr; }
  .stats.s4 { gap: 6px; }
  .stats.s4 .stat { padding: 10px 4px; }
}

/* Dentro l'Area riservata drsystemcode.it */
html.embed .topbar { padding-top: 10px; }
html.embed .auth-wrap { min-height: 100%; padding-top: 30px; }

/* ---- Colori e tema personali ---- */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 8px; margin-top: 8px; }
.sw { width: 100%; aspect-ratio: 1; border-radius: 12px; border: 3px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); padding: 0; }
.sw.on { border-color: var(--ink); }
.sw.custom { display: grid; place-items: center; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); position: relative; overflow: hidden; }
.sw.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; margin: 0; min-height: 0; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.seg button { border: 2px solid var(--line); background: var(--soft); border-radius: 12px; padding: 10px 4px; font-weight: 700; cursor: pointer; color: var(--ink); }
.seg button.on { border-color: var(--brand2); color: var(--brand2); background: color-mix(in srgb, var(--brand2) 10%, var(--card)); }
.stcol { display: grid; gap: 8px; margin-top: 8px; }
.stcol label { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--ink); font-weight: 600; font-size: 14px; }
.stcol input[type=color] { width: 44px; height: 34px; padding: 2px; margin: 0; min-height: 0; border-radius: 8px; flex: none; }
.stcol span { flex: 1; }
.sheet h4 { margin: 18px 0 2px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
html.dark .sw { box-shadow: inset 0 0 0 1px rgba(255,255,255,.28); }

/* ---- Congedi da confermare ---- */
.pend { background: var(--card); border: 2px solid #f59e0b; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; box-shadow: var(--shadow); }
.pend-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pend p { margin: 4px 0 8px; font-size: 13px; }
.pend-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); }
.pend-row .pd { font-weight: 700; min-width: 92px; }
.pend-row .pb { margin-left: auto; display: flex; gap: 6px; }
.conf-lock { margin-top: 12px; font-size: 13.5px; background: color-mix(in srgb, #f59e0b 14%, var(--card)); border-radius: 12px; padding: 10px 12px; color: var(--ink); }
.stats.s5 .stat b { font-size: 22px; }
.stats.s5 .stat span { font-size: 10.5px; line-height: 1.2; display: block; }
@media (max-width: 560px) { .stats.s5 { gap: 4px; } .stats.s5 .stat { padding: 8px 2px; } }

/* ---- Tasto Oggi, Cerca collega ---- */
.toolrow { display: flex; gap: 8px; justify-content: center; margin: -4px 0 12px; flex-wrap: wrap; }
.toolrow .btn { min-width: 120px; }
.qmain { border-left: 5px solid var(--g); background: var(--soft); border-radius: 14px; padding: 12px; margin-top: 12px; display: grid; gap: 6px; }
.qhead { display: flex; gap: 10px; align-items: center; }
.qstato { font-size: 18px; font-weight: 800; color: var(--g); }
.qweek { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.qday { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 6px 2px; display: grid; justify-items: center; gap: 2px; cursor: pointer; color: var(--ink); }
.qday small { font-size: 10px; color: var(--muted); } .qday b { font-size: 14px; }
.qday.on { border: 2px solid var(--brand2); } .qday.off { background: var(--soft); }
.qday i { font-style: normal; color: #fff; font-weight: 800; font-size: 9.5px; border-radius: 6px; min-width: 22px; height: 18px; display: inline-grid; place-items: center; padding: 0 2px; }
.qday i.pres { opacity: .35; } .qday i.vuoto { color: var(--muted); background: none; }
@media (max-width: 420px) { .toolrow .btn { min-width: 0; flex: 1; padding: 6px 6px; font-size: 12.5px; } }

/* ---- Etichette ---- */
.vnew { display: grid; grid-template-columns: 70px 1fr; gap: 0 10px; align-items: end; }
.vnew .vt { grid-column: 1 / -1; }
.vnew input[type=color] { height: 44px; padding: 3px; }
.vnew .btn { grid-column: 1 / -1; margin-top: 14px; }
.vlist { display: grid; gap: 8px; margin-top: 10px; }
.vrow { display: grid; grid-template-columns: 52px 1fr 48px auto; gap: 8px; align-items: center; }
.vrow input { margin: 0; }
.vrow .vic { text-align: center; font-size: 18px; padding: 8px 4px; }
.vrow input[type=color] { height: 44px; padding: 3px; }
.vrow .vtipo { grid-column: 2 / -1; margin-top: -4px; font-size: 11.5px; }
.vrow.inactive { opacity: .55; }
@media (min-width: 900px) {
  .vnew { grid-template-columns: 80px 1fr 80px 1.2fr auto; }
  .vnew .vt { grid-column: auto; } .vnew .btn { grid-column: auto; margin-top: 0; }
  .vrow { grid-template-columns: 60px 1fr 60px 260px auto; } .vrow .vtipo { grid-column: auto; margin: 0; }
}
.vrow > .btn { grid-row: 1; grid-column: 4; }

/* ---- Zona / localita' ---- */
.pinfo small.zona, .zrow .zona { color: var(--brand2); font-weight: 700; }
.qzona { font-size: 17px; font-weight: 800; color: var(--ink); }
.seg.seg2 { grid-template-columns: 1fr 1fr; margin-bottom: 4px; }
.zlist { display: grid; gap: 6px; margin-top: 6px; }
.zrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border: 1px solid var(--line); background: var(--card); border-radius: 12px; padding: 8px 10px; cursor: pointer; text-align: left; color: var(--ink); }
.zrow .pd { font-weight: 700; min-width: 92px; } .zrow .av.sm { margin: 0; }
.zrow .zona { width: 100%; padding-left: 100px; }
@media (max-width: 480px) { .zrow .zona { padding-left: 0; } }
textarea { width: 100%; margin-top: 5px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); font: inherit; }
.cal th.fest small { font-size: 11px; }
.festlist { margin-top: 12px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; display: grid; gap: 4px; font-size: 14px; border-left: 5px solid #f59e0b; }
