/* ==========================================================================
   BackupHub — foglio di stile principale
   I colori arrivano dalle variabili CSS generate da Theme::styleTag()
   ========================================================================== */

*, *::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;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; } h3 { font-size: 1.1rem; } h4 { font-size: 1rem; }
p { margin: 0 0 1em; }
code, pre, .mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: .88em; }
code { background: var(--surface-2); border: 1px solid var(--border); padding: .1em .4em; border-radius: 6px; }
pre { background: var(--surface-2); border: 1px solid var(--border); padding: 14px; border-radius: var(--radius); overflow: auto; white-space: pre-wrap; word-break: break-word; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.icon { flex-shrink: 0; vertical-align: middle; }
[hidden] { display: none !important; }

/* Utility ----------------------------------------------------------------- */
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.xsmall { font-size: .76rem; }
.text-right { text-align: right; } .text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.break { word-break: break-all; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.end { justify-content: flex-end; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 16px; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 36px; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.grid { display: grid; gap: 20px; }
.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)); }
.span-2 { grid-column: span 2; }
.text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-warning { color: var(--warning); } .text-info { color: var(--info); } .text-primary { color: var(--primary); }
.only-mobile { display: none !important; }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .hide-mobile { display: none !important; }
  .only-mobile { display: inline-flex !important; }
}

/* Layout area riservata --------------------------------------------------- */
.app-shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--sidebar); color: var(--sidebar-text); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; overflow-y: auto; z-index: 40;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 14px; color: #fff; font-weight: 700; font-size: 1.08rem; text-decoration: none; }
.brand .logo { max-height: 34px; max-width: 180px; }
.logo-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--primary); color: var(--primary-text); }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-dark { display: inline; } :root[data-theme="dark"] .logo-light { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-dark { display: inline; } :root:not([data-theme="light"]) .logo-light { display: none; } }
.sidebar .logo-light { display: none; } .sidebar .logo-dark { display: inline; }
.nav { padding: 6px 12px 20px; flex: 1; }
.nav-group { margin-top: 14px; }
.nav-group-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; opacity: .55; padding: 0 10px 6px; font-weight: 600; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 9px; color: var(--sidebar-text);
  font-size: .92rem; text-decoration: none !important; transition: background .15s, color .15s;
}
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link.active { background: var(--primary); color: var(--primary-text); }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: .7rem; padding: 1px 7px; border-radius: 99px; }
.sidebar-footer { padding: 12px 22px; font-size: .75rem; opacity: .5; }
.sidebar-backdrop { display: none; }
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 14px 28px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30;
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 1.2rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p { margin: 0; color: var(--muted); font-size: .85rem; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.content { padding: 26px 28px 40px; flex: 1; width: 100%; max-width: 1400px; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-bottom: 18px; }
.banner { display: flex; align-items: center; gap: 8px; padding: 9px 28px; font-size: .88rem; border-bottom: 1px solid var(--border); }
.banner-warning { background: color-mix(in srgb, var(--warning) 14%, var(--surface)); }
.banner-danger { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); }
.app-footer { border-top: 1px solid var(--border); padding: 16px 28px; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; transform: translateX(-100%); transition: transform .2s; }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 35; }
  .topbar { padding: 10px 16px; }
  .content { padding: 18px 16px 32px; }
  .banner { padding: 8px 16px; }
  .user-chip-name { display: none; }
  .app-footer { padding: 14px 16px; }
}

/* Topbar controls --------------------------------------------------------- */
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border); text-decoration: none; }
.dot-badge { position: absolute; top: 2px; right: 0; background: var(--danger); color: #fff; font-size: .62rem; min-width: 17px; height: 17px; border-radius: 99px; display: grid; place-items: center; padding: 0 4px; font-weight: 700; }
.user-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 3px 10px 3px 3px; border-radius: 99px; cursor: pointer; font: inherit; }
.user-chip:hover { background: var(--surface-2); }
.theme-icon-dark { display: none; }
:root[data-theme="dark"] .theme-icon-dark { display: inline; } :root[data-theme="dark"] .theme-icon-light { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-icon-dark { display: inline; } :root:not([data-theme="light"]) .theme-icon-light { display: none; } }

