/* ST SAFE TRAVEL — Elegant travel advisor
 *
 * Design language: clean, refined, airy. No glassmorphism, no neon.
 * Light sky-paper background (flat, MAS-like) with a soft sky glow on top;
 * slightly translucent white cards, thin borders, soft shadows.
 * Work Sans light weights, muted palette, sky accent used sparingly.
 */

:root {
    --accent: #3b82a0;
    --accent-d: #2c6e8a;
    --accent-l: rgba(59, 130, 160, .08);
    --sky-paper: #e9f0f4;
    --sky-glow: rgba(14, 165, 233, .10);
    --sky-glow-2: rgba(59, 130, 160, .07);
    --ink: #1a2332;
    --text: #2c3e50;
    --text-secondary: #5a6b7d;
    --muted: #7f8c9b;
    --faint: #a0aab4;
    --line: #e8ecf0;
    --line-strong: #d5dce4;
    --panel: #f5f7f9;
    --surface: #ffffff;
    --border: #e8ecf0;
    --border2: #d5dce4;
    --white: #fff;
    --green: #2d8a4e;
    --green-l: rgba(45, 138, 78, .08);
    --amber: #b8860b;
    --amber-l: rgba(184, 134, 11, .10);
    --red: #c0392b;
    --red-l: rgba(192, 57, 43, .08);
    --slate: #7f8c9b;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(20,30,50,.04), 0 4px 16px rgba(20,30,50,.05);
    --shadow-hover: 0 8px 30px rgba(20,30,50,.10);
    --sans: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --headings: 'Work Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mono: 'Menlo', 'Consolas', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Utility locali (ex-Bootstrap): uniche due classi usate in interact.php. */
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: 1rem; }

body {
    background-color: var(--sky-paper);
    background-image:
        radial-gradient(120% 42% at 50% 0%, var(--sky-glow), transparent 70%),
        radial-gradient(90% 30% at 85% 0%, var(--sky-glow-2), transparent 70%);
    background-repeat: no-repeat;
    color: var(--text);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* Nuvole marcate disegnate in CSS: nessuna immagine o richiesta aggiuntiva. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        radial-gradient(ellipse 120px 48px at 12% 17%, rgba(255,255,255,.95) 55%, transparent 100%),
        radial-gradient(ellipse 78px 60px at 16% 14%, rgba(255,255,255,.92) 50%, transparent 100%),
        radial-gradient(ellipse 108px 44px at 20% 18%, rgba(255,255,255,.9) 55%, transparent 100%),
        radial-gradient(ellipse 150px 54px at 83% 31%, rgba(255,255,255,.92) 55%, transparent 100%),
        radial-gradient(ellipse 90px 66px at 79% 28%, rgba(255,255,255,.9) 50%, transparent 100%),
        radial-gradient(ellipse 108px 48px at 88% 30%, rgba(255,255,255,.88) 55%, transparent 100%),
        radial-gradient(ellipse 140px 48px at 18% 79%, rgba(255,255,255,.82) 55%, transparent 100%),
        radial-gradient(ellipse 86px 60px at 23% 76%, rgba(255,255,255,.8) 50%, transparent 100%),
        radial-gradient(ellipse 130px 44px at 55% 8%, rgba(255,255,255,.85) 55%, transparent 100%),
        radial-gradient(ellipse 110px 40px at 65% 88%, rgba(255,255,255,.75) 55%, transparent 100%);
    background-repeat: no-repeat;
}

h1, h2, h3, h4, h5 { font-family: var(--headings); letter-spacing: -.01em; }

