/* ==========================================================================
   BW Panel - design system
   I colori sono variabili CSS generate da App\Core\Theme (vedi <style> nel layout)
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.5;
    color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.3rem; } h3 { font-size: 1.1rem; } h4 { font-size: 1rem; }
p { margin: 0 0 1em; }
code, kbd, pre, .mono { font-family: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace; font-size: .88em; }
code { background: var(--surface-2); border: 1px solid var(--border); padding: .08em .38em; border-radius: 5px; word-break: break-all; }
pre { background: var(--surface-2); border: 1px solid var(--border); padding: 12px 14px; border-radius: 8px; overflow: auto; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.hidden { display: none !important; }
.icon { width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 24px; height: 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ----------------------------------------------------------------- shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 260px; flex-shrink: 0; background: var(--sidebar-bg); color: var(--sidebar-text);
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 40;
    border-right: 1px solid color-mix(in srgb, var(--sidebar-text) 10%, transparent);
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 14px; }
.brand-link { display: flex; align-items: center; gap: 10px; color: inherit; font-weight: 700; font-size: 1.08rem; text-decoration: none !important; min-width: 0; }
.brand-link .brand-name { color: var(--sidebar-text); filter: brightness(1.35); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-logo { max-height: 36px; max-width: 200px; object-fit: contain; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 40%, transparent); }
.brand-mark .icon { width: 20px; height: 20px; }
.brand-mark-lg { width: 44px; height: 44px; border-radius: 12px; }
.brand-mark-lg .icon { width: 26px; height: 26px; }
.sidebar .sidebar-close { display: none; color: var(--sidebar-text); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; scrollbar-width: thin; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; opacity: .55; padding: 16px 10px 6px; font-weight: 600; }
.nav-link {
    display: flex; align-items: center; gap: 11px; padding: 8.5px 10px; border-radius: calc(var(--radius) * .7);
    color: var(--sidebar-text); font-weight: 500; margin-bottom: 1px; position: relative; transition: background .15s, color .15s;
}
.nav-link:hover { background: color-mix(in srgb, var(--sidebar-text) 9%, transparent); text-decoration: none; }
.nav-link.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-text); }
.nav-link .icon { width: 18px; height: 18px; opacity: .9; }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.nav-dot { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; }
.nav-dot-warning { background: var(--warning); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warning) 30%, transparent); }
.sidebar-footer { padding: 12px 22px; font-size: .75rem; opacity: .5; }
.sidebar-backdrop { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: 62px; display: flex; align-items: center; gap: 14px; padding: 0 24px; background: var(--topbar-bg); color: var(--topbar-text);
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30;
}
.topbar .topbar-menu { display: none; }
.topbar-title { flex: 1; min-width: 0; }
.breadcrumbs { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs span:last-child { color: var(--topbar-text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.breadcrumbs .sep { opacity: .5; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-bell { position: relative; }
.bell-count { position: absolute; top: 3px; right: 2px; background: var(--danger); color: #fff; font-size: .62rem; font-weight: 700; min-width: 16px; height: 16px; border-radius: 99px; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--topbar-bg); }
.user-chip { display: flex; align-items: center; gap: 8px; background: none; border: 1px solid transparent; color: inherit; padding: 4px 8px 4px 4px; border-radius: 99px; cursor: pointer; font: inherit; }
.user-chip:hover { background: var(--surface-2); border-color: var(--border); }
.user-chip-name { font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.content { flex: 1; padding: 28px; max-width: 1440px; width: 100%; margin: 0 auto; }
.footer { display: flex; justify-content: space-between; gap: 12px; padding: 16px 28px; font-size: .8rem; color: var(--text-muted); border-top: 1px solid var(--border); flex-wrap: wrap; }

.banner { display: flex; align-items: center; gap: 12px; padding: 10px 24px; font-size: .9rem; border-bottom: 1px solid var(--border); }
.banner > span { flex: 1; }
.banner form { margin: 0; }
.banner-info { background: var(--info-soft); color: var(--text); }
.banner-warning { background: var(--warning-soft); color: var(--text); }
.banner-danger { background: var(--danger-soft); color: var(--text); }
.banner-success { background: var(--success-soft); color: var(--text); }
.banner > .icon { color: var(--primary); }
.banner-warning > .icon { color: var(--warning); }
.banner-danger > .icon { color: var(--danger); }

/* ----------------------------------------------------------------- page header */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header h1 { margin: 0; display: flex; align-items: center; gap: 10px; }
.page-header p { margin: 4px 0 0; color: var(--text-muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ----------------------------------------------------------------- buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8.5px 15px; border-radius: calc(var(--radius) * .7);
    border: 1px solid transparent; font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; line-height: 1.2; white-space: nowrap;
    transition: background .15s, border-color .15s, box-shadow .15s, transform .05s; text-decoration: none !important; user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: var(--primary-contrast); box-shadow: 0 1px 2px rgba(0,0,0,.08), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 88%, #000); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.btn-secondary:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--border) 60%, var(--text)); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-danger-soft:hover { background: color-mix(in srgb, var(--danger) 20%, var(--surface)); }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-sm { padding: 5.5px 10px; font-size: .82rem; }
.btn-lg { padding: 11px 20px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border-radius: 10px; background: transparent; border: 0; color: inherit; cursor: pointer; }
.btn-icon:hover { background: var(--surface-2); }
.btn.btn-icon { width: 34px; height: 34px; padding: 0; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid currentColor; border-color: var(--primary-contrast) transparent var(--primary-contrast) transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.btn-secondary.loading::after { border-color: var(--text) transparent var(--text) transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ----------------------------------------------------------------- cards */
.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, .stack > .card + .card, .grid > form.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-header h2, .card-header h3 { margin: 0; font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.card-header p { margin: 2px 0 0; color: var(--text-muted); font-size: .85rem; }
.card-body { padding: 20px; }
.card-body.p0 { padding: 0; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; border-radius: 0 0 var(--radius) var(--radius); }
.card-danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.card-danger .card-header { background: var(--danger-soft); border-radius: var(--radius) var(--radius) 0 0; }

.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)); }
.grid-sidebar { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.grid-sidebar-left { grid-template-columns: 240px minmax(0, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-sm { font-size: .85rem; }
.text-xs { font-size: .76rem; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-600 { font-weight: 600; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.w-100 { width: 100%; }

/* ----------------------------------------------------------------- stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; gap: 14px; align-items: center; }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex-shrink: 0; }
.stat-icon.success { background: var(--success-soft); color: var(--success); }
.stat-icon.warning { background: var(--warning-soft); color: var(--warning); }
.stat-icon.danger { background: var(--danger-soft); color: var(--danger); }
.stat-icon.info { background: var(--info-soft); color: var(--info); }
.stat-icon .icon { width: 22px; height: 22px; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--text-muted); font-size: .83rem; }
.stat-sub { font-size: .76rem; color: var(--text-muted); }

/* ----------------------------------------------------------------- forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 20px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field + .field { margin-top: 16px; }
.form-grid .field + .field, .form-grid-3 .field + .field { margin-top: 0; }
.field + .form-grid, .field + .form-grid-3 { margin-top: 16px; }
label, .label { font-weight: 600; font-size: .86rem; }
.label-hint { font-weight: 400; color: var(--text-muted); }
.input, .select, .textarea {
    width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: calc(var(--radius) * .65); background: var(--surface);
    color: var(--text); font: inherit; font-size: .92rem; transition: border-color .15s, box-shadow .15s; min-height: 40px;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.input::placeholder, .textarea::placeholder { color: color-mix(in srgb, var(--text-muted) 75%, transparent); }
.input[readonly] { background: var(--surface-2); }
.input.is-invalid { border-color: var(--danger); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.textarea.mono, .input.mono { font-family: "JetBrains Mono", Menlo, Consolas, monospace; font-size: .82rem; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.help { font-size: .8rem; color: var(--text-muted); }
.error-text { font-size: .8rem; color: var(--danger); }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: calc(var(--radius) * .65) 0 0 calc(var(--radius) * .65); }
.input-group .btn, .input-group .input-addon { border-radius: 0 calc(var(--radius) * .65) calc(var(--radius) * .65) 0; border: 1px solid var(--border); border-left: 0; }
.input-addon { display: flex; align-items: center; padding: 0 12px; background: var(--surface-2); color: var(--text-muted); font-size: .88rem; }
.input-group .input-prefix { border-radius: calc(var(--radius) * .65) 0 0 calc(var(--radius) * .65); border-left: 1px solid var(--border); border-right: 0; }
.input-group .input-prefix + .input { border-radius: 0 calc(var(--radius) * .65) calc(var(--radius) * .65) 0; }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 44px; }
.password-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; color: var(--text-muted); }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--primary); flex-shrink: 0; }
.check small { display: block; color: var(--text-muted); font-weight: 400; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 40px; height: 22px; background: var(--border); border-radius: 99px; position: relative; transition: background .2s; flex-shrink: 0; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--primary); outline-offset: 2px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: 0; }
.setting-row:first-child { padding-top: 0; }
.setting-row .setting-info { min-width: 0; }
.setting-row .setting-info strong { display: block; font-size: .92rem; }
.setting-row .setting-info span { color: var(--text-muted); font-size: .84rem; }
.setting-row .setting-control { flex-shrink: 0; min-width: 120px; display: flex; justify-content: flex-end; }
.setting-row .setting-control .input, .setting-row .setting-control .select { width: 180px; }
fieldset { border: 0; padding: 0; margin: 0; }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.radio-card { position: relative; display: block; border: 1.5px solid var(--border); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s; font-weight: 400; }
.radio-card input { position: absolute; opacity: 0; }
.radio-card strong { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: .95rem; }
.radio-card span { color: var(--text-muted); font-size: .83rem; display: block; }
.radio-card:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.radio-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.radio-card:has(input:checked)::after { content: ""; position: absolute; top: 12px; right: 12px; width: 18px; height: 18px; border-radius: 50%; background: var(--primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/11px no-repeat; }
.radio-card:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.hp-field { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
.form-section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); font-weight: 700; margin: 26px 0 12px; display: flex; align-items: center; gap: 10px; }
.form-section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.form-section-title:first-child { margin-top: 0; }
input[type=color] { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; }

/* strength meter */
.strength { height: 5px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.strength span { display: block; height: 100%; width: 0; transition: width .25s, background .25s; border-radius: 99px; }

/* ----------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-weight: 600; color: var(--text-muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 16px; 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) 60%, transparent); }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions form { display: inline; }
.table-compact td { padding: 8px 14px; }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-main strong { display: block; }
.cell-main small { color: var(--text-muted); display: block; }

/* ----------------------------------------------------------------- badges / alerts */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2.5px 9px; border-radius: 99px; font-size: .74rem; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.no-dot::before { display: none; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-muted { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.badge-info::before { animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; font-size: .8rem; }
.alert { display: flex; gap: 12px; padding: 12px 16px; border-radius: calc(var(--radius) * .8); border: 1px solid; margin-bottom: 16px; font-size: .9rem; align-items: flex-start; }
.alert > .icon { margin-top: 1px; }
.alert > div { flex: 1; min-width: 0; }
.alert p:last-child { margin-bottom: 0; }
.alert-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.alert-info > .icon { color: var(--info); }
.alert-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.alert-success > .icon { color: var(--success); }
.alert-warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.alert-warning > .icon { color: var(--warning); }
.alert-danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert-danger > .icon { color: var(--danger); }

/* ----------------------------------------------------------------- dropdown */
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(16,24,40,.16); padding: 6px; display: none; z-index: 60; }
.dropdown.open .dropdown-menu { display: block; animation: dropIn .14s ease-out; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-4px); } }
.dropdown-wide { width: 360px; max-width: calc(100vw - 24px); padding: 0; }
.dropdown-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; color: var(--text); background: none; border: 0; font: inherit; font-size: .9rem; cursor: pointer; text-align: left; }
.dropdown-item:hover { background: var(--surface-2); text-decoration: none; }
.dropdown-item .icon { width: 16px; height: 16px; color: var(--text-muted); }
.dropdown-item.text-danger .icon { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: 6px 0; }
.dropdown-user { display: flex; gap: 12px; align-items: center; padding: 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.dropdown-user strong { display: block; }
.dropdown-user small { display: block; color: var(--text-muted); font-size: .8rem; word-break: break-all; }
.dropdown-user .badge { margin-top: 4px; }
.dropdown-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: .9rem; }
.dropdown-body { max-height: 380px; overflow-y: auto; }
.dropdown-empty { padding: 28px 16px; text-align: center; color: var(--text-muted); font-size: .9rem; }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text); }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--surface-2); text-decoration: none; }
.notif-item.unread { background: color-mix(in srgb, var(--primary-soft) 55%, transparent); }
.notif-item strong { display: block; font-size: .88rem; }
.notif-item small { color: var(--text-muted); font-size: .78rem; }
.notif-dot { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: var(--info-soft); color: var(--info); }
.notif-dot .icon { width: 16px; height: 16px; }
.notif-dot.success { background: var(--success-soft); color: var(--success); }
.notif-dot.danger { background: var(--danger-soft); color: var(--danger); }
.notif-dot.warning { background: var(--warning-soft); color: var(--warning); }

/* ----------------------------------------------------------------- avatar */
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; display: inline-grid; place-items: center; }
.avatar-sm { width: 32px; height: 32px; font-size: .8rem; }
.avatar-lg { width: 96px; height: 96px; font-size: 2rem; }
.avatar-xl { width: 128px; height: 128px; font-size: 2.6rem; }
.avatar-initials { background: hsl(var(--h, 230) 55% 52%); color: #fff; font-weight: 700; letter-spacing: .02em; }

/* ----------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; color: var(--text-muted); font-weight: 600; font-size: .9rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; background: none; border-top: 0; border-left: 0; border-right: 0; cursor: pointer; font-family: inherit; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab .icon { width: 16px; height: 16px; }
.tab .count { background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 0 7px; font-size: .72rem; }
.side-menu { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 82px; }
.side-menu a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--text-muted); font-weight: 500; }
.side-menu a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.side-menu a.active { background: var(--surface); color: var(--primary); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.05); border: 1px solid var(--border); }
.side-menu .icon { width: 17px; height: 17px; }

/* ----------------------------------------------------------------- lists / misc */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 13px 20px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item strong { display: block; font-size: .92rem; }
.list-item small { color: var(--text-muted); font-size: .8rem; }
.list-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-muted); flex-shrink: 0; }
.list-icon.success { background: var(--success-soft); color: var(--success); }
.list-icon.danger { background: var(--danger-soft); color: var(--danger); }
.list-icon.warning { background: var(--warning-soft); color: var(--warning); }
.list-icon.primary { background: var(--primary-soft); color: var(--primary); }
.empty { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-icon { width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 18px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.empty-icon .icon { width: 28px; height: 28px; }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty p { max-width: 440px; margin: 0 auto 18px; }
.kv { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 0; font-size: .9rem; }
.kv > div { padding: 9px 0; border-bottom: 1px solid var(--border); min-width: 0; overflow-wrap: anywhere; }
.kv > div:nth-child(odd) { color: var(--text-muted); padding-right: 12px; }
.kv > div:nth-last-child(-n+2) { border-bottom: 0; }
.secret-box { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px dashed var(--border); border-radius: 10px; padding: 8px 8px 8px 14px; }
.secret-box code { background: none; border: 0; padding: 0; flex: 1; font-size: .86rem; overflow-wrap: anywhere; }
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 99px; transition: width .4s; }
.progress.success > span { background: var(--success); }
.progress.danger > span { background: var(--danger); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--text-muted); flex-shrink: 0; }
.dot-success { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.dot-danger { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.dot-warning { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 18px 26px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: -6px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 1px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); }
.timeline li.success::after { border-color: var(--success); background: var(--success); }
.timeline li.danger::after { border-color: var(--danger); background: var(--danger); }
.timeline small { color: var(--text-muted); display: block; }

/* uptime bar */
.uptime { display: flex; gap: 2px; height: 30px; align-items: stretch; }
.uptime span { flex: 1; border-radius: 3px; background: var(--surface-2); min-width: 2px; }
.uptime span.up { background: var(--success); opacity: .85; }
.uptime span.down { background: var(--danger); }
.uptime span.partial { background: var(--warning); }

/* console / job log */
.console { background: #0d1117; color: #c9d1d9; border-radius: var(--radius); padding: 16px 18px; font-family: "JetBrains Mono", Menlo, Consolas, monospace; font-size: .8rem; line-height: 1.6; max-height: 560px; overflow: auto; white-space: pre-wrap; word-break: break-word; border: 1px solid #30363d; }
.console .l-ok { color: #3fb950; } .console .l-err { color: #f85149; } .console .l-warn { color: #d29922; } .console .l-step { color: #79c0ff; font-weight: 700; } .console .l-dim { color: #8b949e; }
.console:empty::before { content: "In attesa di output…"; color: #8b949e; }

/* steps (wizard) */
.steps { display: flex; gap: 0; margin-bottom: 24px; counter-reset: step; }
.steps li { list-style: none; flex: 1; position: relative; text-align: center; font-size: .82rem; color: var(--text-muted); font-weight: 600; padding-top: 38px; }
.steps li::before { counter-increment: step; content: counter(step); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--border); z-index: 1; }
.steps li::after { content: ""; position: absolute; top: 14px; left: calc(-50% + 15px); right: calc(50% + 15px); height: 2px; background: var(--border); }
.steps li:first-child::after { display: none; }
.steps li.done::before { content: "✓"; background: var(--success); border-color: var(--success); color: #fff; }
.steps li.current { color: var(--primary); }
.steps li.current::before { border-color: var(--primary); background: var(--primary); color: #fff; }
.steps li.done::after, .steps li.current::after { background: var(--primary); }

/* pagination */
.pagination { display: flex; align-items: center; gap: 4px; padding: 14px 20px; flex-wrap: wrap; border-top: 1px solid var(--border); }
.pagination a, .pagination span.current { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; padding: 0 8px; font-weight: 600; font-size: .86rem; }
.pagination a { color: var(--text); border: 1px solid var(--border); }
.pagination a:hover { background: var(--surface-2); text-decoration: none; }
.pagination .current { background: var(--primary); color: var(--primary-contrast); }
.pagination-info { margin-left: auto; color: var(--text-muted); font-size: .82rem; }

/* filters bar */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.filters .input, .filters .select { width: auto; min-width: 160px; min-height: 36px; padding-top: 6px; padding-bottom: 6px; }
.filters .search { flex: 1; min-width: 200px; }

/* toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--info); border-radius: 12px; padding: 12px 12px 12px 14px; box-shadow: 0 10px 30px rgba(16,24,40,.18); animation: toastIn .25s ease-out; font-size: .9rem; }
.toast span { flex: 1; padding-top: 1px; }
.toast-success { border-left-color: var(--success); } .toast-success > .icon { color: var(--success); }
.toast-danger { border-left-color: var(--danger); } .toast-danger > .icon { color: var(--danger); }
.toast-warning { border-left-color: var(--warning); } .toast-warning > .icon { color: var(--warning); }
.toast-info > .icon { color: var(--info); }
.toast-close { background: none; border: 0; color: var(--text-muted); cursor: pointer; padding: 0; display: grid; }
.toast-close .icon { width: 16px; height: 16px; }
.toast.out { animation: toastOut .25s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* modal */
.modal { border: 0; padding: 0; border-radius: calc(var(--radius) + 4px); background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(0,0,0,.3); width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 40px); }
.modal-lg { width: min(760px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(10, 12, 20, .55); backdrop-filter: blur(2px); }
.modal[open] { animation: modalIn .18s ease-out; }
@keyframes modalIn { from { opacity: 0; transform: scale(.97) translateY(6px); } }
.modal-box { padding: 26px; }
.modal-icon { width: 46px; height: 46px; border-radius: 14px; background: var(--danger-soft); color: var(--danger); display: grid; place-items: center; margin-bottom: 14px; }
.modal-icon.primary { background: var(--primary-soft); color: var(--primary); }
.modal-title { margin-bottom: 6px; }
.modal-text { color: var(--text-muted); white-space: pre-line; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-header h3 { margin: 0; }
.modal-body { padding: 22px; overflow-y: auto; max-height: calc(100vh - 200px); }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; background: var(--surface-2); }

/* ----------------------------------------------------------------- server cards */
.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; }
.server-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: box-shadow .15s, border-color .15s, transform .15s; color: var(--text); }
.server-card:hover { box-shadow: 0 8px 28px rgba(16,24,40,.09); border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); text-decoration: none; transform: translateY(-1px); }
.server-card-head { display: flex; gap: 12px; align-items: center; padding: 16px 18px 12px; }
.server-card-head .grow { min-width: 0; flex: 1; }
.server-card-head strong { display: block; font-size: 1rem; }
.server-card-head small { color: var(--text-muted); display: block; font-size: .8rem; }
.server-logo { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex-shrink: 0; }
.server-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; padding: 4px 18px 16px; font-size: .82rem; }
.server-meta span { color: var(--text-muted); display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
.server-meta b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.server-card-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 11px 18px; background: var(--surface-2); border-top: 1px solid var(--border); font-size: .8rem; color: var(--text-muted); }
.server-hero { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.server-hero .server-logo { width: 56px; height: 56px; border-radius: 16px; }
.server-hero .server-logo .icon { width: 28px; height: 28px; }

/* ----------------------------------------------------------------- dashboard */
.welcome { background: linear-gradient(120deg, var(--login-from), var(--login-to)); color: #fff; border-radius: calc(var(--radius) + 4px); padding: 26px 28px; margin-bottom: 24px; display: flex; justify-content: space-between; gap: 20px; align-items: center; flex-wrap: wrap; position: relative; overflow: hidden; }
.welcome::after { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: rgba(255,255,255,.08); }
.welcome h1 { color: #fff; margin-bottom: 4px; }
.welcome p { margin: 0; opacity: .85; }
.welcome .btn-secondary { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.25); }
.welcome .btn-secondary:hover { background: rgba(255,255,255,.25); }
.welcome > * { position: relative; z-index: 1; }
.news-item { padding: 16px 20px; border-bottom: 1px solid var(--border); display: block; color: var(--text); }
.news-item:last-child { border-bottom: 0; }
.news-item:hover { background: var(--surface-2); text-decoration: none; }
.news-item h4 { margin: 0 0 4px; display: flex; gap: 8px; align-items: center; }
.news-item p { margin: 0; color: var(--text-muted); font-size: .88rem; }
.news-item small { color: var(--text-muted); font-size: .78rem; }
.prose { line-height: 1.7; }
.prose h3, .prose h4 { margin-top: 1.4em; }
.prose ul { padding-left: 22px; }
.prose blockquote { margin: 0 0 1em; padding: 8px 16px; border-left: 3px solid var(--primary); background: var(--surface-2); border-radius: 0 8px 8px 0; }

/* ----------------------------------------------------------------- captcha */
.bw-captcha { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--border); background: var(--surface-2); border-radius: calc(var(--radius) * .7); padding: 10px 14px; margin: 4px 0 16px; user-select: none; }
.bw-captcha-check { display: flex; align-items: center; gap: 12px; background: none; border: 0; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; padding: 4px 0; }
.bw-captcha-box { width: 26px; height: 26px; border: 2px solid color-mix(in srgb, var(--text-muted) 60%, transparent); border-radius: 6px; background: var(--surface); display: grid; place-items: center; transition: all .2s; flex-shrink: 0; }
.bw-captcha.working .bw-captcha-box { border-color: var(--primary); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.bw-captcha.done .bw-captcha-box { background: var(--success); border-color: var(--success); }
.bw-captcha.done .bw-captcha-box::after { content: ""; width: 12px; height: 7px; border-left: 3px solid #fff; border-bottom: 3px solid #fff; transform: rotate(-45deg) translate(1px, -1px); }
.bw-captcha.error .bw-captcha-box { border-color: var(--danger); }
.bw-captcha-brand { display: flex; flex-direction: column; align-items: center; color: var(--text-muted); font-size: .65rem; text-align: center; }
.bw-captcha-brand .icon { width: 22px; height: 22px; color: var(--primary); }
.bw-captcha-image { margin: 4px 0 16px; display: flex; flex-direction: column; gap: 6px; }
.bw-captcha-image-row { display: flex; align-items: center; gap: 8px; }
.bw-captcha-image img { border-radius: 8px; border: 1px solid var(--border); background: #fff; height: 64px; width: 200px; }
.captcha-box { margin: 4px 0 16px; min-height: 78px; }
.captcha-note { font-size: .72rem; color: var(--text-muted); }

/* ----------------------------------------------------------------- auth pages */
.auth-body { background: var(--bg); }
.auth-shell { display: grid; grid-template-columns: minmax(380px, 46%) 1fr; min-height: 100vh; }
.auth-aside { background: linear-gradient(150deg, var(--login-from), var(--login-to)); background-size: cover; background-position: center; color: #fff; position: relative; overflow: hidden; }
.auth-aside::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 20% 110%, rgba(255,255,255,.14), transparent 50%), radial-gradient(circle at 110% -10%, rgba(255,255,255,.12), transparent 45%); }
.auth-aside-inner { position: relative; display: flex; flex-direction: column; height: 100%; padding: 44px 52px; }
.auth-brand { display: flex; align-items: center; gap: 12px; font-size: 1.3rem; font-weight: 700; }
.auth-brand img { max-height: 46px; max-width: 240px; }
.auth-brand .brand-mark { background: rgba(255,255,255,.18); box-shadow: none; backdrop-filter: blur(6px); }
.auth-hero { margin: auto 0; max-width: 460px; }
.auth-hero h2 { font-size: 2.1rem; line-height: 1.2; color: #fff; margin-bottom: 28px; letter-spacing: -.02em; }
.auth-features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 16px; }
.auth-features li { display: flex; gap: 14px; align-items: center; font-size: 1rem; opacity: .95; }
.auth-features .icon { width: 38px; height: 38px; padding: 9px; border-radius: 12px; background: rgba(255,255,255,.14); flex-shrink: 0; }
.auth-aside-footer { font-size: .8rem; opacity: .7; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 1.75rem; margin-bottom: 6px; }
.auth-card .lead { color: var(--text-muted); margin-bottom: 26px; }
.auth-card .field + .field { margin-top: 16px; }
.auth-links { display: flex; justify-content: space-between; align-items: center; margin: 14px 0 20px; font-size: .88rem; flex-wrap: wrap; gap: 8px; }
.auth-mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 26px; font-size: 1.15rem; }
.auth-alt { margin-top: 22px; text-align: center; font-size: .88rem; color: var(--text-muted); }
.otp-input { font-size: 1.6rem; letter-spacing: .5em; text-align: center; font-family: "JetBrains Mono", Menlo, monospace; padding: 12px; }
.method-switch { display: flex; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); padding: 4px; border-radius: 12px; margin-bottom: 20px; }
.method-switch a, .method-switch button { flex: 1; text-align: center; padding: 8px; border-radius: 9px; font-weight: 600; font-size: .85rem; color: var(--text-muted); background: none; border: 0; cursor: pointer; font-family: inherit; }
.method-switch .active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.notice-box { padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; font-size: .85rem; color: var(--text-muted); margin-bottom: 18px; }

.error-page, .maintenance { text-align: center; padding: 40px 10px; max-width: 520px; margin: 0 auto; }
.error-code { font-size: 5rem; font-weight: 800; line-height: 1; background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; margin-bottom: 10px; }
.maintenance-icon { width: 76px; height: 76px; border-radius: 22px; background: var(--warning-soft); color: var(--warning); display: grid; place-items: center; margin: 0 auto 20px; }
.maintenance-icon .icon { width: 36px; height: 36px; }

/* ----------------------------------------------------------------- avatar cropper */
.cropper { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.cropper-stage { position: relative; width: 280px; height: 280px; border-radius: 16px; overflow: hidden; background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0/20px 20px; touch-action: none; cursor: grab; border: 1px solid var(--border); flex-shrink: 0; }
.cropper-stage.dragging { cursor: grabbing; }
.cropper-stage img { position: absolute; top: 0; left: 0; transform-origin: 0 0; user-select: none; -webkit-user-drag: none; pointer-events: none; max-width: none; }
.cropper-mask { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 9999px rgba(0,0,0,.5); border-radius: 50%; margin: 20px; outline: 2px solid rgba(255,255,255,.9); }
.cropper-controls { display: flex; flex-direction: column; gap: 14px; flex: 1; min-width: 220px; }
.cropper-zoom { display: flex; align-items: center; gap: 10px; }
.cropper-zoom input[type=range] { flex: 1; accent-color: var(--primary); }
.cropper-preview { display: flex; gap: 14px; align-items: center; }
.cropper-preview canvas { border-radius: 50%; border: 1px solid var(--border); }
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 26px; text-align: center; color: var(--text-muted); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone .icon { width: 30px; height: 30px; color: var(--primary); margin-bottom: 6px; }

/* ----------------------------------------------------------------- theme editor */
.theme-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.theme-preset { border: 2px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer; background: var(--surface); padding: 0; font: inherit; color: var(--text); text-align: left; position: relative; }
.theme-preset:has(input:checked), .theme-preset.active { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.theme-preset input { position: absolute; opacity: 0; }
.theme-preview { display: flex; height: 68px; }
.theme-preview .tp-side { width: 30%; }
.theme-preview .tp-main { flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 5px; }
.theme-preview .tp-bar { height: 8px; border-radius: 4px; }
.theme-preview .tp-btn { width: 40%; height: 12px; border-radius: 4px; margin-top: auto; }
.theme-preset-name { padding: 8px 10px; font-weight: 600; font-size: .85rem; border-top: 1px solid var(--border); }
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.color-field { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.color-field label { flex: 1; font-size: .82rem; font-weight: 500; }
.color-field .input { width: 92px; min-height: 32px; padding: 4px 8px; font-family: monospace; font-size: .8rem; }
.image-slot { display: flex; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); }
.image-slot:last-child { border-bottom: 0; }
.image-slot-preview { width: 120px; height: 64px; border-radius: 10px; background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0/14px 14px; border: 1px solid var(--border); display: grid; place-items: center; overflow: hidden; flex-shrink: 0; }
.image-slot-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.image-slot .grow { flex: 1; min-width: 0; }

.code-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.code-list code { display: block; text-align: center; padding: 10px; font-size: .95rem; letter-spacing: .08em; background: var(--surface-2); }
.code-list code.used { text-decoration: line-through; opacity: .45; }
.qr-box { background: #fff; padding: 10px; border-radius: 12px; border: 1px solid var(--border); display: inline-block; }
.qr-box img { width: 200px; height: 200px; display: block; }
.cve-item { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.cve-item:last-child { border-bottom: 0; }
.sev-critical { color: #fff; background: #9f1239; } .sev-high { color: #fff; background: var(--danger); } .sev-medium { color: #fff; background: var(--warning); } .sev-low { background: var(--info-soft); color: var(--info); }

/* ----------------------------------------------------------------- responsive */
@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-sidebar { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
    .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0,0,0,.3); }
    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; }
    .sidebar .sidebar-close, .topbar .topbar-menu { display: inline-grid; }
    .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
    .grid-sidebar-left { grid-template-columns: minmax(0, 1fr); }
    .side-menu { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; }
    .side-menu a { white-space: nowrap; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .auth-mobile-brand { display: flex; }
}
@media (max-width: 640px) {
    body { font-size: 14px; }
    .content { padding: 16px; }
    .topbar { padding: 0 12px; }
    .footer { padding: 14px 16px; }
    .banner { padding: 10px 16px; flex-wrap: wrap; }
    .user-chip-name { display: none; }
    .grid-4 { grid-template-columns: minmax(0, 1fr); }
    .form-grid, .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
    .form-grid .span-2 { grid-column: auto; }
    .card-body { padding: 16px; }
    .card-header { padding: 14px 16px; }
    .list-item { padding: 12px 16px; }
    .setting-row { flex-direction: column; align-items: flex-start; gap: 10px; }
    .setting-row .setting-control { justify-content: flex-start; width: 100%; }
    .setting-row .setting-control .input, .setting-row .setting-control .select { width: 100%; }
    .page-header h1 { font-size: 1.35rem; }
    .server-grid { grid-template-columns: minmax(0, 1fr); }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat { padding: 12px; gap: 10px; }
    .stat-icon { width: 36px; height: 36px; }
    .stat-value { font-size: 1.2rem; }
    .kv { grid-template-columns: 1fr; }
    .kv > div:nth-child(odd) { padding-bottom: 0; border-bottom: 0; font-size: .8rem; }
    .welcome { padding: 20px; }
    .cropper-stage { width: 240px; height: 240px; }
    .steps li { font-size: 0; }
    .table-stack thead { display: none; }
    .table-stack tr { display: block; border-bottom: 1px solid var(--border); padding: 8px 0; }
    .table-stack td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 6px 16px; text-align: right; }
    .table-stack td::before { content: attr(data-label); font-weight: 600; color: var(--text-muted); font-size: .78rem; text-align: left; }
    .table-stack td.actions { justify-content: flex-end; }
    .table-stack td.actions::before { display: none; }
    .code-list { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* account module */
.account-main { min-width: 0; }
.account-main .grow { flex: 1; min-width: 0; }
.account-main .grid > .card + .card { margin-top: 0; }
.account-main .stats { margin-bottom: 20px; }
.account-avatar-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.account-totp-setup { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.account-totp-setup > .grow { min-width: min(100%, 260px); }
.account-code-group { max-width: 320px; }
.account-code-input { letter-spacing: .3em; font-size: 1.05rem; text-align: center; }
.account-checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: .9rem; }
.account-checklist li { display: flex; gap: 8px; align-items: flex-start; }
.account-recovery-status { display: flex; align-items: center; gap: 18px; }
.account-recovery-status .stat-value { font-size: 2rem; }
.account-recovery-status .stat-value small { font-size: .9rem; font-weight: 500; }
.account-stat-text { font-size: 1.15rem; }
.account-narrow { max-width: 360px; }
@media (max-width: 640px) {
    .account-avatar-row .avatar-xl { width: 88px; height: 88px; font-size: 1.8rem; }
    .account-main .hide-xs { display: none; }
}

/* admin module */
a.stat { color: var(--text); transition: border-color .15s, box-shadow .15s; }
a.stat:hover { text-decoration: none; border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); box-shadow: 0 4px 16px rgba(16,24,40,.06); }
.mail-preview { display: block; width: 100%; height: 560px; border: 1px solid var(--border); border-radius: calc(var(--radius) * .7); background: #eef0f4; }
button.chip { cursor: pointer; font: inherit; font-size: .78rem; color: var(--text); }
button.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip a { display: inline-grid; color: var(--text-muted); }
@media (max-width: 640px) { .mail-preview { height: 420px; } }

/* modalità chiara / scura */
.mode-toggle .mode-icon { display: none; }
:root[data-mode=auto] .mode-icon-auto, :root[data-mode=light] .mode-icon-light, :root[data-mode=dark] .mode-icon-dark { display: inline-grid; }
.auth-main { position: relative; }
.auth-mode-toggle { position: absolute; top: 18px; right: 18px; color: var(--text-muted); border: 1px solid var(--border); background: var(--surface); }
.mode-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mode-card-preview { height: 54px; border-radius: 8px; margin-bottom: 10px; border: 1px solid var(--border); display: flex; overflow: hidden; }
.mode-card-preview span { flex: 1; }
.mode-card-preview .mp-l { background: linear-gradient(180deg, #ffffff 0 30%, #f4f5f8 30%); }
.mode-card-preview .mp-d { background: linear-gradient(180deg, #171a21 0 30%, #0f1115 30%); }
html { transition: background-color .2s; }
@media (max-width: 640px) { .mode-cards { grid-template-columns: 1fr; } }