/* Dropdown ---------------------------------------------------------------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 220px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 12px 32px rgba(0,0,0,.16); padding: 6px; display: none; z-index: 60;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-right { left: auto; right: 0; }
.dropdown-menu a, .dropdown-menu button {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border-radius: 8px; color: var(--text);
  background: none; border: 0; font: inherit; font-size: .9rem; text-align: left; cursor: pointer; text-decoration: none;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); }
.dropdown-menu button.active { color: var(--primary); font-weight: 600; }
.dropdown-menu form { margin: 0; }
.dropdown-header { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; display: flex; flex-direction: column; }
.dropdown-header small { color: var(--muted); }

/* Avatar ------------------------------------------------------------------ */
.avatar { border-radius: 50%; object-fit: cover; display: inline-block; flex-shrink: 0; }
.avatar-initials { display: inline-grid; place-items: center; color: #fff; font-weight: 650; }

/* Card -------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(16,24,40,.04); min-width: 0; }
.card + .card { margin-top: 20px; }
.grid > .card + .card { margin-top: 0; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-title { margin: 0; font-size: 1rem; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.card-subtitle { margin: 2px 0 0; color: var(--muted); font-size: .85rem; }
.card-body { padding: 20px; }
.card-body.p-0 { padding: 0; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.card-danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.card-danger .card-header { background: color-mix(in srgb, var(--danger) 8%, var(--surface)); border-radius: var(--radius) var(--radius) 0 0; }

/* Statistiche ------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; }
.stat-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 13%, transparent); color: var(--primary); flex-shrink: 0; }
.stat-icon.success { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.stat-icon.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.stat-icon.warning { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.stat-icon.info { background: color-mix(in srgb, var(--info) 14%, transparent); color: var(--info); }
.stat-label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat-value { font-size: 1.55rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-meta { font-size: .8rem; color: var(--muted); }

/* Bottoni ----------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: calc(var(--radius) - 3px);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .9rem; font-weight: 550;
  cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: filter .15s, background .15s; line-height: 1.3;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary); filter: brightness(1.08); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: var(--success); filter: brightness(1.08); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger); filter: brightness(1.08); }
.btn-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn-ghost { background: transparent; }
.btn-outline-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, var(--border)); background: transparent; }
.btn-outline-danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn-sm { padding: 6px 11px; font-size: .83rem; }
.btn-xs { padding: 3px 8px; font-size: .76rem; border-radius: 7px; }
.btn-lg { padding: 12px 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.btn .spinner { width: 14px; height: 14px; }

/* Form -------------------------------------------------------------------- */
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }
label, .label { display: block; font-weight: 550; font-size: .88rem; margin-bottom: 6px; }
.form-control, input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search],
input[type=tel], input[type=date], input[type=datetime-local], input[type=time], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: calc(var(--radius) - 4px); background: var(--surface);
  color: var(--text); font: inherit; font-size: .93rem; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 110px; resize: vertical; }
textarea.code { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; min-height: 260px; }
input:focus, select:focus, textarea:focus, .form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
input[type=color] { width: 46px; height: 38px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; }
input[type=file] { font: inherit; font-size: .88rem; }
input[readonly] { background: var(--surface-2); }
.form-hint { font-size: .8rem; color: var(--muted); margin-top: 5px; }
.form-error { font-size: .82rem; color: var(--danger); margin-top: 5px; }
.is-invalid { border-color: var(--danger) !important; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 20px; }
.input-group { display: flex; }
.input-group > input, .input-group > select { border-radius: calc(var(--radius) - 4px) 0 0 calc(var(--radius) - 4px); flex: 1; min-width: 0; }
.input-group > .btn { border-radius: 0 calc(var(--radius) - 4px) calc(var(--radius) - 4px) 0; border-left: 0; }
.check { display: flex; align-items: flex-start; gap: 9px; font-weight: 450; cursor: pointer; margin-bottom: 10px; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--primary); flex-shrink: 0; }
.check small { display: block; color: var(--muted); font-weight: 400; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer; margin: 0; font-weight: 450; }
.switch:last-child { border-bottom: 0; }
.switch small { display: block; color: var(--muted); font-weight: 400; }
.switch input { appearance: none; width: 42px; height: 24px; border-radius: 99px; background: var(--border); position: relative; cursor: pointer; flex-shrink: 0; transition: background .2s; border: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(18px); }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.radio-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; display: flex; gap: 10px; align-items: flex-start; font-weight: 450; margin: 0; }
.radio-card:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent); }
.radio-card input { accent-color: var(--primary); margin-top: 3px; }
.radio-card small { display: block; color: var(--muted); }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 42px; }
.password-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; }

