﻿:root {
    --bg: #f6f9ff;
    --card: #ffffff;
    --stroke: #e7eef8;
    --text: #1f2b3a;
    --muted: #6b7a90;
    --primary: #2f6fed;
    --primary-weak: #e9f0ff;
    --ok: #22c55e;
    --shadow: 0 10px 28px rgba(28,39,64,.08);
    --r: 18px;
}

* {
    box-sizing: border-box
}

html, body {
    height: 100%
}

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    color: var(--text);
    background: radial-gradient(1200px 800px at -10% -10%, #f0f6ff 0%, transparent 60%), radial-gradient(1200px 800px at 110% -10%, #f3f8ff 0%, transparent 60%), var(--bg);
}

/* --- Topbar --- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 16px;
    background: var(--card);
    border-bottom: 1px solid var(--stroke);
    box-shadow: var(--shadow);
    border-bottom-left-radius: var(--r);
    border-bottom-right-radius: var(--r);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none
}

.brand-logo {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: linear-gradient(135deg,var(--primary),#6ba4ff);
    color: #fff;
    font-weight: 700;
}

.brand-name {
    font-weight: 700;
    letter-spacing: .3px;
    color: var(--text);
    font-size: 18px
}

/* Burger (mobile) */
.burger {
    display: none;
    background: transparent;
    border: 0;
    padding: 8px;
    cursor: pointer
}

    .burger span {
        display: block;
        width: 22px;
        height: 2px;
        background: #2a3a52;
        margin: 5px 0;
        border-radius: 2px
    }

/* Nav */
.navbar {
    display: flex;
    align-items: center;
    gap: 8px
}

.nav-link {
    padding: 8px 12px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text);
    border: 1px solid transparent;
}

    .nav-link:hover {
        background: var(--primary-weak)
    }

    .nav-link.active {
        border-color: var(--primary);
        color: var(--primary);
        background: #fff
    }

.nav-sep {
    color: #c1ccdf;
    margin: 0 2px
}

/* Dropdown gestione */
.nav-group {
    position: relative
}

.nav-label {
    padding: 8px 12px;
    border-radius: 12px;
    cursor: default;
    color: var(--muted);
    border: 1px solid var(--stroke)
}

.nav-group:hover .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0)
}

.nav-dropdown {
    position: absolute;
    top: 46px;
    left: 0;
    min-width: 200px;
    background: var(--card);
    border: 1px solid var(--stroke);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: .15s ease;
}

.drop-link {
    display: block;
    padding: 10px 10px;
    border-radius: 12px;
    color: var(--text);
    text-decoration: none
}

    .drop-link:hover {
        background: var(--primary-weak)
    }

/* User box */
.userbox {
    display: flex;
    align-items: center;
    gap: 10px
}

    .userbox .link {
        color: var(--primary);
        text-decoration: none;
        font-weight: 600
    }

.hello {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted)
}

.dot {
    width: 8px;
    height: 8px;
    background: var(--ok);
    border-radius: 50%
}

/* --- Page wrapper --- */
.page {
    max-width: 1400px;
    margin: 22px auto;
    padding: 0 16px
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px
}

.page-title {
    font-size: 22px;
    margin: 0
}

/* Alerts */
.alert {
    background: #fff;
    border: 1px solid var(--stroke);
    border-left: 5px solid var(--primary);
    border-radius: 12px;
    padding: 12px 14px;
    margin: 8px 0;
    box-shadow: var(--shadow)
}

/* Content area */
.page-content {
    display: block
}

.card-soft {
    background: var(--card);
    border: 1px solid var(--stroke);
    border-radius: 18px;
    padding: 16px;
    box-shadow: var(--shadow)
}

.grid-gap {
    display: grid;
    gap: 12px
}

.row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap
}

.col {
    flex: 1 1 240px
}

/* Inputs & buttons */
.input, .select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--stroke);
    border-radius: 12px;
    background: #fff
}

.btn {
    display: inline-block;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none
}

.btn-primary {
    background: var(--primary);
    color: #fff
}

.btn-soft {
    background: #fff;
    border: 1px solid var(--stroke)
}

.btn-danger {
    background: #ef4444;
    color: #fff
}

/* Tables */
.table-soft {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border: 1px solid var(--stroke);
    border-radius: 16px;
    overflow: hidden
}

    .table-soft th, .table-soft td {
        padding: 10px 12px;
        border-bottom: 1px solid var(--stroke)
    }

    .table-soft th {
        background: #f7faff;
        text-align: left;
        color: #334155
    }

    .table-soft tr:last-child td {
        border-bottom: 0
    }

    .table-soft tr:hover td {
        background: #f7fbff
    }

/* Footer */
.footer {
    max-width: 1200px;
    margin: 30px auto 24px;
    padding: 0 16px;
    color: var(--muted);
    font-size: 13px
}

/* Mobile */
@media (max-width: 980px) {
    .burger {
        display: block
    }

    .navbar {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--card);
        border-top: 1px solid var(--stroke);
        box-shadow: var(--shadow);
        padding: 8px;
        gap: 6px;
        transform: translateY(-120%);
        transition: .18s ease-in-out;
        z-index: 999
    }

    body.menu-open .navbar {
        transform: translateY(0)
    }
}


/* --- Tiles in Dashboard --- */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 260px));
    gap: 16px;
    justify-content: start; /* allinea le colonne a sinistra */
}

