:root {
    --bg: #0f172a;
    --panel: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --brand: #2563eb;
    --brand-dark: #1d4ed8;
    --danger: #b91c1c;
    --danger-bg: #fee2e2;
    --warn-bg: #fffbeb;
    --warn-text: #92400e;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    color: var(--text);
    background: #f3f4f6;
}

.container {
    width: min(1100px, 92vw);
    margin: 0 auto;
}

.topbar {
    background: var(--bg);
    color: white;
    border-bottom: 3px solid var(--brand);
}

.topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    min-height: 145px;
}

.brand {
    color: white;
    font-weight: 700;
    text-decoration: none;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
}

.brand-logo {
    height: 132px;
    width: auto;
    display: block;
    filter: invert(1);
    mix-blend-mode: screen;
}

nav a {
    color: #cbd5e1;
    text-decoration: none;
    margin-left: 16px;
    font-size: 1.05rem;
}

nav a:hover {
    color: white;
}

/* ── Language switcher ─────────────────────────────────────────────────────── */
.lang-switcher {
    display: inline-flex;
    align-items: center;
    margin-left: 18px;
    gap: 2px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    overflow: hidden;
}

.lang-btn {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 3px 8px;
    letter-spacing: 0.04em;
    transition: background 0.15s, color 0.15s;
    margin-left: 0 !important; /* override nav a margin */
    min-height: 28px;
    display: inline-flex;
    align-items: center;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.lang-btn--active {
    background: var(--brand);
    color: white;
}

main.container {
    padding: 26px 0 40px;
}

.page-header h1 {
    margin: 0;
    font-size: 1.7rem;
}

.page-header p {
    margin: 6px 0 0;
    color: var(--muted);
}

.back-link {
    display: inline-block;
    color: var(--brand);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}

.back-link:hover {
    background: rgba(37, 99, 235, 0.1);
    color: var(--brand-dark);
}

.cards {
    margin-top: 18px;
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.card,
.panel {
    background: var(--panel);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.card {
    display: flex;
    flex-direction: column;
}

.card .button {
    margin-top: auto;
    align-self: flex-start;
}

.card h2 {
    margin-top: 0;
    margin-bottom: 8px;
}

.card p {
    color: var(--muted);
}

.form-grid {
    display: grid;
    gap: 12px;
}

label {
    display: grid;
    gap: 6px;
    font-weight: 600;
    font-size: 0.92rem;
}

input[type="text"],
input[type="number"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font: inherit;
    color: var(--text);
    background: #fff;
}

textarea {
    resize: vertical;
}

.button {
    display: inline-block;
    border: none;
    border-radius: 8px;
    background: var(--brand);
    color: white;
    text-decoration: none;
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
    width: fit-content;
}

.button:hover {
    background: var(--brand-dark);
}

.button.secondary {
    background: #374151;
}

.button.secondary:hover {
    background: #1f2937;
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.panel.error {
    border-color: #fecaca;
    background: var(--danger-bg);
}

.panel.error h2 {
    color: var(--danger);
    margin-top: 0;
}

.panel.warning {
    border-color: #fde68a;
    background: var(--warn-bg);
    color: var(--warn-text);
}

pre {
    white-space: pre-wrap;
    word-break: break-word;
    background: #0b1021;
    color: #d1d5db;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 0;
}

code {
    background: #e5e7eb;
    padding: 2px 5px;
    border-radius: 4px;
}

/* ── Focus-visible ring — improves keyboard navigation & FID perception ── */
:focus-visible {
    outline: 3px solid var(--brand);
    outline-offset: 3px;
}

/* ── Touch target sizing — buttons & links min 44×44 px (mobile UX + CWV) ── */
.button,
button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

nav a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

/* ── Mobile hamburger nav toggle ── */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    min-height: 44px;
    min-width: 44px;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: white;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
}

/* Animate to X when open */
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Responsive: stack nav on small screens ── */
@media (max-width: 600px) {
    .nav-toggle {
        display: flex;
    }

    #main-nav {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding: 8px 0;
        z-index: 100;
    }

    #main-nav.is-open {
        display: flex;
    }

    #main-nav a {
        margin-left: 0;
        padding: 12px 20px;
        font-size: 1rem;
    }

    .topbar-inner {
        position: relative;
        flex-wrap: wrap;
    }

    .page-header h1 {
        font-size: 1.4rem;
    }

    main.container {
        padding: 20px 0 32px;
    }
}

