:root {
    --brand: #1d4ed8;
    --brand-dark: #1e3a8a;
    --brand-soft: #dbeafe;
    --text: #111827;
    --muted: #6b7280;
    --border: #d1d5db;
    --border-soft: #e5e7eb;
    --surface: #ffffff;
    --surface-muted: #f3f4f6;
    --surface-glass: rgba(255,255,255,.92);
    --success: #047857;
    --warning: #b45309;
    --danger: #b91c1c;
    --shadow: 0 24px 80px rgba(15,23,42,.14);
}

* { box-sizing: border-box; }
html { min-height: 100%; font-size: 16px; }
body {
    margin: 0;
    min-height: 100vh;
    background: #0f172a;
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.site-background {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at 1px 1px, rgba(219,234,254,.28) 1.2px, transparent 1.2px),
        radial-gradient(circle at top left, rgba(59,130,246,.34), transparent 34rem),
        linear-gradient(135deg, rgba(15,23,42,.92), rgba(30,64,175,.74)),
        url('/img/tagliabuegomme-nov2020-027-9058.webp');
    background-attachment: fixed, fixed, fixed, fixed;
    background-position: top left, top left, center, center;
    background-size: 18px 18px, auto, auto, cover;
}

.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.site-header { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--border-soft); box-shadow: 0 1px 2px rgba(15,23,42,.05); backdrop-filter: blur(16px); }
.header-content { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 14px; color: var(--brand-dark); text-decoration: none; }
.brand-logo { display: block; width: 178px; max-width: 48vw; height: auto; }
.brand-portal-name { border-left: 1px solid var(--border-soft); padding-left: 14px; color: #475569; font-size: .75rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 14px; background: var(--brand); color: white; box-shadow: 0 12px 24px rgba(37,99,235,.25); }
.brand-mark svg { width: 24px; height: 24px; }
.brand-text { display: grid; gap: 2px; color: #0f172a; font-size: 1rem; font-weight: 800; line-height: 1.1; }
.brand-text small { color: var(--muted); font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.header-meta { display: flex; align-items: center; justify-content: flex-end; gap: 14px; flex-wrap: wrap; }
.environment-banner { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #fcd34d; border-radius: 999px; background: #fef3c7; color: #92400e; padding: 7px 12px; font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.environment-banner span { width: 8px; height: 8px; border-radius: 999px; background: #f59e0b; box-shadow: 0 0 0 4px rgba(245,158,11,.18); }
.theme-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; border: 1px solid var(--border-soft); border-radius: 999px; background: #f8fafc; color: #334155; padding: 0 12px; font: inherit; font-size: .84rem; font-weight: 800; cursor: pointer; transition: background-color .16s ease, border-color .16s ease, color .16s ease; }
.theme-toggle:hover { background: #eff6ff; border-color: #bfdbfe; color: var(--brand); }
.theme-toggle-icon { width: 18px; height: 18px; }
.theme-toggle-icon-sun { display: none; }
.nav-links { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav-link { display: inline-flex; align-items: center; min-height: 38px; border-radius: 10px; padding: 0 12px; color: #374151; font-size: .88rem; font-weight: 700; text-decoration: none; background: transparent; border: 0; cursor: pointer; transition: background-color .16s ease, color .16s ease; }
.nav-link:hover { background: #f3f4f6; color: var(--brand); }
.nav-link.active { background: #eff6ff; color: var(--brand-dark); }
.nav-button { font-family: inherit; }
.inline-form { display: inline; margin: 0; }
.main-shell { flex: 1; padding: 40px 0 56px; }
.site-footer { border-top: 1px solid rgba(255,255,255,.18); padding: 20px 0; color: rgba(255,255,255,.72); font-size: .85rem; background: rgba(15,23,42,.34); }

.hero { position: relative; overflow: hidden; padding: 56px; border: 1px solid rgba(191,219,254,.85); border-radius: 28px; background: var(--surface-glass); box-shadow: var(--shadow); }
.hero::after { content: ""; position: absolute; right: -120px; top: -120px; width: 300px; height: 300px; border-radius: 999px; background: rgba(59,130,246,.13); }
.hero h1 { position: relative; margin: 0; max-width: 780px; font-size: clamp(2rem, 5vw, 4rem); line-height: 1.05; color: #0f172a; letter-spacing: -.04em; }
.hero p { position: relative; max-width: 720px; margin: 20px 0 0; color: #374151; font-size: 1.08rem; line-height: 1.7; }
.actions { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }

.button, button.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--brand); background: var(--brand); color: white; font-weight: 800; text-decoration: none; cursor: pointer; box-shadow: 0 10px 20px rgba(37,99,235,.18); transition: background-color .16s ease, border-color .16s ease, color .16s ease; }
.button:hover, button.button:hover { background: #1d4ed8; border-color: #1d4ed8; }
.button.secondary { background: white; color: var(--brand); box-shadow: none; }
.button.secondary:hover { background: #eff6ff; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.card { border: 1px solid var(--border-soft); border-radius: 20px; background: var(--surface-glass); padding: 24px; box-shadow: 0 18px 44px rgba(15,23,42,.10); }
.card h2, .card h3 { margin-top: 0; color: var(--text); }
.card p { color: var(--muted); line-height: 1.6; }
.page-title { margin: 0 0 24px; color: white; font-size: 2rem; letter-spacing: -.025em; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: 18px; background: var(--surface-glass); box-shadow: 0 18px 44px rgba(15,23,42,.10); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 16px; border-bottom: 1px solid #e5e7eb; text-align: left; font-size: .92rem; }
th { color: var(--muted); font-size: .75rem; text-transform: uppercase; background: var(--surface-muted); }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 10px; font-size: .78rem; font-weight: 700; background: #e0f2fe; color: #0369a1; }
.badge.success { background: #dcfce7; color: var(--success); }
.badge.warning { background: #fef3c7; color: var(--warning); }
.badge.danger { background: #fee2e2; color: var(--danger); }

.form-card { max-width: 560px; margin: 0 auto; }
.form-grid { display: grid; gap: 16px; }
label { display: grid; gap: 6px; color: #374151; font-size: .9rem; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 11px 12px; color: var(--text); font: inherit; background: white; outline: none; transition: border-color .16s ease, box-shadow .16s ease; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.16); }
textarea { min-height: 130px; resize: vertical; }
.alert { border-radius: 12px; padding: 14px 16px; margin-bottom: 20px; border: 1px solid #fecaca; color: var(--danger); background: #fef2f2; }
.muted { color: rgba(255,255,255,.78); line-height: 1.6; }
.card .muted, .form-card .muted { color: var(--muted); }
.details-list { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 12px 18px; margin: 22px 0 0; }
.details-list dt { color: var(--muted); font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.details-list dd { margin: 0; color: var(--text); font-weight: 700; overflow-wrap: anywhere; }
code { border-radius: 8px; background: var(--surface-muted); color: #0f172a; padding: 3px 6px; font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: .92em; }

html.theme-dark body { background: #020617; color: #e5e7eb; }
html.theme-dark .site-background {
    background:
        radial-gradient(circle at 1px 1px, rgba(147,197,253,.20) 1.2px, transparent 1.2px),
        radial-gradient(circle at top left, rgba(37,99,235,.28), transparent 34rem),
        linear-gradient(135deg, rgba(2,6,23,.95), rgba(15,23,42,.88)),
        url('/img/tagliabuegomme-nov2020-027-9058.webp');
    background-attachment: fixed, fixed, fixed, fixed;
    background-position: top left, top left, center, center;
    background-size: 18px 18px, auto, auto, cover;
}
html.theme-dark .site-header { background: rgba(15,23,42,.94); border-bottom-color: rgba(148,163,184,.24); box-shadow: 0 1px 2px rgba(0,0,0,.35); }
html.theme-dark .brand-logo { filter: brightness(0) invert(1); }
html.theme-dark .brand-portal-name { border-left-color: rgba(148,163,184,.28); color: #cbd5e1; }
html.theme-dark .brand-text { color: #f8fafc; }
html.theme-dark .brand-text small { color: #94a3b8; }
html.theme-dark .theme-toggle { background: rgba(30,41,59,.92); border-color: rgba(148,163,184,.28); color: #cbd5e1; }
html.theme-dark .theme-toggle:hover { background: rgba(51,65,85,.92); border-color: rgba(147,197,253,.42); color: #bfdbfe; }
html.theme-dark .theme-toggle-icon-moon { display: none; }
html.theme-dark .theme-toggle-icon-sun { display: block; }
html.theme-dark .nav-link { color: #cbd5e1; }
html.theme-dark .nav-link:hover { background: rgba(51,65,85,.82); color: #bfdbfe; }
html.theme-dark .nav-link.active { background: rgba(37,99,235,.24); color: #dbeafe; }
html.theme-dark .environment-banner { border-color: rgba(251,191,36,.48); background: rgba(120,53,15,.55); color: #fde68a; }
html.theme-dark .hero, html.theme-dark .card, html.theme-dark .table-wrap { border-color: rgba(148,163,184,.24); background: rgba(15,23,42,.88); box-shadow: 0 24px 80px rgba(0,0,0,.28); }
html.theme-dark .hero::after { background: rgba(59,130,246,.18); }
html.theme-dark .hero h1, html.theme-dark .card h2, html.theme-dark .card h3 { color: #f8fafc; }
html.theme-dark .hero p, html.theme-dark .card p, html.theme-dark label, html.theme-dark td { color: #cbd5e1; }
html.theme-dark .page-title { color: #f8fafc; }
html.theme-dark th, html.theme-dark td { border-bottom-color: rgba(148,163,184,.20); }
html.theme-dark th { background: rgba(30,41,59,.92); color: #94a3b8; }
html.theme-dark input, html.theme-dark select, html.theme-dark textarea { border-color: rgba(148,163,184,.30); background: rgba(15,23,42,.92); color: #f8fafc; }
html.theme-dark input:focus, html.theme-dark select:focus, html.theme-dark textarea:focus { border-color: #60a5fa; box-shadow: 0 0 0 3px rgba(96,165,250,.18); }
html.theme-dark .button.secondary { border-color: rgba(147,197,253,.44); background: rgba(15,23,42,.86); color: #bfdbfe; }
html.theme-dark .button.secondary:hover { background: rgba(30,41,59,.92); }
html.theme-dark .alert { border-color: rgba(248,113,113,.36); background: rgba(127,29,29,.34); color: #fecaca; }
html.theme-dark .muted, html.theme-dark .card .muted, html.theme-dark .form-card .muted { color: #94a3b8; }
html.theme-dark .details-list dd { color: #e5e7eb; }
html.theme-dark code { background: rgba(30,41,59,.92); color: #dbeafe; }
html.theme-dark .site-footer { border-top-color: rgba(148,163,184,.18); background: rgba(2,6,23,.52); color: rgba(203,213,225,.78); }

@media (max-width: 720px) {
    .hero { padding: 32px 24px; }
    .header-content { align-items: flex-start; padding: 16px 0; flex-direction: column; }
    .header-meta { align-items: flex-start; justify-content: flex-start; }
    .details-list { grid-template-columns: 1fr; }
}