.tile {
    display: block;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--stroke);
    background: var(--card);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text);
    transition: transform .12s ease, box-shadow .12s ease
}

    .tile:hover {
        transform: translateY(-2px);
        box-shadow: 0 14px 34px rgba(28,39,64,.12);
        background: #fff
    }

    .tile .t-ico {
        font-size: 22px;
        line-height: 1
    }

    .tile .t-title {
        margin: 6px 0 4px;
        font-weight: 700
    }

    .tile .t-desc {
        color: var(--muted);
        font-size: 13px
    }

/* --- Dashboard: soft tiles as buttons --- */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill,minmax(240px,1fr));
    gap: 12px
}

.tile-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 16px 16px 18px;
    border-radius: 22px;
    background: linear-gradient(180deg,#ffffff, #fbfdff);
    border: 1px solid var(--stroke);
    box-shadow: var(--shadow);
    cursor: pointer;
    user-select: none;
    transition: .12s ease;
}

    .tile-btn::before { /* barra verticale */
        content: "";
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 6px;
        border-top-left-radius: 22px;
        border-bottom-left-radius: 22px;
        background: linear-gradient(180deg,var(--primary),#6ba4ff);
        opacity: .85;
    }

    .tile-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 14px 34px rgba(28,39,64,.12)
    }

    .tile-btn:active {
        transform: translateY(0)
    }

    .tile-btn:focus {
        outline: 3px solid rgba(47,111,237,.25);
        outline-offset: 2px
    }

.tile-ico {
    min-width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--primary-weak);
    font-size: 22px;
}

.tile-text {
    display: grid;
    gap: 3px
}

.tile-title {
    font-weight: 700
}

.tile-desc {
    color: var(--muted);
    font-size: 13px
}

.table-wrap {
    overflow: auto
}
/* ----- Tiles equal height (flex) ----- */
.home-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: stretch; /* fa allungare tutte le card alla stessa altezza della riga */
}

    .home-tiles .col {
        display: flex;
        min-width: 260px; /* breakpoint “card” */
    }

    .home-tiles .card-soft {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 18px;
        text-decoration: none;
        flex: 1 1 auto; /* riempie l’altezza disponibile */
    }

    .home-tiles .tile-ico {
        font-size: 28px;
        line-height: 1
    }

    .home-tiles .tile-title {
        font-weight: 600;
        font-size: 1.1rem
    }

    .home-tiles .tile-desc {
        opacity: .7
    }

:root {
    --tile-w: 300px; /* larghezza desiderata per ogni tile */
    --tile-h: 120px; /* altezza uniforme (se vuoi) */
}

/* variante a larghezza fissa per ogni tile */
.tile-grid.fixed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--tile-w), var(--tile-w)));
    gap: 16px;
    justify-content: start; /* niente stretch */
}

/* opzionale: se vuoi uniformare le altezze */
.tile-card {
    height: var(--tile-h);
}

/* --- HOME tiles: layout stabile con larghezza fissa --- */
.tile-grid.home {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: stretch; /* tutte le tile stessa altezza se hanno height */
    justify-content: flex-start; /* niente stretch full-row */
}

    .tile-grid.home .tile-card {
        box-sizing: border-box;
        flex: 0 0 300px; /* larghezza fissa */
        width: 300px; /* per sicurezza */
        height: 120px; /* opzionale: altezza uniforme */
    }

/* ===== NEW — safe additions, no overrides ===== */

/* titoletti di sezione */
.section-title {
    font-weight: 600;
    color: var(--text);
    margin: 0 0 .75rem 0;
}

/* toolbar a pillole (scoped) */
.top-tabs .btn {
    background: #f3f4f6;
    border-color: var(--stroke);
}

    .top-tabs .btn.active,
    .top-tabs .btn:focus {
        background: var(--primary);
        color: #fff;
        border-color: var(--primary);
    }

/* layout form a 2 colonne, responsive */
.form-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 980px) {
    .form-two {
        grid-template-columns: 1fr;
    }
}

.field > label {
    display: block;
    font-size: .92rem;
    color: var(--muted);
    margin-bottom: .25rem;
}

.field .form-control,
.field .input,
.field .select {
    height: 44px;
    border-radius: 12px; /* coerente col tuo r = 12 */
    border: 1px solid var(--stroke);
    background: #fff;
}

.field .input-group .form-control {
    height: 44px;
}

/* barra azioni sotto i form */
.form-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
}

/* badge light opzionale */
.badge-soft {
    background: var(--primary-weak);
    color: var(--primary);
    padding: .2rem .5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: .85rem;
}
.page.wide {
    max-width: 1480px;
}
/* scegli tu il valore */

/* === Tabelle arrotondate + pager pill === */
.table-soft { /* c'è già: aggiungo solo piccoli ritocchi */
    border-radius: var(--r);
    overflow: hidden; /* taglia gli spigoli delle celle */
}

    .table-soft thead th {
        font-weight: 600;
    }

    .table-soft .col-actions {
        white-space: nowrap;
    }

.pager-soft {
    display: flex;
    gap: 6px;
    padding: 10px;
    justify-content: flex-end;
}

    .pager-soft a, .pager-soft span {
        padding: 6px 10px;
        border: 1px solid var(--stroke);
        border-radius: 999px;
        text-decoration: none;
    }

    .pager-soft span {
        background: var(--primary-weak);
        border-color: var(--primary-weak);
        color: var(--primary);
        font-weight: 600;
    }

/* bottoni “pill” nelle azioni riga */
.btn-chip {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--stroke);
    background: #fff;
    text-decoration: none;
    margin-right: 6px;
}

    .btn-chip:hover {
        background: #f5f7ff;
    }

    .btn-chip.danger {
        border-color: #f5d0d0;
        color: #9a1c1c;
    }

        .btn-chip.danger:hover {
            background: #fff0f0;
        }

