/* Fogli di lavoro Tipress: stile sopra MDB UI Kit. Colori del logo: giallo, ciano, magenta su nero. */
:root {
    --tp-black: #0d0d0f;
    --tp-yellow: #ffed00;
    --tp-cyan: #009fe3;
    --tp-magenta: #e6007e;
    --tp-bg: #f4f5f7;
    --tp-border: #e3e5e8;
    --tp-muted: #6b7280;
    --tp-radius: 10px;
}

body { background: var(--tp-bg); color: #1f2329; }

/* Pulsanti: niente maiuscolo, stessa altezza, sempre distanziati nei gruppi */
.btn { text-transform: none; letter-spacing: normal; font-weight: 500; border-radius: 8px; box-shadow: none; }
.btn:hover, .btn:focus { box-shadow: none; }
.btn-dark { background: var(--tp-black); }
.btn-brand { background: var(--tp-yellow); color: var(--tp-black); }
.btn-brand:hover { background: #f2e000; color: var(--tp-black); }
.btn-outline { background: #fff; border: 1px solid var(--tp-border); color: #1f2329; }
.btn-outline:hover { background: #f0f1f3; color: #1f2329; }
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.actions { display: inline-flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.form-actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; align-items: center; }

/* Navbar */
.tp-nav { background: var(--tp-black); }
.tp-nav .navbar-brand { color: #fff; font-weight: 600; display: flex; align-items: center; gap: .6rem; }
.tp-nav .navbar-brand img { height: 30px; width: auto; }
.tp-nav .nav-link { color: rgba(255, 255, 255, .75); border-bottom: 2px solid transparent; }
.tp-nav .nav-link:hover, .tp-nav .nav-link.active { color: #fff; }
.tp-nav .nav-link.active { border-bottom-color: var(--tp-cyan); }
.tp-nav .navbar-toggler { color: #fff; }
.tp-nav .nav-link, .tp-nav .btn { white-space: nowrap; }

/* Superfici */
.card { border: 1px solid var(--tp-border); border-radius: var(--tp-radius); box-shadow: none; }
.card-header { background: #fff; border-bottom: 1px solid var(--tp-border); padding: 1rem 1.25rem; }
.page-title { font-size: 1.5rem; font-weight: 600; margin: 0; }
.section-title { font-size: .8rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--tp-muted); margin: 0 0 .75rem; }
.muted { color: var(--tp-muted); }
.form-label { font-weight: 500; font-size: .9rem; margin-bottom: .3rem; }
.form-text { color: var(--tp-muted); }

/* Etichette di stato e categoria (colori del marchio) */
.pill { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.pill-pending { background: #eceef1; color: #4b5563; }
.pill-in_progress { background: #e0f3fc; color: #00618b; }
.pill-completed { background: #e3f6ea; color: #17663a; }
.pill-canceled { background: #fde8ea; color: #a1162a; }
.pill-invoiced, .pill-counted { background: var(--tp-black); color: #fff; }
.pill-commercial { background: #fde6f2; color: #a4005a; }
.pill-subscription { background: #fffbcc; color: #6b6100; }
.pill-package { background: #e0f3fc; color: #00618b; }
.pill-internal { background: #eceef1; color: #4b5563; }

/* Scorciatoie della lista */
.presets { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.preset { display: inline-flex; align-items: center; gap: .45rem; padding: .4rem .85rem; border-radius: 999px;
    background: #fff; border: 1px solid var(--tp-border); color: #1f2329; font-size: .9rem; font-weight: 500; }
.preset:hover { border-color: #c9ccd1; color: #1f2329; }
.preset.active { background: var(--tp-black); border-color: var(--tp-black); color: #fff; }
.preset .count { background: var(--tp-magenta); color: #fff; border-radius: 999px; padding: 0 .45rem; font-size: .75rem; line-height: 1.35rem; }

/* Categoria: controllo segmentato */
.segmented { display: flex; flex-wrap: wrap; gap: .5rem; }
.segmented .btn-check + label { border: 1px solid var(--tp-border); background: #fff; color: #1f2329; border-radius: 8px; padding: .45rem .9rem; }
.segmented .btn-check:checked + label { color: #fff; border-color: transparent; }
.segmented .btn-check:checked + label.cat-commercial { background: var(--tp-magenta); }
.segmented .btn-check:checked + label.cat-subscription { background: var(--tp-yellow); color: var(--tp-black); }
.segmented .btn-check:checked + label.cat-package { background: var(--tp-cyan); }
.segmented .btn-check:checked + label.cat-internal { background: #4b5563; }
.segmented .btn-check:focus-visible + label { outline: 2px solid var(--tp-cyan); outline-offset: 2px; }

/* Tabelle */
.ws-table { margin: 0; }
.ws-table th { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; color: var(--tp-muted); background: #fafbfc; }
.ws-table td, .ws-table th { vertical-align: middle; padding: .75rem 1rem; }
.ws-table tr.overdue td:first-child { box-shadow: inset 4px 0 0 var(--tp-magenta); }
.ws-title { font-weight: 600; color: #1f2329; }
a.ws-title:hover { color: var(--tp-cyan); }
.ws-meta { font-size: .82rem; color: var(--tp-muted); display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .9rem; margin-top: .3rem; }
.ws-meta .pill { font-size: .72rem; padding: .1rem .5rem; }
.client-list { max-height: 15em; overflow-y: auto; }
.stats-table td, .stats-table th { white-space: nowrap; }

/* Su telefono le tabelle diventano schede: ogni cella con la sua etichetta */
@media (max-width: 767.98px) {
    .table-responsive { overflow: visible; }
    .ws-table thead { display: none; }
    .ws-table, .ws-table tbody, .ws-table tr, .ws-table td { display: block; width: 100%; }
    .ws-table tr { border-bottom: 1px solid var(--tp-border); padding: .5rem 0; }
    .ws-table td { border: 0; padding: .3rem 1rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
    .ws-table td[data-label]::before { content: attr(data-label); font-size: .78rem; color: var(--tp-muted); flex-shrink: 0; }
    .ws-table td.cell-main { display: block; }
    .ws-table td.cell-main::before { content: none; }
    .ws-table td .form-select { max-width: 72%; }
    .ws-table tr.overdue td:first-child { box-shadow: none; }
    .ws-table tr.overdue { box-shadow: inset 4px 0 0 var(--tp-magenta); }
}

/* Login */
.login-page { min-height: 100vh; background: var(--tp-black); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { width: 100%; max-width: 400px; }
.login-logo { height: 64px; display: block; margin: 0 auto 1.5rem; }

.ws-table .actions { flex-wrap: nowrap; }

/* Statistiche: barre per mese e quota sul totale */
.month-bars { display: flex; align-items: flex-end; gap: .35rem; height: 160px; overflow-x: auto; padding-bottom: .25rem; }
.month-bar { flex: 1 0 28px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.month-bar .bar { width: 100%; max-width: 40px; background: var(--tp-cyan); border-radius: 4px 4px 0 0; }
.month-bar .value { font-size: .75rem; font-weight: 600; margin-bottom: .2rem; }
.month-bar .label { font-size: .72rem; color: var(--tp-muted); margin-top: .3rem; text-align: center; line-height: 1.1; }
.share-bar { display: block; height: 8px; border-radius: 4px; background: var(--tp-cyan); min-width: 2px; }

/* Conteggi: barra di utilizzo della dotazione */
.usage { height: 8px; background: #eceef1; border-radius: 4px; overflow: hidden; }
.usage-bar { display: block; height: 100%; background: var(--tp-cyan); border-radius: 4px; }
.usage-bar.over { background: var(--tp-magenta); }

/* Km team: griglia persone × giorni */
.km-grid th, .km-grid td { padding: .3rem .2rem; vertical-align: middle; font-size: .8rem; }
.km-grid .km-name { position: sticky; left: 0; background: #fff; z-index: 1; white-space: nowrap; padding-left: .75rem; min-width: 9rem; }
.km-grid thead .km-name { background: #fafbfc; }
.km-grid .km-cell { width: 3.4rem; padding: .2rem .25rem; text-align: right; font-size: .8rem; -moz-appearance: textfield; }
.km-grid .km-cell::-webkit-inner-spin-button { -webkit-appearance: none; }
.km-grid .km-hint::placeholder { color: var(--tp-cyan); opacity: .9; }
.km-grid .km-weekend { background: #f4f5f7; }
