/*
 * Stili del sito di amministrazione: copia di www/public/assets/css/style.css (le due document root
 * sono separate e non condividono file) più, in fondo, le regole proprie dell'admin.
 */
:root {
    --bg: #f7f8fa;
    --surface: #ffffff;
    --text: #1d2330;
    --muted: #5c6577;
    --primary: #0b6bcb;
    --primary-text: #ffffff;
    --border: #dde2ea;
    --error: #b42318;
    --success-bg: #e7f6ec;
    --success-text: #146c2e;
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12151b;
        --surface: #1b2029;
        --text: #e6e9ef;
        --muted: #9aa3b5;
        --primary: #4ea1f3;
        --primary-text: #0b1220;
        --border: #2c3340;
        --error: #f97066;
        --success-bg: #12301d;
        --success-text: #7fdc9b;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }
main.container { flex: 1; padding-block: 32px; }

a { color: var(--primary); }
code { background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }

.site-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 12px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.25rem; text-decoration: none; color: var(--text); }
nav { display: flex; gap: 16px; }
nav a { text-decoration: none; color: var(--muted); }
nav a[aria-current="page"], nav a:hover { color: var(--text); font-weight: 600; }

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; padding-block: 16px; }

.hero { padding-block: 24px 32px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 8px; }
.hero p { color: var(--muted); max-width: 60ch; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px 20px; }
.card h2 { margin-top: 0; font-size: 1.2rem; }

.button {
    display: inline-block; background: var(--primary); color: var(--primary-text);
    border: 0; border-radius: 6px; padding: 10px 20px; font: inherit; font-weight: 600;
    text-decoration: none; cursor: pointer;
}
.button:hover { filter: brightness(1.1); }

.form { display: grid; gap: 6px; max-width: 520px; }
.form label { font-weight: 600; margin-top: 10px; }
.form fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 8px 16px 16px; margin: 8px 0; display: grid; gap: 6px; }
.form legend { font-weight: 700; padding: 0 6px; }
.form input, .form textarea, .form select {
    font: inherit; color: inherit; background: var(--surface);
    border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px;
}
.form .button { justify-self: start; margin-top: 16px; }
.error { color: var(--error); margin: 0; font-size: .9rem; }
.notice { padding: 12px 16px; border-radius: 6px; }
.debug { background: var(--surface); border: 1px solid var(--error); border-radius: 6px; padding: 12px 16px; }
.debug pre { overflow-x: auto; font-size: .85rem; }
.notice.error-box { border: 1px solid var(--error); color: var(--error); }
.notice.info { border: 1px solid var(--primary); }

.inline-form { display: inline; margin: 0; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; text-decoration: underline; }
.link-button.danger { color: var(--error); }
nav .link-button { color: var(--muted); text-decoration: none; }
nav .link-button:hover { color: var(--text); font-weight: 600; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: var(--surface); }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); }
th { font-size: .9rem; color: var(--muted); }
.plain-list { padding-left: 0; list-style: none; }
.plain-list li { padding: 6px 0; border-bottom: 1px solid var(--border); }

.hint { color: var(--muted); font-size: .9rem; margin: 0; }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); vertical-align: middle; }
.badge.ok { color: var(--success-text); background: var(--success-bg); border-color: transparent; }
.badge.todo { color: var(--error); border-color: var(--error); }
.steps { padding-left: 20px; }
.steps li { margin-bottom: 16px; }
.steps h2 { font-size: 1.1rem; margin-bottom: 4px; }
.dns-record, .details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 12px 0; }
.dns-record dt, .details dt { font-weight: 600; }
.dns-record dd, .details dd { margin: 0; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.button.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.button.danger { background: var(--error); color: #fff; }
.card.claim { margin-bottom: 12px; }
.message-text { white-space: normal; }
.notice { border: 1px solid var(--border); margin: 12px 0; }

.notice.success { background: var(--success-bg); color: var(--success-text); }

/* --- Solo admin: filtri ed elenchi paginati --- */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 16px 0; }
.filters input, .filters select { font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; }
.filters input[type="search"] { min-width: 260px; flex: 1; }
.pagination { display: flex; gap: 16px; align-items: center; margin: 16px 0; }

.form.wide { max-width: none; }
textarea.code { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }

.preview-section { margin-top: 28px; }
.preview-questions { padding-left: 24px; }
.preview-questions > li { margin-bottom: 14px; }
.preview-label { margin: 0; font-weight: 600; }
.preview-meta { margin: 4px 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.preview-options { margin: 4px 0; color: var(--muted); }

/* --- Analisi sicurezza (frammento templates/partials/security-report.php, come nel sito clienti) --- */
.grade { display: inline-block; min-width: 1.6em; padding: 0 .35em; border-radius: 4px; font-weight: 700; text-align: center; color: #fff; background: #6b7280; }
.grade-A { background: #15803d; }
.grade-B { background: #4d7c0f; }
.grade-C { background: #b45309; }
.grade-D { background: #c2410c; }
.grade-F { background: #b91c1c; }
.grade-large { font-size: 2.2rem; min-width: 1.4em; padding: .1em .3em; }
.security-grade { display: flex; align-items: center; gap: 14px; font-size: 1.3rem; margin: 0; }
.badge.danger { background: #fee2e2; color: #991b1b; }
.plan-price { font-size: 1.4rem; font-weight: 700; margin: 4px 0; }

.form .checkbox { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-top: 12px; }

/* --- Solo admin: intestazione scura, per distinguere a colpo d'occhio il pannello dal sito clienti --- */
body.admin .site-header { background: #1f2a44; border-bottom-color: #1f2a44; }
body.admin .site-header .brand,
body.admin .site-header nav a,
body.admin .site-header .link-button { color: #e6e9ef; }
body.admin .site-header nav a[aria-current] { color: #ffffff; }

/* --- Solo admin: gruppi del menu a tendina (<details>, funzionano anche senza JavaScript) --- */
.nav-group { position: relative; }
.nav-group summary { cursor: pointer; list-style: none; color: #e6e9ef; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary::after { content: " ▾"; font-size: .8em; }
.nav-group summary.is-active { color: #ffffff; font-weight: 600; }
.nav-menu { position: absolute; top: calc(100% + 8px); left: 0; z-index: 10; min-width: 200px; display: flex; flex-direction: column;
            background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 0; box-shadow: 0 6px 20px rgb(0 0 0 / .18); }
body.admin .site-header .nav-menu a { color: var(--text); padding: 6px 14px; }
body.admin .site-header .nav-menu a:hover { background: var(--bg); }
body.admin .site-header .nav-menu a[aria-current] { color: var(--primary); font-weight: 600; }
.site-header nav { align-items: center; }

/* Editor dei modelli di questionario (come nel sito clienti, public/assets/css/style.css) */
.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin: 20px 0 8px; }
.optional { font-weight: 400; color: var(--muted); font-size: .9rem; }
.section { margin-bottom: 40px; }
.section h2 { margin-bottom: 4px; }
.form .rows { display: grid; grid-template-columns: 1fr 110px; gap: 6px; align-items: center; }
.form .rows .rows-head { font-size: .9rem; color: var(--muted); }