/* ── content-visibility: auto — skip off-screen rendering cost (LCP/CLS) ── */
.cards,
.panel,
.card {
    content-visibility: auto;
    contain-intrinsic-size: 0 120px;
}

/* ── verify_pdfa result styles ─────────────────────────────────────────────── */
.verify-summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 600;
}

.verify-summary--pass { background: #d1fae5; border: 1px solid #6ee7b7; }
.verify-summary--fail { background: var(--danger-bg); border: 1px solid #fecaca; }

.verify-badge {
    font-size: 1rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
}

.verify-badge--pass { background: #059669; color: white; }
.verify-badge--fail { background: var(--danger); color: white; }

.verify-summary-counts { color: var(--text); font-size: 0.95rem; }

.verify-file {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 16px;
    overflow: hidden;
}

.verify-file-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-weight: 700;
}

.verify-file-header--pass { background: #d1fae5; }
.verify-file-header--fail { background: var(--danger-bg); }

.verify-file-status { font-size: 1.1rem; }
.verify-file-name   { flex: 1; word-break: break-all; }

.verify-file-level {
    font-size: 0.8rem;
    background: #e5e7eb;
    border-radius: 4px;
    padding: 2px 7px;
    color: var(--muted);
    font-weight: 600;
}

.verify-file-error {
    padding: 10px 14px;
    color: var(--danger);
    margin: 0;
}

.verify-checks {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.verify-checks th {
    text-align: left;
    padding: 8px 12px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-size: 0.8rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.verify-checks td { padding: 7px 12px; border-bottom: 1px solid #f3f4f6; vertical-align: top; }
.verify-checks tr:last-child td { border-bottom: none; }

.check-pass { background: #f0fdf4; }
.check-warn { background: var(--warn-bg); }
.check-fail { background: #fff1f2; }

.check-icon { font-size: 0.9rem; }
.check-icon--pass { color: #059669; }
.check-icon--warn { color: #d97706; }
.check-icon--fail { color: var(--danger); }

.check-name   { font-weight: 600; white-space: nowrap; }
.check-status { text-align: center; width: 52px; }
.check-detail { color: var(--muted); }

.verify-failures {
    padding: 10px 14px;
    background: #fff1f2;
    border-top: 1px solid #fecaca;
    font-size: 0.88rem;
}

.verify-failures ul {
    margin: 6px 0 0;
    padding-left: 18px;
    color: var(--danger);
}

/* ── Disclaimer banner (homepage warning) ─────────────────────────────────── */
.disclaimer-banner {
    background: var(--warn-bg);
    color: var(--warn-text);
    border: 1px solid #fcd34d;
    border-left: 4px solid #f59e0b;
    border-radius: 6px;
    padding: 14px 18px;
    margin: 18px 0 6px;
    font-weight: 600;
    font-size: 0.97rem;
}

.disclaimer-banner a {
    color: var(--warn-text);
    text-decoration: underline;
    font-weight: 700;
}

.disclaimer-banner a:hover {
    color: #78350f;
}

/* ── Disclaimer nav link (topbar) ─────────────────────────────────────────── */
nav a.nav-disclaimer {
    color: #fcd34d;
    font-weight: 800;
    font-size: 1.12rem;
    border: 1px solid rgba(252, 211, 77, 0.5);
    border-radius: 6px;
    padding: 7px 14px;
    transition: background 0.15s;
}

nav a.nav-disclaimer:hover {
    background: rgba(252, 211, 77, 0.15);
}

/* ── Disclaimer page content ──────────────────────────────────────────────── */
.disclaimer-page {
    
    margin-top: 24px;
}

.disclaimer-section {
    margin-bottom: 28px;
}

.disclaimer-section h2 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text);
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 6px;
}

.disclaimer-section p {
    margin: 0 0 10px;
    color: var(--muted);
    line-height: 1.65;
}

.disclaimer-back {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}
/* ── Homepage styles — aggiungi in fondo a webapp/static/style.css ── */

/* Hero */
.home-hero {
  text-align: center;
  padding: 3rem 0 2.5rem;  /* remove side padding, container handles it */
  max-width: 600px;
  margin: 0 auto;
}
.home-hero__badge {
  display: inline-block;
  background: #d1fae5;
  color: #065f46;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 8px 22px;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  letter-spacing: 0.03em;
}
.home-hero__title {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}
.home-hero__title-accent {
  color: var(--brand);
}
.home-hero__sub {
  font-size: 1rem;
  opacity: 0.7;
  max-width: 480px;
  margin: 0 auto 1.75rem;
  line-height: 1.7;
}
.home-hero__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.button--outline {
  background: transparent;
  border: 1px solid var(--brand);
  color: var(--brand) !important;
}
.button--outline:hover {
  background: var(--brand);
  color: white;
}

/* Sections */
.home-section {
  
  margin: 0 auto 2rem;
  padding: 0 1rem;
}
.home-section__label {
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  opacity: 0.45;
  margin-bottom: 1rem;
}

/* Tool cards */
.home-tools {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 0.5rem;
}
.home-toolcard {
  background: var(--card-bg, #fff);
  border: 1px solid var(--card-border, #e5e7eb);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.home-toolcard__icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.875rem;
}
.home-toolcard__icon--blue  { background: #eff6ff; color: #1d4ed8; }
.home-toolcard__icon--amber { background: #fffbeb; color: #b45309; }
.home-toolcard__icon--green { background: #f0fdf4; color: #15803d; }

/* ── Firma Digitale page ─────────────────────────────────────────────────── */
.sig-msg { padding: 10px 14px; border-radius: 8px; font-size: 0.9rem; margin: 4px 0; }
.sig-msg--error   { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }
.sig-msg--warning { background: var(--warn-bg); color: var(--warn-text); border: 1px solid #fde68a; }
.sig-msg--info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.sig-msg--success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }

.panel.success { border-color: #bbf7d0; background: #f0fdf4; }
.panel.success h2 { color: #15803d; margin-top: 0; }

.result-fields { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; }
.result-fields dt { font-weight: 600; color: var(--muted); white-space: nowrap; }
.result-fields dd { margin: 0; font-family: monospace; }
.home-toolcard__title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.home-toolcard__desc {
  font-size: 0.875rem;
  opacity: 0.65;
  line-height: 1.65;
  margin-bottom: 1rem;
  flex: 1;
}
.home-toolcard__link {
  font-size: 0.875rem;
  text-decoration: none;
  font-weight: 500;
  color: var(--brand);
}
.home-toolcard__link:hover {
  color: var(--brand-dark)!important;
}

/* Benefits */
.home-benefits {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}
.home-benefit {
  background: var(--card-bg, #fff);
  border: 1px solid var(--card-border, #e5e7eb);
  border-radius: 10px;
  padding: 1rem 1.25rem;
}
.home-benefit__value {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.home-benefit__desc {
  font-size: 0.8125rem;
  opacity: 0.6;
  line-height: 1.5;
}

/* Audience tags */
.home-audience {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.home-tag {
  font-size: 0.8125rem;
  padding: 5px 13px;
  border: 1px solid var(--card-border, #e5e7eb);
  border-radius: 6px;
  opacity: 0.75;
}
