/* ==========================================================================
   Deck AI - tema tricolore (mobile first)
   Riusato dal sito pubblico, dall'admin e dall'installer.
   ========================================================================== */

:root {
    --verde: #009246;
    --verde-scuro: #00713a;
    --verde-btn: #00753b;
    --verde-btn-hover: #006230;
    --bianco: #ffffff;
    --rosso: #ce2b37;
    --rosso-scuro: #a81f29;
    --ink: #16211b;
    --ink-soft: #33413a;
    --muted: #5d6b64;
    --bg: #f2f6f3;
    --surface: #ffffff;
    --surface-2: #f7faf8;
    --line: #dde6e0;
    --line-strong: #c6d4cc;
    --amber: #a86400;
    --amber-bg: #fff6e5;
    --verde-bg: #e9f7ef;
    --rosso-bg: #fdecee;
    --radius: 20px;
    --radius-sm: 12px;
    --shadow: 0 18px 40px rgba(13, 40, 26, 0.10);
    --shadow-sm: 0 4px 14px rgba(13, 40, 26, 0.08);
    --font-display: "Lilita One", "Arial Black", Impact, system-ui, sans-serif;
    --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

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

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink);
    background:
        radial-gradient(900px 420px at 8% -10%, rgba(0, 146, 70, 0.10), transparent 60%),
        radial-gradient(760px 380px at 100% 0%, rgba(206, 43, 55, 0.09), transparent 55%),
        var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 400;
    line-height: 1.12;
    letter-spacing: 0.2px;
    color: var(--ink);
    margin: 0 0 0.5em;
}

h1 { font-size: clamp(1.85rem, 4.4vw, 2.6rem); }
h2 { font-size: clamp(1.25rem, 2.6vw, 1.55rem); margin-top: 1.6em; }
h3 { font-size: 1.1rem; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--verde-scuro); text-underline-offset: 2px; }
a:hover { color: var(--verde); }

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.875em;
    background: #eef4f0;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.1em 0.38em;
    overflow-wrap: anywhere;
}

:focus-visible {
    outline: 3px solid rgba(0, 146, 70, 0.55);
    outline-offset: 2px;
    border-radius: 6px;
}

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

.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 100;
    background: var(--ink);
    color: #fff;
    padding: 10px 16px;
    border-radius: 10px;
    transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; color: #fff; }

.wrap {
    width: 100%;
    max-width: 1060px;
    margin-inline: auto;
    padding-inline: 20px;
}

.hidden { display: none !important; }

/* --------------------------------------------------------------------------
   Header e tricolore
   -------------------------------------------------------------------------- */

.site-head {
    position: relative;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.tricolore {
    height: 6px;
    background: linear-gradient(90deg,
        var(--verde) 0 calc(100% / 3),
        #f4f7f5 calc(100% / 3) calc(200% / 3),
        var(--rosso) calc(200% / 3) 100%);
}

.head-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-block: 14px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--ink);
    color: #fff;
    font-family: var(--font-display);
    font-size: 1.15rem;
    letter-spacing: 0.5px;
    box-shadow: inset 0 -4px 0 var(--verde), inset 0 -8px 0 #fff, inset 0 -12px 0 var(--rosso);
    flex: 0 0 auto;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.1; }

.brand-name {
    font-family: var(--font-display);
    font-size: 1.35rem;
    letter-spacing: 0.4px;
}

.brand-text small {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.head-badge {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--verde-scuro);
    background: var(--verde-bg);
    border: 1px solid #bfe3cd;
    border-radius: 999px;
    padding: 6px 14px;
}

/* --------------------------------------------------------------------------
   Layout wizard
   -------------------------------------------------------------------------- */

.wizard {
    flex: 1 0 auto;
    padding-block: 26px 48px;
}

.wizard.narrow { max-width: 680px; }

.wizard-top { margin-bottom: 18px; }

.steps {
    list-style: none;
    display: flex;
    gap: 6px;
    padding: 0;
    margin: 0 0 14px;
    overflow-x: auto;
    scrollbar-width: none;
}
.steps::-webkit-scrollbar { display: none; }

.step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    flex: 0 0 auto;
}

.step-dot {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--line-strong);
    background: var(--surface);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
}

.step-label { display: none; }

.step.current { color: var(--ink); background: var(--surface); box-shadow: var(--shadow-sm); }
.step.current .step-dot {
    background: var(--verde);
    border-color: var(--verde);
    color: #fff;
}
.step.current .step-label { display: inline; }