/* Tabelle ----------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions form { display: inline; }
.table-compact td, .table-compact th { padding: 7px 12px; }
.cell-title { font-weight: 600; }
.cell-sub { font-size: .8rem; color: var(--muted); }
.kv { display: grid; grid-template-columns: minmax(140px, 32%) 1fr; gap: 0; font-size: .9rem; }
.kv > div { padding: 9px 0; border-bottom: 1px solid var(--border); }
.kv > div:nth-child(odd) { color: var(--muted); padding-right: 12px; }
.kv > div:nth-last-child(-n+2) { border-bottom: 0; }

/* Badge, alert ------------------------------------------------------------ */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: .74rem; font-weight: 650; white-space: nowrap; line-height: 1.6; }
.badge-success { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.badge-danger { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.badge-warning { background: color-mix(in srgb, var(--warning) 18%, transparent); color: var(--warning); }
.badge-info { background: color-mix(in srgb, var(--info) 15%, transparent); color: var(--info); }
.badge-primary { background: color-mix(in srgb, var(--primary) 15%, transparent); color: var(--primary); }
.badge-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid; font-size: .92rem; }
.alert > div { flex: 1; }
.alert p:last-child { margin-bottom: 0; }
.alert-success { background: color-mix(in srgb, var(--success) 10%, var(--surface)); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.alert-success > .icon { color: var(--success); }
.alert-error, .alert-danger { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.alert-error > .icon, .alert-danger > .icon { color: var(--danger); }
.alert-warning { background: color-mix(in srgb, var(--warning) 11%, var(--surface)); border-color: color-mix(in srgb, var(--warning) 38%, transparent); }
.alert-warning > .icon { color: var(--warning); }
.alert-info { background: color-mix(in srgb, var(--info) 10%, var(--surface)); border-color: color-mix(in srgb, var(--info) 32%, transparent); }
.alert-info > .icon { color: var(--info); }
.alert-close { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; }

/* Tabs -------------------------------------------------------------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; scrollbar-width: thin; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 550; font-size: .9rem; text-decoration: none !important; background: none; border-top: 0; border-left: 0; border-right: 0; cursor: pointer; font-family: inherit; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; } .tab-panel.active { display: block; }

/* Progress ---------------------------------------------------------------- */
.progress { height: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 99px; transition: width .6s ease; }
.progress-bar.success { background: var(--success); } .progress-bar.danger { background: var(--danger); } .progress-bar.warning { background: var(--warning); }
.progress-bar.animated { background-image: linear-gradient(45deg, rgba(255,255,255,.22) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.22) 50%, rgba(255,255,255,.22) 75%, transparent 75%); background-size: 18px 18px; animation: stripes 1s linear infinite; }
@keyframes stripes { to { background-position: 18px 0; } }
.progress-lg { height: 16px; }
.progress-label { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Paginazione ------------------------------------------------------------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; font-size: .85rem; }
.pagination-info { color: var(--muted); }
.pagination-links { display: flex; gap: 4px; flex-wrap: wrap; }
.page-link { min-width: 32px; height: 32px; padding: 0 9px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid var(--border); color: var(--text); text-decoration: none !important; background: var(--surface); }
.page-link:hover { background: var(--surface-2); }
.page-link.active { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.page-link.disabled, .page-link.dots { opacity: .45; pointer-events: none; }

/* Filtri / toolbar -------------------------------------------------------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.toolbar input, .toolbar select { width: auto; min-width: 160px; padding: 7px 10px; font-size: .88rem; }
.toolbar .grow input { width: 100%; }

/* Empty state, timeline, liste --------------------------------------------- */
.empty-state { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-state .icon { opacity: .45; margin-bottom: 10px; }
.empty-state h3 { color: var(--text); margin-bottom: 6px; }
.list { list-style: none; padding: 0; margin: 0; }
.list-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item.unread { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.list-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--primary); flex-shrink: 0; }

/* Modal ------------------------------------------------------------------- */
dialog.modal { border: 1px solid var(--border); border-radius: calc(var(--radius) + 2px); padding: 0; background: var(--surface); color: var(--text); width: min(560px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(0,0,0,.3); }
dialog.modal.modal-lg { width: min(860px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(10,12,18,.55); backdrop-filter: blur(2px); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { margin: 0; }
.modal-body { padding: 20px; max-height: 70vh; overflow-y: auto; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; background: var(--surface-2); }

/* Pagine pubbliche -------------------------------------------------------- */
.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 16px; }
body.public { display: flex; flex-direction: column; min-height: 100vh; }
.public-header { background: color-mix(in srgb, var(--surface) 88%, transparent); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; backdrop-filter: blur(10px); }
.public-header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 12px; }
.public-header .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.08rem; }
.public-nav { display: flex; align-items: center; gap: 10px; }
.public-nav > a:not(.btn) { color: var(--text); font-weight: 500; font-size: .92rem; padding: 6px 8px; }
.public-main { flex: 1; }
.site-footer { border-top: 1px solid var(--border); background: var(--surface); font-size: .86rem; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; align-items: center; padding-top: 22px; padding-bottom: 22px; }
.app-footer .footer-inner { padding: 0; }
.footer-links { display: flex; gap: 6px 18px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); }
.footer-text { margin-bottom: 6px; }

/* Autenticazione ---------------------------------------------------------- */
.auth-wrap { min-height: calc(100vh - 140px); display: grid; place-items: center; padding: 36px 16px; }
.auth-card { width: 100%; max-width: 430px; background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); padding: 32px; box-shadow: 0 18px 50px rgba(16,24,40,.08); }
.auth-card h1 { font-size: 1.45rem; margin-bottom: 4px; }
.auth-card .lead { color: var(--muted); margin-bottom: 24px; font-size: .93rem; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; font-size: .88rem; margin-top: 16px; flex-wrap: wrap; }
.auth-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); margin-bottom: 16px; }
@media (max-width: 520px) { .auth-card { padding: 24px 18px; } }