::selection { background: var(--accent); color: #fff; }

/* ─── Header ─── */
header {
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(0,0,0,.06);
    /* Pinned alla colonna contenuto (max 1040px, centrata come .content). */
    padding: 0 max(clamp(1rem, 3vw, 2.5rem), calc((100% - 1040px) / 2));
    height: 60px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}
.hdr-left { display: flex; align-items: center; gap: .7rem; }
.logo {
    font-weight: 600; font-size: 1.15rem;
    letter-spacing: .12em; text-transform: uppercase;
    color: var(--ink); text-decoration: none; white-space: nowrap;
}
.logo span { color: var(--accent); }
.back-arrow {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; flex-shrink: 0;
    color: var(--muted);
    text-decoration: none;
    border: 1px solid var(--border2);
    border-radius: 50%;
    background: rgba(255,255,255,.6);
    transition: color .15s, border-color .15s, background .15s;
}
.back-arrow svg { display: block; }
.back-arrow:hover { color: var(--accent); border-color: var(--accent); background: #fff; }
.hdr-right { margin-left: auto; display: flex; align-items: center; gap: .85rem; }
.badge-st {
    background: var(--accent-l); color: var(--accent-d);
    border: 1px solid rgba(59,130,160,.18);
    border-radius: 50px; padding: 3px 11px;
    font-size: .68rem; font-weight: 600; letter-spacing: .1em;
}
.hdr-title {
    color: var(--muted); font-size: .78rem; font-weight: 500;
    text-transform: uppercase; letter-spacing: .05em;
}

/* ─── Tabs ─── */
.tabs-bar {
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-bottom: 1px solid rgba(0,0,0,.05);
    padding: 0 clamp(1rem, 3vw, 2.5rem);
    display: flex;
    justify-content: center;
    /* Fissa sotto l'header (60px desktop): i tasti restano fermi tra i tab. */
    position: sticky;
    top: 60px;
    z-index: 90;
}
.tab-link {
    padding: .8rem 1.3rem;
    font-size: .85rem; font-weight: 500;
    color: var(--muted); text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color .15s, border-color .15s;
    white-space: nowrap;
}
.tab-link:hover { color: var(--ink); }
.tab-link.active { color: var(--accent-d); border-bottom-color: var(--accent); }

/* ─── Content ─── */
.content {
    flex: 1; display: flex; flex-direction: column;
    max-width: 1040px; width: 100%;
    margin: 0 auto;
    padding: 0 clamp(1rem, 3vw, 2rem) 3rem;
    position: relative; z-index: 1;
}
.sec-title {
    font-size: .72rem; font-weight: 600;
    letter-spacing: 2.5px; text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    padding-bottom: .55rem;
    margin: 2.5rem 0 1.25rem;
}

/* ─── Hero ─── */
.st-hero {
    text-align: center;
    margin: 2.5rem 0 0;
    animation: heroFadeIn .8s cubic-bezier(.16,1,.3,1) both;
}
@keyframes heroFadeIn {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}
.st-hero-inner { padding: 0 1rem; }
.st-hero h1 {
    color: var(--ink);
    font-weight: 300;
    font-size: clamp(1.5rem, 3.5vw, 2.4rem);
    margin-bottom: .5rem;
    line-height: 1.25;
}
.st-hero .lead {
    color: var(--text-secondary);
    font-weight: 300;
    font-size: clamp(.85rem, 1.4vw, 1rem);
    max-width: 36rem;
    margin: 0 auto;
    line-height: 1.6;
}

/* ─── Search form ─── */
.st-search {
    background: rgba(255,255,255,.86);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow), 0 0 0 1px rgba(0,0,0,.03);
    padding: clamp(1.5rem, 3vw, 2rem);
    margin-top: 1.75rem;
    margin-bottom: 1.75rem;
    animation: searchFadeIn .7s .15s cubic-bezier(.16,1,.3,1) both;
}
@keyframes searchFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.st-search h2 {
    font-size: 1.15rem; font-weight: 600;
    color: var(--ink); margin-bottom: .15rem;
}
.st-search > p {
    color: var(--muted); font-size: .85rem;
    font-weight: 300; margin-bottom: 1.25rem;
}

/* ─── Form card ─── */
.form-card {
    background: rgba(255,255,255,.86);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: 1.5rem;
}
.form-card h2 {
    font-size: 1.15rem; font-weight: 600;
    margin-bottom: .15rem; color: var(--ink);
}
.form-card > p {
    color: var(--muted); font-weight: 300;
    font-size: .85rem; margin-bottom: 1.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.form-row--2 { grid-template-columns: repeat(2, 1fr); }
.form-row > * { min-width: 0; }
.form-row-full { margin-bottom: 1.25rem; }

.field { min-width: 0; }
.field label {
    display: block; font-size: .7rem; font-weight: 600;
    letter-spacing: .06em; text-transform: uppercase;
    color: var(--muted); margin-bottom: .35rem;
}
.field input,
.field select,
.field textarea {
    width: 100%; min-width: 0; max-width: 100%;
    box-sizing: border-box;
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--text); font-family: inherit;
    font-weight: 400; font-size: .9rem;
    padding: .65rem .9rem;
    min-height: 44px;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.field textarea {
    resize: vertical; min-height: 110px;
    font-family: var(--mono); font-size: .8rem;
}
.field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237f8c9b' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .9rem center;
    padding-right: 2.2rem;
}
.field input::placeholder,
.field textarea::placeholder { color: var(--faint); }
.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59,130,160,.1);
}
.field select option { background: #fff; color: var(--text); }

.btn-go {
    width: 100%; padding: .8rem;
    background: var(--accent-d); color: #fff;
    border: none;
    border-radius: 50px;
    font-family: var(--headings);
    font-size: .82rem; font-weight: 500;
    letter-spacing: .1em; text-transform: uppercase;
    cursor: pointer;
    transition: background .2s, transform .15s;
}
.btn-go:hover:not(:disabled) {
    background: var(--accent);
    transform: translateY(-1px);
}
.btn-go:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ─── Threat cards ─── */
.threats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.threat {
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,.45);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow .2s, transform .2s;
}
.threat:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}
.threat.entering {
    animation: threatIn .5s cubic-bezier(.16,1,.3,1) both;
}
@keyframes threatIn {
    from { opacity: 0; transform: translateY(16px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.threat-head {
    display: flex; align-items: center; gap: .75rem;
    padding: .95rem 1.15rem;
    border-bottom: 1px solid var(--line);
}
.threat-icon {
    font-size: 1.2rem;
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    background: var(--panel);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.threat-title {
    font-weight: 600; font-size: .9rem;
    color: var(--ink); flex: 1;
}
.threat-badge {
    padding: 2px 10px; border-radius: 50px;
    font-size: .65rem; font-weight: 600;
    letter-spacing: .06em; text-transform: uppercase;
    white-space: nowrap;
}
.threat-score {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .82rem; font-weight: 600; color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.badge-LOW { background: var(--green-l); color: var(--green); }
.badge-MEDIUM { background: var(--amber-l); color: var(--amber); }
.badge-HIGH { background: var(--red-l); color: var(--red); }
.badge-CRITICAL { background: var(--red-l); color: var(--red); }
.badge-ERROR { background: rgba(127,140,155,.1); color: var(--slate); }

.threat-body { padding: 1rem 1.15rem 1.15rem; }

/* Score summary (full width, no gauge) */
.score-row {
    margin-bottom: .9rem;
}
.score-summary {
    font-size: .85rem; font-weight: 300;
    line-height: 1.65; color: var(--text-secondary);
    padding-top: .15rem;
}

/* Articles */
.articles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: .6rem;
}
/* News su due righe: l'ultima (orfana) si allarga a tutta la larghezza. */
.articles--orphan > :last-child { grid-column: 1 / -1; }
.article {
    background: rgba(245,247,249,.7);
    border: 1px solid rgba(232,236,240,.5);
    border-radius: var(--radius-sm);
    padding: .8rem .9rem;
    transition: border-color .15s, transform .15s;
}
.article:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}
.article-title {
    font-size: .8rem; font-weight: 500;
    color: var(--ink); margin-bottom: .25rem;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.article-snippet {
    font-size: .75rem; font-weight: 300;
    color: var(--muted); line-height: 1.5;
    margin-bottom: .3rem;
    display: -webkit-box; -webkit-line-clamp: 3;
    -webkit-box-orient: vertical; overflow: hidden;
}
.article-src {
    font-size: .68rem; color: var(--accent-d);
    font-weight: 500; word-break: break-all; text-decoration: none;
}
.article-src:hover { text-decoration: underline; }
.article-expand {
    display: none; font-size: .76rem; font-weight: 300;
    color: var(--muted); line-height: 1.55;
    margin-top: .3rem; padding-top: .3rem;
    border-top: 1px solid var(--line);
}
.article-expand.open { display: block; }
.article-toggle {
    font-size: .68rem; color: var(--accent-d); font-weight: 500;
    cursor: pointer; border: none; background: none; padding: 0;
    font-family: inherit; text-decoration: underline;
    text-underline-offset: 2px;
}
.article-toggle:hover { color: var(--accent); }

.threat-loading {
    display: flex; align-items: center; justify-content: center;
    gap: .6rem; padding: 1.75rem;
    color: var(--muted); font-size: .85rem; font-weight: 300;
}
.tl-spin {
    width: 18px; height: 18px;
    border: 2px solid var(--line-strong); border-top-color: var(--accent);
    border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Actions */
.action-bar {
    display: none; gap: .5rem; flex-wrap: wrap;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}
.action-bar.show { display: flex; }
.abtn {
    padding: .45rem 1.1rem;
    border: 1px solid var(--border2);
    background: rgba(255,255,255,.86);
    color: var(--text); border-radius: 50px;
    font-family: inherit; font-size: .78rem; font-weight: 500;
    cursor: pointer; transition: all .15s;
}
.abtn:hover {
    border-color: var(--accent); color: var(--accent-d);
    transform: translateY(-1px);
}
.abtn-red { color: var(--red); border-color: rgba(192,57,43,.25); }

.error-box {
    background: var(--red-l); border: 1px solid rgba(192,57,43,.2);
    border-radius: var(--radius-sm); padding: .9rem;
    color: var(--red); font-size: .85rem; margin-bottom: 1rem;
    display: none;
}

.no-ep {
    background: rgba(255,255,255,.86);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 3rem 2rem; text-align: center;
    color: var(--muted); margin-top: 2rem;
}
.no-ep i { color: var(--accent); }

/* ─── Stats ─── */
/* ─── Stats: colonne fisse e bilanciate (come F1): 6 card → 3×2, 4 card → 4 in riga ─── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .9rem; margin-bottom: 2rem;
}
.stat-grid.stat-grid--reduced { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) {
    .stat-grid, .stat-grid.stat-grid--reduced { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.stat-card {
    background: rgba(255,255,255,.86);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 1.2rem .9rem; text-align: center;
    transition: box-shadow .2s, transform .2s;
}
.stat-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.stat-card i { color: var(--accent); margin-bottom: .4rem; }
.stat-val {
    display: block; font-size: 1.55rem;
    font-weight: 500; color: var(--ink);
}
.stat-label {
    display: block; font-size: .73rem;
    color: var(--muted); margin-top: .15rem;
}

.chart-box {
    background: rgba(255,255,255,.86);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: clamp(.75rem, 2vw, 1.15rem) clamp(1rem, 2.5vw, 1.4rem);
    margin-bottom: 1.15rem; overflow: hidden;
}
.chart-box canvas { max-width: 100%; }
.chart-box h3 {
    font-size: .82rem; font-weight: 500;
    margin: 0 0 .6rem; color: var(--ink);
}

.stats-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.stats-table th {
    text-align: left; font-size: .68rem; font-weight: 600;
    letter-spacing: .06em; text-transform: uppercase;
    color: var(--muted); padding: .5rem .65rem;
    border-bottom: 1px solid var(--border);
}
.stats-table td {
    padding: .4rem .65rem;
    border-bottom: 1px solid var(--line);
    color: var(--text);
}
.stats-table tr:last-child td { border: none; }
.stats-table tbody tr:hover td { background: var(--panel); }

.dl-btn {
    background: var(--surface); border: 1px solid var(--border2);
    color: var(--muted); border-radius: var(--radius-sm);
    padding: 2px 7px; font-size: .7rem; cursor: pointer;
    transition: .15s; white-space: nowrap;
}
.dl-btn:hover { color: var(--accent-d); border-color: var(--accent); background: var(--accent-l); }

/* ─── Info ─── */
.info-grid { display: grid; grid-template-columns: 1fr; gap: .9rem; margin-bottom: 1.15rem; }
/* Desktop: 2 colonne bilanciate (3 card → 2 + orfana a tutta riga). */
@media (min-width: 900px) {
    .info-grid { grid-template-columns: 1fr 1fr; }
    .info-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
.info-icon {
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    background: var(--accent-l); color: var(--accent-d);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
}
.info-card {
    background: rgba(255,255,255,.86);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 1.15rem 1.35rem;
    position: relative; overflow: hidden;
    transition: box-shadow .2s, transform .2s;
}
.info-grid .info-card { margin-bottom: 0; }
.info-head {
    display: flex; align-items: center;
    gap: .7rem; margin-bottom: .5rem;
}
.info-head h3 { margin: 0; }
.info-card::before {
    content: ''; position: absolute;
    left: 0; top: 0; bottom: 0; width: 3px;
    background: var(--accent); border-radius: 0 2px 2px 0;
}
.info-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.info-card h3 {
    font-size: 1rem; font-weight: 500;
    margin-bottom: .5rem; color: var(--ink);
}
.info-grid .info-card h3 { font-size: .9rem; }
.info-card p {
    font-size: .85rem; font-weight: 300;
    color: var(--text-secondary); line-height: 1.65;
}
.info-card p + p { margin-top: .4rem; }

.res-links {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: .45rem; margin-top: .8rem;
}
.res-links > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.res-links > a,
.res-links > span {
    display: flex !important; align-items: center; justify-content: center;
    text-align: center; padding: .45rem .9rem;
    font-size: .78rem; border-radius: 50px;
    font-weight: 500; text-decoration: none;
}
.res-links > a {
    background: var(--accent-l); color: var(--accent-d);
    border: 1px solid rgba(59,130,160,.15);
    transition: background .15s;
}
.res-links > a:hover { background: rgba(59,130,160,.14); }
.res-links > span {
    background: var(--panel); color: var(--faint);
    border: 1px solid var(--border); cursor: not-allowed;
}

/* ─── AI transparency ─── */
.ai-notice {
    margin: 1.5rem 0 0;
    border: 1px solid #c5cdd6;
    background: #eef1f5; color: #2c3e50;
    font-weight: 500; box-shadow: var(--shadow);
}
.ai-notice .ai-notice-link { color: var(--accent-d); }
.ai-notice .ai-notice-link:hover { color: var(--accent); }
.ai-info-card {
    border: 1px solid #b8c2cc; background: #e8ecf1;
    box-shadow: var(--shadow-hover);
}
.ai-info-card h3 { color: #1a2332; }
.ai-info-card > p { color: #4a5568; }
.ai-info-card .ai-field { background: #fff; border-color: var(--line-strong); }
.ai-info-card .ai-field-label { color: var(--muted); }
.ai-info-card .ai-field-value { color: var(--ink); }
.ai-info-card .ai-limits {
    background: rgba(59,130,160,.08);
    border-color: rgba(59,130,160,.2);
    color: var(--text-secondary);
}
.ai-info-card .ai-ref-line { color: var(--muted); }
.ai-info-card .ai-limits strong { color: var(--accent-d); }

/* ─── Testing chat ─── */
.chat-container { display: none; flex-direction: column; }
.chat-container.show { display: flex; }
#testing-chat { display: none; }
#testing-chat.show { display: flex; }

.ticket-bar {
    background: rgba(255,255,255,.86);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: .9rem 1.15rem; margin-bottom: .9rem;
    display: flex; align-items: center;
    gap: .9rem; flex-wrap: wrap;
}
.ticket-bar .tb-label {
    font-size: .65rem; font-weight: 600;
    letter-spacing: .06em; text-transform: uppercase;
    color: var(--muted);
}
.ticket-bar .tb-val { font-size: .82rem; color: var(--text); font-weight: 500; }
.ticket-bar .tb-item { display: flex; flex-direction: column; gap: .1rem; }
.tb-divider { width: 1px; height: 26px; background: var(--border); }

.chat-messages {
    display: flex; flex-direction: column; gap: .7rem;
    padding: .9rem 0; min-height: 110px;
    max-height: 60vh; overflow-y: auto;
}
.msg {
    display: flex; gap: .55rem; max-width: 90%;
}
.msg-agent { align-self: flex-start; }
.msg-user { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem; flex-shrink: 0;
    background: var(--accent-l); color: var(--accent-d);
}
.msg-user .msg-avatar { background: var(--ink); color: #fff; }
.msg-bubble {
    padding: .65rem 1rem; border-radius: var(--radius-sm);
    font-size: .82rem; font-weight: 300; line-height: 1.6;
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text); box-shadow: var(--shadow);
}
.msg-user .msg-bubble {
    background: var(--accent-d); border-color: var(--accent-d); color: #fff;
}
.msg-bubble pre {
    margin: 0; white-space: pre-wrap; word-break: break-all;
    font-size: .75rem; font-family: var(--mono);
}
.msg-meta { font-size: .65rem; color: var(--muted); margin-top: .2rem; padding: 0 .35rem; }
.msg-phase {
    display: inline-block; font-size: .65rem; font-weight: 600;
    letter-spacing: .06em; text-transform: uppercase;
    padding: 2px 7px; border-radius: 3px;
    margin-bottom: .4rem;
    background: var(--accent-l); color: var(--accent-d);
}
.phase-retrieve { background: var(--green-l); color: var(--green); }
.phase-escalated { background: var(--red-l); color: var(--red); }
.phase-done { background: var(--green-l); color: var(--green); }

.btn-reset {
    padding: .5rem 1.3rem;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border2); border-radius: 50px;
    font-family: inherit; font-size: .82rem; font-weight: 500;
    cursor: pointer; transition: .15s;
}
.btn-reset:hover {
    border-color: var(--accent); color: var(--accent-d);
    transform: translateY(-1px);
}

/* ─── Reveal ─── */
.reveal {
    opacity: 0; transform: translateY(24px);
    transition: opacity .6s cubic-bezier(.16,1,.3,1), transform .6s cubic-bezier(.16,1,.3,1);
}
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-stagger > *:nth-child(1) { transition-delay: 0s; }
.reveal-stagger > *:nth-child(2) { transition-delay: .06s; }
.reveal-stagger > *:nth-child(3) { transition-delay: .12s; }
.reveal-stagger > *:nth-child(4) { transition-delay: .18s; }
.reveal-stagger > *:nth-child(5) { transition-delay: .24s; }

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */

/* Tablet */
@media (max-width: 768px) {
    .form-card, .st-search { padding: 1.15rem; }

    .st-hero { margin-top: 1.5rem; }
    .st-hero h1 { font-size: 1.4rem; }
    .st-hero .lead { font-size: .82rem; }

    .st-search { margin-top: 1.25rem; margin-bottom: 1.25rem; }

    .form-row { grid-template-columns: repeat(2, 1fr); }
    .form-row .field:nth-child(3) { grid-column: 1 / -1; }
    .form-row--2 { grid-template-columns: 1fr; }

    .threats { grid-template-columns: 1fr; }

    .articles { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-grid.stat-grid--reduced { grid-template-columns: 1fr 1fr; }

    .info-grid { grid-template-columns: 1fr; }

    .hdr-title { display: none; }
    header { height: 56px; }
    .logo { font-size: 1rem; }

    .tabs-bar {
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        top: 56px;
    }
    .tabs-bar::-webkit-scrollbar { display: none; }

    .content { padding: 0 1rem 2rem; }

    .ticket-bar { flex-direction: column; align-items: flex-start; gap: .5rem; }
    .tb-divider { display: none; }
    .msg { max-width: 95%; }
}

/* Phone */
@media (max-width: 480px) {
    header { height: 52px; padding: 0 .75rem; }
    .logo { font-size: .92rem; letter-spacing: .08em; }
    .badge-st { font-size: .6rem; padding: 2px 7px; }

    .tabs-bar { padding: 0 .75rem; top: 52px; }
    .tab-link { padding: .65rem .9rem; font-size: .8rem; }

    .content { padding: 0 .75rem 1.5rem; }

    .st-hero { margin-top: 1rem; }
    .st-hero h1 { font-size: 1.2rem; }
    .st-hero .lead { font-size: .78rem; }

    .st-search { padding: 1rem; margin-top: 1rem; margin-bottom: 1rem; }
    .st-search h2 { font-size: 1rem; }

    .form-card { padding: 1rem; }

    .form-row { grid-template-columns: 1fr; }
    .form-row .field:nth-child(3) { grid-column: auto; }

    .threat-head { padding: .8rem .9rem; gap: .55rem; }
    .threat-icon { width: 36px; height: 36px; font-size: 1rem; }
    .threat-title { font-size: .82rem; }
    .threat-body { padding: .8rem .9rem 1rem; }

    .score-summary { font-size: .8rem; }

    .articles { grid-template-columns: 1fr; }

    .stat-grid { grid-template-columns: 1fr 1fr; gap: .65rem; }
    .stat-card { padding: .9rem .65rem; }
    .stat-val { font-size: 1.3rem; }

    .abtn { padding: .4rem .9rem; font-size: .72rem; }

    .res-links { grid-template-columns: 1fr; }
    .res-links > :last-child:nth-child(odd) { grid-column: auto; }
}

/* Billing tables keep native layout on mobile: detail columns hide via
   .col-detail (only Servizio/Prezzo/Min-oggi restano). vedi responsive.css. */

/* Torna in alto (iniettato da animations.js): sempre ancorato in basso a
   destra della finestra, mai in mezzo al contenuto. */
#to-top {
    position: fixed; right: 1rem; bottom: 1rem; z-index: 300;
    width: 44px; height: 44px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: #fff; border: 1px solid var(--accent); color: var(--accent);
    cursor: pointer; box-shadow: 0 8px 20px -10px rgba(59, 130, 160, .6);
    opacity: 0; transform: translateY(10px); pointer-events: none;
    transition: opacity .2s, transform .2s, color .15s;
}
#to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
#to-top:hover { background: var(--accent-l); }
