/* ==========================================================================
   Backup Center — interfaccia
   ========================================================================== */
:root {
    --bg: #07080c;
    --bg-2: #0b0d13;
    --surface: rgba(255, 255, 255, .028);
    --surface-2: rgba(255, 255, 255, .045);
    --surface-3: rgba(255, 255, 255, .07);
    --border: rgba(255, 255, 255, .07);
    --border-2: rgba(255, 255, 255, .12);
    --text: #eceef5;
    --text-2: #a4abbd;
    --text-3: #6b7287;
    --accent: #8b9bff;
    --accent-2: #6ee7d8;
    --accent-grad: linear-gradient(135deg, #a5b0ff 0%, #7c8cff 45%, #5fd6c9 100%);
    --ok: #3ddc97;
    --ok-bg: rgba(61, 220, 151, .1);
    --warn: #f5b84a;
    --warn-bg: rgba(245, 184, 74, .1);
    --bad: #ff6b7a;
    --bad-bg: rgba(255, 107, 122, .1);
    --run: #8b9bff;
    --run-bg: rgba(139, 155, 255, .12);
    --radius: 18px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 20px 50px -20px rgba(0, 0, 0, .6);
    --ease: cubic-bezier(.22, 1, .36, 1);
    --font: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
    --mono: "JetBrains Mono", "SF Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
    --sidebar: 264px;
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.55 var(--font);
    font-feature-settings: "cv11", "ss01", "tnum";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.02em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(139, 155, 255, .35); }
.ico { width: 18px; height: 18px; flex: none; }
.mono { font-family: var(--mono); font-size: .92em; letter-spacing: -.01em; }
.muted { color: var(--text-2); }
.text-ok { color: var(--ok); }
.text-warn { color: var(--warn); }
.text-bad { color: var(--bad); }

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 10px; border: 3px solid var(--bg); }

/* Glow di sfondo */
.bg-glow {
    position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background:
        radial-gradient(900px 500px at 85% -10%, rgba(124, 140, 255, .13), transparent 60%),
        radial-gradient(700px 500px at 10% 110%, rgba(95, 214, 201, .07), transparent 60%),
        radial-gradient(600px 300px at 40% 0%, rgba(165, 120, 255, .05), transparent 70%);
}

/* ==========================================================================
   Layout
   ========================================================================== */
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 20;
    display: flex; flex-direction: column; gap: 22px;
    padding: 22px 16px 16px;
    background: linear-gradient(180deg, rgba(12, 14, 20, .82), rgba(9, 10, 15, .9));
    border-right: 1px solid var(--border);
    backdrop-filter: blur(20px);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 8px; }
