/* valikard.ch · stile Alpino (da mio-dominio.ch)
   Colori, tipografia e componenti presi 1:1 dal canvas di design. */

:root {
  --bg: #EEF2F5;
  --ink: #16324A;
  --ink-2: #2B4256;
  --muted: #44596B;
  --accent: #1F7FB8;
  --accent-ink: #165F8A;
  --tint: #E3F1F9;
  --soft: #F4F7F9;
  --line: #EEF2F5;
  --line-2: #D5DEE5;
  --white: #ffffff;
  --ok-bg: #DDEFE6;
  --ok: #1E7A4F;
  --ok-ink: #1E5C3E;
  --warn-bg: #FBEBD3;
  --warn: #8A4B08;
  --warn-ink: #6B3A06;
  --bad-bg: #FBE3E1;
  --bad: #B42318;
  --neutral-bg: #E8EDF2;
  --radius: 20px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); }
a:hover { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid #9FD3F0; outline-offset: 2px; border-radius: 8px; }
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------------------------------------------------------------------------
   Luci soffuse sullo sfondo
--------------------------------------------------------------------------- */
#app { position: relative; isolation: isolate; min-height: 100vh; display: flex; flex-direction: column; }
.glow { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.glow i { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .45; will-change: transform; }
.glow i:nth-child(1) { width: 46vmax; height: 46vmax; left: -12vmax; top: -14vmax; background: #9FD3F0; animation: g1 38s ease-in-out infinite alternate; }
.glow i:nth-child(2) { width: 38vmax; height: 38vmax; right: -10vmax; top: 10vh; background: #C7B8F5; animation: g2 46s ease-in-out infinite alternate; }
.glow i:nth-child(3) { width: 42vmax; height: 42vmax; left: 20vw; bottom: -18vmax; background: #A8E6D2; animation: g3 52s ease-in-out infinite alternate; }
.glow i:nth-child(4) { width: 30vmax; height: 30vmax; right: 18vw; bottom: 5vh; background: #F7CFB0; opacity: .35; animation: g4 41s ease-in-out infinite alternate; }
@keyframes g1 { to { transform: translate(28vw, 22vh) scale(1.15); } }
@keyframes g2 { to { transform: translate(-30vw, 30vh) scale(.9); } }
@keyframes g3 { to { transform: translate(18vw, -34vh) scale(1.1); } }
@keyframes g4 { to { transform: translate(-22vw, -18vh) scale(1.2); } }
@media (prefers-reduced-motion: reduce) { .glow i { animation: none; } }

/* ---------------------------------------------------------------------------
   Testata
--------------------------------------------------------------------------- */
.hdr { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; padding: 24px 32px; }
.hdr nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 15px; font-weight: 500; }
.hdr nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; text-decoration: none; }
.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.brand-name { font-weight: 700; font-size: 17px; }
.back { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; text-decoration: none; font-weight: 600; font-size: 15px; color: var(--muted); }
.hdr-domain { font-size: 14px; font-weight: 600; color: var(--muted); }

/* ---------------------------------------------------------------------------
   Pulsanti
--------------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border: 0; border-radius: 14px; font-weight: 700; font-size: 15px; text-decoration: none; background: var(--accent); color: #fff; transition: filter .15s, background .15s; white-space: nowrap; }
.btn:hover { color: #fff; filter: brightness(1.06); }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--line-2); color: var(--muted); filter: none; }
.btn-lg { min-height: 60px; border-radius: 16px; font-size: 17px; }
.btn-md { min-height: 44px; padding: 0 16px; border-radius: 12px; font-size: 14px; font-weight: 600; }
.btn-sm { min-height: 40px; padding: 0 14px; border-radius: 10px; font-size: 13px; font-weight: 600; }
.btn-white { background: var(--white); color: var(--ink); font-weight: 600; }
.btn-white:hover { color: var(--accent); }
.btn-soft { background: var(--soft); color: var(--ink); font-weight: 600; }
.btn-soft:hover { color: var(--accent); }
.btn-tint { background: var(--tint); color: var(--ink); font-weight: 600; }
.btn-tint:hover { color: var(--accent-ink); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-plain { background: transparent; color: var(--muted); font-weight: 600; }
.btn-plain:hover { color: var(--ink); }
.btn-danger { background: var(--white); color: var(--bad); border: 2px solid var(--bad); }
.btn-danger:hover { color: var(--bad); background: var(--bad-bg); }
.btn-block { width: 100%; }

/* ---------------------------------------------------------------------------
   Superfici
--------------------------------------------------------------------------- */
.card { background: var(--white); border-radius: var(--radius); padding: 22px; }
.card-lg { border-radius: 24px; padding: 28px; }
.card-soft { background: var(--soft); border-radius: 16px; padding: 16px; }
.card-accent { border: 2px solid var(--accent); }
.card-list { background: var(--white); border-radius: var(--radius); padding: 6px 20px; }
.card-list > .row:last-child { border-bottom: 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; min-height: 60px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row-main { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-title { font-weight: 700; font-size: 15px; }
.row-sub { font-size: 14px; color: var(--muted); }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 20px 24px; border-radius: var(--radius); }
.banner-warn { background: var(--warn-bg); color: var(--warn-ink); }
.banner-ok { background: var(--ok-bg); color: var(--ok-ink); }
.banner-bad { background: var(--bad-bg); color: var(--bad); }
.banner-info { background: var(--white); color: var(--muted); }
.dark-band { background: var(--ink); color: #fff; border-radius: 28px; padding: 56px 48px; }

/* ---------------------------------------------------------------------------
   Tipografia
--------------------------------------------------------------------------- */
.h1 { margin: 0; font-size: 38px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }
.h1-xl { font-size: 56px; line-height: 1.06; letter-spacing: -0.03em; }
.h2 { margin: 0; font-size: 20px; font-weight: 700; }
.h2-lg { font-size: 40px; line-height: 1.15; letter-spacing: -0.02em; }
.h3 { margin: 0; font-size: 17px; font-weight: 700; }
.lead { margin: 0; font-size: 17px; line-height: 1.6; color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }
.label { font-size: 14px; font-weight: 600; color: var(--muted); }
.eyebrow { font-size: 14px; font-weight: 600; color: var(--accent); }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-14 { gap: 14px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; } .gap-24 { gap: 24px; } .gap-28 { gap: 28px; } .gap-36 { gap: 36px; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid { display: grid; gap: 16px; }
.cols-200 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.cols-230 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.cols-260 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.cols-300 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.cols-340 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }

/* ---------------------------------------------------------------------------
   Pagine
--------------------------------------------------------------------------- */
main { flex: 1; }
.page { width: 100%; margin: 0 auto; padding: 56px 24px 120px; display: flex; flex-direction: column; gap: 28px; }
.w-440 { max-width: 488px; } .w-560 { max-width: 608px; } .w-600 { max-width: 648px; } .w-640 { max-width: 688px; } .w-720 { max-width: 768px; } .w-760 { max-width: 808px; } .w-1000 { max-width: 1048px; }
.wide { max-width: 1180px; margin: 0 auto; padding: 0 32px; }
.page-head { display: flex; flex-direction: column; gap: 10px; text-align: center; }
.page-head-left { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }

/* ---------------------------------------------------------------------------
   Etichette di stato
--------------------------------------------------------------------------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.chip-ok { background: var(--ok-bg); color: var(--ok); }
.chip-warn { background: var(--warn-bg); color: var(--warn); }
.chip-bad { background: var(--bad-bg); color: var(--bad); }
.chip-neutral { background: var(--neutral-bg); color: var(--ink-2); }
.chip-info { background: var(--tint); color: var(--accent-ink); }
.chip-dark { background: var(--ink); color: #fff; }
.dot { width: 8px; height: 8px; border-radius: 999px; display: inline-block; flex: none; }
.dot-ok { background: #2E9E68; } .dot-warn { background: #D98A1F; } .dot-bad { background: var(--bad); } .dot-off { background: var(--line-2); }
.icon-tile { width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--tint); display: inline-flex; align-items: center; justify-content: center; color: var(--accent); }
.icon-tile-ok { background: var(--ok-bg); color: var(--ok); }
.icon-tile-warn { background: var(--warn-bg); color: var(--warn); }
.num { width: 32px; height: 32px; flex: none; border-radius: 999px; background: var(--tint); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.num-solid { background: var(--accent); color: #fff; }
.alert-red { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--bad); }

/* ---------------------------------------------------------------------------
   Moduli
--------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.input, .select, .textarea { width: 100%; min-height: 52px; padding: 0 16px; border: 0; border-radius: 12px; background: var(--soft); font-weight: 600; color: var(--ink); }
.input-white { background: var(--white); }
.input-lg { min-height: 60px; padding: 0 20px; border-radius: 16px; font-size: 20px; }
.input-mono { font-family: var(--mono); font-weight: 500; font-size: 14px; }
.textarea { padding: 14px; min-height: 140px; font: 500 13px/1.6 var(--mono); resize: vertical; }
.select { padding: 0 12px; }
.choice { display: flex; align-items: center; gap: 16px; min-height: 68px; padding: 14px 20px; border-radius: 16px; background: var(--white); border: 2px solid var(--white); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); }
.choice input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex: none; }
.choice-soft { background: var(--soft); border-color: var(--soft); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { min-height: 44px; padding: 0 18px; border-radius: 999px; border: 0; background: var(--white); color: var(--muted); font-weight: 600; font-size: 14px; }
.pill[aria-pressed="true"] { background: var(--ink); color: #fff; }
.pill-outline { border: 2px solid var(--white); }
.pill-outline[aria-pressed="true"] { background: var(--white); color: var(--ink); border-color: var(--accent); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; padding: 6px; background: var(--white); border-radius: 16px; }
.seg button { min-height: 48px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-weight: 600; font-size: 15px; }
.seg button[aria-selected="true"], .seg button[aria-current="page"] { background: var(--ink); color: #fff; }
.copy-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; background: var(--soft); border-radius: 10px; font-family: var(--mono); font-size: 14px; }
.copy-row .btn-sm { background: var(--white); color: var(--ink); font-weight: 600; }
.copy-row .btn-sm:hover { color: var(--accent); }
.code { background: var(--ink); color: #E6EEF5; border-radius: 16px; padding: 20px; font: 14px/1.7 var(--mono); white-space: pre; overflow-x: auto; }
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.details { background: var(--white); border-radius: var(--radius); padding: 0 22px; }
.details > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; font-weight: 600; color: var(--muted); }

/* ---------------------------------------------------------------------------
   Tabelle a griglia
--------------------------------------------------------------------------- */
.table-wrap { background: var(--white); border-radius: var(--radius); padding: 8px 8px 12px; overflow-x: auto; }
.table { min-width: 760px; display: flex; flex-direction: column; }
.tr { display: grid; gap: 12px; align-items: center; min-height: 56px; padding: 0 16px; border-top: 1px solid var(--line); font-size: 14px; }
.tr.th { min-height: 44px; border-top: 0; font-size: 13px; font-weight: 600; color: var(--muted); }
.cell-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------------------
   Console: barra laterale
--------------------------------------------------------------------------- */
.shell { max-width: 1360px; width: 100%; margin: 0 auto; padding: 24px; display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.side { flex: 1 1 220px; max-width: 260px; display: flex; flex-direction: column; gap: 24px; }
.side nav { display: flex; flex-direction: column; gap: 4px; font-size: 15px; font-weight: 600; }
.side nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 12px; text-decoration: none; color: var(--muted); }
.side nav a[aria-current="page"] { background: var(--white); color: var(--accent); }
.content { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 760px) {
  .shell { padding: 16px; gap: 16px; }
  .side { max-width: none; gap: 12px; min-width: 0; flex: 1 1 100%; }
  .content { flex: 1 1 100%; }
  .side nav { min-width: 0; max-width: calc(100% + 32px); flex-direction: row; overflow-x: auto; gap: 4px; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
  .side nav a { flex: none; background: rgba(255,255,255,.55); }
  .side .card { display: none; }
}
@media (max-width: 760px) { .h1-xl { font-size: 40px; } .h2-lg { font-size: 30px; } .dark-band { padding: 36px 24px; } .card-lg { padding: 22px; } .hdr { padding: 18px 20px; } .page { padding-top: 32px; } }

/* ---------------------------------------------------------------------------
   Monitor: sparkline a barre
--------------------------------------------------------------------------- */
.spark { display: flex; align-items: flex-end; gap: 2px; height: 48px; width: 100%; overflow: hidden; }
.spark span { flex: 1 1 0; min-width: 0; border-radius: 2px; }
@media (max-width: 760px) { .spark { gap: 1px; } .spark span { border-radius: 1px; } }
.spark .s-ok { background: #3CB98A; } .spark .s-warn { background: #E2A23B; } .spark .s-bad { background: var(--bad); } .spark .s-off { background: var(--line-2); height: 18%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ---------------------------------------------------------------------------
   Propagazione
--------------------------------------------------------------------------- */
.pview { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 14px; border-radius: 14px; }
.pview-ok { background: #EEF8F2; } .pview-ok svg { color: var(--ok); }
.pview-wait { background: #FDF4E7; } .pview-wait svg { color: var(--warn); }
.pview-off { background: var(--soft); } .pview-off svg { color: var(--muted); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------------------
   Avvisi e finestre
--------------------------------------------------------------------------- */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.toast { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px; background: var(--ink); color: #fff; font-size: 14px; box-shadow: 0 8px 24px rgba(22, 50, 74, .18); }
.toast-ok { background: var(--ok-ink); } .toast-bad { background: var(--bad); }
.toast button { margin-left: auto; background: transparent; border: 0; color: inherit; opacity: .8; min-width: 32px; min-height: 32px; }
dialog.modal { border: 0; padding: 0; border-radius: 24px; max-width: min(560px, calc(100vw - 32px)); width: 100%; color: var(--ink); box-shadow: 0 24px 64px rgba(22, 50, 74, .25); }
dialog.modal::backdrop { background: rgba(22, 50, 74, .35); backdrop-filter: blur(3px); }
.modal-body { padding: 26px; display: flex; flex-direction: column; gap: 16px; }
.empty { padding: 24px; text-align: center; color: var(--muted); font-size: 15px; }
.skeleton { background: linear-gradient(90deg, var(--soft), #fff, var(--soft)); background-size: 200% 100%; animation: sk 1.2s linear infinite; border-radius: 12px; min-height: 60px; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .spin, .skeleton { animation: none; } }

/* ---------------------------------------------------------------------------
   Valikard: aggiunte
--------------------------------------------------------------------------- */
.vk-root { position: relative; isolation: isolate; min-height: 100vh; background: var(--bg); color: var(--ink); font-family: var(--font); overflow: hidden; }
.vk-root .glow { position: absolute; }
.meter { height: 10px; border-radius: 999px; background: var(--soft); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.meter-warn > span { background: #D98A1F; }
.meter-bad > span { background: var(--bad); }
.secret-mask { letter-spacing: .12em; color: var(--muted); }
.kv { display: grid; grid-template-columns: minmax(120px, 180px) minmax(0, 1fr); gap: 10px 16px; align-items: center; font-size: 14px; }
.kv > dt { color: var(--muted); font-weight: 600; }
.kv > dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.method { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 8px; font: 600 12px/1.4 var(--mono); background: var(--tint); color: var(--accent-ink); }
.method-del { background: var(--bad-bg); color: var(--bad); }
.steps { display: flex; flex-wrap: wrap; gap: 8px; }
.step { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px 0 8px; border-radius: 999px; background: var(--white); font-weight: 600; font-size: 14px; color: var(--muted); }
.step[aria-current="step"] { color: var(--ink); box-shadow: inset 0 0 0 2px var(--accent); }
.switch { width: 44px; height: 26px; border-radius: 999px; background: var(--line-2); position: relative; flex: none; border: 0; padding: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 999px; background: #fff; transition: left .15s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { left: 21px; }
.browser { background: var(--white); border-radius: 24px; overflow: hidden; box-shadow: 0 24px 64px rgba(22, 50, 74, .12); }
.browser-bar { display: flex; align-items: center; gap: 12px; padding: 12px 18px; background: var(--soft); font-size: 13px; color: var(--muted); }
.browser-bar .url { flex: 1; background: var(--white); border-radius: 999px; padding: 6px 14px; font-family: var(--mono); font-size: 12px; }
