/*! FidUP! — Copyright LITUP S.r.l.
 * SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0
 * Required Notice: Copyright LITUP S.r.l. (https://github.com/litupsrl/fidup)
 * https://polyformproject.org/licenses/noncommercial/1.0.0 */
:root {
  /* Colori FidUP!: nero #3A3A3A e verde #B1C900 */
  --black: #3A3A3A; --green: #B1C900; --green-text: #6E7D00;
  --bg: #f4f4f2; --fg: #1f1f1f; --muted: #6b6b6b; --card: #fff; --line: #d6d6d0;
  --primary: var(--black); --on-primary: #fff; --bar: var(--black); --on-bar: #fff;
  --link: var(--green-text); --danger: #b91c1c; --radius: 14px;
  --safe-top: env(safe-area-inset-top); --safe-bottom: env(safe-area-inset-bottom);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121212; --fg: #ececec; --muted: #a3a3a3; --card: #1e1e1e; --line: #333; --primary: var(--green); --on-primary: #1f1f1f;
    --bar: #1e1e1e; --link: var(--green); }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--fg); overscroll-behavior-y: none; }
[hidden] { display: none !important; }
.view { min-height: 100%; padding: calc(var(--safe-top) + 0px) 0 calc(var(--safe-bottom) + 90px); }
.topbar { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 8px;
  padding: calc(var(--safe-top) + 8px) 12px 8px; margin-top: calc(-1 * var(--safe-top)); background: var(--bar); color: var(--on-bar); margin-bottom: 10px; }
.topbar .icon-btn { color: var(--on-bar); }
.up { color: var(--green); }
#view-list .topbar { grid-template-columns: 1fr auto; }
.topbar h1 { font-size: 22px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions { display: flex; gap: 4px; }
.icon-btn { background: none; border: 0; font-size: 22px; padding: 8px; color: var(--fg); cursor: pointer; min-width: 44px; min-height: 44px; }
.btn { display: block; width: 100%; padding: 13px 16px; margin: 8px 0; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--fg); font-size: 16px; text-align: center; cursor: pointer; font-weight: 500; }
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn:focus-visible, input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); outline-offset: 1px; }
a { color: var(--link); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn:disabled { opacity: .5; }
input, select, textarea { width: 100%; padding: 12px; margin: 6px 0; font-size: 16px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--fg); font-family: inherit; }
input[type=color] { height: 46px; padding: 4px; }
label { display: block; margin: 10px 0; font-size: 14px; color: var(--muted); }
label input, label select, label textarea { color: var(--fg); }
.form { padding: 0 16px; max-width: 560px; margin: 0 auto; }
.form h2 { font-size: 18px; margin: 24px 0 4px; }
.form h3 { font-size: 15px; margin: 16px 0 0; color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
.scan-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.warn { font-size: 13px; color: #b45309; } .error { color: var(--danger); text-align: center; }
.auth { display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-box { width: 100%; max-width: 380px; text-align: center; }
.auth-box .logo { width: 84px; height: 84px; border-radius: 20px; }
.sep { margin: 18px 0 6px; color: var(--muted); font-size: 13px; }
.search-wrap { padding: 0 12px; }
.card-grid { list-style: none; padding: 8px 12px; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.card-tile { aspect-ratio: 1.586; border-radius: var(--radius); color: #fff; padding: 12px; display: flex; flex-direction: column; justify-content: space-between;
  cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.15); user-select: none; overflow: hidden; }
.card-tile .name { font-weight: 700; font-size: 17px; word-break: break-word; }
.card-tile .num { font-size: 12px; opacity: .85; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fab { position: fixed; right: 20px; bottom: calc(var(--safe-bottom) + 20px); width: 60px; height: 60px; border-radius: 50%; border: 0;
  background: var(--green); color: var(--black); font-size: 34px; font-weight: 600; box-shadow: 0 4px 14px rgba(0,0,0,.3); cursor: pointer; }
.detail { padding: 16px; text-align: center; max-width: 600px; margin: 0 auto; }
.code-box { background: #fff; border-radius: var(--radius); padding: 20px 12px; display: flex; justify-content: center; align-items: center; min-height: 120px; color: #000; }
.code-box svg, .code-box img { max-width: 100%; height: auto; }
.code-box.qr img { width: min(75vw, 320px); image-rendering: pixelated; }
.small-box { min-height: 60px; padding: 10px; }
.small-box:empty { display: none; }
.number { font-size: 22px; letter-spacing: 1px; margin: 14px 0; font-variant-numeric: tabular-nums; word-break: break-all; user-select: all; }
.overlay { position: fixed; inset: 0; background: #000; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; }
.overlay video { width: 100%; max-height: 70vh; object-fit: cover; border-radius: 12px; }
.scanner-frame { position: absolute; width: 70%; height: 22%; border: 3px solid var(--green); border-radius: 12px; top: 35%; pointer-events: none; }
.scanner-msg { color: #fff; }
.overlay .btn { max-width: 300px; }
dialog { border: 0; border-radius: 16px; padding: 20px; width: min(92vw, 400px); background: var(--card); color: var(--fg); }
dialog::backdrop { background: rgba(0,0,0,.5); }
dialog h3 { margin-top: 0; }
.dlg-actions { display: flex; gap: 8px; } .dlg-actions .btn { margin-bottom: 0; }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-bottom) + 96px); background: var(--black); color: #fff; border-bottom: 3px solid var(--green);
  padding: 10px 18px; border-radius: 20px; z-index: 100; max-width: 90vw; text-align: center; font-size: 14px; }

.install { margin: 8px 12px 4px; padding: 14px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.install-head { display: flex; gap: 12px; align-items: center; }
.install-icon { width: 48px; height: 48px; border-radius: 12px; }
.steps { margin: 10px 0 6px; padding-left: 22px; } .steps li { margin: 6px 0; }
.ios-share { width: 20px; height: 20px; vertical-align: -4px; color: #0a84ff; }
.link-btn { background: none; border: 0; color: var(--muted); font-size: 14px; padding: 8px 0 0; cursor: pointer; display: block; margin: 0 auto; }
.install a { color: var(--link); }
.left { text-align: left; }
details { margin: 12px 0; } summary { cursor: pointer; color: var(--muted); }
.auth-box a.btn { text-decoration: none; }
.donate { text-align: center; font-size: 14px; margin: 18px 16px; color: var(--muted); }
.donate a { font-weight: 600; text-decoration: none; white-space: nowrap; }

/* Slogan: si adatta a telefono, tablet e computer */
.slogan { background: var(--black); color: #fff; border-radius: 18px; text-align: center; position: relative; overflow: hidden;
  padding: clamp(14px, 4vw, 26px) clamp(14px, 5vw, 32px); box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.slogan::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--green); }
.slogan-text { margin: 0; font-weight: 800; letter-spacing: -.01em; line-height: 1.25;
  font-size: clamp(17px, 4.8vw, 28px); text-wrap: balance; }
.slogan .hl { color: var(--green); }
.slogan sup { font-size: .55em; color: var(--green); }
.slogan .footnote { margin: 8px 0 0; font-size: clamp(10.5px, 2.8vw, 13px); font-weight: 400; color: #c9c9c9; line-height: 1.35; text-wrap: balance; }
.slogan-gate { margin: 14px 0 18px; }
.slogan-list { margin: 0 12px 12px; }
@media (prefers-color-scheme: dark) { .slogan { background: #262626; border: 1px solid #333; } }
/* schermi bassi (telefono in orizzontale / piccoli): più compatto */
@media (max-height: 560px) { .slogan-text { font-size: 16px; } .slogan .footnote { display: none; } }
/* tablet e computer */
@media (min-width: 700px) {
  .slogan-list { max-width: 760px; margin: 4px auto 16px; }
  .search-wrap, .card-grid, #empty, #view-list .install, #view-list .donate { max-width: 760px; margin-left: auto; margin-right: auto; }
  .auth-box { max-width: 460px; }
}
.install-qr { display: flex; gap: 16px; align-items: center; margin-top: 12px; }
.install-qr img { width: 150px; height: 150px; border-radius: 10px; background: #fff; padding: 6px; flex: none; }
.install-qr p { margin: 6px 0 0; }
#version-footer { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-bottom) + 6px); z-index: 4;
  font-size: 11px; color: var(--muted); background: var(--bg); border: 1px solid var(--line); padding: 2px 10px; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.08);
  pointer-events: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.license-note { text-align: center; font-size: 11.5px; line-height: 1.5; color: var(--muted); margin: 22px 16px 8px; }
#view-list .license-note { max-width: 760px; margin-left: auto; margin-right: auto; }
.gate-browser { margin: 4px 0 0; text-align: left; }
.gate-steps .steps li { margin: 8px 0; }
.chain-hint { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0 0; padding: 8px 8px 8px 12px;
  border-radius: 12px; background: var(--card); border: 1px solid var(--green); font-size: 15px; }
.chain-hint .btn { width: auto; margin: 0; padding: 8px 18px; }
.name-suggest { margin: -4px 0 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); overflow: hidden; }
.name-opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line);
  background: none; color: var(--fg); font-size: 16px; text-align: left; cursor: pointer; }
.name-opt:last-child { border-bottom: 0; }
.name-opt .dot { width: 16px; height: 16px; border-radius: 4px; flex: none; }
.ocr-status { margin: 10px 0 0; padding: 8px 12px; border-radius: 12px; background: var(--card); border: 1px dashed var(--line); font-size: 14px; color: var(--muted); }
.search-wrap { display: flex; gap: 8px; align-items: center; }
.search-wrap input { flex: 1; min-width: 0; }
.search-wrap select { width: auto; flex: none; padding: 12px 8px; }
/* Lingue */
.i18n-pending body { visibility: hidden; }
.lang-select { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--fg); font-size: 15px; }
.lang-select select { width: auto; margin: 0; padding: 8px 10px; font-size: 15px; }
.gate-lang { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.settings-lang .lang-select select { min-width: 200px; }
/* Modalità debug */
.debug-preview { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px 10px; margin: 10px 0; max-height: 320px; overflow: auto; }
.debug-preview table { width: 100%; border-collapse: collapse; font-size: 14px; }
.debug-preview th, .debug-preview td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); }
.debug-preview td.mono { font-family: ui-monospace, Menlo, monospace; }
.debug-preview tr:last-child td { border-bottom: 0; }
#app-version { cursor: default; user-select: none; -webkit-user-select: none; }
/* Slogan sopra l'elenco: chiudibile; se chiuso compare in fondo all'elenco */
.slogan-close { position: absolute; top: 6px; right: 8px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255,255,255,.12);
  color: #fff; font-size: 22px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.slogan-close:hover { background: rgba(255,255,255,.22); }
.slogan-list:not(.at-bottom) .slogan-text { padding: 0 26px; }
.slogan-list.at-bottom { margin-top: 18px; }
.slogan-list.at-bottom .slogan-close { display: none; }