.brand-mark {
    width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
    background: var(--accent-grad); color: #0b0d14;
    box-shadow: 0 8px 24px -6px rgba(124, 140, 255, .55), inset 0 1px 0 rgba(255,255,255,.5);
}
.brand-mark .ico { width: 20px; height: 20px; stroke-width: 2.1; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 15px; letter-spacing: -.01em; }
.brand-text small { color: var(--text-3); font-size: 12px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    position: relative; display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 11px; color: var(--text-2); font-weight: 500;
    transition: background .2s var(--ease), color .2s var(--ease);
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.is-active { background: var(--surface-3); color: var(--text); }
.nav-item.is-active::before {
    content: ""; position: absolute; left: -16px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0;
    background: var(--accent-grad);
}
.nav-item.is-active .ico { color: var(--accent); }

.sidebar-card {
    margin-top: auto; padding: 16px; border-radius: var(--radius-sm);
    background: linear-gradient(160deg, rgba(124, 140, 255, .1), rgba(95, 214, 201, .04));
    border: 1px solid rgba(139, 155, 255, .16);
}
.sidebar-card-label { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12px; font-weight: 500; }
.sidebar-card-label .ico { width: 14px; height: 14px; }
.countdown { font: 600 24px/1.2 var(--mono); letter-spacing: -.02em; margin: 8px 0 2px; }
.sidebar-card-sub { color: var(--text-3); font-size: 12px; }

.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 10px 6px 0; border-top: 1px solid var(--border); }
.sidebar-user-name { flex: 1; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user form { margin: 0; }
.avatar {
    width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
    background: linear-gradient(135deg, #2a2f45, #1b1f2e); border: 1px solid var(--border-2);
    font-weight: 600; font-size: 13px; color: var(--accent);
}

.main { position: relative; z-index: 1; margin-left: var(--sidebar); min-height: 100vh; }
.page { max-width: 1240px; margin: 0 auto; padding: 40px 44px 80px; animation: page-in .5s var(--ease) both; }
body.is-leaving .page { animation: page-out .18s ease-in both; }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes page-out { to { opacity: 0; transform: translateY(-4px); } }

.reveal { animation: reveal .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms + 60ms); }
@keyframes reveal { from { opacity: 0; transform: translateY(12px) scale(.995); } to { opacity: 1; transform: none; } }

.mobile-nav { display: none; }

/* ==========================================================================
   Testate
   ========================================================================== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; line-height: 1.15; letter-spacing: -.03em; }
.eyebrow { color: var(--text-3); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .09em; margin-bottom: 6px; }
.lead { color: var(--text-2); margin-top: 8px; max-width: 620px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.crumb { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); font-weight: 500; margin-bottom: 18px; transition: color .2s; }
.crumb:hover { color: var(--text); }
.crumb .ico { width: 16px; height: 16px; }
.title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.title-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--text-3); box-shadow: 0 0 0 4px rgba(255,255,255,.04); }
.head-meta { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 10px; color: var(--text-2); }
.head-meta > span { display: inline-flex; align-items: center; gap: 7px; }
.head-meta .ico { width: 15px; height: 15px; color: var(--text-3); }

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 40px 0 16px; gap: 16px; flex-wrap: wrap; }
.section-head h2 { font-size: 18px; }
.legend { display: flex; gap: 16px; color: var(--text-3); font-size: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .n { width: 8px; height: 8px; }

.link { display: inline-flex; align-items: center; gap: 2px; color: var(--accent); font-weight: 500; background: none; border: 0; padding: 0; cursor: pointer; }
.link .ico { width: 15px; height: 15px; transition: transform .2s var(--ease); }
.link:hover .ico { transform: translateX(2px); }

/* ==========================================================================
   Bottoni
   ========================================================================== */
.btn {
    --h: 40px;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: var(--h); padding: 0 16px; border-radius: 11px; border: 1px solid transparent;
    font-weight: 550; font-size: 13.5px; white-space: nowrap; cursor: pointer;
    transition: transform .15s var(--ease), background .2s, border-color .2s, box-shadow .25s, opacity .2s;
    user-select: none;
}
.btn .ico { width: 16px; height: 16px; }
.btn:active { transform: scale(.97); }
.btn:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn[disabled], .btn.is-disabled { opacity: .45; pointer-events: none; }
.btn-primary {
    background: var(--accent-grad); color: #0a0c14;
    box-shadow: 0 8px 22px -8px rgba(124, 140, 255, .65), inset 0 1px 0 rgba(255, 255, 255, .45);
}
.btn-primary:hover { box-shadow: 0 12px 30px -8px rgba(124, 140, 255, .8), inset 0 1px 0 rgba(255, 255, 255, .55); transform: translateY(-1px); }
.btn-ghost { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-3); border-color: var(--border-2); }
.btn-soft { background: rgba(139, 155, 255, .12); color: #c3cbff; border-color: rgba(139, 155, 255, .18); }
.btn-soft:hover { background: rgba(139, 155, 255, .2); }
.btn-danger { background: var(--bad-bg); color: var(--bad); border-color: rgba(255, 107, 122, .25); }
.btn-danger:hover { background: rgba(255, 107, 122, .18); }
.btn-sm { --h: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn-lg { --h: 48px; font-size: 15px; border-radius: 13px; }
.btn-block { width: 100%; }
.btn.is-loading { pointer-events: none; }
.btn.is-loading .ico { animation: spin .8s linear infinite; }

.icon-btn {
    width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px;
    background: transparent; border: 1px solid transparent; color: var(--text-2); cursor: pointer;
    transition: background .2s, color .2s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn-danger:hover { background: var(--bad-bg); color: var(--bad); }

/* ==========================================================================
   Pill, tag, chip
   ========================================================================== */
.pill {
    display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px;
    font-size: 12px; font-weight: 600; letter-spacing: .01em; white-space: nowrap;
    background: var(--surface-3); color: var(--text-2);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-run { background: var(--run-bg); color: var(--run); }
.pill-run::before { animation: pulse 1.4s ease-in-out infinite; }
.tag {
    display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 6px;
    font-size: 11px; font-weight: 600; color: #c9b8ff; background: rgba(165, 120, 255, .13); border: 1px solid rgba(165, 120, 255, .2);
}
.chip { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 550; margin-right: 4px; }
.chip-daily { background: rgba(139, 155, 255, .12); color: #b5bfff; }
.chip-weekly { background: rgba(95, 214, 201, .12); color: #8ff0e2; }
.chip-monthly { background: rgba(245, 184, 74, .12); color: #ffd28a; }

.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); flex: none; position: relative; }
.state-ok .status-dot, .status-dot.state-ok, .title-dot.state-ok { background: var(--ok); box-shadow: 0 0 0 4px rgba(61, 220, 151, .14), 0 0 14px rgba(61, 220, 151, .6); }
.state-warn .status-dot, .status-dot.state-warn, .title-dot.state-warn { background: var(--warn); box-shadow: 0 0 0 4px rgba(245, 184, 74, .14); }
.state-bad .status-dot, .status-dot.state-bad, .title-dot.state-bad { background: var(--bad); box-shadow: 0 0 0 4px rgba(255, 107, 122, .16), 0 0 14px rgba(255, 107, 122, .6); animation: beat 2s ease-in-out infinite; }
.state-run .status-dot, .is-busy .status-dot { background: var(--run); animation: pulse 1.2s ease-in-out infinite; }

@keyframes pulse { 50% { opacity: .35; } }
@keyframes beat { 50% { box-shadow: 0 0 0 7px rgba(255, 107, 122, .06), 0 0 18px rgba(255, 107, 122, .7); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Hero stato
   ========================================================================== */
.hero {
    position: relative; overflow: hidden;
    display: grid; grid-template-columns: auto 1fr auto; gap: 26px; align-items: center;
    padding: 28px 30px; border-radius: 22px; border: 1px solid var(--border);
    background: linear-gradient(120deg, rgba(61, 220, 151, .1), rgba(61, 220, 151, .02) 45%, rgba(255,255,255,.02));
    box-shadow: var(--shadow);
}
.hero::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(500px 200px at 0% 0%, rgba(61, 220, 151, .15), transparent 70%);
}
.hero-warn { background: linear-gradient(120deg, rgba(245, 184, 74, .11), rgba(245, 184, 74, .02) 45%, rgba(255,255,255,.02)); }
.hero-warn::after { background: radial-gradient(500px 200px at 0% 0%, rgba(245, 184, 74, .14), transparent 70%); }
.hero-bad { background: linear-gradient(120deg, rgba(255, 107, 122, .13), rgba(255, 107, 122, .02) 45%, rgba(255,255,255,.02)); border-color: rgba(255, 107, 122, .2); }
.hero-bad::after { background: radial-gradient(500px 200px at 0% 0%, rgba(255, 107, 122, .16), transparent 70%); }
.hero-orb {
    --c: var(--ok);
    position: relative; width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center;
    color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
}
.hero-orb .ico { width: 30px; height: 30px; position: relative; }
.hero-orb span { position: absolute; inset: -1px; border-radius: inherit; border: 1px solid var(--c); opacity: 0; animation: ring 3s var(--ease) infinite; }
.hero-warn .hero-orb { --c: var(--warn); }
.hero-bad .hero-orb { --c: var(--bad); }
@keyframes ring { 0% { opacity: .6; transform: scale(1); } 100% { opacity: 0; transform: scale(1.5); } }
.hero-text h2 { font-size: 22px; letter-spacing: -.025em; }
.hero-text p { color: var(--text-2); margin-top: 4px; }
.hero-meta { display: flex; flex-direction: column; gap: 6px; padding-left: 26px; border-left: 1px solid var(--border); min-width: 220px; position: relative; z-index: 1; }
.hero-meta-row { display: flex; justify-content: space-between; gap: 24px; font-size: 13px; }
.hero-meta-row span { color: var(--text-3); }

/* ==========================================================================
   KPI
   ========================================================================== */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 14px; }
.kpis-3 { grid-template-columns: repeat(3, 1fr); margin: 0 0 14px; }
.kpi {
    position: relative; padding: 20px; border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--surface); box-shadow: var(--shadow); overflow: hidden;
    transition: border-color .25s, transform .3s var(--ease);
}
.kpi:hover { border-color: var(--border-2); transform: translateY(-2px); }
.kpi-icon {
    width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 16px;
    background: var(--surface-3); color: var(--accent);
}
.kpi-icon .ico { width: 17px; height: 17px; }
.kpi-label { color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.kpi-value { font-size: 26px; font-weight: 650; letter-spacing: -.03em; margin: 4px 0 4px; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 14px; font-weight: 500; color: var(--text-2); letter-spacing: 0; }
.kpi-value[data-countdown] { font-family: var(--mono); font-size: 23px; }
.kpi-sub { color: var(--text-3); font-size: 12px; }

/* ==========================================================================
   Card progetto
   ========================================================================== */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.pcard {
    position: relative; padding: 20px; border-radius: var(--radius); border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.015));
    box-shadow: var(--shadow); overflow: hidden; isolation: isolate;
    transition: transform .35s var(--ease), border-color .25s, box-shadow .35s var(--ease);
}
.pcard::before {
    content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0; transition: opacity .35s;
    background: radial-gradient(400px 160px at 50% -20%, rgba(139, 155, 255, .12), transparent 70%);
}
.pcard:hover { transform: translateY(-3px); border-color: var(--border-2); box-shadow: var(--shadow), 0 24px 50px -24px rgba(124, 140, 255, .35); }
.pcard:hover::before { opacity: 1; }
.pcard.state-bad { border-color: rgba(255, 107, 122, .25); }
.pcard.state-bad::before { opacity: 1; background: radial-gradient(400px 160px at 50% -20%, rgba(255, 107, 122, .12), transparent 70%); }
.pcard-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.pcard-link:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.pcard-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pcard-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pcard-title h3 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-ip { display: flex; align-items: center; gap: 6px; color: var(--text-2); margin: 6px 0 16px 19px; font-size: 12.5px; }
.pcard-ip .ico { width: 13px; height: 13px; color: var(--text-3); }

.nights { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; }
.nights-lg { grid-template-columns: repeat(30, 1fr); gap: 5px; }
.n {
    display: block; height: 22px; border-radius: 5px; background: rgba(255, 255, 255, .055);
    transition: transform .2s var(--ease), filter .2s;
}
.nights-lg .n { height: 34px; border-radius: 6px; }
.legend .n { display: inline-block; border-radius: 3px; }
.n-success { background: linear-gradient(180deg, #49e6a3, #2bb67b); }
.n-warning { background: linear-gradient(180deg, #ffc964, #e09a2a); }
.n-failed { background: linear-gradient(180deg, #ff7f8c, #e24b5d); box-shadow: 0 0 12px rgba(255, 107, 122, .45); }
.n-running { background: var(--run); animation: pulse 1.2s infinite; }
.nights .n:hover { transform: scaleY(1.15); filter: brightness(1.2); }
.nights-axis { display: flex; justify-content: space-between; color: var(--text-3); font-size: 12px; margin-top: 10px; }

.pcard-stats { display: grid; grid-template-columns: 1.3fr 1fr .8fr; gap: 10px; margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--border); }
.pcard-stats dt { color: var(--text-3); font-size: 11.5px; margin-bottom: 2px; }
.pcard-stats dd { margin: 0; font-weight: 600; font-size: 13.5px; font-variant-numeric: tabular-nums; }

.pcard-progress, .callout-progress { height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin-top: 16px; }
.pcard-progress span, .callout-progress span {
    display: block; height: 100%; width: 40%; border-radius: inherit; background: var(--accent-grad);
    animation: indet 1.6s var(--ease) infinite;
}
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
.pcard-step { color: var(--text-2); font-size: 12px; margin-top: 8px; }

.pcard-foot { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }
.pcard-foot .btn { position: relative; z-index: 2; }
.badges { display: flex; gap: 6px; }
.badge {
    width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
    background: var(--surface-2); color: var(--text-3); border: 1px solid var(--border);
}
.badge .ico { width: 14px; height: 14px; }
.badge.is-on { color: var(--ok); background: var(--ok-bg); border-color: rgba(61, 220, 151, .2); }
.badge.is-bad { color: var(--bad); background: var(--bad-bg); border-color: rgba(255, 107, 122, .25); }

/* ==========================================================================
   Pannelli
   ========================================================================== */
.panel {
    padding: 22px; border-radius: var(--radius); border: 1px solid var(--border);
    background: var(--surface); box-shadow: var(--shadow); margin-bottom: 14px;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.panel-head h2 { font-size: 16px; display: flex; align-items: center; gap: 9px; }
.panel-head h2 .ico { color: var(--accent); width: 17px; height: 17px; }
.panel-head .muted { font-size: 12.5px; }
.panel-intro { margin: -8px 0 18px; font-size: 13px; }
.panel-note { display: flex; gap: 8px; align-items: flex-start; color: var(--text-2); font-size: 12.5px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.panel-note .ico { width: 15px; height: 15px; color: var(--ok); margin-top: 2px; }
.panel-danger { border-color: rgba(255, 107, 122, .15); background: linear-gradient(180deg, rgba(255, 107, 122, .04), transparent); }
.panel-danger .panel-head h2 { color: #ffb3bb; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.two-col > .panel { margin-bottom: 14px; }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 34px 20px; color: var(--text-2); }
.empty .ico { width: 30px; height: 30px; color: var(--text-3); }
.empty p { max-width: 420px; }
.empty-page { min-height: 60vh; justify-content: center; }
.empty-page h1 { font-size: 26px; color: var(--text); }

/* Lista avvisi */
.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-item { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.alert-item:last-child { border-bottom: 0; }
.alert-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; }
.alert-ico .ico { width: 16px; height: 16px; }
.lvl-error .alert-ico { background: var(--bad-bg); color: var(--bad); }
.lvl-warning .alert-ico { background: var(--warn-bg); color: var(--warn); }
.lvl-info .alert-ico { background: var(--ok-bg); color: var(--ok); }
.alert-body { display: flex; flex-direction: column; min-width: 0; }
.alert-body .muted { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alert-channels { font-size: 11px; color: var(--text-3); font-family: var(--mono); margin-top: 2px; }
.alert-item time { font-size: 12px; white-space: nowrap; }

/* Retention */
.tiers { display: flex; flex-direction: column; gap: 16px; }
.tier-label { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-2); font-weight: 500; margin-bottom: 8px; }
.tier-label span { color: var(--text-3); font-family: var(--mono); }
.tier-slots { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.slot {
    height: 52px; border-radius: 10px; border: 1px dashed var(--border-2);
    display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1;
    transition: transform .25s var(--ease);
}
.slot.is-full { border: 1px solid rgba(139, 155, 255, .25); background: linear-gradient(180deg, rgba(139, 155, 255, .16), rgba(139, 155, 255, .05)); }
.tier:nth-child(2) .slot.is-full { border-color: rgba(95, 214, 201, .25); background: linear-gradient(180deg, rgba(95, 214, 201, .16), rgba(95, 214, 201, .05)); }
.tier:nth-child(3) .slot.is-full { border-color: rgba(245, 184, 74, .25); background: linear-gradient(180deg, rgba(245, 184, 74, .16), rgba(245, 184, 74, .05)); }
.slot.is-full:hover { transform: translateY(-2px); }
.slot strong { font-size: 15px; }
.slot small { font-size: 10.5px; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; }

/* Specifiche */
.spec { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.spec li { display: flex; gap: 14px; align-items: center; padding: 9px 0; }
.spec li > div { display: flex; flex-direction: column; min-width: 0; }
.spec li span.muted, .spec li span.mono { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spec-ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-3); color: var(--accent); flex: none; }
.spec-ico .ico { width: 17px; height: 17px; }
.spec-ico.is-muted { color: var(--text-3); }
.spec-ico.is-warn { color: var(--warn); background: var(--warn-bg); }

/* Tabelle */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
    text-align: left; font-weight: 550; color: var(--text-3); font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em;
    padding: 0 12px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 13px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-click tbody tr { cursor: pointer; transition: background .15s; }
.table-click tbody tr:hover, .table-click tbody tr:focus-visible { background: var(--surface-2); outline: none; }
.row-arrow { width: 24px; color: var(--text-3); }
.row-arrow .ico { width: 16px; height: 16px; transition: transform .2s var(--ease); }
.table-click tr:hover .row-arrow .ico { transform: translateX(3px); color: var(--text); }
.row-msg { color: var(--text-3); font-size: 12px; margin-top: 2px; max-width: 520px; }
.cell-title { display: flex; align-items: center; gap: 10px; }
.mini-ico { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; color: var(--text-3); opacity: .5; }
.mini-ico.on { color: var(--accent); background: var(--run-bg); opacity: 1; }
.mini-ico .ico { width: 14px; height: 14px; }
.offsite { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text-3); }
.offsite .ico { width: 14px; height: 14px; }
.offsite-ok { color: var(--ok); }
.offsite-failed { color: var(--bad); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; align-items: center; gap: 8px; padding: 8px 0; flex-wrap: wrap; }
.timeline .ico { width: 14px; height: 14px; color: var(--text-3); }

/* Come funziona */
.how { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 8px; }
.how-step { display: flex; gap: 14px; padding: 18px; border-radius: var(--radius); border: 1px solid var(--border); background: linear-gradient(180deg, var(--surface), transparent); }
.how-step > span {
    width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex: none;
    background: var(--accent-grad); color: #0a0c14; font-weight: 700; font-size: 13px;
}
.how-step strong { display: block; margin-bottom: 4px; }
.how-step p { color: var(--text-2); font-size: 12.5px; }

/* Callout */
.callout {
    position: relative; display: flex; gap: 14px; align-items: center; padding: 16px 18px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); margin-bottom: 14px; flex-wrap: wrap;
}
.callout > div:not(.callout-progress) { display: flex; flex-direction: column; flex: 1; }
.callout > .ico { width: 20px; height: 20px; }
.callout-warn { background: var(--warn-bg); border-color: rgba(245, 184, 74, .22); }
.callout-warn > .ico { color: var(--warn); }
.callout-run { background: var(--run-bg); border-color: rgba(139, 155, 255, .22); }
.callout-progress { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(139, 155, 255, .25); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }

/* Filtri */
.filters { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.filters-count { margin-left: auto; font-size: 12.5px; }
.select-pill {
    position: relative; display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px;
    border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); transition: border-color .2s;
}
.select-pill:hover { border-color: var(--border-2); }
.select-pill .ico { width: 15px; height: 15px; color: var(--text-3); }
.select-pill select { appearance: none; background: transparent; border: 0; outline: 0; padding-right: 6px; cursor: pointer; font-weight: 500; }
.select-pill select option { background: #12141c; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 18px; }

/* ==========================================================================
   Form
   ========================================================================== */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field-label { font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.field-label em { font-style: normal; color: var(--text-3); font-weight: 400; }
.field-hint { font-size: 11.5px; color: var(--text-3); }
.field input, .field select, .field textarea, .inline-form input, .form-inline-user input {
    width: 100%; height: 42px; padding: 0 13px; border-radius: 11px;
    background: rgba(0, 0, 0, .25); border: 1px solid var(--border-2); outline: none;
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.field textarea { height: auto; padding: 10px 13px; resize: vertical; }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 18px) 18px, calc(100% - 13px) 18px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.field select option { background: #12141c; }
.field input:focus, .field select:focus, .field textarea:focus, .inline-form input:focus, .form-inline-user input:focus {
    border-color: rgba(139, 155, 255, .6); box-shadow: 0 0 0 4px rgba(139, 155, 255, .14); background: rgba(0, 0, 0, .35);
}
.field input[readonly] { color: var(--text-2); background: var(--surface); cursor: not-allowed; }
.form-section { padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.form-section-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; margin-bottom: 14px; }
.form-section-title .ico { width: 16px; height: 16px; color: var(--accent); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.form-switches { display: flex; flex-direction: column; gap: 12px; }
.inline-form, .form-inline-user { display: flex; flex-direction: row; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.users li > div > .tag { align-self: flex-start; margin: 2px 0; }
.inline-form input, .form-inline-user input { flex: 1; min-width: 180px; }

.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
    position: relative; width: 40px; height: 23px; border-radius: 99px; flex: none;
    background: var(--surface-3); border: 1px solid var(--border-2); transition: background .25s var(--ease), border-color .25s;
}
.switch-track span {
    position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: #c8cddb;
    transition: transform .3s var(--ease), background .25s; box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
.switch input:checked + .switch-track { background: rgba(124, 140, 255, .55); border-color: rgba(139, 155, 255, .6); }
.switch input:checked + .switch-track span { transform: translateX(17px); background: #fff; }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px rgba(139, 155, 255, .35); }
.switch > span:last-child { display: flex; flex-direction: column; line-height: 1.35; }
.switch small { color: var(--text-3); font-size: 12px; }

.users { list-style: none; margin: 0; padding: 0; }
.users li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.users li > div { flex: 1; display: flex; flex-direction: column; }
.users li .muted { font-size: 12px; }
.users form { margin: 0; }

/* ==========================================================================
   Modal e drawer
   ========================================================================== */
.modal, .drawer { position: fixed; inset: 0; z-index: 100; visibility: hidden; pointer-events: none; }
.modal.is-open, .drawer.is-open { visibility: visible; pointer-events: auto; }
.modal-backdrop, .drawer-backdrop {
    position: absolute; inset: 0; background: rgba(3, 4, 8, .6); backdrop-filter: blur(6px);
    opacity: 0; transition: opacity .3s var(--ease);
}
.is-open > .modal-backdrop, .is-open > .drawer-backdrop { opacity: 1; }
.modal { display: grid; place-items: center; padding: 20px; }
.modal-panel {
    position: relative; width: min(680px, 100%); max-height: calc(100vh - 40px); overflow-y: auto;
    padding: 26px; border-radius: 22px; background: linear-gradient(180deg, #13151e, #0e1017);
    border: 1px solid var(--border-2); box-shadow: 0 40px 100px -20px rgba(0, 0, 0, .8);
    opacity: 0; transform: translateY(14px) scale(.97); transition: opacity .3s var(--ease), transform .4s var(--ease);
}
.modal.is-open .modal-panel { opacity: 1; transform: none; }
.modal-sm { width: min(420px, 100%); text-align: center; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-head h3 { font-size: 19px; }
.modal-icon { width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; background: var(--warn-bg); color: var(--warn); }
.modal-icon .ico { width: 24px; height: 24px; }
.modal-sm h3 { font-size: 18px; margin-bottom: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.modal-sm .modal-actions { justify-content: center; margin-top: 22px; }

.drawer-panel {
    position: absolute; top: 0; right: 0; bottom: 0; width: min(720px, 100%);
    display: flex; flex-direction: column; background: linear-gradient(180deg, #12141c, #0c0e14);
    border-left: 1px solid var(--border-2); box-shadow: -40px 0 80px -30px rgba(0, 0, 0, .8);
    transform: translateX(100%); transition: transform .45s var(--ease);
}
.drawer.is-open .drawer-panel { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 24px 26px 18px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: 20px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px 26px 30px; }
.run-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.run-meta div { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.run-meta dt { color: var(--text-3); font-size: 11.5px; }
.run-meta dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.run-message { padding: 12px 14px; border-radius: 12px; margin-bottom: 18px; font-size: 13px; }
.run-message.is-bad { background: var(--bad-bg); color: #ffc2c8; border: 1px solid rgba(255, 107, 122, .25); }
.run-message.is-warn { background: var(--warn-bg); color: #ffe0a8; border: 1px solid rgba(245, 184, 74, .25); }
.run-message.is-ok { background: var(--ok-bg); color: #b6f5d8; border: 1px solid rgba(61, 220, 151, .2); }
.log {
    margin: 0; padding: 16px 18px; border-radius: 14px; background: #06070a; border: 1px solid var(--border);
    font: 12px/1.7 var(--mono); color: #b8bfd0; white-space: pre-wrap; word-break: break-word; max-height: none;
}
.log .l-step { color: var(--accent); font-weight: 600; }
.log .l-err { color: var(--bad); }
.log .l-cmd { color: var(--text-3); }
.skeleton { height: 14px; border-radius: 6px; margin: 10px 0; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Toast */
.toasts { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast {
    pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 420px;
    padding: 13px 16px 13px 14px; border-radius: 14px; background: rgba(22, 25, 35, .92); backdrop-filter: blur(16px);
    border: 1px solid var(--border-2); box-shadow: 0 20px 50px -12px rgba(0, 0, 0, .7);
    animation: toast-in .45s var(--ease) both;
}
.toast.is-out { animation: toast-out .3s ease-in both; }
.toast-ico { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.toast-ico .ico { width: 15px; height: 15px; }
.toast-success .toast-ico { background: var(--ok-bg); color: var(--ok); }
.toast-error .toast-ico { background: var(--bad-bg); color: var(--bad); }
.toast-info .toast-ico { background: var(--run-bg); color: var(--run); }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

/* ==========================================================================
   Login
   ========================================================================== */
.login-body { display: grid; place-items: center; min-height: 100vh; overflow: hidden; padding: 20px; }
.login-orbs span {
    position: fixed; border-radius: 50%; filter: blur(80px); opacity: .55; pointer-events: none;
    animation: float 18s ease-in-out infinite;
}
.login-orbs span:nth-child(1) { width: 520px; height: 520px; background: #4e5bd6; top: -180px; right: -120px; }
.login-orbs span:nth-child(2) { width: 420px; height: 420px; background: #1f8f84; bottom: -160px; left: -100px; animation-delay: -6s; opacity: .4; }
.login-orbs span:nth-child(3) { width: 300px; height: 300px; background: #7a4fd6; top: 40%; left: 55%; animation-delay: -12s; opacity: .25; }
@keyframes float { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(40px, 30px) scale(1.08); } 66% { transform: translate(-30px, 20px) scale(.95); } }
.login-grid {
    position: fixed; inset: 0; pointer-events: none;
    background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse at center, #000 20%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 70%);
}
.login-wrap { position: relative; z-index: 1; width: min(410px, 100%); }
.login-card {
    padding: 38px 34px 28px; border-radius: 26px; text-align: center;
    background: linear-gradient(180deg, rgba(22, 25, 36, .78), rgba(13, 15, 22, .85));
    border: 1px solid rgba(255, 255, 255, .09); backdrop-filter: blur(24px);
    box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 50px 120px -30px rgba(0, 0, 0, .9);
    animation: login-in .8s var(--ease) both;
}
@keyframes login-in { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
.login-logo {
    width: 60px; height: 60px; margin: 0 auto 18px; border-radius: 18px; display: grid; place-items: center;
    background: var(--accent-grad); color: #0b0d14;
    box-shadow: 0 16px 40px -10px rgba(124, 140, 255, .7), inset 0 1px 0 rgba(255,255,255,.55);
}
.login-logo .ico { width: 30px; height: 30px; stroke-width: 2; }
.login-card h1 { font-size: 24px; letter-spacing: -.03em; }
.login-card > .muted { margin-top: 4px; }
.login-form { display: flex; flex-direction: column; gap: 16px; margin-top: 28px; text-align: left; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .ico { position: absolute; left: 14px; width: 17px; height: 17px; color: var(--text-3); pointer-events: none; transition: color .2s; }
.input-wrap input { padding-left: 42px !important; height: 48px !important; border-radius: 13px !important; }
.input-wrap:focus-within > .ico { color: var(--accent); }
.input-action { position: absolute; right: 6px; width: 36px; height: 36px; display: grid; place-items: center; border: 0; background: none; color: var(--text-3); cursor: pointer; border-radius: 9px; }
.input-action:hover { color: var(--text); background: var(--surface-3); }
.input-action .ico { width: 17px; height: 17px; }
.login-form .btn { margin-top: 6px; }
.login-form .btn .ico { transition: transform .25s var(--ease); }
.login-form .btn:hover .ico { transform: translateX(3px); }
.login-alert { display: flex; gap: 10px; align-items: center; text-align: left; margin-top: 20px; padding: 11px 14px; border-radius: 12px; font-size: 13px; animation: shake .45s var(--ease); }
.login-alert .ico { width: 16px; height: 16px; flex: none; }
.login-alert.is-error { background: var(--bad-bg); color: #ffc2c8; border: 1px solid rgba(255, 107, 122, .25); }
.login-alert.is-info, .login-alert.is-success { background: var(--run-bg); color: #ccd3ff; border: 1px solid rgba(139, 155, 255, .25); animation: none; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.login-foot { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 22px; color: var(--text-3); font-size: 12px; }
.login-foot .ico { width: 13px; height: 13px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1180px) {
    .kpis { grid-template-columns: repeat(2, 1fr); }
    .how { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 980px) {
    .sidebar { display: none; }
    .main { margin-left: 0; }
    .page { padding: 26px 18px 110px; }
    .two-col { grid-template-columns: 1fr; }
    .hero { grid-template-columns: auto 1fr; }
    .hero-meta { grid-column: 1 / -1; border-left: 0; padding-left: 0; border-top: 1px solid var(--border); padding-top: 14px; }
    .mobile-nav {
        position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 50; display: grid; grid-template-columns: repeat(4, 1fr);
        padding: 6px; border-radius: 18px; background: rgba(16, 18, 26, .88); backdrop-filter: blur(20px);
        border: 1px solid var(--border-2); box-shadow: 0 20px 50px -10px rgba(0, 0, 0, .8);
    }
    .mobile-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; border-radius: 13px; color: var(--text-3); font-size: 10.5px; font-weight: 500; }
    .mobile-nav a.is-active { color: var(--text); background: var(--surface-3); }
    .mobile-nav a.is-active .ico { color: var(--accent); }
    .toasts { bottom: 96px; left: 16px; right: 16px; align-items: stretch; }
}
@media (max-width: 640px) {
    .kpis, .kpis-3, .how, .form-grid { grid-template-columns: 1fr; }
    .page-head h1 { font-size: 25px; }
    .pgrid { grid-template-columns: 1fr; }
    .nights-lg { gap: 3px; }
    .nights-lg .n { height: 26px; border-radius: 4px; }
    .run-meta { grid-template-columns: 1fr 1fr; }
    .tier-slots { gap: 4px; }
    .slot { height: 44px; }
}

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