/* ==========================================================================
   MyIPO - Design system
   Struttura ispirata a MyIVO (sidebar + topbar), palette blu.
   Indice:
     1. Font & token        6. Card & widget       11. Modali & dropdown
     2. Base                7. Bottoni & badge     12. Pagine specifiche
     3. Shell               8. Form                13. Auth
     4. Sidebar             9. Liste & tabelle     14. Responsive
     5. Topbar             10. Alert & toast       15. Utility
   ========================================================================== */

/* 1. FONT & TOKEN ---------------------------------------------------------- */
@font-face {
    font-family: "Plus Jakarta Sans";
    src: url("../fonts/plus-jakarta-sans.woff2") format("woff2");
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
}

:root {
    --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    --blue-50: #eef4ff;
    --blue-100: #dbe7ff;
    --blue-200: #bcd2fe;
    --blue-400: #5b8cf7;
    --blue-500: #2f6bf0;
    --blue-600: #1f55d6;
    --blue-700: #1a44ab;
    --cyan-400: #22c3e6;
    --navy-900: #071330;
    --navy-800: #0b1d45;
    --navy-700: #12295c;

    --bg: #f1f5fc;
    --surface: #ffffff;
    --surface-2: #f6f9fe;
    --surface-3: #edf2fb;
    --border: #e1e8f4;
    --border-strong: #cdd8ea;
    --text: #0e1a33;
    --text-2: #3a4a66;
    --muted: #6b7a96;
    --primary: var(--blue-500);
    --primary-hover: var(--blue-600);
    --primary-soft: var(--blue-50);
    --primary-text: var(--blue-600);
    --ring: rgba(47, 107, 240, .28);

    --success: #12a37a;
    --success-soft: #e5f7f1;
    --warning: #c98a06;
    --warning-soft: #fdf5e1;
    --danger: #dc3c4b;
    --danger-soft: #fdecee;
    --info: #0c94c4;
    --info-soft: #e3f5fc;

    --gradient: linear-gradient(135deg, #2f6bf0 0%, #2a8ef0 55%, #22c3e6 100%);
    --gradient-deep: linear-gradient(140deg, #0b1d45 0%, #143a8a 55%, #1f6fd8 100%);

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --shadow-sm: 0 1px 2px rgba(14, 26, 51, .05);
    --shadow: 0 1px 2px rgba(14, 26, 51, .04), 0 8px 24px -12px rgba(20, 50, 110, .14);
    --shadow-lg: 0 24px 48px -16px rgba(12, 30, 70, .28);

    --sidebar-w: 272px;
    --sidebar-w-collapsed: 84px;
    --topbar-h: 72px;
    --bottomnav-h: 66px;

    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #060d1f;
    --surface: #0c1730;
    --surface-2: #0f1c3a;
    --surface-3: #142346;
    --border: #1c2c52;
    --border-strong: #27396a;
    --text: #e8eefb;
    --text-2: #b9c6e2;
    --muted: #8495b8;
    --primary: #4b83f6;
    --primary-hover: #6b9bff;
    --primary-soft: rgba(75, 131, 246, .14);
    --primary-text: #8fb3ff;
    --ring: rgba(107, 155, 255, .35);
    --success-soft: rgba(18, 163, 122, .15);
    --warning-soft: rgba(201, 138, 6, .16);
    --danger-soft: rgba(220, 60, 75, .16);
    --info-soft: rgba(12, 148, 196, .16);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
    --shadow-lg: 0 24px 48px -16px rgba(0, 0, 0, .7);
    color-scheme: dark;
}

/* 2. BASE ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 { margin: 0; line-height: 1.25; font-weight: 700; letter-spacing: -.015em; }
p { margin: 0; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; display: block; }
button { font: inherit; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 6px; }

.icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; left: 12px; top: -60px; z-index: 200;
    background: var(--primary); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 12px; color: #fff; }

/* 3. SHELL ----------------------------------------------------------------- */
.app {
    min-height: 100vh;
    min-height: 100dvh;
}

.main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .25s ease;
}

.content {
    flex: 1;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 28px 32px 48px;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.page-head h1 { font-size: 26px; }
.page-head p { color: var(--muted); margin-top: 4px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }

.breadcrumb {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--muted); margin-bottom: 6px;
}
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary-text); }

.footer {
    padding: 18px 32px;
    font-size: 12.5px;
    color: var(--muted);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
}

.sidebar-collapsed .main { margin-left: var(--sidebar-w-collapsed); }

/* 4. SIDEBAR (light) ------------------------------------------------------- */
:root {
    --sb-bg: #ffffff;
    --sb-border: #e6ecf6;
    --sb-text: #3d4b66;
    --sb-muted: #8b98b3;
    --sb-hover: #f3f6fc;
    --sb-active-bg: linear-gradient(90deg, #e9f0ff 0%, #f2f7ff 100%);
    --sb-active-text: #1f55d6;
    --sb-profile-bg: linear-gradient(135deg, #f3f7ff 0%, #eefaff 100%);
}
:root[data-theme="dark"] {
    --sb-bg: #0a1530;
    --sb-border: #1a2a4f;
    --sb-text: #b9c6e2;
    --sb-muted: #6f82a8;
    --sb-hover: rgba(255, 255, 255, .05);
    --sb-active-bg: linear-gradient(90deg, rgba(75, 131, 246, .22), rgba(75, 131, 246, .08));
    --sb-active-text: #9cc2ff;
    --sb-profile-bg: linear-gradient(135deg, rgba(75, 131, 246, .12), rgba(34, 195, 230, .06));
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    color: var(--sb-text);
    background:
        radial-gradient(140% 38% at 0% 0%, rgba(47, 107, 240, .07) 0%, transparent 60%),
        radial-gradient(120% 30% at 100% 100%, rgba(34, 195, 230, .06) 0%, transparent 60%),
        var(--sb-bg);
    border-right: 1px solid var(--sb-border);
    box-shadow: 4px 0 24px -18px rgba(20, 50, 110, .25);
    transition: width .25s ease, transform .25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-h);
    padding: 0 16px 0 22px;
    flex-shrink: 0;
}
.brand {
    display: flex; align-items: center; gap: 11px;
    color: var(--text); font-weight: 800; font-size: 20px; letter-spacing: -.02em;
}
.brand:hover { color: var(--text); }
.brand-mark { width: 36px; height: 36px; flex-shrink: 0; filter: drop-shadow(0 6px 10px rgba(47, 107, 240, .25)); }
.brand-name span { color: var(--primary); }

.sidebar-toggle {
    display: grid; place-items: center;
    width: 32px; height: 32px;
    border: 1px solid var(--sb-border); border-radius: 10px;
    background: var(--surface);
    color: var(--sb-muted); cursor: pointer;
    transition: background .2s, color .2s, transform .25s;
}
.sidebar-toggle:hover { background: var(--primary-soft); color: var(--primary-text); border-color: var(--blue-200); }

.sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 14px 18px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

.sidebar-profile {
    display: flex; align-items: center; gap: 12px;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: var(--radius);
    background: var(--sb-profile-bg);
    border: 1px solid var(--sb-border);
    color: inherit;
    transition: border-color .2s, box-shadow .2s;
}
.sidebar-profile:hover { color: inherit; border-color: var(--blue-200); box-shadow: 0 8px 20px -14px rgba(47, 107, 240, .5); }
.sidebar-profile .who { min-width: 0; }
.sidebar-profile strong { display: block; color: var(--text); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-profile small { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }

.avatar {
    width: 42px; height: 42px; flex-shrink: 0;
    border-radius: 50%;
    display: grid; place-items: center;
    font-weight: 700; font-size: 14px; color: #fff;
    background: var(--gradient);
    overflow: hidden;
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--blue-200);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 34px; height: 34px; font-size: 12px; }
.avatar-xl { width: 104px; height: 104px; font-size: 32px; box-shadow: 0 0 0 4px var(--surface), 0 0 0 6px var(--blue-200); }

.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c07a; box-shadow: 0 0 0 3px rgba(34, 192, 122, .18); }

