/* ============================================================
   Design system "Presenze" — derivato dal mockup GD Presenze.
   Palette: navy #0C1C2B, accento ciano #00A3E0, superfici chiare.
   Font: Archivo (titoli/numeri) + Public Sans (testo).
   ============================================================ */
:root {
    --bg: #F1F4F7;
    --surface: #FFFFFF;
    --ink: #0C1C2B;
    --text-2: #4A5A68;
    --muted: #67788A;
    --muted-2: #8798A6;
    --muted-3: #93A2AF;
    --line: #E2E8EE;
    --line-soft: #EBEFF4;
    --thead: #F7F9FB;

    --primary: #00A3E0;
    --primary-dark: #0079A8;
    --primary-soft: #E4F4FB;
    --primary-light: #7FD3F2;

    --sidebar: #0C1C2B;
    --sidebar-fg: #A7B8C6;
    --sidebar-fg-strong: #E6EDF3;
    --sidebar-muted: #7F94A6;
    --sidebar-label: #5F7385;
    --sidebar-line: #1C3348;
    --sidebar-hover: #16324A;

    --warn: #DC7C3F;
    --warn-bg: #FDF3E4;
    --warn-fg: #9A6212;
    --danger: #B4322F;
    --danger-bg: #FDECEC;
    --slate-bg: #EEF2F7;
    --slate-fg: #3C5A78;
    --violet-bg: #F3EEF7;
    --violet-fg: #5C4477;
    --ok: #16A34A;

    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(12,28,43,.04);
}

/* Reset minimo: prima lo faceva Bootstrap, caricato intero (230 KB) per due classi e in conflitto con .card e .btn */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Public Sans', 'Segoe UI', system-ui, -apple-system, Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

h1, h2, h3, h4 { font-family: Archivo, 'Public Sans', sans-serif; font-weight: 600; color: var(--ink); margin-top: 0; margin-bottom: .5rem; line-height: 1.2; }
p { margin-top: 0; margin-bottom: 1rem; }
button, input, select, textarea { font: inherit; color: inherit; margin: 0; }
button { cursor: pointer; }
img, svg { vertical-align: middle; }
table { border-collapse: collapse; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .875em; }
.visually-hidden {
    position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important;
    margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Shell: sidebar + area principale ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 252px; flex: 0 0 252px;
    background: var(--sidebar); color: var(--sidebar-fg-strong);
    display: flex; flex-direction: column; padding: 22px 16px;
    position: sticky; top: 0; height: 100vh;
}
.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 24px; }
.sidebar__logo { height: 30px; width: auto; display: block; border-radius: 6px; }
.sidebar__sep { width: 1px; height: 26px; background: var(--sidebar-line); }
.sidebar__names { display: flex; flex-direction: column; line-height: 1.2; }
.sidebar__product { font-family: Archivo, sans-serif; font-weight: 600; font-size: 15px; letter-spacing: .01em; }
.sidebar__company { font-size: 10.5px; color: var(--sidebar-muted); letter-spacing: .06em; text-transform: uppercase; }

