/* ============================================================
   QEMURO - Travel Risk & Rescue System
   Official brand kit (v1.0, Maggio 2025):
     Blu Notte   #0A1A2F   Blu Primario #0D47A1
     Turchese    #00BCD4   Grigio       #6B7280   Grigio Chiaro #F2F4F7
     Font: Poppins   Gradient: #0D47A1 -> #00BCD4
   Full-width responsive website (desktop-first, mobile-ready).
   ============================================================ */
:root {
  --notte: #0A1A2F;
  --blu: #0D47A1;
  --blu-2: #1157c4;
  --turchese: #00BCD4;
  --turchese-2: #33cbdd;
  --grigio: #6B7280;
  --chiaro: #F2F4F7;
  --ink: #0A1A2F;
  --muted: #6B7280;
  --bg: #F2F4F7;
  --card: #ffffff;
  --line: #e4e8f0;
  --line-strong: #d5dbe6;
  --grad: linear-gradient(135deg, #0D47A1 0%, #00BCD4 100%);
  --grad-soft: linear-gradient(135deg, rgba(13,71,161,.08), rgba(0,188,212,.08));
  --danger: #e5484d;        /* reserved for emergency/Rescue actions only */
  --danger-dark: #c93b40;
  --danger-soft: #fdecec;
  --amber: #d99a2b;
  --amber-ink: #8a6116;
  --amber-soft: #faf1dc;
  /* Risk Score 4-band scale (client UI Review v1.0):
     Verde 0-30 · Giallo 31-60 · Arancione 61-80 · Rosso 81-100 */
  --arancione: #ef7d21;
  --arancione-ink: #b4550c;
  --arancione-soft: #fdeede;
  --green: #1f9d57;
  --green-soft: #e4f4ec;
  --turchese-soft: #e3f7fa;
  --blu-soft: #e7effb;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(10,26,47,.05), 0 8px 24px rgba(10,26,47,.06);
  --shadow-lg: 0 12px 40px rgba(10,26,47,.14);
  --container: 1200px;
  --header-h: 68px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Poppins', -apple-system, 'Segoe UI', system-ui, Roboto, sans-serif;
  background: var(--bg); color: var(--ink);
  font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
#app { min-height: 100vh; display: flex; flex-direction: column; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }
main.page { flex: 1; width: 100%; max-width: var(--container); margin: 0 auto; padding: 28px 24px 64px; }

.ic { width: 1.1em; height: 1.1em; vertical-align: -0.18em; flex: none; }
.ic.big { width: 1.5em; height: 1.5em; }

/* ---------- logo ---------- */
.qmark { display: inline-block; vertical-align: middle; object-fit: contain; }
.qmark.on-dark { background: #fff; border-radius: 9px; padding: 3px; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.qlockup { display: inline-flex; align-items: center; gap: 10px; }
.qlockup-word { font-weight: 700; font-size: 22px; letter-spacing: .04em; line-height: 1; }
/* turquoise macron accent over the U (matches the official wordmark) */
.qlockup-word .qu, .brand-txt .qu { position: relative; }
.qlockup-word .qmac, .brand-txt .qmac {
  position: absolute; left: 7%; right: 7%; top: -0.14em; height: 0.1em;
  background: linear-gradient(90deg, #0D47A1, #00BCD4); border-radius: 2px;
}
.qlogo-full { width: auto; display: block; }
.auth-logo { margin-bottom: 10px; }
/* white chip so the (navy-wordmark) logo stays readable on dark surfaces */
.logo-chip { display: inline-flex; background: #fff; border-radius: 10px; padding: 6px 11px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
/* module label next to the header logo (ecosystem consistency) */
.brand-module { font-size: 11px; font-weight: 500; letter-spacing: .04em; color: var(--grigio); text-transform: uppercase; padding-left: 12px; margin-left: 2px; border-left: 1px solid var(--line); align-self: center; }
@media (max-width: 680px) { .brand-module { display: none; } }

/* ---------- site header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92); backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .nav { display: flex; align-items: center; gap: 20px; height: var(--header-h); }
.site-header .brand { display: inline-flex; align-items: center; gap: 11px; cursor: pointer; text-decoration: none; margin-right: 8px; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.05; }
.brand-txt .brand-sub { font-size: 10px; font-weight: 500; letter-spacing: .05em; color: var(--grigio); text-transform: uppercase; margin-top: 2px; }
@media (max-width: 680px) { .brand-txt .brand-sub { display: none; } }
.nav-links { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav-links a {
  color: var(--ink); text-decoration: none; font-weight: 500; font-size: 14.5px;
  padding: 8px 14px; border-radius: 9px; cursor: pointer; position: relative;
}
.nav-links a:hover { background: var(--chiaro); }
.nav-links a.on { color: var(--blu); }
.nav-links a.on::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 2.5px;
  background: var(--grad); border-radius: 2px;
}
.nav-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; min-width: 0; }
.user-btn {
  background: var(--chiaro); border: 1px solid var(--line); color: var(--ink);
  padding: 7px 12px; border-radius: 9px; font-weight: 600; font-size: 13.5px; cursor: pointer;
  /* a long account name must shrink, not push the header off the screen */
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 46vw; min-width: 0; overflow: hidden; white-space: nowrap;
}
.user-btn > span { overflow: hidden; text-overflow: ellipsis; }
.user-btn .ic { color: var(--blu); }
.user-btn:hover { border-color: var(--line-strong); }

/* language segmented control */
.lang-seg { display: inline-flex; background: var(--chiaro); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.lang-seg button {
  background: transparent; color: var(--grigio); border: 0; cursor: pointer;
  font-size: 12px; font-weight: 700; letter-spacing: .06em; padding: 0 11px; height: 32px;
}
.lang-seg button.on { background: var(--blu); color: #fff; }

/* ---------- footer ---------- */
.site-footer { background: var(--notte); color: #cdd6e4; margin-top: auto; }
.site-footer .foot { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; justify-content: space-between; padding: 26px 24px; }
.site-footer .qlockup-word { color: #fff; }
.site-footer .foot small { color: #8595ad; font-size: 12.5px; }
.site-footer a { color: #9fd8e6; text-decoration: none; font-size: 13.5px; }
.site-footer .foot-links { display: flex; gap: 18px; flex-wrap: wrap; }

/* ---------- hero / landing ---------- */
.hero {
  background: radial-gradient(1200px 500px at 80% -10%, rgba(0,188,212,.28), transparent 60%),
              linear-gradient(135deg, #0A1A2F 0%, #0D47A1 90%);
  color: #fff; position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px;
  background: radial-gradient(circle, rgba(0,188,212,.35), transparent 70%); pointer-events: none;
}
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; padding: 64px 24px 72px; }
.hero h1 { display: block; font-size: 44px; line-height: 1.12; font-weight: 700; letter-spacing: -.02em; margin: 14px 0 16px; }
.hero h1 .accent { white-space: nowrap; }
.hero h1 .accent { background: linear-gradient(90deg,#7fe3f0,#00BCD4); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { font-size: 17.5px; color: #c9d6ea; max-width: 520px; margin: 0 0 26px; }
.hero .eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: #7fe3f0; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-badges { display: flex; gap: 22px; margin-top: 30px; flex-wrap: wrap; }
.hero-badges .hb { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: #c9d6ea; }
.hero-badges .hb .ic { color: #7fe3f0; }

/* auth card in hero */
.auth-card { background: #fff; color: var(--ink); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 26px; }
.auth-card h2 { margin: 0 0 4px; font-size: 20px; }
.auth-tabs { display: flex; gap: 6px; margin: 14px 0 6px; background: var(--chiaro); padding: 4px; border-radius: 11px; }
.auth-tabs button { flex: 1; background: transparent; border: 0; color: var(--grigio); font-weight: 600; font-size: 14px; padding: 9px; border-radius: 8px; cursor: pointer; }
.auth-tabs button.active { background: #fff; color: var(--blu); box-shadow: 0 1px 3px rgba(10,26,47,.12); }
.demo-hint { background: var(--turchese-soft); border: 1px solid #b8e8ef; border-radius: 10px; padding: 10px 12px; font-size: 12.5px; color: #0b6b78; display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; }
.demo-hint .ic { color: var(--turchese); margin-top: 1px; flex: none; }

/* standalone auth pages (password recovery / reset) */
.hero.slim::after { display: none; }
.auth-solo { display: flex; justify-content: center; padding: 56px 24px 68px; }
.auth-solo .auth-card { width: 100%; max-width: 460px; }
.auth-aside { margin-top: 10px; font-size: 13px; }
.auth-aside.center { text-align: center; margin-top: 16px; }
.link { color: var(--blu); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.link:hover { text-decoration: underline; }
.notice { display: flex; gap: 9px; align-items: flex-start; border-radius: 10px; padding: 12px 13px; font-size: 13.5px; margin: 12px 0; }
.notice .ic { flex: none; margin-top: 1px; }
.notice.ok { background: var(--turchese-soft); border: 1px solid #b8e8ef; color: #0b6b78; }
.notice.ok .ic { color: var(--turchese); }
.notice.warn { background: #fff4e5; border: 1px solid #ffd9a8; color: #8a4b00; }
.notice.warn .ic { color: #e07a00; }
.notice.danger { background: var(--danger-soft); border: 1px solid #f5b9ba; color: #8e2528; }
.notice.info { background: var(--blu-soft); border: 1px solid #c3d7f5; color: #1b3a63; }
.notice.info .ic { color: var(--blu); }
.scope-note { margin: 0 0 16px; line-height: 1.55; font-size: 13.5px; }
.notice.danger .ic { color: var(--danger); }

/* in-app preview of an uploaded proof */
.ev-preview { padding: 0 0 12px; }
.ev-preview img {
  display: block; max-width: 100%; height: auto; max-height: 60vh;
  margin: 0 auto; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--chiaro);
}
.ev-preview object { display: block; width: 100%; height: 60vh; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.pv-fallback { display: flex; gap: 8px; align-items: flex-start; padding: 14px; background: var(--chiaro); border-radius: var(--radius-sm); font-size: 13.5px; }
.pv-fallback .ic { color: var(--blu); flex: none; margin-top: 2px; }
@media (max-width: 680px) {
  .ev-preview object { height: 46vh; }
  .ev-preview img { max-height: 46vh; }
}

/* ready checklist rows carry their fix */
.ready-row { align-items: center; gap: 10px; }
.ready-row .ready-fix { flex: none; white-space: nowrap; }
@media (max-width: 560px) {
  .ready-row { flex-wrap: wrap; }
  .ready-row .ready-fix { margin-left: auto; }
}

/* plan comparison: the buyer should see the difference, not guess it */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 14px; align-items: start; }
.plan { position: relative; display: flex; flex-direction: column; }
.plan-reco { border: 2px solid var(--blu); }
.plan-tag { position: absolute; top: -11px; left: 16px; background: var(--grad); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; }
.plan-price { font-size: 26px; font-weight: 800; margin: 10px 0 2px; }
.plan-feat { list-style: none; margin: 14px 0; padding: 0; flex: 1; }
.plan-feat li { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; padding: 4px 0; line-height: 1.45; }
.plan-feat li .ic { flex: none; margin-top: 3px; }
.plan-feat .yes .ic { color: var(--green); }
.plan-feat .no { color: var(--muted); }
.plan-feat .no .ic { color: #c9d0dd; }
.plan-feat .no span { text-decoration: line-through; text-decoration-color: #c9d0dd; }
.plan-current { text-align: center; font-size: 13px; color: var(--muted); padding: 9px 0; border-top: 1px dashed var(--line); }

/* policy documents + account rows */
.kv-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.kv-row:first-of-type { border-top: 0; }
.doc { line-height: 1.7; }
.doc .doc-intro { font-size: 16.5px; color: var(--ink); margin-top: 0; }
.doc h3 { margin: 22px 0 6px; font-size: 16px; }
.doc p { margin: 0 0 8px; color: #33415c; }
.doc ul { margin: 0 0 10px; padding-left: 20px; color: #33415c; }
.doc li { margin-bottom: 5px; }
.doc-list { margin: 4px 0 14px; padding-left: 20px; }
.doc-list li { margin-bottom: 4px; }

/* rescue lifecycle controls (RES-01) */
.rescue-state { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 12px 0; }
.att-list { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
@media (max-width: 720px) { .rescue-state { grid-template-columns: 1fr; } }

/* trip form: individual travellers + inline validation */
.req { color: #c0392b; font-weight: 700; }
.field-err { color: #c0392b; font-size: 12.5px; margin: -2px 0 8px; }
.field-err:empty { display: none; }
.trav-add { display: flex; gap: 8px; align-items: stretch; }
.trav-add input { flex: 1; }
.trav-add button { flex: none; white-space: nowrap; }
.trav-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; min-height: 24px; }
.trav-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--chiaro); border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 10px; font-size: 13px; }
.trav-chip .ic { width: 13px; height: 13px; color: var(--blu); }
.trav-chip button { background: transparent; border: 0; cursor: pointer; color: var(--grigio); display: inline-flex; padding: 2px; border-radius: 50%; }
.trav-chip button:hover { background: #fdecea; color: #c0392b; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* masked booking reference */
.pnr { font-variant-numeric: tabular-nums; letter-spacing: .04em; cursor: help; border-bottom: 1px dotted var(--line-strong); }

/* "Perche questo rischio?" breakdown */
.conn-times { display: flex; flex-wrap: wrap; gap: 12px; margin: 6px 0; font-size: 12.5px; color: var(--grigio); }
.conn-times b { color: var(--ink); }
.conn-times .neg b { color: #c0392b; }
.why-btn { margin-top: 4px; }
.why-panel { margin-top: 10px; padding: 12px; background: #fbfcfe; border: 1px solid var(--line); border-radius: 10px; }
.why-title { font-size: 12px; font-weight: 700; color: var(--blu); text-transform: uppercase; letter-spacing: .04em; margin: 10px 0 6px; }
.why-title:first-child { margin-top: 0; }
.why-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.why-table td { padding: 4px 0; border-bottom: 1px solid var(--line); }
.why-table td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.why-table tr.tot td { font-weight: 700; border-bottom: 2px solid var(--line-strong); }
.why-table tr:last-child td { border-bottom: 0; }

/* Rescue: what-it-does explainer + prominent emergency notice */
.emergency-banner { display: flex; gap: 12px; align-items: flex-start; background: #fdecea; border: 1px solid #f5b7b1; border-left: 4px solid #c0392b; border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; color: #7b241c; }
.emergency-banner .eb-ic { color: #c0392b; flex: none; margin-top: 1px; }
.emergency-banner .eb-ic .ic { width: 20px; height: 20px; }
.emergency-banner b { display: block; margin-bottom: 2px; }
.rescue-explain { margin-bottom: 12px; }
.rescue-list { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-direction: column; gap: 8px; }
.rescue-list li { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; line-height: 1.45; }
.rescue-list li .ic { color: #16a34a; flex: none; margin-top: 3px; width: 14px; height: 14px; }

/* boot screen (shown before the app renders; the test env can be slow to wake) */
.boot { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 40px 24px; text-align: center; }
.boot-logo { max-height: 46px; width: auto; opacity: .95; }
.boot-spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--turchese); border-radius: 50%; animation: bootspin .8s linear infinite; }
@keyframes bootspin { to { transform: rotate(360deg); } }
.boot-msg { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.boot-msg span[lang=en] { color: var(--grigio); font-weight: 500; }
.boot-sub { font-size: 12.5px; color: var(--grigio); max-width: 460px; line-height: 1.5; min-height: 34px; }

/* example scenarios gallery */
.scenarios-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 14px; margin-top: 12px; }
.scenario-card { display: flex; flex-direction: column; gap: 6px; }
.scenario-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.scenario-card .btn-block { margin-top: auto; }

/* GDPR consent toggles */
.consent-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.consent-row:first-of-type { border-top: 0; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: var(--line-strong); border-radius: 999px; transition: .2s; cursor: pointer; }
.switch .slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--turchese); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch input:disabled + .slider { opacity: .5; cursor: not-allowed; }

/* back office user management */
.admin-search { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 12px; font-size: 14px; }
select.mini { padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }
tr.row-susp { opacity: .6; }

/* trip filters + card actions (duplicate/archive) */
.trip-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.trip-filters .tf { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; color: var(--grigio); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.trip-filters .tf.on { background: var(--blu); border-color: var(--blu); color: #fff; }
.trip-filters .tf-n { font-size: 11px; opacity: .7; }
.trip-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; }
.trip-acts { display: flex; gap: 4px; }
.icon-btn { background: transparent; border: 1px solid var(--line); border-radius: 8px; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; color: var(--grigio); cursor: pointer; }
.icon-btn:hover { background: var(--chiaro); color: var(--blu); border-color: var(--line-strong); }
.icon-btn .ic { width: 15px; height: 15px; }

/* status coherence note (STA-01) */
.status-note { margin-top: 8px; background: #fff4e5; border: 1px solid #ffd9a8; color: #8a4b00; border-radius: 9px; padding: 9px 10px; font-size: 12px; display: flex; flex-direction: column; gap: 5px; }
.status-note .ic { width: 13px; height: 13px; flex: none; }
.status-note .btn-ghost { align-self: flex-start; margin-top: 2px; }

/* three separate meters: progress / completeness / readiness (TIM-01) */
.meters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.meter { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.meter-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 7px; }
.meter-head b { font-size: 16px; }
.meter-sub { margin-top: 7px; font-size: 11.5px; color: var(--grigio); display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.meter-sub .ic { width: 12px; height: 12px; }
.meter .progress i.verde { background: #16a34a; }
.meter .progress i.giallo { background: #eab308; }
.meter .progress i.rosso { background: #dc2626; }
.meter .progress i.blu { background: var(--grad); }
.miss-chip { display: inline-flex; align-items: center; gap: 4px; background: #fff4e5; border: 1px solid #ffd9a8; color: #8a4b00; border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 600; cursor: pointer; }
.miss-chip:hover { background: #ffe9cc; }
.tl-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }

/* empty states (ERR-01) */
.empty-state { text-align: center; padding: 40px 24px; background: var(--card); border: 1px dashed var(--line-strong); border-radius: 14px; }
.empty-state .empty-ic { color: var(--turchese); margin-bottom: 10px; }
.empty-state .empty-ic .ic { width: 40px; height: 40px; }
.empty-state h3 { margin: 0 0 6px; font-size: 17px; }
.empty-state p { max-width: 460px; margin: 0 auto 14px; font-size: 14px; }
.empty-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 12px; }

@media (max-width: 860px) { .meters { grid-template-columns: 1fr; gap: 10px; } }

/* timezone + duration hints on the segment form (TZ-01) */
.tz-line { min-height: 20px; margin-top: 5px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tz-chip { display: inline-flex; align-items: center; gap: 5px; background: var(--turchese-soft); border: 1px solid #b8e8ef; color: #0b6b78; border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 600; }
.tz-chip .ic { width: 13px; height: 13px; }
.tz-chip.manual { background: #fff4e5; border-color: #ffd9a8; color: #8a4b00; }
.tz-chip.warn { background: #fff4e5; border-color: #ffd9a8; color: #8a4b00; font-weight: 500; }
.tz-sub { font-size: 11.5px; color: var(--grigio); }
.tz-inline { font-size: 11px; font-weight: 600; color: var(--blu); background: #eef3fb; border-radius: 5px; padding: 1px 5px; white-space: nowrap; }
.duration-line { margin: 10px 0 2px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dur-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--chiaro); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; font-size: 13px; font-weight: 600; color: var(--ink); }
details.adv { margin: 12px 0 4px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: #fbfcfe; }
details.adv > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--blu); display: flex; align-items: center; gap: 6px; list-style: none; }
details.adv > summary::-webkit-details-marker { display: none; }
details.adv[open] > summary { margin-bottom: 8px; }

/* feature band */
.band { padding: 56px 24px; }
.band.alt { background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.band h2.section-title { font-size: 28px; text-align: center; margin: 0 0 6px; letter-spacing: -.01em; }
.band p.section-sub { text-align: center; color: var(--muted); max-width: 620px; margin: 0 auto 34px; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.feature .fi { width: 46px; height: 46px; border-radius: 12px; background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.feature .fi .ic { width: 23px; height: 23px; }
.feature h3 { margin: 0 0 6px; font-size: 16.5px; }
.feature p { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- headings ---------- */
h1 { font-size: 27px; margin: 6px 0 8px; letter-spacing: -.01em; display: flex; align-items: center; gap: 11px; font-weight: 600; }
h1 .ic { color: var(--turchese); }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
h2 { font-size: 20px; margin: 24px 0 10px; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; font-weight: 600; }
h2 .ic { color: var(--grigio); width: 1em; height: 1em; }
h3 { font-size: 16px; margin: 14px 0 6px; font-weight: 600; }
p { margin: 6px 0; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 12.5px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin: 14px 0; }

/* ---------- buttons ---------- */
button, .btn {
  font: inherit; cursor: pointer; border: 0; border-radius: var(--radius-sm);
  padding: 11px 18px; font-weight: 600; font-size: 14.5px; display: inline-flex; align-items: center; gap: 8px;
  justify-content: center; text-decoration: none; letter-spacing: .01em; font-family: inherit;
}
.btn-primary { background: var(--blu); color: #fff; box-shadow: 0 3px 10px rgba(13,71,161,.25); }
.btn-primary:hover { background: var(--blu-2); }
.btn-grad { background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgba(0,188,212,.3); }
.btn-grad:hover { filter: brightness(1.05); }
.btn-teal { background: var(--turchese); color: #063a41; box-shadow: 0 3px 10px rgba(0,188,212,.28); }
.btn-teal:hover { background: var(--turchese-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-dark); }
.btn-ghost { background: #fff; color: var(--blu); border: 1.5px solid var(--line-strong); }
.btn-ghost:hover { border-color: var(--blu); }
.btn-ghost.on-dark { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.btn-ghost.on-dark:hover { background: rgba(255,255,255,.12); }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 9px; }
.btn-lg { padding: 13px 24px; font-size: 16px; }
.btn-block { width: 100%; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* rescue SOS */
.sos {
  width: 100%; background: linear-gradient(135deg, var(--danger) 0%, #f0663f 100%);
  color: #fff; font-size: 17px; font-weight: 700; letter-spacing: .02em;
  padding: 16px; border-radius: var(--radius); box-shadow: 0 8px 22px rgba(229,72,77,.32);
}
.sos:hover { filter: brightness(1.05); }
.sos .ic { width: 21px; height: 21px; }

/* ---------- forms ---------- */
label.f { display: block; margin: 12px 0 5px; font-size: 13px; font-weight: 600; color: var(--notte); }
input, select, textarea {
  font: inherit; font-family: inherit; width: 100%; padding: 11px 12px; border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm); background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(0,188,212,.25); border-color: var(--turchese); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; margin: 9px 0; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--turchese); }
input[type=checkbox] { accent-color: var(--turchese); }

/* ---------- chips & badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3.5px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.chip .ic { width: .95em; height: .95em; }
.chip.verde, .chip.ok, .chip.pagato { background: var(--green-soft); color: var(--green); }
.chip.giallo, .chip.avviso, .chip.in_attesa, .chip.teso { background: var(--amber-soft); color: var(--amber-ink); }
.chip.rosso, .chip.critico, .chip.perso, .chip.annullato { background: var(--danger-soft); color: var(--danger-dark); }
.chip.neutro { background: var(--blu-soft); color: var(--blu); }
.chip.trust-verificato { background: var(--green-soft); color: var(--green); }
.chip.trust-dichiarato { background: var(--blu-soft); color: var(--blu); }
.chip.trust-stimato { background: var(--amber-soft); color: var(--amber-ink); }
.chip.trust-generato { background: var(--danger-soft); color: var(--danger-dark); }

.badge-score { font-size: 44px; font-weight: 700; line-height: 1; }
.score-ring {
  width: 128px; height: 128px; border-radius: 50%; margin: 8px auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #fff; text-align: center; box-shadow: inset 0 -6px 14px rgba(0,0,0,.14), var(--shadow);
}
.score-ring .lvl { font-size: 11.5px; font-weight: 700; opacity: .92; text-transform: uppercase; letter-spacing: .1em; }
.ring-verde { background: radial-gradient(circle at 32% 28%, #3bb673, var(--green)); }
.ring-giallo { background: radial-gradient(circle at 32% 28%, #e7b555, var(--amber)); }
.ring-rosso { background: radial-gradient(circle at 32% 28%, #ef6f74, var(--danger)); }

/* semaforo */
.semaforo { display: flex; align-items: center; gap: 14px; }
.semaforo .dot { width: 54px; height: 54px; border-radius: 50%; flex: none; box-shadow: inset 0 -5px 10px rgba(0,0,0,.18), 0 2px 8px rgba(10,26,47,.15); }
.dot.verde { background: var(--green); } .dot.giallo { background: var(--amber); } .dot.rosso { background: var(--danger); }

/* ---------- timeline ---------- */
.tl { position: relative; margin: 4px 0; padding-left: 30px; }
.tl:before { content: ''; position: absolute; left: 11px; top: 10px; bottom: 10px; width: 2px; background: var(--grad); border-radius: 2px; opacity: .5; }
.tl-seg { position: relative; margin: 0 0 6px; }
.tl-seg .node {
  position: absolute; left: -30px; top: 8px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--blu); color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 3px var(--bg);
}
.tl-seg .node .ic { width: 12.5px; height: 12.5px; }
.tl-seg .seg-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }
.tl-conn { margin: 4px 0 10px; padding: 5px 11px; border-radius: 9px; font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.tl-conn.verde { background: var(--green-soft); color: var(--green); }
.tl-conn.giallo { background: var(--amber-soft); color: var(--amber-ink); }
.tl-conn.rosso { background: var(--danger-soft); color: var(--danger-dark); }
.seg-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.seg-head b { font-size: 15px; }
.seg-actions { display: flex; gap: 6px; margin-top: 8px; }
.seg-meta .ic { width: .95em; height: .95em; color: var(--grigio); }

/* ---------- trip two-column layout ---------- */
.trip-layout { display: grid; grid-template-columns: 264px 1fr; gap: 24px; align-items: start; }
.trip-side { position: sticky; top: calc(var(--header-h) + 20px); }
.trip-side .side-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.side-tabs { display: flex; flex-direction: column; gap: 3px; margin-top: 12px; }
.side-tabs button {
  justify-content: flex-start; background: transparent; color: var(--ink); border: 0;
  padding: 10px 12px; border-radius: 9px; font-weight: 500; font-size: 14px; width: 100%;
}
.side-tabs button .ic { color: var(--grigio); }
.side-tabs button:hover { background: var(--chiaro); }
.side-tabs button.active { background: var(--blu-soft); color: var(--blu); font-weight: 600; }
.side-tabs button.active .ic { color: var(--blu); }
.trip-main { min-width: 0; }

/* horizontal tabs (mobile / fallback) */
.tabs { display: none; gap: 6px; flex-wrap: wrap; margin: 14px 0 4px; padding-bottom: 4px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 0 1 auto; background: #fff; color: var(--notte); border: 1px solid var(--line); border-radius: 99px; padding: 8px 13px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.tabs button.active { background: var(--blu); color: #fff; border-color: var(--blu); }

/* ---------- lists / cards ---------- */
.item-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.item-row:last-child { border-bottom: 0; }
.item-row .grow { flex: 1; min-width: 0; }

.factor { display: flex; align-items: flex-start; gap: 9px; margin: 7px 0; font-size: 13.5px; }
.factor .pts { flex: none; min-width: 44px; text-align: center; background: var(--blu); color: #fff; border-radius: 7px; padding: 2.5px 6px; font-weight: 600; font-size: 12px; }

/* trips grid */
.trips-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 16px; }
.trip-card { cursor: pointer; transition: transform .1s, box-shadow .15s, border-color .15s; margin: 0; }
.trip-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--turchese); }
.trip-head { display: flex; justify-content: space-between; align-items: start; gap: 8px; }

/* scenario grid */
.scen-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.scen-grid button {
  flex-direction: column; padding: 20px 12px 16px; background: var(--card);
  border: 1.5px solid var(--line); color: var(--ink); border-radius: var(--radius);
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow); gap: 12px;
}
.scen-grid button:hover { border-color: var(--danger); color: var(--danger-dark); transform: translateY(-2px); }
.scen-grid .ico { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 13px; background: var(--danger-soft); color: var(--danger); }
.scen-grid .ico .ic { width: 23px; height: 23px; }

/* plan (rescue) */
.plan-acc { border: 1px solid var(--line); border-radius: 12px; margin: 10px 0; overflow: hidden; background: var(--card); box-shadow: var(--shadow); }
.plan-acc > .head { padding: 13px 15px; font-weight: 600; cursor: pointer; display: flex; justify-content: space-between; background: #f8fafc; }
.plan-acc .body { padding: 4px 15px 12px; }
.action-row { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); align-items: start; }
.action-row:last-child { border-bottom: 0; }
.action-row input[type=checkbox] { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.kind { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; padding: 2.5px 7px; border-radius: 6px; }
.kind.certo { background: var(--green-soft); color: var(--green); }
.kind.verifica { background: var(--amber-soft); color: var(--amber-ink); }
.kind.stima { background: var(--blu-soft); color: var(--blu); }
.kind.suggerimento { background: #efe7f8; color: #7444a5; }

/* messages */
.msg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.msg-card textarea { min-height: 170px; font-size: 13.5px; }
.msg-lang { display: flex; align-items: center; gap: 7px; font-weight: 600; }
.msg-lang .ic { color: var(--turchese); }

/* toast */
#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--notte); color: #fff; padding: 12px 20px; border-radius: 12px;
  box-shadow: var(--shadow-lg); z-index: 100; display: none; max-width: 90vw; font-size: 14px;
}
#toast.error { background: var(--danger); }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 14px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.tile .n { font-size: 28px; font-weight: 700; color: var(--blu); letter-spacing: -.01em; }
.tile .l { font-size: 12.5px; color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.table-wrap { overflow-x: auto; }

.disclaimer { background: var(--amber-soft); border: 1px solid #ecd9ab; border-radius: 10px; padding: 11px 13px; font-size: 12.5px; color: var(--amber-ink); margin: 12px 0; display: flex; gap: 8px; align-items: flex-start; }
.disclaimer .ic { flex: none; margin-top: 1px; }
.demo-badge { display: inline-block; background: var(--blu); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .1em; border-radius: 5px; padding: 2px 7px; vertical-align: middle; }

a { color: var(--blu); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; gap: 32px; padding: 44px 24px 52px; }
  .hero h1 { font-size: 34px; }
  .features { grid-template-columns: repeat(2, 1fr); }
  .trip-layout { grid-template-columns: 1fr; }
  .trip-side { position: static; }
  .side-tabs { display: none; }
  .tabs { display: flex; }
  .scen-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 680px) {
  :root { --header-h: 60px; }
  .nav-links { display: none; }
  main.page { padding: 20px 16px 48px; }
  .container { padding: 0 16px; }
  .hero h1 { font-size: 28px; }
  .features { grid-template-columns: 1fr; }
  .scen-grid { grid-template-columns: repeat(2, 1fr); }
  .row2, .row3 { grid-template-columns: 1fr; }
  .msg-grid, .grid-2 { grid-template-columns: 1fr; }
  .qlockup-word { font-size: 19px; }
}

/* ---------- dashboard summary cards (UI Review v2.0 §2.1) ---------- */
.sum-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 0 0 18px; }
.sum-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; align-items: center; gap: 14px; }
.sum-ic { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; }
.sum-ic .ic { width: 22px; height: 22px; }
.sum-ic.blu { background: var(--blu-soft); color: var(--blu); }
.sum-ic.green { background: var(--green-soft); color: var(--green); }
.sum-ic.amber { background: var(--amber-soft); color: var(--amber-ink); }
.sum-ic.red { background: var(--danger-soft); color: var(--danger-dark); }
.sum-n { font-size: 24px; font-weight: 700; color: var(--notte); line-height: 1.1; }
.sum-l { font-size: 12.5px; color: var(--muted); }

/* Declared after the base rule on purpose: an override with the same
   specificity only wins if it comes later in the file. */
@media (max-width: 680px) {
  .sum-grid { grid-template-columns: 1fr; gap: 10px; }
  .sum-card { padding: 13px; }
}

/* trip card metrics */
.trip-metrics { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.trip-foot { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.chip.clickable { cursor: pointer; }
.chip.clickable:hover { filter: brightness(.96); text-decoration: underline; }

/* timeline: trip progress bar + segment states (UI Review v2.0 §4) */
.progress-wrap { margin: 4px 0 6px; }
.progress-head { display: flex; justify-content: space-between; color: var(--muted); margin-bottom: 5px; }
.progress { height: 8px; background: var(--chiaro); border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.progress i { display: block; height: 100%; background: var(--grad); border-radius: 6px; transition: width .5s ease; }
.tl-seg.state-completed .seg-card { opacity: .82; }
.tl-seg.state-current .seg-card { border-color: var(--turchese); box-shadow: 0 0 0 2px rgba(0,188,212,.25), var(--shadow); }
.tl-seg.state-at_risk .seg-card { border-color: var(--danger); }
.tl-seg.state-cancelled .seg-card { opacity: .6; }
.tl-seg.state-cancelled .seg-head b { text-decoration: line-through; }
.node.node-now { background: var(--turchese); box-shadow: 0 0 0 4px rgba(0,188,212,.28); }

/* ---------- Risk Score 4-band coding (client UI Review v1.0) ---------- */
.chip.arancione { background: var(--arancione-soft); color: var(--arancione-ink); }
.tl-conn.arancione { background: var(--arancione-soft); color: var(--arancione-ink); }
.ring-arancione { background: radial-gradient(circle at 32% 28%, #f59a4e, var(--arancione)); }
.score-legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 2px; }
.score-legend .lg { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.score-legend .sw { width: 12px; height: 12px; border-radius: 4px; }
.sw.verde { background: var(--green); } .sw.giallo { background: var(--amber); }
.sw.arancione { background: var(--arancione); } .sw.rosso { background: var(--danger); }

/* ---------- dashboard insight bar (dynamic messages) ---------- */
.dashbar {
  position: relative; overflow: hidden; color: #fff; border-radius: var(--radius); padding: 20px 22px; margin: 4px 0 18px;
  background: radial-gradient(700px 240px at 88% -40%, rgba(0,188,212,.4), transparent 60%),
              linear-gradient(120deg, #0A1A2F 0%, #0D47A1 100%);
  box-shadow: var(--shadow);
}
.dashbar .db-route { position: absolute; right: 14px; bottom: -6px; width: 240px; opacity: .5; pointer-events: none; }
.dashbar .db-hi { display: flex; align-items: center; gap: 9px; font-size: 13px; color: #a9c6ea; }
.dashbar .db-hi .ic { color: #7fe3f0; }
.dashbar .db-msg { font-size: 19px; font-weight: 600; margin: 6px 0 0; letter-spacing: -.01em; position: relative; z-index: 1; }
.dashbar .db-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; position: relative; z-index: 1; }
.dashbar .db-pill { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.16); border-radius: 99px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; }
.dashbar .db-pill .ic { width: .95em; height: .95em; }
.dashbar .db-pill.alert { background: rgba(239,125,33,.25); border-color: rgba(239,125,33,.5); }
.dashbar .db-pill.crit { background: rgba(229,72,77,.28); border-color: rgba(229,72,77,.55); }
.dashbar .db-pill.ok { background: rgba(31,157,87,.28); border-color: rgba(31,157,87,.5); }

/* ---------- travel motif: dotted route ---------- */
.route-line { stroke: currentColor; stroke-width: 2; stroke-dasharray: 1 7; stroke-linecap: round; fill: none; }
.coords { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.hero-deco { position: absolute; left: 0; right: 0; bottom: 8px; height: 90px; opacity: .18; pointer-events: none; color: #7fe3f0; }
.payoff { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 13px; font-weight: 600; letter-spacing: .02em; color: #7fe3f0; }

/* ---------- micro-animations ---------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.82); opacity: 0; } 60% { transform: scale(1.04); } 100% { transform: scale(1); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(14px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes sospulse { 0%,100% { box-shadow: 0 8px 22px rgba(229,72,77,.32); } 50% { box-shadow: 0 8px 30px rgba(229,72,77,.55); } }

main.page { animation: fadeUp .34s ease both; }
.hero, .dashbar { animation: fadeUp .4s ease both; }
.trips-grid > .trip-card { animation: fadeUp .3s ease both; }
.trips-grid > .trip-card:nth-child(2) { animation-delay: .04s; }
.trips-grid > .trip-card:nth-child(3) { animation-delay: .08s; }
.trips-grid > .trip-card:nth-child(n+4) { animation-delay: .12s; }
.score-ring { animation: pop .5s cubic-bezier(.34,1.4,.5,1) both; }
.sos { animation: sospulse 2.6s ease-in-out infinite; }

a, button, .btn, .card, .chip, .nav-links a, .side-tabs button, .tabs button, .feature, .user-btn, input, select, textarea {
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .18s ease, transform .1s ease, filter .16s ease;
}
button:active:not(:disabled), .btn:active { transform: translateY(1px); }
.trip-card, .feature, .scen-grid button, .mission { transition: transform .12s ease, box-shadow .18s ease, border-color .16s ease; }

.spinner { width: 26px; height: 26px; border: 3px solid var(--line-strong); border-top-color: var(--blu); border-radius: 50%; animation: spin .7s linear infinite; margin: 22px auto; }
.loading-row { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); padding: 20px; }

#toast { display: none; align-items: center; gap: 8px; }
#toast.show { display: inline-flex; animation: toastIn .28s ease; }
#toast .ic { width: 17px; height: 17px; }

@media (prefers-reduced-motion: reduce) {
  *, main.page, .hero, .dashbar, .score-ring, .sos, .trips-grid > .trip-card { animation: none !important; transition: none !important; }
}

/* print (dossier) */
@media print {
  .site-header, .site-footer, .no-print, #toast, .trip-side { display: none !important; }
  body { background: #fff; }
  .trip-layout { grid-template-columns: 1fr; }
  .card { box-shadow: none; border: 1px solid #ccc; page-break-inside: avoid; }
  main.page { padding: 0; max-width: 100%; animation: none; }
}

/* ---------- mobile refinements (client report from smartphone test) ---------- */
@media (max-width: 680px) {
  /* the footer was taking ~25% of a phone screen */
  .site-footer .foot { padding: 14px 18px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .site-footer .foot-links { gap: 14px; font-size: 12.5px; }
  .site-footer .logo-chip { padding: 4px 8px; }
  .site-footer .qlogo-full { max-height: 22px; }

  /* keep everything inside the viewport */
  main.page { padding-left: 16px; padding-right: 16px; }
  /* `anywhere` lets a column shrink to its narrowest possible break point, so a
     long word is chopped mid-syllable to fit: that is how a heading rendered as
     two fragments. `break-word` breaks only a token that genuinely cannot fit,
     and never squeezes the column in order to force the break. */
  .card { overflow-wrap: break-word; }
  /* Tables scroll sideways rather than crushing their columns. */
  table { display: block; overflow-x: auto; max-width: 100%; }
  .card table th, .card table td { white-space: nowrap; }
  /* At the narrowest widths the account name has nowhere to go; the icon alone
     still identifies the button. */
  .user-btn > span { display: none; }
  .nav-actions .lang-seg { flex: none; }
  .conn-times { gap: 8px; font-size: 12px; }
  .trip-filters { gap: 5px; }
  .trip-filters .tf { padding: 4px 10px; font-size: 12px; }
  .page-head { flex-wrap: wrap; gap: 10px; }
  /* Rescue must stay reachable without hunting for it */
  .sos { position: sticky; bottom: 10px; z-index: 20; box-shadow: 0 6px 20px rgba(197,48,48,.28); }
}

/* ---------- view states: loading, failed, refused ---------- */
.state-box {
  max-width: 460px; margin: 12vh auto; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 34px 26px; box-shadow: var(--shadow);
}
.state-box h2 { margin: 14px 0 6px; font-size: 19px; }
.state-box p { margin: 0 0 18px; line-height: 1.6; }
.state-ic { width: 54px; height: 54px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; }
.state-ic .ic { width: 26px; height: 26px; }
.state-ic.bad { background: var(--danger-soft); color: var(--danger); }
.state-ic.warn { background: var(--amber-soft); color: var(--amber-ink); }
.state-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.spinner {
  width: 34px; height: 34px; margin: 0 auto 14px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--blu);
  animation: qspin .8s linear infinite;
}
@keyframes qspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
}