.step.done .step-dot {
    background: var(--verde-bg);
    border-color: var(--verde);
    color: var(--verde-scuro);
}

.wizard-progress {
    display: block;
    width: 100%;
    height: 8px;
    appearance: none;
    border: 0;
    border-radius: 999px;
    overflow: hidden;
    background: #e2ebe5;
}
.wizard-progress::-webkit-progress-bar { background: #e2ebe5; border-radius: 999px; }
.wizard-progress::-webkit-progress-value {
    background: linear-gradient(90deg, var(--verde), #4cbf7d);
    border-radius: 999px;
}
.wizard-progress::-moz-progress-bar {
    background: linear-gradient(90deg, var(--verde), #4cbf7d);
    border-radius: 999px;
}

/* --------------------------------------------------------------------------
   Pannello
   -------------------------------------------------------------------------- */

.panel {
    position: relative;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 26px 20px 30px;
    overflow: hidden;
}

.panel::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 5px;
    background: linear-gradient(90deg,
        var(--verde) 0 calc(100% / 3),
        #eef4f0 calc(100% / 3) calc(200% / 3),
        var(--rosso) calc(200% / 3) 100%);
}

.panel-head { margin-bottom: 18px; }

.kicker {
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--verde-scuro);
    margin-bottom: 6px;
}

.lead {
    font-size: 1.02rem;
    color: var(--ink-soft);
    max-width: 68ch;
}

.callout {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-left: 4px solid var(--verde);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    color: var(--ink-soft);
    margin: 18px 0;
}

/* --------------------------------------------------------------------------
   Alert
   -------------------------------------------------------------------------- */

.alert {
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    border-left-width: 5px;
    padding: 14px 16px;
    margin: 0 0 20px;
    font-size: 0.96rem;
    color: var(--ink);
}
.alert p + p { margin-top: 0.5em; }
.alert a { font-weight: 600; }

.alert-ok { background: var(--verde-bg); border-left-color: var(--verde); }
.alert-info { background: #eef4fb; border-left-color: #2f6bb0; }
.alert-warn { background: var(--amber-bg); border-left-color: #d28a00; }
.alert-err { background: var(--rosso-bg); border-left-color: var(--rosso); }

.big-warning { font-size: 1.02rem; }
.big-warning strong { color: var(--rosso-scuro); }

/* --------------------------------------------------------------------------
   Checklist requisiti
   -------------------------------------------------------------------------- */

.check-group { margin-top: 26px; }
.check-group h2 { margin-bottom: 10px; }

.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.checks li {
    display: grid;
    grid-template-columns: 34px 1fr;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.check-icon {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-weight: 800;
    font-size: 1rem;
    color: #fff;
    background: var(--muted);
}

.is-ok .check-icon { background: var(--verde); }
.is-ko .check-icon { background: var(--rosso); }
.is-warn .check-icon { background: #c98600; }

.is-ko { background: var(--rosso-bg); border-color: #f3c9ce; }
.is-warn { background: var(--amber-bg); border-color: #f0dcb0; }

.check-title {
    margin: 0 0 2px;
    font-weight: 700;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.check-detail { margin: 0; font-size: 0.9rem; color: var(--muted); }

.check-fix {
    margin: 6px 0 0;
    font-size: 0.88rem;
    color: var(--ink-soft);
    background: #fff;
    border-left: 3px solid var(--line-strong);
    padding-left: 10px;
}

.pill {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eef4f0;
    color: var(--ink-soft);
}
.pill.warn { background: #ffe7b8; color: #714600; }

/* --------------------------------------------------------------------------
   Form
   -------------------------------------------------------------------------- */

.wizard-form { margin-top: 22px; }

.grid-2 { display: grid; gap: 18px; }

.field { margin-bottom: 18px; display: flex; flex-direction: column; }

.field label,
fieldset legend {
    font-weight: 700;
    font-size: 0.94rem;
    margin-bottom: 6px;
    color: var(--ink);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="url"],
textarea,
select {
    width: 100%;
    min-height: 48px;
    padding: 11px 14px;
    font: inherit;
    font-size: 0.97rem;
    color: var(--ink);
    background: #fff;
    border: 1.5px solid var(--line-strong);
    border-radius: var(--radius-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea { min-height: 120px; resize: vertical; }

input:hover, textarea:hover, select:hover { border-color: #a9bdb2; }

input:focus, textarea:focus, select:focus {
    border-color: var(--verde);
    box-shadow: 0 0 0 4px rgba(0, 146, 70, 0.14);
    outline: none;
}

.help {
    margin: 6px 0 0;
    font-size: 0.84rem;
    color: var(--muted);
}

.field-check { justify-content: flex-end; }

.checkbox,
.choice {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-weight: 500;
    line-height: 1.45;
    cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] {
    width: 20px;
    height: 20px;
    margin: 2px 0 0;
    accent-color: var(--verde);
    flex: 0 0 auto;
}

fieldset {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    margin: 0 0 20px;
    padding: 16px;
}

fieldset legend { padding: 0 6px; }

.choices { display: grid; gap: 10px; border: 0; padding: 0; margin: 14px 0; }
.choice {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    background: #fff;
}
.choice:has(input:checked) {
    border-color: var(--verde);
    box-shadow: 0 0 0 3px rgba(0, 146, 70, 0.12);
}
.choice span { font-size: 0.94rem; }

.token-field legend {
    font-family: var(--font-display);
    font-size: 1.08rem;
    letter-spacing: 0.3px;
}

/* --------------------------------------------------------------------------
   Box informativi
   -------------------------------------------------------------------------- */

.inset {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 18px;
    margin: 22px 0;
}
.inset h2 { margin-top: 0; }

.danger-zone { background: #fff8f8; border-color: #f0c9cd; }

.ip-box { border-left: 4px solid var(--verde); }

.ip-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 8px 0;
}
.ip-row code {
    font-size: 1.05rem;
    font-weight: 700;
    padding: 8px 12px;
    background: #fff;
    border-color: var(--line-strong);
}

.table-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin: 10px 0;
    font-size: 0.86rem;
}

.table-list li {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px 10px;
}

.inline-result { display: block; font-size: 0.9rem; font-weight: 600; min-height: 1.2em; }
.inline-result.ok { color: var(--verde-scuro); }
.inline-result.err { color: var(--rosso-scuro); }
.inline-result.pending { color: var(--muted); }

/* --------------------------------------------------------------------------
   Bottoni
   -------------------------------------------------------------------------- */

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 24px;
}
.actions.compact { margin-top: 10px; }
.inline-form { display: inline-flex; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 11px 22px;
    border-radius: 12px;
    border: 1.5px solid transparent;
    font: inherit;
    font-weight: 700;
    font-size: 0.96rem;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: translateY(1px); }

.btn.primary {
    background: var(--verde-btn);
    color: #fff;
    box-shadow: 0 4px 0 var(--verde-btn-hover);
}
.btn.primary:hover { background: var(--verde-scuro); color: #fff; }
.btn.primary:active { box-shadow: 0 2px 0 var(--verde-btn-hover); }

.btn.ghost {
    background: #fff;
    color: var(--ink);
    border-color: var(--line-strong);
}
.btn.ghost:hover { border-color: var(--verde); color: var(--verde-scuro); background: #fafffc; }

.btn.danger {
    background: var(--rosso);
    color: #fff;
    box-shadow: 0 4px 0 var(--rosso-scuro);
}
.btn.danger:hover { background: var(--rosso-scuro); }

.btn.big { min-height: 52px; padding: 14px 28px; font-size: 1.02rem; }

.btn.tiny { min-height: 38px; padding: 7px 14px; font-size: 0.86rem; border-radius: 10px; }

.btn:disabled,
.btn.disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   Riepilogo
   -------------------------------------------------------------------------- */

.recap {
    display: grid;
    gap: 0;
    margin: 18px 0;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #fff;
}

.recap > div {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
}
.recap > div:last-child { border-bottom: 0; }
.recap dt { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
.recap dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.recap dd small { display: block; font-weight: 500; color: var(--muted); font-size: 0.85rem; }

/* --------------------------------------------------------------------------
   Installazione
   -------------------------------------------------------------------------- */

.install-box {
    margin-top: 22px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}
.install-box h2 { margin-top: 0; }

#install-progress {
    width: 100%;
    height: 14px;
    appearance: none;
    border: 0;
    border-radius: 999px;
    overflow: hidden;
    background: #dfe9e2;
}
#install-progress::-webkit-progress-bar { background: #dfe9e2; border-radius: 999px; }
#install-progress::-webkit-progress-value {
    background: linear-gradient(90deg, var(--verde), #59c687);
    border-radius: 999px;
    transition: width 0.3s ease;
}
#install-progress::-moz-progress-bar { background: var(--verde); border-radius: 999px; }

.install-status { margin: 10px 0; font-weight: 600; font-size: 0.94rem; }

.install-log {
    max-height: 220px;
    overflow-y: auto;
    margin: 0;
    padding: 0 0 0 4px;
    list-style: none;
    font-size: 0.86rem;
    color: var(--ink-soft);
}
.install-log li {
    padding: 4px 0 4px 22px;
    position: relative;
    border-bottom: 1px dashed var(--line);
}
.install-log li:last-child { border-bottom: 0; }
.install-log li::before {
    content: "›";
    position: absolute;
    left: 4px;
    color: var(--verde);
    font-weight: 800;
}
.install-log li.err::before { content: "✗"; color: var(--rosso); }
.install-log li.ok::before { content: "✓"; color: var(--verde); }

/* --------------------------------------------------------------------------
   Fine installazione
   -------------------------------------------------------------------------- */

.done-hero {
    text-align: center;
    padding: 10px 6px 24px;
}

.done-icon {
    display: grid;
    place-items: center;
    width: 84px;
    height: 84px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--verde);
    color: #fff;
    font-size: 2.2rem;
    font-weight: 800;
    box-shadow:
        0 0 0 6px #fff,
        0 0 0 9px var(--verde),
        0 0 0 12px #fff,
        0 0 0 15px var(--rosso),
        var(--shadow);
}

.done-hero h2 { margin-bottom: 6px; }

.next-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 22px 0;
}

.next-list {
    margin: 0;
    padding-left: 20px;
    color: var(--ink-soft);
}
.next-list li { margin-bottom: 6px; }

/* --------------------------------------------------------------------------
   Password meter
   -------------------------------------------------------------------------- */

.strength {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: -4px;
}
#pw-meter {
    width: 180px;
    height: 10px;
    appearance: none;
    border: 0;
    border-radius: 999px;
    overflow: hidden;
    background: #e2ebe5;
}
#pw-meter::-webkit-progress-bar { background: #e2ebe5; }
#pw-meter::-webkit-progress-value { background: var(--muted); border-radius: 999px; }
#pw-meter::-moz-progress-bar { background: var(--muted); border-radius: 999px; }
#pw-meter[data-level="1"]::-webkit-progress-value { background: var(--rosso); }
#pw-meter[data-level="2"]::-webkit-progress-value { background: #d28a00; }
#pw-meter[data-level="3"]::-webkit-progress-value { background: #4c9b2a; }
#pw-meter[data-level="4"]::-webkit-progress-value { background: var(--verde); }
#pw-meter[data-level="1"]::-moz-progress-bar { background: var(--rosso); }
#pw-meter[data-level="2"]::-moz-progress-bar { background: #d28a00; }
#pw-meter[data-level="3"]::-moz-progress-bar { background: #4c9b2a; }
#pw-meter[data-level="4"]::-moz-progress-bar { background: var(--verde); }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.wizard-foot {
    text-align: center;
    font-size: 0.78rem;
    color: var(--muted);
    margin: 22px 0 0;
}

.site-foot {
    background: var(--ink);
    color: #dfe8e2;
    padding: 20px 0;
    font-size: 0.8rem;
    margin-top: auto;
}
.site-foot p { margin: 0; text-align: center; }
.site-foot a { color: #fff; }

/* --------------------------------------------------------------------------
   Desktop
   -------------------------------------------------------------------------- */

@media (min-width: 700px) {
    .panel { padding: 36px 40px 40px; }
    .steps { gap: 4px; justify-content: space-between; }
    .step { padding: 6px 10px; }
    .step-label { display: inline; }
    .step.todo .step-label { display: none; }
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .recap > div { grid-template-columns: 220px 1fr; align-items: baseline; }
    .wizard { padding-block: 36px 64px; }
    .head-inner { padding-block: 16px; }
}

@media (min-width: 980px) {
    .step.todo .step-label { display: inline; }
}

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

/* --------------------------------------------------------------------------
   Stampa (solo per le pagine informative)
   -------------------------------------------------------------------------- */

@media print {
    body { background: #fff; }
    .site-head, .site-foot, .actions, .wizard-top { display: none; }
    .panel { box-shadow: none; border: 1px solid #ccc; }
}

/* ==========================================================================
   Sito pubblico - dashboard e builder
   ========================================================================== */

.site-body { display: flex; flex-direction: column; }
.site-main { flex: 1 0 auto; }
.section { padding-block: 34px 18px; }
.section.narrow { max-width: 720px; }

.head-nav { display: flex; align-items: center; gap: 18px; font-weight: 600; font-size: 0.92rem; }
.head-nav a { color: var(--ink-soft); text-decoration: none; }
.head-nav a:hover { color: var(--verde-scuro); }
.head-nav .head-admin { padding: 7px 12px; border: 1.5px solid var(--line-strong); border-radius: 10px; font-size: 0.82rem; }

.hero { padding: 44px 0 6px; }
.hero-inner { display: grid; gap: 30px; align-items: center; }
.hero-copy h1 { max-width: 16ch; }
.hero-copy .lead { margin-bottom: 22px; }

.hero-panel { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero-card {
    width: 108px; height: 132px; border-radius: 18px; display: grid; place-items: center;
    align-content: center; gap: 2px; color: #fff; border: 3px solid #fff;
    box-shadow: var(--shadow); transform: rotate(-3deg);
}
.hero-card span { font-family: var(--font-display); font-size: 1.55rem; line-height: 1; }
.hero-card small { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.9; }
.hero-card-a { background: linear-gradient(150deg, #009246, #006a33); }
.hero-card-b { background: linear-gradient(150deg, #26332c, #101815); transform: rotate(2deg) translateY(-10px); }
.hero-card-c { background: linear-gradient(150deg, #ce2b37, #971d27); transform: rotate(4deg); }

.tag-form { display: flex; flex-wrap: wrap; gap: 10px; max-width: 560px; }
.tag-input { display: flex; align-items: center; flex: 1 1 210px; min-width: 0; min-height: 52px; background: #fff;
    border: 1.5px solid var(--line-strong); border-radius: 14px; padding: 0 4px 0 16px; }
.tag-input span { font-family: var(--font-display); color: var(--muted); font-size: 1.25rem; }
.tag-input input { border: 0 !important; box-shadow: none !important; padding-left: 8px; min-height: 48px;
    font-size: 1.1rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.tag-form .btn { flex: 0 0 auto; }

.alert-slot { margin-top: 14px; }
.alert-slot:empty { display: none; }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head h2 { margin: 0; }
.panel-head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-head-row h3 { margin: 0; }

.player-card { display: flex; align-items: center; gap: 14px; background: var(--surface); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 18px 18px 18px 20px; margin-bottom: 16px; flex-wrap: wrap; }
.player-avatar { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
    background: linear-gradient(140deg, var(--verde), var(--rosso)); color: #fff;
    font-family: var(--font-display); font-size: 1.6rem; flex: 0 0 auto; }
.player-body { flex: 1 1 200px; }
.player-body h3 { margin: 0 0 2px; font-size: 1.25rem; }
.player-tag { font-family: var(--font-body); font-size: 0.8rem; color: var(--muted); font-weight: 600;
    margin-left: 8px; letter-spacing: 0.04em; }
.player-meta { margin: 0; font-size: 0.88rem; color: var(--muted); }
.player-levels { margin: 4px 0 0; font-size: 0.84rem; color: var(--ink-soft); }
.player-king { font-weight: 700; font-size: 0.85rem; background: var(--surface-2); border: 1px solid var(--line);
    padding: 6px 10px; border-radius: 10px; }

.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat-grid.compact { margin: 16px 0; }
.stat-card { background: var(--surface); border-radius: 14px; padding: 12px 14px; border: 1px solid var(--line);
    display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.stat-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
.stat-value { font-family: var(--font-display); font-size: 1.3rem; line-height: 1.15; color: var(--ink); }
.stat-sub { font-size: 0.76rem; color: var(--muted); overflow-wrap: anywhere; }

.two-col { display: grid; gap: 16px; margin-bottom: 16px; }
.two-col .panel { padding: 22px 18px; }
.two-col .panel h3 { margin-top: 0; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.muted { color: var(--muted); }
.help.inline { display: inline; margin: 0; }
.actions.center { justify-content: center; }

.weakness-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.weakness { display: flex; gap: 10px; align-items: flex-start; background: var(--surface-2); border-radius: 12px;
    padding: 10px 12px; border-left: 4px solid var(--line-strong); }
.weakness strong { font-size: 0.92rem; }
.weakness p { margin: 2px 0 0; font-size: 0.84rem; color: var(--muted); }
.weakness-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); margin-top: 7px; flex: 0 0 auto; }
.weakness.alta { border-left-color: var(--rosso); background: var(--rosso-bg); }
.weakness.alta .weakness-dot { background: var(--rosso); }
.weakness.media { border-left-color: #d28a00; background: var(--amber-bg); }
.weakness.media .weakness-dot { background: #d28a00; }
.weakness.bassa { border-left-color: var(--verde); }
.weakness.bassa .weakness-dot { background: var(--verde); }

.deck-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.deck-card { position: relative; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px;
    padding: 8px 6px 10px; text-align: center; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.deck-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.card-img { width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: contain; display: block; }
.card-badges { position: absolute; inset: 6px 6px auto 6px; display: flex; justify-content: space-between; gap: 4px; pointer-events: none; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 22px;
    padding: 0 6px; border-radius: 8px; font-size: 0.72rem; font-weight: 800; line-height: 1; }
.badge.elixir { background: #7b2cbf; color: #fff; }
.badge.elixir.tiny { height: 18px; min-width: 18px; font-size: 0.66rem; }
.badge.level { background: rgba(22, 33, 27, 0.85); color: #fff; }
.card-name { display: block; margin-top: 6px; font-size: 0.74rem; font-weight: 700; line-height: 1.25;
    color: var(--ink-soft); overflow-wrap: anywhere; }
.deck-card.compact .card-name { font-size: 0.7rem; }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--line); font-size: 0.76rem; font-weight: 600; color: var(--ink-soft); }
.chip.strong { background: var(--verde-bg); border-color: #b9e2c9; color: var(--verde-scuro); }
.chip.muted { color: var(--muted); }

.mini-list { display: flex; flex-direction: column; gap: 6px; }
.mini-card { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px; background: var(--surface-2); }
.mini-name { flex: 1 1 auto; font-weight: 600; font-size: 0.88rem; overflow-wrap: anywhere; }
.mini-meta { font-size: 0.78rem; color: var(--muted); font-weight: 700; }

.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-head { display: flex; justify-content: space-between; gap: 10px; font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; }
.bar-rate { color: var(--muted); font-weight: 700; }
.bar-rate.bad { color: var(--rosso); }
.bar-track { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--verde), #35b56f); }
.bar-fill.bad { background: linear-gradient(90deg, #d24b56, var(--rosso)); }

.war-row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; border-bottom: 1px dashed var(--line); padding-bottom: 6px; }
.war-row strong { font-family: var(--font-display); font-size: 1.15rem; }
.war-history { font-size: 0.82rem; color: var(--muted); margin: 0; }
.locked-count { font-size: 0.88rem; color: var(--ink-soft); margin: 0; }

.build-form { padding: 24px 20px; }
.form-grid { display: grid; gap: 14px; }
.form-grid .field { margin: 0; }
.form-grid .field.full { grid-column: 1 / -1; }
.form-grid small { color: var(--muted); font-size: 0.78rem; margin-top: 4px; }

.build-result { margin-top: 22px; }
.result-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; padding: 20px; }
.result-head h3 { margin: 0; }
.result-sections { display: grid; gap: 14px; }
.result-block { padding: 20px 18px; }
.result-block h3 { margin: 0 0 10px; font-size: 1.05rem; }
.steps-list, .bullet-list { margin: 0; padding-left: 20px; font-size: 0.92rem; }
.steps-list li, .bullet-list li { margin-bottom: 6px; }

.upgrade-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.upgrade { border-radius: 12px; padding: 10px 12px; border-left: 5px solid var(--line-strong); background: var(--surface-2); }
.upgrade.alta { border-left-color: var(--rosso); background: var(--rosso-bg); }
.upgrade.media { border-left-color: #d28a00; background: var(--amber-bg); }
.upgrade.bassa { border-left-color: var(--verde); background: var(--verde-bg); }
.upgrade-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.upgrade p { margin: 4px 0 0; font-size: 0.84rem; color: var(--ink-soft); }
.badge.urgency { background: #fff; border: 1px solid var(--line-strong); color: var(--ink-soft); font-size: 0.68rem; text-transform: uppercase; }
.upgrade.alta .badge.urgency { color: var(--rosso); border-color: #f0b6bb; }
.upgrade.media .badge.urgency { color: var(--amber); border-color: #efd09b; }
.upgrade.bassa .badge.urgency { color: var(--verde-scuro); border-color: #b9e2c9; }

.swap-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.swap { background: var(--surface-2); border-radius: 10px; padding: 9px 12px; font-size: 0.9rem; }
.swap-out { font-weight: 600; }
.swap-arrow { margin: 0 6px; color: var(--muted); }
.swap-in { font-weight: 700; color: var(--verde-scuro); }
.swap-when { margin: 3px 0 0; font-size: 0.8rem; color: var(--muted); }

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

@media (min-width: 700px) {
    .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .stat-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hero { padding-top: 56px; }
    .tag-form { max-width: 640px; }
}

@media (min-width: 900px) {
    .hero-inner { grid-template-columns: 1.35fr 0.8fr; }
    .two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .deck-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
    .section { padding-block: 48px 24px; }
    .build-form { padding: 28px; }
    .result-sections { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .result-sections .result-block:first-child { grid-column: 1 / -1; }
}

@media (max-width: 699px) {
    .head-nav a:not(.head-admin) { display: none; }
    .tag-form .btn { width: 100%; }
    .tag-input input { min-width: 0; }
    .hero-copy h1 { max-width: none; }
    .hero-panel { justify-content: flex-start; }
    .hero-card { width: 92px; height: 112px; }
    .deck-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ==========================================================================
   Admin minimo
   ========================================================================== */

.admin-body { background: var(--bg); }
.admin-main { padding-block: 28px 40px; }
.admin-main h1 { margin-top: 0; }
.admin-auth { max-width: 480px; padding-block: 8vh; }
.admin-auth h1 { margin-top: 0; }
.admin-auth .actions { margin-top: 8px; }
.admin-foot { text-align: center; color: var(--muted); font-size: 0.8rem; margin-top: 18px; }
.admin-user { font-size: 0.82rem; font-weight: 700; color: var(--muted); }
.admin-main .inline-form { margin: 0; }

.status-row { display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 0.9rem; }
.status-row:last-child { border-bottom: 0; }
.status-pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
    background: var(--surface-2); border: 1px solid var(--line); font-size: 0.76rem; font-weight: 700; color: var(--ink-soft); }
.status-pill.ok { background: var(--verde-bg); border-color: #b9e2c9; color: var(--verde-scuro); }
.status-pill.warn { background: var(--amber-bg); border-color: #efd09b; color: var(--amber); }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.data-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.data-table tr:last-child td { border-bottom: 0; }

.dataset-details { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
.dataset-details summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; }
.dataset-list { margin: 10px 0 0; padding-left: 20px; font-size: 0.85rem; color: var(--ink-soft); }
.dataset-list li { margin-bottom: 4px; }
.dataset-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 16px; padding-top: 12px;
    border-top: 1px dashed var(--line); font-size: 0.82rem; color: var(--muted); }

/* Navigazione del pannello */
.admin-bar { background: var(--surface); border-top: 1px solid var(--line); }
.admin-nav { display: flex; gap: 6px; overflow-x: auto; padding-block: 8px; }
.admin-nav a { padding: 8px 12px; border-radius: 10px; font-size: 0.86rem; font-weight: 700;
    color: var(--ink-soft); text-decoration: none; white-space: nowrap; }
.admin-nav a:hover { background: var(--surface-2); color: var(--verde-scuro); }

.pagination { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.log-json { background: #0f1a14; color: #d7f3e1; border-radius: 12px; padding: 14px; font-size: 0.78rem;
    line-height: 1.45; overflow-x: auto; max-height: 420px; white-space: pre-wrap; overflow-wrap: anywhere; }
.small-value { font-size: 0.95rem; }
.danger-zone { margin-top: 18px; background: #fff8f8; border-color: #f0c9cd; }
.danger-zone summary { font-size: 0.86rem; }

/* Slot pubblicitari */
.ad-slot { display: flex; justify-content: center; margin: 18px auto; max-width: 970px; }
.ad-slot img { max-width: 100%; height: auto; border-radius: 12px; display: block; }
.ad-slot:empty { display: none; }

@media print {
    .hero, #analisi, #generatore .build-form, .site-foot, .head-nav, .alert-slot { display: none !important; }
    #generatore { padding: 0; }
    .build-result { margin: 0; }
    .result-head { border: 0; padding: 0 0 10px; }
    .result-head .actions { display: none; }
    .deck-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
    .result-sections { display: block; }
    .result-block { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; margin-bottom: 8px; }
    .card-img { max-height: 110px; }
}