/* Pulsante contesto verso MyIVO (verde, richiamo al brand MyIVO) */
.context-switch {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    margin-bottom: 14px;
    border-radius: var(--radius);
    color: #1d7a4e;
    background: linear-gradient(125deg, #effaf4, #e8f8f3);
    border: 1px solid #cdeedd;
    transition: transform .2s, box-shadow .2s, border-color .2s;
}
.context-switch:hover {
    color: #17673f;
    transform: translateY(-1px);
    border-color: #9edfbe;
    box-shadow: 0 10px 22px -14px rgba(47, 191, 155, .7);
}
.context-switch .cs-icon {
    width: 34px; height: 34px; flex-shrink: 0;
    display: grid; place-items: center;
    border-radius: 10px; color: #fff;
    background: linear-gradient(135deg, #3fae78, #2fbf9b);
    box-shadow: 0 6px 12px -6px rgba(47, 191, 155, .8);
}
.context-switch .cs-text { flex: 1; min-width: 0; line-height: 1.25; }
.context-switch .cs-text strong { display: block; font-size: 13px; }
.context-switch .cs-text small { color: #4f9a76; font-size: 11.5px; }
.context-switch .cs-arrow { opacity: .7; transition: transform .2s; }
.context-switch:hover .cs-arrow { transform: translateX(3px); }
:root[data-theme="dark"] .context-switch { color: #8ff0bd; background: rgba(63, 174, 120, .1); border-color: rgba(114, 223, 162, .22); }
:root[data-theme="dark"] .context-switch .cs-text small { color: rgba(143, 240, 189, .7); }

.nav-heading {
    padding: 14px 12px 6px;
    font-size: 10.5px;
    font-weight: 750;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--sb-muted);
    white-space: nowrap;
}

.nav { list-style: none; margin: 0; padding: 0; }
.nav-item { margin-bottom: 2px; }

.nav-link {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    width: 100%;
    padding: 9px 12px;
    border: 0; border-radius: 11px;
    background: transparent;
    color: var(--sb-text);
    font-size: 14px; font-weight: 600;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
    transition: background .18s, color .18s;
}
.nav-link .icon { color: var(--sb-muted); transition: color .18s; }
.nav-link:hover { background: var(--sb-hover); color: var(--text); }
.nav-link:hover .icon { color: var(--primary); }
.nav-link .nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-link .chev { display: inline-flex; transition: transform .2s; color: var(--sb-muted); }
.nav-item.open > .nav-link .chev { transform: rotate(90deg); }

.nav-link.active {
    color: var(--sb-active-text);
    background: var(--sb-active-bg);
    font-weight: 700;
}
.nav-link.active .icon { color: var(--primary); }
.nav-link.active::before {
    content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px;
    width: 4px; border-radius: 0 4px 4px 0; background: var(--gradient);
}
/* Il gruppo aperto non ha lo sfondo pieno: si evidenzia la sottovoce */
.nav-item.open > .nav-link.active { background: transparent; }
.nav-item.open > .nav-link.active::before { display: none; }

.nav-pill {
    margin-left: auto;
    font-size: 10px; font-weight: 700; letter-spacing: .03em;
    padding: 2px 7px; border-radius: 99px;
    background: var(--surface-3); color: var(--muted);
}

.nav-sub {
    list-style: none; margin: 2px 0 8px 21px; padding: 0 0 0 14px;
    border-left: 1.5px solid var(--sb-border);
    display: none;
}
.nav-item.open > .nav-sub { display: block; }
.nav-sub a {
    position: relative;
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px;
    border-radius: 9px;
    font-size: 13.5px; font-weight: 550; color: var(--sb-text);
}
.nav-sub a::before {
    content: ""; position: absolute; left: -18px; top: 50%;
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--sb-bg); border: 1.5px solid var(--border-strong);
    transform: translateY(-50%);
}
.nav-sub a:hover { color: var(--text); background: var(--sb-hover); }
.nav-sub a.active { color: var(--sb-active-text); font-weight: 700; background: var(--sb-active-bg); }
.nav-sub a.active::before { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }

.sidebar-foot {
    padding: 14px 18px 18px;
    border-top: 1px solid var(--sb-border);
    font-size: 11.5px;
    color: var(--sb-muted);
    display: flex; gap: 8px; align-items: center;
    white-space: nowrap;
}

/* Sidebar compressa (desktop) */
.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
.sidebar-collapsed .sidebar .brand-name,
.sidebar-collapsed .sidebar .who,
.sidebar-collapsed .sidebar .cs-text,
.sidebar-collapsed .sidebar .cs-arrow,
.sidebar-collapsed .sidebar .nav-label,
.sidebar-collapsed .sidebar .chev,
.sidebar-collapsed .sidebar .nav-link .nav-pill,
.sidebar-collapsed .sidebar .nav-sub,
.sidebar-collapsed .sidebar .sidebar-foot span:last-child { display: none; }
.sidebar-collapsed .sidebar-brand { padding: 16px 0 0; flex-direction: column; justify-content: center; gap: 10px; height: auto; }
.sidebar-collapsed .sidebar-toggle { transform: rotate(180deg); }
.sidebar-collapsed .nav-heading { font-size: 0; padding: 10px 0 6px; }
.sidebar-collapsed .nav-heading::after { content: ""; display: block; height: 1px; margin: 0 14px; background: var(--sb-border); }
.sidebar-collapsed .nav-link,
.sidebar-collapsed .sidebar-profile,
.sidebar-collapsed .context-switch { justify-content: center; padding-left: 0; padding-right: 0; }
.sidebar-collapsed .sidebar-profile { background: transparent; border-color: transparent; }
.sidebar-collapsed .nav-item.open > .nav-link.active { background: var(--sb-active-bg); }
.sidebar-collapsed .sidebar-foot { justify-content: center; }

/* 5. TOPBAR ---------------------------------------------------------------- */
.topbar {
    position: sticky; top: 0; z-index: 40;
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 14px;
    padding: 0 32px;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid var(--border);
}

.topbar .menu-btn { display: none; }
.topbar .brand-mobile { display: none; }
.myca-toggle { display: none !important; }

/* Chiedi a Myca */
.myca {
    position: relative;
    flex: 1;
    max-width: 760px;
    margin: 0 auto;
}
.myca-field {
    display: flex; align-items: center; gap: 10px;
    height: 48px;
    padding: 0 6px 0 7px;
    border-radius: 16px;
    border: 1.5px solid transparent;
    background:
        linear-gradient(var(--surface), var(--surface)) padding-box,
        linear-gradient(110deg, #2f6bf0, #22c3e6 45%, #8b7cf6 100%) border-box;
    box-shadow: 0 8px 24px -16px rgba(47, 107, 240, .6);
    transition: box-shadow .2s;
}
.myca-field:focus-within { box-shadow: 0 0 0 4px var(--ring), 0 12px 28px -16px rgba(47, 107, 240, .7); }
.myca-avatar {
    width: 34px; height: 34px; flex-shrink: 0;
    border-radius: 11px;
    display: grid; place-items: center;
    color: #fff;
    background: linear-gradient(135deg, #2f6bf0, #22c3e6);
    box-shadow: 0 6px 14px -6px rgba(47, 107, 240, .7);
}
.myca-avatar.sm { width: 30px; height: 30px; border-radius: 10px; }
.myca-spark { fill: currentColor; stroke: none; }
.myca-field input {
    flex: 1; min-width: 0;
    height: 100%;
    border: 0; outline: 0;
    background: transparent;
    color: var(--text);
    font: inherit; font-size: 14.5px;
}
.myca-field input::placeholder { color: var(--muted); }
.myca-field kbd {
    font: 600 11px var(--font); color: var(--muted);
    padding: 3px 7px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2);
}
.myca-send {
    width: 36px; height: 36px; flex-shrink: 0;
    display: grid; place-items: center;
    border: 0; border-radius: 11px;
    color: #fff; cursor: pointer;
    background: var(--gradient);
    transition: transform .15s, filter .2s;
}
.myca-send:hover { filter: brightness(1.08); }
.myca-send:active { transform: scale(.95); }

.myca-panel {
    position: absolute; left: 0; right: 0; top: calc(100% + 10px); z-index: 70;
    border-radius: var(--radius-lg);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity .18s, transform .18s, visibility .18s;
}
.myca.open .myca-panel { opacity: 1; visibility: visible; transform: none; }
.myca-panel-head {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(120deg, var(--primary-soft), transparent);
}
.myca-panel-head strong { display: block; font-size: 14px; }
.myca-panel-head small { color: var(--muted); font-size: 12px; }
.myca-thread { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; max-height: 280px; overflow-y: auto; }
.myca-msg { max-width: 85%; padding: 10px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; }
.myca-msg.bot { align-self: flex-start; background: var(--surface-3); color: var(--text-2); border-top-left-radius: 4px; }
.myca-msg.user { align-self: flex-end; background: var(--gradient); color: #fff; border-top-right-radius: 4px; }
.myca-msg a { font-weight: 650; }
.myca-suggest { padding: 0 18px 16px; display: flex; flex-direction: column; gap: 8px; }
.myca-suggest .chip { height: 32px; font-size: 12.5px; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.icon-btn {
    position: relative;
    display: inline-grid; place-items: center;
    width: 42px; height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    cursor: pointer;
    transition: background .2s, color .2s, border-color .2s;
}
.icon-btn:hover { color: var(--primary-text); border-color: var(--blue-200); background: var(--primary-soft); }
.icon-btn .dot {
    position: absolute; top: 8px; right: 9px;
    min-width: 17px; height: 17px; padding: 0 4px;
    border-radius: 99px;
    background: var(--danger); color: #fff;
    font-size: 10px; font-weight: 700; line-height: 17px; text-align: center;
    box-shadow: 0 0 0 2px var(--surface);
    transform: translate(40%, -40%);
}
.icon-btn.myca-toggle { color: #fff; border: 0; background: linear-gradient(135deg, #2f6bf0, #22c3e6); }

.user-btn {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 10px 4px 4px;
    border: 1px solid var(--border); border-radius: 99px;
    background: var(--surface); color: var(--text);
    cursor: pointer;
}
.user-btn:hover { border-color: var(--blue-200); }
.user-btn .avatar { box-shadow: none; }
.user-btn .name { font-size: 13.5px; font-weight: 650; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 6. CARD & WIDGET --------------------------------------------------------- */
.grid { display: grid; gap: 22px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid-side { grid-template-columns: 300px minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 22px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    min-width: 0;
}
.card-body { padding: 22px 24px; }
.card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}
.card-head h2, .card-head h3 { font-size: 16px; display: flex; align-items: center; gap: 10px; }
.card-head p { font-size: 13px; color: var(--muted); }
.card-head .link { font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.card-foot { padding: 14px 24px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.head-icon {
    width: 34px; height: 34px; border-radius: 10px;
    display: grid; place-items: center;
    background: var(--primary-soft); color: var(--primary-text);
}
.head-icon.danger { background: var(--danger-soft); color: var(--danger); }
.head-icon.success { background: var(--success-soft); color: var(--success); }
.head-icon.warning { background: var(--warning-soft); color: var(--warning); }

/* Hero dashboard */
.hero {
    position: relative;
    overflow: hidden;
    padding: 30px 32px;
    border-radius: var(--radius-lg);
    color: #fff;
    background: var(--gradient-deep);
    box-shadow: var(--shadow-lg);
    isolation: isolate;
}
.hero::before, .hero::after {
    content: ""; position: absolute; border-radius: 50%; z-index: -1; filter: blur(2px);
}
.hero::before { width: 420px; height: 420px; right: -120px; top: -180px; background: radial-gradient(circle, rgba(34, 195, 230, .55), transparent 65%); }
.hero::after { width: 320px; height: 320px; left: 30%; bottom: -220px; background: radial-gradient(circle, rgba(127, 177, 255, .45), transparent 65%); }
.hero-grid { display: flex; justify-content: space-between; gap: 28px; align-items: center; flex-wrap: wrap; }
.hero .eyebrow { font-size: 13px; color: #a9c6ff; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.hero h1 { font-size: 30px; margin: 8px 0 6px; }
.hero p { color: #c9d9fb; max-width: 520px; }
.hero-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.hero-chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 7px 12px; border-radius: 99px;
    font-size: 12.5px; color: #e6eeff;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .14);
    backdrop-filter: blur(6px);
}
.hero-chip.warn { background: rgba(255, 196, 77, .16); border-color: rgba(255, 196, 77, .35); color: #ffe1a3; }
.hero-chip:hover { color: #fff; background: rgba(255, 255, 255, .16); }

.ring {
    --p: 0;
    width: 132px; height: 132px; flex-shrink: 0;
    border-radius: 50%;
    display: grid; place-items: center;
    background:
        radial-gradient(closest-side, rgba(11, 29, 69, .92) 76%, transparent 78% 100%),
        conic-gradient(#7fe3ff calc(var(--p) * 1%), rgba(255, 255, 255, .14) 0);
    text-align: center;
}
.ring strong { display: block; font-size: 28px; line-height: 1; }
.ring small { font-size: 11.5px; color: #a9c6ff; }

/* KPI */
.kpi {
    position: relative;
    padding: 20px;
    display: flex; flex-direction: column; gap: 14px;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-icon {
    width: 44px; height: 44px; border-radius: 13px;
    display: grid; place-items: center;
    color: #fff;
}
.kpi-value { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.kpi-label { color: var(--muted); font-size: 13.5px; font-weight: 550; }
.kpi .trend { font-size: 12px; font-weight: 650; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.kpi::after {
    content: ""; position: absolute; right: -30px; bottom: -40px;
    width: 120px; height: 120px; border-radius: 50%;
    background: var(--primary-soft); opacity: .6; z-index: 0;
}
.kpi > * { position: relative; z-index: 1; }

/* Tinte categorie */
.tint-blue    { --t: #2f6bf0; }
.tint-cyan    { --t: #0ea5c6; }
.tint-sky     { --t: #0284c7; }
.tint-indigo  { --t: #4f46e5; }
.tint-violet  { --t: #7c3aed; }
.tint-teal    { --t: #0d9488; }
.tint-emerald { --t: #059669; }
.tint-amber   { --t: #d97706; }
.tint-orange  { --t: #ea580c; }
.tint-rose    { --t: #e11d48; }
.tint-red     { --t: #dc2626; }
.tint-slate   { --t: #475569; }
.tile-icon {
    width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
    display: grid; place-items: center;
    color: var(--t, var(--primary));
    background: color-mix(in srgb, var(--t, var(--primary)) 12%, transparent);
}
.kpi-icon.tinted { background: linear-gradient(135deg, var(--t), color-mix(in srgb, var(--t) 60%, #22c3e6)); box-shadow: 0 10px 20px -10px var(--t); }

/* 7. BOTTONI & BADGE ------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 42px; padding: 0 18px;
    border-radius: 12px;
    border: 1px solid transparent;
    font-size: 14px; font-weight: 650;
    cursor: pointer;
    white-space: nowrap;
    transition: background .18s, border-color .18s, color .18s, box-shadow .18s, transform .1s;
    text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-loading { opacity: .65; pointer-events: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 18px -10px var(--primary); }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-gradient { background: var(--gradient); color: #fff; box-shadow: 0 10px 22px -12px #2f6bf0; }
.btn-gradient:hover { color: #fff; filter: brightness(1.06); }
.btn-outline { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary-text); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-soft { background: var(--primary-soft); color: var(--primary-text); }
.btn-soft:hover { background: var(--blue-100); color: var(--primary-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.95); color: #fff; }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-danger-soft:hover { background: var(--danger); color: #fff; }
.btn-white { background: #fff; color: var(--blue-700); }
.btn-white:hover { color: var(--blue-700); box-shadow: 0 10px 22px -10px rgba(0, 0, 0, .4); }
.btn-glass { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .2); }
.btn-glass:hover { background: rgba(255, 255, 255, .2); color: #fff; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-lg { height: 50px; font-size: 15px; border-radius: 14px; }
:root[data-theme="dark"] .btn-soft:hover { background: rgba(75, 131, 246, .25); }

.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 99px;
    font-size: 11.5px; font-weight: 650;
    white-space: nowrap;
    background: var(--surface-3); color: var(--text-2);
}
.badge-primary { background: var(--primary-soft); color: var(--primary-text); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft); color: var(--danger); }
.badge-info    { background: var(--info-soft); color: var(--info); }
.badge-muted   { background: var(--surface-3); color: var(--muted); }
.badge-myivo   { background: rgba(63, 174, 120, .14); color: #2c9a66; }

/* 8. FORM ------------------------------------------------------------------ */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field label, .label { font-size: 13px; font-weight: 650; color: var(--text-2); }
.field .hint { font-size: 12.5px; color: var(--muted); }

.input, .select, .textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font: inherit; font-size: 14.5px;
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.textarea { min-height: 96px; resize: vertical; }
.select {
    appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7a96' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.input[readonly] { background: var(--surface-2); color: var(--muted); }
.input::placeholder, .textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }

.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon > .input { padding-left: 42px; }
.input-icon > .toggle-visibility {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    width: 34px; height: 34px; border: 0; border-radius: 9px;
    background: transparent; color: var(--muted); cursor: pointer;
    display: grid; place-items: center;
}
.input-icon > .toggle-visibility:hover { background: var(--surface-3); color: var(--text); }
.input-icon.has-toggle > .input { padding-right: 46px; }

.switch { display: flex; align-items: flex-start; gap: 14px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
    position: relative; flex-shrink: 0;
    width: 44px; height: 26px; border-radius: 99px;
    background: var(--border-strong);
    transition: background .2s;
    margin-top: 2px;
}
.switch .track::after {
    content: ""; position: absolute; top: 3px; left: 3px;
    width: 20px; height: 20px; border-radius: 50%;
    background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2);
    transition: transform .2s;
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px var(--ring); }
.switch input:disabled + .track { opacity: .5; }
.switch .text strong { display: block; font-size: 14px; }
.switch .text small { color: var(--muted); font-size: 13px; }

.check { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

.segmented { display: inline-flex; padding: 4px; gap: 4px; border-radius: 12px; background: var(--surface-3); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; }
.segmented span {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 12px; border-radius: 9px;
    font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented input:focus-visible + span { box-shadow: 0 0 0 3px var(--ring); }

.dropzone {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    padding: 28px 20px;
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface-2);
    text-align: center;
    color: var(--muted);
    transition: border-color .2s, background .2s;
}
.dropzone.is-over, .dropzone:hover { border-color: var(--primary); background: var(--primary-soft); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone strong { color: var(--text); }
.dropzone .file-name { font-size: 13px; color: var(--primary-text); font-weight: 600; word-break: break-all; }

.otp-input {
    letter-spacing: .5em;
    text-align: center;
    font-size: 24px; font-weight: 700;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    height: 60px;
}

/* 9. LISTE & TABELLE ------------------------------------------------------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-item {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    min-width: 0;
}
.list-item:last-child { border-bottom: 0; }
a.list-item { color: inherit; transition: background .15s; }
a.list-item:hover { background: var(--surface-2); }
.list-item .main-text { flex: 1; min-width: 0; }
.list-item .main-text strong { display: block; font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .main-text small { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .side { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
    text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    color: var(--muted); padding: 12px 24px; background: var(--surface-2); border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td { padding: 14px 24px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }

.empty {
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
    padding: 44px 24px;
    color: var(--muted);
}
.empty .empty-icon {
    width: 64px; height: 64px; border-radius: 20px;
    display: grid; place-items: center;
    background: var(--primary-soft); color: var(--primary-text);
    margin-bottom: 4px;
}
.empty .empty-icon .icon { width: 28px; height: 28px; }
.empty h3 { color: var(--text); font-size: 16px; }
.empty p { max-width: 380px; font-size: 14px; }

/* 10. ALERT & TOAST -------------------------------------------------------- */
.alert {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 14px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    border: 1px solid transparent;
}
.alert .icon { margin-top: 2px; }
.alert-info    { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 20%, transparent); }
.alert-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 20%, transparent); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 22%, transparent); }
.alert-danger  { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 20%, transparent); }
.alert strong { display: block; }
.alert p { color: var(--text-2); }

.toasts {
    position: fixed; z-index: 120;
    right: 24px; top: 88px;
    display: flex; flex-direction: column; gap: 10px;
    width: min(400px, calc(100vw - 32px));
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    display: flex; gap: 12px; align-items: flex-start;
    padding: 14px 14px 14px 16px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    animation: toast-in .35s cubic-bezier(.2, .9, .3, 1.2);
}
.toast.hide { animation: toast-out .25s ease forwards; }
.toast .t-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.toast-success .t-icon { background: var(--success-soft); color: var(--success); }
.toast-danger .t-icon  { background: var(--danger-soft); color: var(--danger); }
.toast-warning .t-icon { background: var(--warning-soft); color: var(--warning); }
.toast-info .t-icon    { background: var(--info-soft); color: var(--info); }
.toast .t-msg { flex: 1; padding-top: 4px; }
.toast .t-close { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 4px; border-radius: 6px; }
.toast .t-close:hover { background: var(--surface-3); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px); } }

/* 11. MODALI & DROPDOWN ---------------------------------------------------- */
dialog.modal {
    width: min(620px, calc(100vw - 24px));
    max-height: calc(100dvh - 48px);
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
dialog.modal[open] { display: flex; flex-direction: column; animation: modal-in .25s cubic-bezier(.2, .9, .3, 1.1); }
dialog.modal::backdrop { background: rgba(6, 14, 34, .55); backdrop-filter: blur(3px); }
dialog.modal-sm { width: min(440px, calc(100vw - 24px)); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 17px; display: flex; align-items: center; gap: 10px; }
.modal-body { padding: 22px 24px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); background: var(--surface-2); }
.modal form { display: contents; }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(.98); } }

.dropdown { position: relative; }
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 10px); z-index: 70;
    min-width: 240px;
    padding: 8px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity .18s, transform .18s, visibility .18s;
}
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: none; }
.dropdown-menu a, .dropdown-menu button.dd-item {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 0; border-radius: 9px;
    background: transparent;
    color: var(--text-2); font-size: 14px; font-weight: 550; text-align: left;
    cursor: pointer;
}
.dropdown-menu a:hover, .dropdown-menu button.dd-item:hover { background: var(--surface-3); color: var(--text); }
.dropdown-menu .dd-danger { color: var(--danger) !important; }
.dropdown-menu .dd-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown-menu .dd-head strong { display: block; font-size: 14px; }
.dropdown-menu .dd-head small { color: var(--muted); font-size: 12.5px; word-break: break-all; }
.dropdown-menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.dropdown-menu.wide { width: 360px; padding: 0; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.notif-head strong { font-size: 14px; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; color: var(--text-2); }
.notif-item.unread { background: var(--primary-soft); }
.notif-item small { color: var(--muted); }

/* 12. PAGINE SPECIFICHE ---------------------------------------------------- */
/* Scadenze */
.deadline-date {
    width: 52px; flex-shrink: 0;
    border-radius: 12px; overflow: hidden;
    text-align: center;
    border: 1px solid var(--border);
    background: var(--surface);
}
.deadline-date span { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #fff; background: var(--primary); padding: 2px 0; }
.deadline-date strong { display: block; font-size: 18px; padding: 3px 0 4px; }
.deadline-date.late span { background: var(--danger); }
.deadline-date.soon span { background: var(--warning); }

/* Servizi */
.service-card {
    position: relative;
    display: flex; flex-direction: column; gap: 14px;
    padding: 20px;
    height: 100%;
    transition: transform .2s, box-shadow .2s, border-color .2s;
}
.service-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--blue-200); }
.service-card .sc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.service-card h3 { font-size: 15.5px; }
.service-card .provider { font-size: 12.5px; color: var(--muted); }
.service-card .summary { font-size: 13.5px; color: var(--text-2); flex: 1; }
.service-card .sc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.service-card .stretched { position: absolute; inset: 0; border-radius: inherit; z-index: 0; }
.service-card .sc-top, .service-card .sc-foot { position: relative; z-index: 1; }
.fav-btn { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 9px; }
.fav-btn:hover { background: var(--surface-3); color: var(--warning); }
.fav-btn.is-fav { color: #f5a524; }
.fav-btn.is-fav .icon { fill: currentColor; }
.auth-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.mini-services { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 18px 24px 22px; }
.mini-service {
    display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
    padding: 16px 10px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--surface-2);
    color: var(--text); font-size: 13px; font-weight: 650;
    transition: border-color .2s, transform .2s, background .2s;
}
.mini-service:hover { border-color: var(--blue-200); transform: translateY(-2px); background: var(--surface); color: var(--text); }
.mini-service small { font-weight: 500; color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
    display: inline-flex; align-items: center; gap: 7px;
    height: 36px; padding: 0 14px;
    border-radius: 99px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2); font-size: 13px; font-weight: 600;
    cursor: pointer; white-space: nowrap;
    transition: all .18s;
}
.chip:hover { border-color: var(--blue-200); color: var(--primary-text); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip .count { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--surface-3); color: var(--muted); }
.chip.active .count { background: rgba(255, 255, 255, .22); color: #fff; }
.chips-scroll { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; scrollbar-width: none; }
.chips-scroll::-webkit-scrollbar { display: none; }

/* Info personali */
.cat-chips { display: none !important; }
.cat-nav { display: flex; flex-direction: column; gap: 4px; padding: 10px; }
.cat-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 12px;
    color: var(--text-2); font-weight: 600; font-size: 14px;
}
.cat-link:hover { background: var(--surface-2); color: var(--text); }
.cat-link.active { background: var(--primary-soft); color: var(--primary-text); }
.cat-link .tile-icon { width: 34px; height: 34px; border-radius: 10px; }
.cat-link .count { margin-left: auto; font-size: 12px; color: var(--muted); }

.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding: 20px 24px 24px; }
.info-card {
    position: relative;
    padding: 16px 18px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface-2);
    display: flex; flex-direction: column; gap: 6px;
    min-width: 0;
}
.info-card .ic-label { font-size: 12.5px; font-weight: 650; color: var(--muted); display: flex; align-items: center; gap: 6px; padding-right: 64px; }
.info-card .ic-value { font-size: 15.5px; font-weight: 650; word-break: break-word; }
.info-card .ic-value.masked { letter-spacing: .2em; color: var(--muted); }
.info-card .ic-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.info-card .ic-actions { position: absolute; top: 10px; right: 10px; display: flex; gap: 2px; }
.info-card .ic-notes { font-size: 12.5px; color: var(--muted); }
.suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
.suggestion { border: 1px dashed var(--border-strong); background: transparent; color: var(--text-2); border-radius: 99px; padding: 4px 11px; font-size: 12.5px; cursor: pointer; }
.suggestion:hover { border-color: var(--primary); color: var(--primary-text); border-style: solid; }

/* Documenti */
.doc-icon {
    width: 42px; height: 50px; flex-shrink: 0;
    border-radius: 9px;
    display: grid; place-items: center;
    font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
    color: #fff;
    background: var(--t, var(--primary));
    position: relative;
    clip-path: polygon(0 0, 72% 0, 100% 22%, 100% 100%, 0 100%);
}
.doc-icon::after { content: ""; position: absolute; top: 0; right: 0; width: 28%; height: 22%; background: rgba(255, 255, 255, .35); clip-path: polygon(0 0, 100% 100%, 0 100%); }
.doc-pdf  { --t: #e5484d; }
.doc-img  { --t: #12a37a; }
.doc-doc  { --t: #2f6bf0; }
.doc-xls  { --t: #0f9d58; }
.doc-txt  { --t: #64748b; }
.usage-bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.usage-bar span { display: block; height: 100%; background: var(--gradient); border-radius: inherit; }

/* Sicurezza */
.security-status { display: flex; align-items: center; gap: 16px; }
.shield {
    width: 56px; height: 56px; border-radius: 18px; flex-shrink: 0;
    display: grid; place-items: center; color: #fff;
}
.shield.on { background: linear-gradient(135deg, #12a37a, #22c3a6); box-shadow: 0 10px 22px -10px #12a37a; }
.shield.off { background: linear-gradient(135deg, #e6a20b, #f0c040); box-shadow: 0 10px 22px -10px #e6a20b; }
.shield .icon { width: 26px; height: 26px; }
.qr-box {
    width: 212px; height: 212px; padding: 14px;
    border-radius: var(--radius);
    background: #fff;
    border: 1px solid var(--border);
    display: grid; place-items: center;
}
.qr-box img, .qr-box svg { width: 100%; height: 100%; image-rendering: pixelated; }
.secret-key {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 12px 14px; border-radius: 12px;
    background: var(--surface-3);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; letter-spacing: .08em;
    word-break: break-all;
}
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.codes code { padding: 10px; border-radius: 10px; background: var(--surface-3); text-align: center; font-size: 15px; font-weight: 700; letter-spacing: .06em; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; display: flex; flex-direction: column; gap: 18px; }
.steps li { counter-increment: step; display: flex; gap: 14px; }
.steps li::before {
    content: counter(step);
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
    display: grid; place-items: center;
    font-size: 13px; font-weight: 800;
    background: var(--primary-soft); color: var(--primary-text);
}
.steps li > div { flex: 1; min-width: 0; padding-top: 4px; }
.log-event { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.log-event .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.log-event.ok .dot { background: var(--success); }
.log-event.ko .dot { background: var(--danger); }
.log-event.warn .dot { background: var(--warning); }

/* Profilo */
.profile-cover {
    height: 120px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: var(--gradient-deep);
    position: relative; overflow: hidden;
}
.profile-cover::after { content: ""; position: absolute; width: 300px; height: 300px; right: -60px; top: -160px; border-radius: 50%; background: radial-gradient(circle, rgba(34, 195, 230, .6), transparent 65%); }
.profile-card .card-body { display: flex; flex-direction: column; align-items: center; text-align: center; margin-top: -64px; position: relative; }
.profile-card h2 { font-size: 19px; margin-top: 14px; }
.profile-card .meta { color: var(--muted); font-size: 13.5px; }
.kv { display: flex; flex-direction: column; gap: 0; width: 100%; margin-top: 18px; text-align: left; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); font-size: 13.5px; }
.kv dt, .kv span:first-child { color: var(--muted); }
.kv strong { font-weight: 650; text-align: right; }

/* Moduli in arrivo */
.roadmap { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 18px 24px 22px; }
.roadmap-item {
    display: flex; gap: 12px; align-items: center;
    padding: 12px 14px; border-radius: var(--radius);
    border: 1px dashed var(--border-strong);
    color: var(--text);
}
.roadmap-item:hover { border-color: var(--primary); border-style: solid; color: var(--text); background: var(--surface-2); }
.roadmap-item strong { display: block; font-size: 13.5px; }
.roadmap-item small { color: var(--muted); font-size: 12px; }
.coming-hero { text-align: center; padding: 48px 28px; }
.coming-hero .big-icon {
    width: 88px; height: 88px; border-radius: 28px; margin: 0 auto 18px;
    display: grid; place-items: center; color: #fff;
    background: var(--gradient); box-shadow: 0 20px 40px -18px #2f6bf0;
}
.coming-hero .big-icon .icon { width: 40px; height: 40px; }
.coming-hero h1 { font-size: 28px; margin: 10px 0 8px; }
.coming-hero p { color: var(--muted); max-width: 560px; margin: 0 auto; }
.feature-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 640px; margin: 28px auto 0; text-align: left; }
.feature-list div { display: flex; gap: 10px; align-items: center; padding: 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; font-weight: 600; }
.feature-list .icon { color: var(--success); }

.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.checklist a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text-2); font-size: 13.5px; }
.checklist a:hover { background: var(--surface-2); color: var(--text); }
.checklist .tick { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--border-strong); color: transparent; flex-shrink: 0; }
.checklist .done .tick { background: var(--success); border-color: var(--success); color: #fff; }
.checklist .done span:last-child { text-decoration: line-through; color: var(--muted); }
.checklist .tick .icon { width: 12px; height: 12px; stroke-width: 3; }

/* Bottom nav (smartphone) */
.bottom-nav { display: none; }

/* 13. AUTH ----------------------------------------------------------------- */
.auth-body { background: var(--bg); }
.auth {
    min-height: 100vh; min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
}
.auth-visual {
    position: relative; overflow: hidden;
    padding: 48px 56px;
    display: flex; flex-direction: column; justify-content: space-between;
    color: #fff;
    background:
        radial-gradient(70% 55% at 85% 10%, rgba(34, 195, 230, .45) 0%, transparent 60%),
        radial-gradient(60% 50% at 10% 95%, rgba(91, 140, 247, .5) 0%, transparent 60%),
        linear-gradient(150deg, #081637 0%, #0f2f73 55%, #1a52c4 100%);
    isolation: isolate;
}
.auth-visual::before {
    content: ""; position: absolute; inset: 0; z-index: -1; opacity: .18;
    background-image: linear-gradient(rgba(255, 255, 255, .25) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .25) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 75%);
}
.auth-visual .brand { font-size: 24px; }
.auth-visual h2 { font-size: 40px; line-height: 1.12; letter-spacing: -.03em; max-width: 520px; }
.auth-visual h2 em { font-style: normal; background: linear-gradient(90deg, #7fb1ff, #7fe3ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-visual .lead { color: #c3d4f7; font-size: 16px; max-width: 480px; margin-top: 16px; }
.auth-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 36px; max-width: 540px; }
.auth-feature {
    display: flex; gap: 12px; align-items: center;
    padding: 14px; border-radius: 16px;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .12);
    backdrop-filter: blur(8px);
    font-size: 13.5px; font-weight: 600;
}
.auth-feature .fi { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: rgba(127, 177, 255, .2); color: #a9c8ff; flex-shrink: 0; }
.auth-visual .foot { font-size: 12.5px; color: #8fa6d6; display: flex; gap: 16px; flex-wrap: wrap; }

.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; position: relative; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand-mobile { display: none; margin-bottom: 28px; color: var(--text); }
.auth-card h1 { font-size: 28px; }
.auth-card .sub { color: var(--muted); margin: 8px 0 28px; }
.auth-card form { display: flex; flex-direction: column; gap: 18px; }
.auth-card .row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13.5px; }
.auth-card .secure-note { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 26px; font-size: 12.5px; color: var(--muted); }
.auth-card .alerts { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.auth-theme { position: absolute; top: 20px; right: 20px; }
.strength { display: flex; gap: 4px; margin-top: 2px; }
.strength span { flex: 1; height: 5px; border-radius: 99px; background: var(--surface-3); transition: background .2s; }
.strength[data-score="1"] span:nth-child(-n+1) { background: var(--danger); }
.strength[data-score="2"] span:nth-child(-n+2) { background: var(--warning); }
.strength[data-score="3"] span:nth-child(-n+3) { background: #4fa3f7; }
.strength[data-score="4"] span:nth-child(-n+4) { background: var(--success); }

/* Error pages */
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; text-align: center; }
.error-page .code { font-size: 96px; font-weight: 800; line-height: 1; background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; letter-spacing: -.04em; }
.error-page h1 { font-size: 22px; margin: 12px 0 8px; }
.error-page p { color: var(--muted); margin-bottom: 24px; }

/* 14. RESPONSIVE ----------------------------------------------------------- */
@media (max-width: 1280px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
    .grid-main, .grid-side { grid-template-columns: minmax(0, 1fr); }
    .auth { grid-template-columns: minmax(0, 1fr); }
    .auth-visual { display: none; }
    .auth-card .brand-mobile { display: flex; }
    .cat-chips { display: flex !important; }
    .cat-nav { display: none; }
}

/* Tablet & smartphone: sidebar off-canvas */
@media (max-width: 1023px) {
    .main, .sidebar-collapsed .main { margin-left: 0; }
    .sidebar, .sidebar-collapsed .sidebar { width: min(300px, 86vw); transform: translateX(-102%); box-shadow: var(--shadow-lg); }
    body.sidebar-open .sidebar { transform: none; }
    .sidebar-collapsed .sidebar .brand-name,
    .sidebar-collapsed .sidebar .who,
    .sidebar-collapsed .sidebar .cs-text,
    .sidebar-collapsed .sidebar .cs-arrow,
    .sidebar-collapsed .sidebar .nav-label,
    .sidebar-collapsed .sidebar .chev,
    .sidebar-collapsed .sidebar .nav-link .nav-pill { display: revert; }
    .sidebar-collapsed .sidebar .nav-sub { display: none; }
    .sidebar-collapsed .sidebar .nav-item.open > .nav-sub { display: block; }
    .sidebar-collapsed .sidebar-brand { flex-direction: row; justify-content: space-between; height: var(--topbar-h); padding: 0 16px 0 22px; }
    .sidebar-collapsed .nav-heading { font-size: 10.5px; padding: 14px 12px 6px; }
    .sidebar-collapsed .nav-heading::after { display: none; }
    .sidebar-collapsed .nav-link, .sidebar-collapsed .sidebar-profile, .sidebar-collapsed .context-switch { justify-content: flex-start; padding-left: 12px; padding-right: 12px; }
    .sidebar-toggle .icon-collapse { display: none; }
    .sidebar-backdrop {
        position: fixed; inset: 0; z-index: 55;
        background: rgba(6, 14, 34, .5);
        backdrop-filter: blur(2px);
        opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s;
    }
    body.sidebar-open .sidebar-backdrop { opacity: 1; visibility: visible; }
    body.sidebar-open { overflow: hidden; }
    .topbar { padding: 0 20px; }
    .topbar .menu-btn { display: inline-grid; }
    .content { padding: 24px 20px 40px; }
    .footer { padding: 18px 20px; }
}
@media (min-width: 768px) {
    .hide-desktop { display: none !important; }
}
@media (min-width: 1024px) {
    .sidebar-toggle .icon-close { display: none; }
    .sidebar-backdrop { display: none; }
}

@media (max-width: 767px) {
    body { font-size: 14.5px; }
    .topbar { gap: 8px; padding: 0 14px; height: 64px; }
    .topbar .brand-mobile { display: flex; color: var(--text); font-size: 18px; }
    .topbar .brand-mobile .brand-mark { width: 30px; height: 30px; }
    .myca { display: none; }
    .myca.mobile-open { display: block; position: fixed; left: 12px; right: 12px; top: 8px; z-index: 50; max-width: none; }
    .myca.mobile-open .myca-panel { max-height: calc(100dvh - 90px); overflow-y: auto; }
    .myca kbd { display: none; }
    .myca-toggle { display: inline-grid !important; }
    .topbar-actions { gap: 6px; }
    .icon-btn { width: 40px; height: 40px; }
    .user-btn { padding: 2px; border: 0; background: transparent; }
    .user-btn .name, .user-btn > .icon { display: none; }
    .hide-mobile { display: none !important; }
    .dropdown-menu.wide { position: fixed; left: 12px; right: 12px; top: 70px; width: auto; }

    .content { padding: 18px 14px calc(var(--bottomnav-h) + 28px); }
    .footer { display: none; }
    .page-head { margin-bottom: 18px; }
    .page-head h1 { font-size: 22px; }
    .page-head .actions { width: 100%; }
    .page-head .actions .btn { flex: 1; }
    .grid { gap: 14px; }
    .stack { gap: 14px; }
    .grid-2, .grid-3, .form-grid, .info-grid, .roadmap, .feature-list { grid-template-columns: minmax(0, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mini-services { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px 16px 18px; }
    .card-body { padding: 18px; }
    .card-head { padding: 16px 18px; }
    .list-item { padding: 13px 18px; }
    .info-grid { padding: 16px; }
    .hero { padding: 24px 20px; }
    .hero h1 { font-size: 23px; }
    .hero-grid { flex-direction: column; align-items: flex-start; }
    .hero .ring { width: 104px; height: 104px; }
    .hero .ring strong { font-size: 22px; }
    .kpi { padding: 16px; gap: 10px; }
    .kpi-value { font-size: 24px; }
    .kpi-icon { width: 38px; height: 38px; border-radius: 11px; }
    .toasts { top: 74px; right: 16px; }
    .codes { grid-template-columns: minmax(0, 1fr); }
    dialog.modal { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 22px 22px 0 0; }
    dialog.modal[open] { animation: sheet-in .3s cubic-bezier(.2, .9, .3, 1); }
    .modal-foot .btn { flex: 1; }

    /* Tabelle trasformate in card */
    .table-responsive thead { display: none; }
    .table-responsive tr { display: block; padding: 14px 18px; border-bottom: 1px solid var(--border); }
    .table-responsive td { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border: 0; font-size: 13.5px; }
    .table-responsive td::before { content: attr(data-label); color: var(--muted); font-weight: 600; }
    .table-responsive td.td-main { display: block; padding-bottom: 8px; }
    .table-responsive td.td-main::before { display: none; }

    .bottom-nav {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
        display: grid; grid-template-columns: repeat(5, 1fr);
        height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        background: color-mix(in srgb, var(--surface) 92%, transparent);
        backdrop-filter: saturate(160%) blur(14px);
        -webkit-backdrop-filter: saturate(160%) blur(14px);
        border-top: 1px solid var(--border);
    }
    .bottom-nav a, .bottom-nav button {
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
        border: 0; background: transparent;
        color: var(--muted); font-size: 10.5px; font-weight: 650;
        cursor: pointer;
    }
    .bottom-nav .icon { width: 21px; height: 21px; }
    .bottom-nav .active { color: var(--primary-text); }
    .bottom-nav .active .icon { stroke-width: 2.4; }
    .auth-panel { padding: 28px 18px; align-items: flex-start; padding-top: 56px; }
}
@keyframes sheet-in { from { transform: translateY(100%); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* 15. UTILITY -------------------------------------------------------------- */
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.strong { font-weight: 700; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-1 { gap: 6px; } .gap-2 { gap: 12px; } .gap-3 { gap: 18px; } .wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; min-width: 0; }
.text-center { text-align: center; }
.text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-warning { color: var(--warning); }
.w-100 { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline-form { display: inline; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
[hidden] { display: none !important; }
.auth-icon { width: 54px; height: 54px; border-radius: 16px; margin-bottom: 18px; }

/* ==========================================================================
   16. CREAZIONE ELEMENTI (pattern unico su tutte le schermate)
   ========================================================================== */
.btn-create {
    display: inline-flex; align-items: center; gap: 10px;
    height: 46px; padding: 0 20px 0 6px;
    border: 0; border-radius: 99px;
    color: #fff; font: 700 14px var(--font);
    background: var(--gradient);
    box-shadow: 0 12px 24px -12px rgba(47, 107, 240, .8);
    cursor: pointer; white-space: nowrap;
    transition: transform .15s, box-shadow .2s, filter .2s;
}
.btn-create:hover { color: #fff; filter: brightness(1.05); box-shadow: 0 16px 28px -12px rgba(47, 107, 240, .9); transform: translateY(-1px); }
.btn-create:active { transform: scale(.98); }
.btn-create-icon {
    width: 34px; height: 34px; border-radius: 50%;
    display: grid; place-items: center;
    background: rgba(255, 255, 255, .22);
}
.btn-create-icon .icon { stroke-width: 2.6; }

.modal-icon {
    width: 42px; height: 42px; flex-shrink: 0;
    border-radius: 13px;
    display: grid; place-items: center;
    color: #fff; background: var(--gradient);
    box-shadow: 0 8px 16px -8px rgba(47, 107, 240, .8);
}
.modal-head h3 { font-size: 17px; }
.modal-head p { margin-top: 2px; }

.new-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
    min-height: 260px; padding: 24px;
    border: 2px dashed var(--border-strong);
    background: transparent; box-shadow: none;
    color: var(--text); font: inherit; text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s, transform .2s;
}
.new-card:hover { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-2px); }
.new-card-icon {
    width: 52px; height: 52px; border-radius: 50%;
    display: grid; place-items: center;
    color: #fff; background: var(--gradient);
    box-shadow: 0 10px 20px -10px rgba(47, 107, 240, .8);
    margin-bottom: 4px;
}

.item-menu .dropdown-menu { min-width: 200px; }
.item-menu.on-cover { position: absolute; top: 10px; right: 10px; }
.item-menu.on-cover > .btn-icon { background: rgba(255, 255, 255, .9); color: var(--text); box-shadow: var(--shadow-sm); backdrop-filter: blur(6px); }
.item-menu.on-cover > .btn-icon:hover { background: #fff; }

/* Progetti */
.project-card { display: flex; flex-direction: column; overflow: visible; transition: transform .2s, box-shadow .2s; }
.project-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.project-cover {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: linear-gradient(135deg, var(--t, #2f6bf0), color-mix(in srgb, var(--t, #2f6bf0) 55%, #22c3e6));
    display: grid; place-items: center;
}
.project-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.project-initial { font-size: 44px; font-weight: 800; color: rgba(255, 255, 255, .9); letter-spacing: -.03em; }
.project-body { padding: 18px 20px 10px; flex: 1; }
.project-body h3 { font-size: 16px; margin-bottom: 6px; }
.project-body p { font-size: 13.5px; color: var(--muted); }
.project-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 20px 16px; }
.project-foot .xs { display: inline-flex; align-items: center; gap: 5px; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.share-list { border: 1px solid var(--border); border-radius: var(--radius); }
.share-list .list-item { padding: 10px 12px; }

.dropzone-image { min-height: 150px; overflow: hidden; }
.dropzone-image img[data-image-preview] { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.dropzone-image.has-preview > :not(img):not(input) { visibility: hidden; }

/* Comunicazioni */
.channel-icon {
    width: 44px; height: 44px; flex-shrink: 0;
    border-radius: 13px;
    display: grid; place-items: center; color: #fff;
}
.channel-icon.is-mail { background: linear-gradient(135deg, #2f6bf0, #22a7e6); box-shadow: 0 8px 16px -8px rgba(47, 107, 240, .8); }
.channel-icon.is-whatsapp { background: linear-gradient(135deg, #1fb855, #25d366); box-shadow: 0 8px 16px -8px rgba(37, 211, 102, .8); }
.channel-card { display: flex; flex-direction: column; gap: 16px; padding: 20px; scroll-margin-top: 90px; }
.channel-card:target { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.channel-card h3 { font-size: 15.5px; }
.channel-card .btn:disabled { opacity: .7; }

.choice-group + .choice-group { margin-top: 22px; }
.choice-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice {
    display: flex; align-items: center; gap: 12px;
    padding: 14px;
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--text); font: inherit; text-align: left;
    cursor: pointer;
    transition: border-color .2s, background .2s, transform .2s;
}
.choice:hover { border-color: var(--primary); background: var(--surface); transform: translateY(-1px); }
.choice strong { display: block; font-size: 14px; }
.choice small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.4; }

.nav-sub li { position: relative; }
.nav-sub a .truncate { flex: 1; min-width: 0; }
.nav-sub a.nav-sub-add {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    width: 26px; height: 26px; border-radius: 8px;
    display: grid !important; place-items: center; padding: 0 !important;
    color: var(--primary-text) !important; background: var(--primary-soft) !important;
}
.nav-sub a.nav-sub-add::before { display: none; }
.nav-sub a.nav-sub-add:hover { background: var(--primary) !important; color: #fff !important; }
.nav-sub li:has(.nav-sub-add) > a:first-child { padding-right: 38px; }
.channel-dot { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; flex-shrink: 0; color: #fff; }
.channel-dot .icon { width: 12px; height: 12px; }
.channel-dot.is-mail { background: #2f6bf0; }
.channel-dot.is-whatsapp { background: #25d366; }

@media (max-width: 767px) {
    /* Il pulsante "+" diventa flottante sopra la barra di navigazione */
    .page-head .btn-create {
        position: fixed; z-index: 44;
        right: 16px; bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom) + 16px);
        width: 58px; height: 58px; padding: 0;
        justify-content: center;
        flex: none !important;
    }
    .page-head .btn-create .btn-create-label { display: none; }
    .page-head .btn-create .btn-create-icon { width: 58px; height: 58px; background: transparent; }
    .page-head .btn-create .btn-create-icon .icon { width: 26px; height: 26px; }
    .choice-grid { grid-template-columns: minmax(0, 1fr); }
    .new-card { min-height: 140px; }
}

/* Persone (rubrica) */
.contact-card { display: flex; flex-direction: column; gap: 14px; padding: 20px; transition: transform .2s, box-shadow .2s; }
.contact-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.contact-top { display: flex; align-items: center; gap: 14px; }
.contact-top h3 { font-size: 15.5px; }
.contact-avatar {
    width: 52px; height: 52px; flex-shrink: 0;
    border-radius: 50%; overflow: hidden;
    display: grid; place-items: center;
    color: #fff; font-weight: 750; font-size: 17px;
    background: linear-gradient(135deg, var(--t), color-mix(in srgb, var(--t) 55%, #22c3e6));
    box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px color-mix(in srgb, var(--t) 30%, transparent);
}
.contact-avatar img { width: 100%; height: 100%; object-fit: cover; }
.contact-info { list-style: none; margin: 0; padding: 12px 14px; display: flex; flex-direction: column; gap: 7px; border-radius: var(--radius); background: var(--surface-2); font-size: 13.5px; color: var(--text-2); min-width: 0; }
.contact-info li { display: flex; align-items: center; gap: 9px; min-width: 0; }
.contact-info .icon { color: var(--muted); }
.contact-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: auto; }
.contact-actions { display: flex; gap: 6px; }
.contact-actions .btn-icon { width: 34px; height: 34px; }
.contact-actions .is-wa { color: #1fa855; background: rgba(37, 211, 102, .12); }
.contact-actions .is-wa:hover { background: rgba(37, 211, 102, .22); color: #17873f; }
.tint-badge { color: var(--t); background: color-mix(in srgb, var(--t) 12%, transparent); }

.photo-picker { display: flex; align-items: center; gap: 16px; }
.dropzone-round { width: 84px; height: 84px; min-height: 0; padding: 0; border-radius: 50%; flex-shrink: 0; cursor: pointer; }
.dropzone-round .icon { width: 22px; height: 22px; }
a.choice { color: var(--text); }

/* ==========================================================================
   17. PASSWORD MANAGER
   ========================================================================== */
.btn.is-disabled { opacity: .55; pointer-events: none; }

.vault-orb {
    position: relative;
    width: 84px; height: 84px; border-radius: 26px;
    display: grid; place-items: center;
    color: #fff;
    background: var(--gradient-deep);
    box-shadow: 0 20px 40px -18px rgba(20, 60, 160, .8), inset 0 1px 0 rgba(255, 255, 255, .25);
    isolation: isolate;
}
.vault-orb .icon { width: 34px; height: 34px; }
.vault-orb::before {
    content: ""; position: absolute; inset: -10px; border-radius: 32px; z-index: -1;
    background: conic-gradient(from 0deg, rgba(47, 107, 240, .0), rgba(34, 195, 230, .55), rgba(139, 124, 246, .5), rgba(47, 107, 240, .0));
    filter: blur(10px); opacity: .8;
    animation: orb-spin 6s linear infinite;
}
.vault-orb.is-open { background: var(--gradient); }
.vault-orb.is-locked::after {
    content: ""; position: absolute; inset: -4px; border-radius: 30px;
    border: 2px solid rgba(47, 107, 240, .35);
    animation: orb-pulse 2.4s ease-out infinite;
}
.vault-orb.sm { width: 42px; height: 42px; border-radius: 14px; }
.vault-orb.sm::before { inset: -5px; border-radius: 18px; filter: blur(6px); }
.vault-orb.sm .icon { width: 18px; height: 18px; }
@keyframes orb-spin { to { transform: rotate(360deg); } }
@keyframes orb-pulse { from { transform: scale(1); opacity: .9; } to { transform: scale(1.35); opacity: 0; } }

/* Schermata di blocco */
.vault-lock {
    max-width: 520px; margin: 12px auto 0;
    padding: 44px 36px 30px;
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
    background:
        radial-gradient(80% 60% at 50% 0%, rgba(47, 107, 240, .10), transparent 70%),
        var(--surface);
}
.vault-lock h2 { font-size: 22px; margin-top: 18px; }
.vault-lock > p { max-width: 400px; }
.vault-lock.is-blurred { filter: blur(3px); pointer-events: none; user-select: none; }
.vault-unlock { width: 100%; max-width: 320px; display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.vault-facts { list-style: none; margin: 18px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.vault-facts li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); }
.vault-facts .icon { color: var(--success); }

/* Barra superiore (vault sbloccato) */
.vault-bar { display: flex; align-items: center; gap: 18px; padding: 14px 18px; flex-wrap: wrap; }
.vault-status { display: flex; align-items: center; gap: 12px; }
.vault-status strong { display: block; font-size: 14px; }
.vault-status small { font-size: 12.5px; }
.vault-timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text); }
.vault-timer.is-ending { color: var(--danger); }
.vault-search { min-width: 220px; }

/* Card credenziale */
.vault-card { display: flex; flex-direction: column; gap: 14px; padding: 20px; transition: transform .2s, box-shadow .2s; }
.vault-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.vault-card-top { display: flex; align-items: center; gap: 14px; }
.vault-card-top h3 { font-size: 15.5px; }
.site-icon {
    width: 46px; height: 46px; flex-shrink: 0; border-radius: 14px;
    display: grid; place-items: center;
    color: #fff; font-weight: 800; font-size: 19px;
    background: linear-gradient(135deg, var(--t), color-mix(in srgb, var(--t) 55%, #22c3e6));
    box-shadow: 0 8px 16px -10px var(--t);
}
.secret-rows { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.secret-row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 2px 4px;
    padding: 8px 8px 8px 14px; min-width: 0;
}
.secret-row + .secret-row { border-top: 1px solid var(--border); }
.secret-label { grid-column: 1 / -1; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.secret-value { font-size: 14px; font-weight: 600; color: var(--text); min-width: 0; word-break: break-all; }
.secret-row:first-child .secret-value { grid-column: 1 / 3; }
.secret-value.is-masked { letter-spacing: .14em; color: var(--muted); }
.secret-row .btn-icon { width: 32px; height: 32px; }
.vault-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.vault-card-foot .xs { display: inline-flex; align-items: center; gap: 6px; }

/* Form credenziali */
.generator { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.generator label { display: inline-flex; align-items: center; gap: 8px; }
.generator input[type=range] { accent-color: var(--primary); width: 120px; }
.generator output { font-weight: 700; color: var(--text); min-width: 18px; }

/* Benvenuto */
.vault-welcome { width: min(640px, calc(100vw - 24px)); }
.welcome-hero {
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
    padding: 34px 28px 22px;
    background:
        radial-gradient(70% 80% at 50% 0%, rgba(47, 107, 240, .14), transparent 70%),
        linear-gradient(180deg, var(--primary-soft), transparent);
    border-bottom: 1px solid var(--border);
}
.welcome-hero .vault-orb { margin-bottom: 8px; }
.welcome-hero h3 { font-size: 20px; }
.welcome-hero p { color: var(--muted); max-width: 460px; font-size: 14px; }
.welcome-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.welcome-features > div { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.welcome-features strong { display: block; font-size: 13.5px; }
.welcome-features small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.45; margin-top: 2px; }
.consent-box {
    display: flex; gap: 12px; align-items: flex-start;
    margin-top: 16px; padding: 14px 16px;
    border-radius: var(--radius); border: 1.5px solid var(--blue-200);
    background: var(--primary-soft);
    font-size: 13px; line-height: 1.5; color: var(--text-2);
    cursor: pointer;
}
.consent-box input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--primary); flex-shrink: 0; }
.welcome-dots { display: inline-flex; gap: 6px; margin-right: 6px; }
.welcome-dots i { width: 8px; height: 8px; border-radius: 99px; background: var(--border-strong); }
.welcome-dots i.on { width: 22px; background: var(--primary); }
.extension-badge { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.extension-badge > span:not(.ext-plus) {
    width: 64px; height: 64px; border-radius: 20px;
    display: grid; place-items: center; color: #fff;
    box-shadow: 0 14px 28px -14px rgba(20, 60, 160, .8);
}
.extension-badge .icon { width: 30px; height: 30px; }
.ext-chrome { background: linear-gradient(135deg, #ea4335, #fbbc05 50%, #34a853); }
.ext-key { background: var(--gradient); }
.ext-plus { font-size: 22px; font-weight: 800; color: var(--muted); }

/* Gate 2FA */
.vault-gate { display: grid; grid-template-columns: 280px minmax(0, 1fr); overflow: hidden; }
.vault-gate-visual {
    display: grid; place-items: center;
    background:
        radial-gradient(80% 60% at 30% 20%, rgba(34, 195, 230, .35), transparent 70%),
        var(--gradient-deep);
}
.vault-gate-visual .vault-orb { width: 110px; height: 110px; border-radius: 34px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .25); backdrop-filter: blur(6px); }
.vault-gate-visual .vault-orb .icon { width: 44px; height: 44px; }
.vault-gate-body { padding: 32px 36px; }
.vault-gate-body h2 { font-size: 22px; margin: 12px 0 8px; }
.vault-gate-body > p { color: var(--muted); max-width: 620px; }

@media (max-width: 767px) {
    .vault-lock { padding: 32px 20px 24px; }
    .vault-bar { gap: 12px; }
    .vault-bar form { width: 100%; }
    .vault-bar form .btn { width: 100%; }
    .vault-search { min-width: 0; width: 100%; flex-basis: 100%; }
    .welcome-features { grid-template-columns: minmax(0, 1fr); }
    .vault-gate { grid-template-columns: minmax(0, 1fr); }
    .vault-gate-visual { padding: 28px; }
    .vault-gate-body { padding: 24px 20px; }
    .welcome-hero { padding: 26px 18px 18px; }
}
@media (prefers-reduced-motion: reduce) {
    .vault-orb::before, .vault-orb.is-locked::after { animation: none; }
}

/* Collegamento estensione (layout di accesso) */
.ext-connect { display: flex; flex-direction: column; gap: 16px; }
.ext-connect .extension-badge, .ext-connect .vault-orb { margin-bottom: 6px; }
.ext-connect h1 { font-size: 24px; }
.ext-connect .sub { margin: 0; }
.ext-connect form { gap: 16px; }
.ext-connect .consent-box { margin-top: 0; }
[data-handoff-icon].is-spinning .icon { animation: orb-spin 1.2s linear infinite; }
.ext-panel { overflow: hidden; scroll-margin-top: 90px; }
.ext-panel-hero {
    display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
    padding: 22px 24px;
    background: radial-gradient(70% 120% at 0% 0%, rgba(47, 107, 240, .10), transparent 70%), var(--surface-2);
    border-bottom: 1px solid var(--border);
}
.ext-panel-hero .extension-badge { margin: 0; }
.ext-panel-hero .extension-badge > span:not(.ext-plus) { width: 52px; height: 52px; border-radius: 16px; }
.ext-panel-hero .extension-badge .icon { width: 24px; height: 24px; }
.ext-panel-hero h2 { font-size: 17px; }
.ext-panel-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; padding: 22px 24px 24px; }
.ext-steps { gap: 12px; }
@media (max-width: 767px) {
    .ext-panel-body { grid-template-columns: minmax(0, 1fr); padding: 18px; }
    .ext-panel-hero { padding: 18px; }
    .ext-panel-hero .btn { width: 100%; }
}
.auth-visual .brand, .auth-visual .brand:hover { color: #fff; }
.auth-visual .brand-name span { color: #7fb1ff; }
.ext-status { display: inline-flex; }
.ext-ready { height: 40px; padding: 0 14px; font-size: 13px; }

/* Pagine pubbliche / legali */
.public-head { max-width: 860px; margin: 0 auto; padding: 28px 24px 8px; }
.public-main { max-width: 860px; margin: 0 auto; padding: 12px 24px 32px; }
.legal { padding: 36px 40px; line-height: 1.7; }
.legal h1 { font-size: 26px; margin-bottom: 6px; }
.legal h2 { font-size: 17px; margin: 26px 0 8px; }
.legal p, .legal li { color: var(--text-2); }
.legal ul { padding-left: 20px; margin: 0; display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 767px) { .legal { padding: 24px 20px; } }