/* Index esterna ----------------------------------------------------------- */
.hero { padding: 84px 0 64px; position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; inset: -40% -10% auto -10%; height: 520px; background: radial-gradient(closest-side, color-mix(in srgb, var(--primary) 22%, transparent), transparent); z-index: -1; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(2rem, 4.4vw, 3.3rem); line-height: 1.08; letter-spacing: -.025em; margin-bottom: 18px; }
.hero p.lead { font-size: 1.12rem; color: var(--muted); max-width: 580px; margin-bottom: 28px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: .8rem; font-weight: 650; color: var(--primary); background: color-mix(in srgb, var(--primary) 12%, transparent); padding: 5px 12px; border-radius: 99px; margin-bottom: 18px; }
.section { padding: 64px 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { text-align: center; max-width: 660px; margin: 0 auto 40px; }
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.section-head p { color: var(--muted); }
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.section-alt .feature { background: var(--bg); }
.feature-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 13%, transparent); color: var(--primary); margin-bottom: 14px; }
.feature h3 { font-size: 1.05rem; }
.feature p { color: var(--muted); margin: 0; font-size: .93rem; }
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; counter-reset: step; }
.step { position: relative; padding-top: 46px; }
.step::before { counter-increment: step; content: counter(step); position: absolute; top: 0; left: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: var(--primary-text); display: grid; place-items: center; font-weight: 700; }
.step p { color: var(--muted); font-size: .92rem; }
.mock-window { background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); box-shadow: 0 30px 70px rgba(16,24,40,.18); overflow: hidden; }
.mock-bar { display: flex; gap: 6px; padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.mock-bar span { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.mock-body { padding: 18px; display: grid; gap: 12px; }
.mock-row { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; font-size: .88rem; }
.mock-row .grow { display: grid; gap: 6px; }
.cta { text-align: center; padding: 56px 24px; border-radius: calc(var(--radius) + 8px); background: linear-gradient(135deg, var(--primary), var(--accent)); color: var(--primary-text); }
.cta h2 { color: inherit; } .cta p { opacity: .9; }
.cta .btn { background: #fff; color: #111; border-color: #fff; }
@media (max-width: 900px) {
  .hero { padding: 48px 0 40px; } .hero-grid { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr; } .steps { grid-template-columns: 1fr 1fr; }
  .section { padding: 44px 0; }
}
@media (max-width: 520px) { .steps { grid-template-columns: 1fr; } }

/* Pagine legali ----------------------------------------------------------- */
.legal { max-width: 860px; margin: 0 auto; padding: 44px 16px 60px; }
.legal-content { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 36px; }
.legal-content h1 { font-size: 1.8rem; } .legal-content h2 { margin-top: 1.6em; font-size: 1.2rem; }
.legal-content table { width: 100%; border-collapse: collapse; margin: 12px 0 18px; font-size: .9rem; }
.legal-content th, .legal-content td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
@media (max-width: 600px) { .legal-content { padding: 22px 16px; } }

/* Pagine di stato --------------------------------------------------------- */
body.status-page { display: grid; place-items: center; min-height: 100vh; padding: 24px 16px; background: var(--bg, #f4f5f7); color: var(--text, #1d2433); }
.status-card { max-width: 520px; text-align: center; background: var(--surface, #fff); border: 1px solid var(--border, #e3e6ec); border-radius: 18px; padding: 40px 32px; }
.status-code { font-size: 4rem; font-weight: 800; color: var(--primary, #4f46e5); line-height: 1; margin-bottom: 12px; }
.status-icon { color: var(--warning, #c27c0e); margin-bottom: 12px; }
.status-card p { color: var(--muted, #667085); }
.status-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 20px 0 10px; }

/* Cookie bar -------------------------------------------------------------- */
.cookie-bar { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 100; display: flex; justify-content: center; }
.cookie-bar-top { bottom: auto; top: 16px; }
.cookie-bar-inner { max-width: 980px; width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) + 2px); box-shadow: 0 18px 50px rgba(0,0,0,.22); padding: 16px 18px; display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.cookie-bar-text { display: flex; gap: 12px; align-items: flex-start; flex: 1; min-width: 260px; font-size: .9rem; }
.cookie-bar-text .icon { color: var(--primary); margin-top: 2px; }
.cookie-bar-text p { margin: 0; }
.cookie-bar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Varie ------------------------------------------------------------------- */
.code-box { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; word-break: break-all; }
.code-box code { background: none; border: 0; padding: 0; flex: 1; }
.swatch { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(0,0,0,.12); display: inline-block; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot-success { background: var(--success); } .dot-danger { background: var(--danger); } .dot-warning { background: var(--warning); } .dot-info { background: var(--info); }
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 200px; }
.log-box { background: #0d1117; color: #c9d1d9; font-family: ui-monospace, Menlo, monospace; font-size: .8rem; padding: 14px; border-radius: var(--radius); max-height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.divider-text { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .8rem; margin: 18px 0; }
.divider-text::before, .divider-text::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.backup-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; font-family: ui-monospace, Menlo, monospace; font-size: 1rem; }
.backup-codes span { background: var(--surface-2); border: 1px dashed var(--border); border-radius: 8px; padding: 8px; text-align: center; letter-spacing: .08em; }
.news-item { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.news-item:last-child { border-bottom: 0; }
.news-item h4 { margin: 0 0 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.news-body { color: var(--text); font-size: .92rem; }
.news-body p:last-child { margin-bottom: 0; }