.sidebar__nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.sidebar__group {
    font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
    color: var(--sidebar-label); padding: 18px 14px 8px;
}
.sidebar__group:first-child { padding-top: 6px; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    text-decoration: none; font-size: 14px; padding: 9px 14px;
    border-radius: var(--radius-sm); color: var(--sidebar-fg); font-weight: 400;
    transition: background .12s ease, color .12s ease;
}
.nav-item .icona { color: var(--sidebar-muted); transition: color .12s ease; }
.nav-item:hover { background: var(--sidebar-hover); color: #FFFFFF; }
.nav-item.active { background: var(--sidebar-hover); color: #FFFFFF; font-weight: 600; box-shadow: inset 3px 0 0 var(--primary); }
.nav-item:hover .icona, .nav-item.active .icona { color: var(--primary-light); }
.nav-item__badge { font-size: 11px; font-variant-numeric: tabular-nums; color: #6C808F; }
.nav-item.active .nav-item__badge { color: var(--primary-light); }

.sidebar__foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; padding-top: 16px; }
.shift-card { border: 1px solid var(--sidebar-line); border-radius: 12px; padding: 14px; }
.shift-card__label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--sidebar-muted); margin-bottom: 8px; }
.shift-card__time { font-family: Archivo, sans-serif; font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; color: #FFFFFF; }
.shift-card__sub { font-size: 12px; color: var(--sidebar-muted); margin-top: 4px; }

.sidebar__user { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.sidebar__profilo {
    flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
    padding: 6px; border-radius: var(--radius-sm); color: inherit;
}
.sidebar__profilo:hover, .sidebar__profilo.active { background: var(--sidebar-hover); color: inherit; }
.sidebar__chi { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sidebar__chi > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
    width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%;
    background: var(--sidebar-line); color: #B7C6D2;
    display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
}
.sidebar__user-name { font-size: 13px; font-weight: 600; color: var(--sidebar-fg-strong); }
.sidebar__user-role { font-size: 11px; color: var(--sidebar-muted); }
.sidebar__logout {
    border: 1px solid var(--sidebar-line); background: transparent; color: var(--sidebar-fg);
    width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center;
    border-radius: var(--radius-sm); cursor: pointer;
}
.sidebar__logout:hover { background: var(--sidebar-hover); color: #fff; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ---------- Barra in basso (solo telefono) e foglio "Altro" ---------- */
.tabbar { display: none; }

.altro { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.altro__voce {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    min-height: 92px; padding: 12px 6px; border-radius: 16px; text-align: center;
    background: var(--bg); color: var(--ink); font-size: 12.5px; font-weight: 600; line-height: 1.2;
}
.altro__voce:hover { color: var(--ink); background: var(--primary-soft); }
.altro__voce.active { background: var(--primary-soft); color: var(--primary-dark); }
.altro__icona {
    width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center;
    background: var(--surface); color: var(--primary-dark); box-shadow: 0 1px 2px rgba(12,28,43,.08);
}
.altro__esci { width: 100%; margin-top: 16px; display: flex; align-items: center; justify-content: center; gap: 8px; }

/* ---------- Page header (sticky) ---------- */
.pagehead {
    position: sticky; top: 0; z-index: 5;
    background: var(--surface); border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between;
    gap: 24px; padding: 13px 28px; min-height: 70px;
}
.pagehead__title { margin: 0; font-size: 19px; letter-spacing: -.01em; }
.pagehead__sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.pagehead__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.pagehead__testo { min-width: 0; }

.content { flex: 1; padding: 26px 28px 40px; }
.stack { display: flex; flex-direction: column; gap: 20px; }

/* ---------- Card / sezioni ---------- */
.card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
}
.card--flush { padding: 0; overflow: hidden; }
.card--dark { background: var(--ink); border-color: var(--ink); color: var(--sidebar-fg-strong); }
.card--dark h2, .card--dark h3 { color: #fff; }
.card--dark .card__sub { color: var(--sidebar-muted); }
.card__title { margin: 0 0 4px; font-size: 15px; }
.card__sub { margin: 0 0 14px; font-size: 12.5px; color: var(--muted); }
.card__head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft);
}
.card__foot { padding: 13px 20px; border-top: 1px solid var(--line-soft); background: var(--thead); font-size: 12.5px; color: var(--muted); }
.card__body { padding: 18px 20px; }

.grid-kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-main { display: grid; grid-template-columns: 1.65fr 1fr; gap: 20px; align-items: start; }
.grid-side { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- KPI ---------- */
.kpi__label { font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.card--dark .kpi__label { color: var(--sidebar-muted); }
.kpi__value { font-family: Archivo, sans-serif; font-size: 34px; font-weight: 600; margin-top: 8px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.card--dark .kpi__value { color: #fff; }
.kpi__value small { font-size: 17px; color: var(--muted-3); font-weight: 500; }
.card--dark .kpi__value small { color: var(--sidebar-muted); }
.kpi__hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.kpi__hint--accent { color: var(--primary); }
.card--dark .kpi__hint { color: var(--primary-light); }

/* ---------- Tabelle ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table thead th {
    text-align: left; font-weight: 400; padding: 11px 20px;
    font-size: 11px; letter-spacing: .07em; text-transform: uppercase;
    color: var(--muted-2); background: var(--thead); white-space: nowrap;
}
.table tbody td { padding: 13px 20px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:hover { background: var(--thead); }
.table tbody tr.is-muted td { color: var(--muted-3); }
.table tbody tr.annullata td { opacity: .55; text-decoration: line-through; }
.table tfoot td { padding: 14px 20px; border-top: 2px solid var(--ink); background: var(--thead); font-weight: 600; }
.table .num { font-variant-numeric: tabular-nums; }
.table__empty { padding: 22px 20px; color: var(--muted); font-size: 13px; }

.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person__ini {
    width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary-dark);
    font-size: 11px; font-weight: 600; display: flex; align-items: center; justify-content: center;
}
.person__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person__meta { font-size: 11.5px; color: var(--muted-2); }

/* ---------- Pill / badge ---------- */
.pill {
    display: inline-block; font-size: 12px; font-weight: 600;
    padding: 4px 10px; border-radius: 100px; white-space: nowrap;
}
.pill--accent { background: var(--primary-soft); color: var(--primary-dark); }
.pill--neutral { background: #F0F3F6; color: var(--text-2); }
.pill--warn { background: var(--warn-bg); color: var(--warn-fg); }
.pill--danger { background: var(--danger-bg); color: var(--danger); }
.pill--slate { background: var(--slate-bg); color: var(--slate-fg); }
.pill--violet { background: var(--violet-bg); color: var(--violet-fg); }
.pill--ok { background: var(--primary-soft); color: var(--primary-dark); }
.pill--off { background: #F0F3F6; color: var(--muted); }

/* ---------- Bottoni ---------- */
.btn {
    border: 0; background: var(--primary); color: #fff;
    font-family: inherit; font-size: 13.5px; font-weight: 600;
    padding: 10px 16px; border-radius: var(--radius-sm); cursor: pointer;
    transition: background .12s ease;
}
.btn:hover:not(:disabled) { background: var(--primary-dark); }
.btn:disabled { opacity: .55; cursor: default; }
.btn--ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); font-weight: 500; }
.btn--ghost:hover:not(:disabled) { background: var(--bg); }
.btn--danger { background: var(--surface); color: var(--text-2); border: 1px solid var(--line); font-weight: 500; }
.btn--danger:hover:not(:disabled) { border-color: #DC7C7C; color: var(--danger); background: var(--surface); }
.btn--sm { font-size: 12.5px; padding: 8px 12px; border-radius: 8px; }
.btn--dashed { background: transparent; border: 1px dashed #C5D0DA; color: var(--text-2); font-weight: 500; }
.btn--dashed:hover:not(:disabled) { border-color: var(--primary); color: var(--primary-dark); background: transparent; }

/* ---------- Form / filtri ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field > label { font-size: 12px; font-weight: 500; color: var(--muted); }
.input, .select {
    font-family: inherit; font-size: 13.5px; color: var(--ink);
    padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
.input:focus, .select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,163,224,.15); }
.input::placeholder { color: var(--muted-3); }

.chip {
    border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-sm);
    padding: 9px 14px; font-size: 13px; display: flex; gap: 8px; align-items: center;
}
.chip__label { color: var(--muted-2); }
.chip__value { font-weight: 600; }

.msg-ok { color: var(--primary-dark); font-size: 13px; }
.msg-err { color: var(--danger); font-size: 13px; }

/* ---------- Policy: righe timbratura + dispositivi ---------- */
.policy-row { padding: 16px 0; border-bottom: 1px solid var(--line-soft); }
.policy-row:last-child { border-bottom: 0; }
.policy-row--inline { display: flex; align-items: center; gap: 12px; }
.policy-row__head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.policy-row__head > div:nth-child(2) { flex: 1 1 auto; min-width: 0; }
.policy-row__icon {
    flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px;
    background: var(--primary-soft); color: var(--primary-dark);
    display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px;
}
.policy-row__title { font-weight: 600; }
.policy-row__sub { color: var(--muted); font-size: 12.5px; }

.policy-devices { background: var(--ink); border-color: var(--ink); color: var(--sidebar-fg-strong); }
.policy-devices .card__title, .policy-devices h2, .policy-devices h3 { color: #fff; }
.policy-devices .card__sub { color: var(--sidebar-muted); }
.device {
    display: flex; align-items: center; gap: .6rem; padding: .7rem .9rem; margin-bottom: .6rem;
    border: 1px solid var(--sidebar-line); border-radius: 12px; cursor: pointer;
}
.device--on { border-color: var(--primary); background: #0A2540; }
.device__name { font-weight: 600; }

/* ---------- Switch ---------- */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: 0 0 44px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__slider { position: absolute; inset: 0; cursor: pointer; background: #CBD5E1; border-radius: 100px; transition: background .15s; }
.switch__slider::before {
    content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
    background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.switch input:checked + .switch__slider { background: var(--primary); }
.switch input:checked + .switch__slider::before { transform: translateX(20px); }

/* ---------- Lista anomalie / richieste ---------- */
.alert-row {
    display: flex; gap: 12px; align-items: flex-start;
    border: 1px solid var(--line-soft); border-radius: 11px; padding: 12px 14px;
}
.alert-row__dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: 0 0 8px; background: var(--warn); }
.alert-row__dot--danger { background: var(--danger); }
.alert-row__dot--warn { background: #C9A227; }
.alert-row__title { font-size: 13.5px; font-weight: 600; }
.alert-row__detail { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.req-card { display: flex; gap: 18px; align-items: center; }
.req-card__ini {
    width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary-dark);
    font-size: 12.5px; font-weight: 600; display: flex; align-items: center; justify-content: center;
}
.req-card__name { font-family: Archivo, sans-serif; font-size: 15px; font-weight: 600; }
.req-card__periodo { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.req-card__nota { font-size: 12.5px; color: var(--muted-2); margin-top: 2px; }

/* ---------- Barre / grafici ---------- */
.bars { display: flex; align-items: flex-end; gap: 14px; height: 132px; }
.bars__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; justify-content: flex-end; height: 100%; }
.bars__stack { width: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.bars__extra { width: 100%; border-radius: 4px 4px 0 0; background: var(--ink); }
.bars__base { width: 100%; border-radius: 0 0 4px 4px; background: var(--primary); }
.bars__label { font-size: 11.5px; color: var(--muted-2); }
.legend { display: flex; gap: 16px; margin-top: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: block; }

.meter { height: 6px; border-radius: 100px; background: var(--line-soft); overflow: hidden; }
.meter__fill { height: 100%; border-radius: 100px; background: var(--primary); }
.hbar { display: flex; height: 12px; border-radius: 100px; overflow: hidden; background: var(--line-soft); }
.hbar__base { background: var(--primary); }
.hbar__extra { background: var(--ink); }

.kv { display: flex; flex-direction: column; gap: 11px; font-size: 13.5px; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; }
.kv span:first-child { color: var(--text-2); }
.kv span:last-child { font-weight: 600; }

/* ---------- Mappa (placeholder) ---------- */
.mapbox {
    height: 420px;
    background: repeating-linear-gradient(135deg, #F1F4F7, #F1F4F7 10px, #E8EDF2 10px, #E8EDF2 20px);
    display: flex; align-items: center; justify-content: center;
}
.mapbox__note {
    background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
    padding: 12px 16px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px; color: var(--muted); text-align: center; line-height: 1.6;
}

/* ---------- Telefono (App dipendente) ---------- */
.phone { width: 340px; border-radius: 34px; background: var(--ink); padding: 12px; box-shadow: 0 24px 60px rgba(12,28,43,.18); }
.phone__screen { border-radius: 24px; background: #F6F8F7; overflow: hidden; display: flex; flex-direction: column; min-height: 620px; }
.phone__top { background: var(--ink); color: var(--sidebar-fg-strong); padding: 18px 20px 22px; }
.phone__status { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--sidebar-muted); margin-bottom: 18px; }
.phone__body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 24px; }
.phone__foot { background: var(--surface); border-top: 1px solid var(--line); padding: 16px 20px; }

/* ---------- QR sede ---------- */
.qr-box { margin-top: 16px; padding: 16px; border: 1px dashed #C5D0DA; border-radius: 12px; text-align: center; }
.qr-box img { margin-top: 8px; image-rendering: pixelated; }
.qr-box code { background: var(--bg); padding: .1rem .4rem; border-radius: 6px; }

/* ---------- Login: split-screen (mockup GD Presenze Login) ---------- */
.auth-checking { padding: 2rem; color: var(--muted); }

.loginpage {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    background: var(--bg);
}

.loginpage__side {
    background: var(--ink);
    color: var(--sidebar-fg-strong);
    padding: 44px 52px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 32px;
    min-width: 420px;
}
.loginpage__logo { height: 34px; width: auto; display: block; align-self: flex-start; object-fit: contain; border-radius: 6px; }

.loginpage__pitch { max-width: 460px; display: flex; flex-direction: column; gap: 26px; }
.loginpage__kicker {
    font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--sidebar-muted);
}
.loginpage__headline {
    margin: 12px 0 0; font-family: Archivo, sans-serif; font-size: 40px; line-height: 1.12;
    font-weight: 600; letter-spacing: -.02em; color: #FFFFFF; text-wrap: pretty;
}
.loginpage__punti { display: flex; flex-direction: column; gap: 12px; }
.loginpage__punto { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.5; color: var(--sidebar-fg); }
.loginpage__dot { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--primary); margin-top: 7px; }
.loginpage__foot { font-size: 12px; color: var(--sidebar-label); }

.loginpage__main { display: flex; align-items: center; justify-content: center; padding: 44px 40px; }
.loginpage__col { width: 100%; max-width: 392px; display: flex; flex-direction: column; gap: 16px; }

/* Card "Installa l'app" */
.install-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: 16px; padding: 20px 22px;
}
.install-card__title { font-family: Archivo, sans-serif; font-size: 14.5px; font-weight: 600; color: var(--ink); margin-bottom: 14px; }
.install-card__rows { display: flex; flex-direction: column; gap: 12px; }
.install-card__row { display: flex; gap: 12px; align-items: baseline; }
.install-card__row--action { align-items: center; justify-content: space-between; }
.install-card__os { font-size: 13px; font-weight: 600; color: var(--ink); min-width: 88px; }
.install-card__row--action .install-card__os { min-width: 0; }
.install-card__how { font-size: 13px; color: var(--muted); line-height: 1.5; }
.install-card__how em { color: var(--text-2); }
.install-card__sep { height: 1px; background: var(--line-soft); }
.install-card__btn {
    flex: 0 0 auto; text-decoration: none; border: 0; background: var(--primary); color: #fff;
    font-size: 12.5px; font-weight: 600; padding: 9px 14px; border-radius: 8px;
}
.install-card__btn:hover { background: var(--primary-dark); color: #fff; }
.install-card__note { font-size: 12px; color: var(--muted-2); line-height: 1.5; }

/* ---------- Pagina d'errore ---------- */
.errore { max-width: 520px; margin: 12vh auto; padding: 0 20px; }
.errore h1 { font-size: 26px; }
.errore p { color: var(--text-2); }
.errore code { background: var(--surface); border: 1px solid var(--line); padding: 2px 8px; border-radius: 6px; }

/* ---------- Blazor error UI ---------- */
.blazor-error-boundary { background: var(--danger); padding: 1rem; color: #fff; }
.blazor-error-boundary::after { content: "Si è verificato un errore."; }
#blazor-error-ui {
    display: none; position: fixed; bottom: 0; left: 0; width: 100%; z-index: 1000;
    padding: .6rem 1.25rem; background: var(--warn-bg); color: var(--warn-fg);
    box-shadow: 0 -1px 2px rgba(0,0,0,.2);
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .9rem; top: .5rem; }

/* ============================================================
   Responsive — tablet e smartphone
   ============================================================ */
@media (max-width: 1200px) {
    .grid-kpi { grid-template-columns: repeat(2, 1fr); }
    .grid-main, .grid-side { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .app { flex-direction: column; }
    .sidebar { display: none; }
    .main { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }

    .tabbar {
        display: flex; position: fixed; z-index: 90; left: 0; right: 0; bottom: 0;
        padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
        background: rgba(255,255,255,.92); backdrop-filter: saturate(1.6) blur(14px);
        -webkit-backdrop-filter: saturate(1.6) blur(14px);
        border-top: 1px solid var(--line);
    }
    .tabbar__voce {
        flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px;
        padding: 4px 2px; border: 0; background: transparent; font: inherit; cursor: pointer;
        color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .01em;
        -webkit-tap-highlight-color: transparent;
    }
    .tabbar__voce:hover { color: var(--muted); }
    .tabbar__icona {
        width: 56px; height: 30px; border-radius: 99px; display: grid; place-items: center;
        transition: background .2s ease, color .2s ease;
    }
    .tabbar__voce.active { color: var(--ink); }
    .tabbar__voce.active .tabbar__icona { background: var(--primary-soft); color: var(--primary-dark); }
    .tabbar__testo { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    .pagehead {
        flex-wrap: wrap; gap: 10px; padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
        min-height: 0; background: rgba(255,255,255,.94); backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }
    .pagehead__title { font-size: 17px; }
    .content { padding: 16px 16px 32px; }
    .grid-kpi { grid-template-columns: 1fr 1fr; gap: 12px; }
    .grid-2 { grid-template-columns: 1fr; }
    .card { padding: 16px; }
    .card--flush { padding: 0; }

    /* Tabelle: scroll orizzontale dentro la card */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table { min-width: 640px; }
    .toolbar .btn, .toolbar .input, .toolbar .select { width: 100%; }
    .toolbar .field { width: 100%; }
    .phone { width: 100%; max-width: 340px; }
    .req-card { flex-wrap: wrap; }
}

/* Schermi bassi: l'orologio della barra laterale lascia il posto al menu, che altrimenti scorre */
@media (min-width: 901px) and (max-height: 880px) {
    .shift-card { display: none; }
}

/* Tabelle che sul telefono diventano schede: ogni cella mostra la sua intestazione (data-label) */
@media (max-width: 720px) {
    .table.tabella-schede { min-width: 0; }
    .tabella-schede thead { display: none; }
    .tabella-schede, .tabella-schede tbody, .tabella-schede tr, .tabella-schede td { display: block; width: 100%; }
    .tabella-schede tbody tr { padding: 12px 16px; border-top: 1px solid var(--line-soft); }
    .tabella-schede tbody tr:first-child { border-top: 0; }
    .tabella-schede tbody tr:hover { background: transparent; }
    .tabella-schede tbody td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; border: 0; }
    .tabella-schede tbody td[data-label]::before { content: attr(data-label); color: var(--muted-2); font-size: 12px; font-weight: 400; }
    .tabella-schede tbody td:first-child { padding-bottom: 8px; }
    .tabella-schede tbody td.table__empty { display: block; }
    .tabella-schede__azioni { justify-content: flex-start !important; gap: 8px; padding-top: 10px !important; }
}

@media (max-width: 430px) {
    .kpi__value { font-size: 28px; }
    .pagehead__actions .btn { font-size: 12.5px; padding: 9px 12px; }
}

/* Login: sotto i 980px lo split-screen diventa una colonna sola */
@media (max-width: 980px) {
    .loginpage { grid-template-columns: 1fr; }
    .loginpage__side {
        min-width: 0; padding: 24px 22px; gap: 18px;
    }
    .loginpage__logo { height: 28px; }
    .loginpage__headline { font-size: 26px; }
    .loginpage__punti { display: none; }          /* la promessa resta nel titolo */
    .loginpage__foot { display: none; }
    .loginpage__main { padding: 22px 18px 36px; align-items: flex-start; }
    .login { padding: 24px; }
}

/* Schede (viste) e filtri a pillola: comuni a Richieste, Documenti, Comunicazioni, Scadenze, Note spese */
.viste {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 12px;
    border-radius: 14px;
    background: #E8EDF2;
}

.vista {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: #4A5A68;
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}

.vista--scelta {
    background: #FFFFFF;
    color: #0C1C2B;
    box-shadow: 0 1px 3px rgba(12, 28, 43, .12);
}

.vista__conteggio {
    min-width: 20px;
    padding: 1px 6px;
    border-radius: 99px;
    background: #E0573F;
    color: #FFFFFF;
    font-size: 11.5px;
    text-align: center;
}

.filtri {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    scrollbar-width: none;
}

.filtri::-webkit-scrollbar {
    display: none;
}

.filtro {
    flex: 0 0 auto;
    padding: 8px 14px;
    border-radius: 99px;
    border: 1px solid #E2E8EE;
    background: #FFFFFF;
    color: #4A5A68;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.filtro--scelto {
    background: #0C1C2B;
    border-color: #0C1C2B;
    color: #FFFFFF;
}
