/* (h)old — "Programma" · palette Ponti
   Un colore pieno per ogni persona, una fascia del tempo con gli anni come fermate.
   Un solo foglio di stile per l'app utenti (l'admin usa css/admin.css). */

/* ------------------------------------------------------------------ Token */
:root {
    --bg: #F7F8F6;
    --surface: #FFFFFF;
    --ink: #16233A;
    --ink-2: #3E4B61;          /* testo secondario, tinto dall'inchiostro */
    --line: #16233A;           /* filetti principali */
    --line-soft: #CDD4DD;      /* filetti secondari */
    --wash: #EDF0F2;           /* campi vuoti, segnaposto foto */

    /* Colori persona (programma) */
    --blu: #1F4BA5;
    --acqua: #237A74;
    --limone: #F1D04B;
    --azzurro: #7FB6DE;

    --danger: #B3261E;
    --ok: #237A74;
    --focus: #1F4BA5;

    --font: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
    --fs-display: clamp(2.5rem, 1.6rem + 3.2vw, 4.25rem);
    --fs-title: 1.375rem;
    --fs-body: 1.0625rem;
    --fs-label: 0.75rem;

    --gap: 8px;
    --pad: clamp(16px, 4vw, 40px);
    --maxw: 1240px;
    --bar: 64px;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Colore della persona: impostato in JS con data-color="blu|acqua|limone|azzurro" */
[data-color="blu"]     { --pc: var(--blu);     --on-pc: #FFFFFF; --on-pc-2: #DCE5F6; --focus-pc: var(--limone); }
[data-color="acqua"]   { --pc: var(--acqua);   --on-pc: #FFFFFF; --on-pc-2: #D6EEEC; --focus-pc: var(--limone); }
[data-color="limone"]  { --pc: var(--limone);  --on-pc: var(--ink); --on-pc-2: #3A3418; --focus-pc: var(--ink); }
[data-color="azzurro"] { --pc: var(--azzurro); --on-pc: var(--ink); --on-pc-2: #1E3550; --focus-pc: var(--ink); }

/* ------------------------------------------------------------------ Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: var(--fs-body);
    line-height: 1.5;
    font-variation-settings: 'wdth' 100;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    caret-color: var(--blu);
}
h1, h2, h3, h4, p { margin: 0; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
::selection { background: var(--limone); color: var(--ink); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.hidden { display: none !important; }
.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;
}

html { scrollbar-color: var(--ink-2) var(--bg); }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line-soft); border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-2); }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: square; stroke-linejoin: miter; }
.icon-sm { width: 16px; height: 16px; }

.label {
    font-size: var(--fs-label);
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* ------------------------------------------------------------------ Logo */
.logo {
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    font-variation-settings: 'wdth' 92;
}
.logo .h { color: var(--limone); }

/* ------------------------------------------------------------------ Splash */
.splash-screen {
    position: fixed; inset: 0; z-index: 50;
    background: var(--blu); color: #fff;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
}
.splash-screen .logo { font-size: clamp(4rem, 12vw, 8rem); }
.splash-screen .payoff { color: #DCE5F6; }

/* ------------------------------------------------------------------ Barra superiore */
.top-nav {
    position: sticky; top: 0; z-index: 20;
    background: var(--bg); color: var(--ink);
    border-bottom: 1px solid var(--line);
}
.top-nav::after {
    content: ""; display: block; height: 5px;
    background: linear-gradient(90deg, var(--blu) 0 25%, var(--acqua) 25% 50%, var(--limone) 50% 75%, var(--azzurro) 75% 100%);
}
.top-nav-content {
    max-width: var(--maxw); margin: 0 auto;
    height: var(--bar);
    display: flex; align-items: center; gap: 24px;
    padding: 0 var(--pad);
}
.brand {
    display: flex; align-items: baseline; gap: 16px;
    background: none; border: 0; padding: 0; color: inherit; cursor: pointer;
}
.brand .logo { font-size: 1.75rem; }
.brand { text-align: left; }
.brand .payoff { color: var(--ink-2); }
.top-nav .logo .h { color: var(--blu); }
.nav-buttons { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.nav-btn {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 44px; padding: 0 12px;
    background: none; border: 0; color: var(--ink); cursor: pointer; text-decoration: none;
    font-size: 0.875rem; font-weight: 600; letter-spacing: 0.04em;
    transition: background-color 0.15s var(--ease);
}
.nav-btn:hover { background: var(--ink); color: #fff; }
.plan-badge { border: 1px solid var(--line); margin-left: 8px; }
.plan-badge .plan-star { display: none; }
.plan-badge.plan-premium .plan-star { display: inline-block; }
.plan-badge.plan-premium { background: var(--limone); border-color: var(--limone); color: var(--ink); }
.plan-badge.plan-premium:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-upgrade {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 44px; padding: 0 16px; margin-left: 4px;
    background: var(--limone); color: var(--ink); border: 0; cursor: pointer;
    font-size: 0.875rem; font-weight: 700; letter-spacing: 0.04em;
}
.btn-upgrade:hover { background: #F6DC73; }

/* ------------------------------------------------------------------ Finestra piano Pro */
.pro-dialog {
    width: min(600px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
    margin: auto; padding: 0; border: 1px solid var(--line);
    background: var(--surface); color: var(--ink); overflow: auto;
}
.pro-dialog::backdrop { background: rgba(22, 35, 58, 0.55); }
.pro-dialog[open] { animation: pro-in .28s var(--ease); }
@keyframes pro-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.pro-sheet { position: relative; }
.pro-sheet::before {
    content: ""; display: block; height: 8px;
    background: linear-gradient(90deg, var(--blu) 0 25%, var(--acqua) 25% 50%, var(--limone) 50% 75%, var(--azzurro) 75%);
}
.pro-close { position: absolute; top: 20px; right: 16px; }
.pro-close .icon { transform: rotate(45deg); }
.pro-head { padding: 32px 32px 24px; padding-right: 72px; }
.pro-head .label { color: var(--ink-2); }
.pro-head h2 { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; margin-top: 8px; }
.pro-lead { color: var(--ink-2); margin-top: 12px; max-width: 46ch; }
.pro-table { width: calc(100% - 64px); margin: 0 32px; border-collapse: collapse; font-size: 0.9375rem; }
.pro-table th, .pro-table td { padding: 12px 8px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.pro-table thead th, .pro-table thead td {
    border-bottom: 1px solid var(--line);
    font-size: var(--fs-label); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
}
.pro-table tbody th { font-weight: 600; padding-left: 0; width: 44%; }
.pro-table td { width: 28%; }
.pro-table td.is-no { color: var(--ink-2); }
.pro-table .pro-col { background: var(--limone); padding-left: 12px; }
.pro-table tbody td:last-child { background: #FCF4CF; padding-left: 12px; font-weight: 600; }
.pro-table tr.is-key th, .pro-table tr.is-key td { border-bottom-color: var(--line); }
.pro-table tr.is-key th { font-weight: 800; }
.pro-table tr.is-key td:last-child { background: var(--limone); }
.pro-foot { display: grid; gap: 16px; justify-items: start; padding: 28px 32px 32px; }
.pro-price { display: flex; align-items: baseline; gap: 8px; }
.pro-price strong { font-size: 2.5rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.pro-price span { color: var(--ink-2); }
.pro-note { color: var(--ink-2); font-size: 0.9375rem; max-width: 52ch; }
.pro-foot .btn { min-width: 220px; }
.pro-foot .btn:disabled { opacity: .4; cursor: not-allowed; }
.pro-consent {
    display: grid; grid-template-columns: 24px 1fr; gap: 12px; align-items: start;
    padding: 16px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
    font-size: 0.9375rem; line-height: 1.45; cursor: pointer; width: 100%;
}
.pro-consent input { width: 22px; height: 22px; margin: 0; accent-color: var(--ink); cursor: pointer; }
.pro-consent a { color: var(--ink); font-weight: 600; text-underline-offset: 3px; }
.pro-error { color: var(--danger); font-weight: 600; font-size: 0.9375rem; }
.pro-foot:empty { display: none; }
.pro-body { padding: 0 32px; }
.pro-body .label { color: var(--ink-2); padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.pro-features { list-style: none; margin: 0; padding: 0; }
.pro-features li {
    display: grid; grid-template-columns: 36px 1fr; gap: 14px; align-items: center;
    padding: 12px 0; border-bottom: 1px solid var(--line-soft); font-weight: 600; line-height: 1.4;
}
.pro-features .icon {
    width: 36px; height: 36px; padding: 8px; background: var(--limone); color: var(--ink);
}
.pro-downgrade { display: grid; gap: 6px; padding-top: 16px; border-top: 1px solid var(--line-soft); width: 100%; }
.pro-textbtn {
    justify-self: start; background: none; border: 0; padding: 4px 0; cursor: pointer;
    font: inherit; font-weight: 700; color: var(--ink); text-decoration: underline; text-underline-offset: 4px;
}
.pro-textbtn:hover { color: var(--danger); }
.pro-textbtn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.pro-textbtn:disabled { opacity: .5; cursor: wait; }
.pro-wait { margin: 0 32px 32px; height: 6px; background: var(--line-soft); overflow: hidden; }
.pro-wait span { display: block; width: 40%; height: 100%; background: var(--ink); animation: pro-wait 1.2s var(--ease) infinite; }
@keyframes pro-wait { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (max-width: 560px) {
    .pro-head { padding: 28px 20px 20px; padding-right: 64px; }
    .pro-table { width: calc(100% - 40px); margin: 0 20px; font-size: 0.875rem; }
    .pro-table tbody th { width: 40%; }
    .pro-table th, .pro-table td { padding: 10px 6px; }
    .pro-foot { padding: 24px 20px; }
    .pro-foot .btn { width: 100%; }
    .pro-body { padding: 0 20px; }
    .pro-wait { margin: 0 20px 28px; }
}

/* ------------------------------------------------------------------ Contenitore */
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad) 96px; }
.screen-head {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap;
    padding: 48px 0 24px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 32px;
}
.screen-head h1 { font-size: var(--fs-display); font-weight: 800; letter-spacing: -0.03em; line-height: 0.95; font-variation-settings: 'wdth' 88; }
.screen-head p { color: var(--ink-2); margin-top: 12px; max-width: 60ch; }
.back-link {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 44px; padding: 0; margin-top: 24px;
    background: none; border: 0; cursor: pointer; color: var(--ink);
    font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
}
.back-link:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ Pulsanti */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    min-height: 48px; padding: 0 20px;
    background: var(--ink); color: #fff;
    border: 1px solid var(--ink); border-radius: 0; cursor: pointer;
    font-size: 0.875rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
    text-decoration: none;
    transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.btn:hover { background: var(--blu); border-color: var(--blu); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-secondary { background: transparent; color: var(--ink); }
.btn-secondary:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-danger { background: transparent; color: var(--danger); border-color: currentColor; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 32px; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; padding: 0;
    background: transparent; border: 1px solid transparent; cursor: pointer; color: inherit;
}
.icon-btn:hover { border-color: currentColor; }

.pro-badge {
    display: inline-block; padding: 2px 6px;
    background: var(--limone); color: var(--ink);
    font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.08em;
}

/* ------------------------------------------------------------------ Campi */
.form-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.form-group label, .field-label {
    font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
}
.form-group .hint { font-size: 0.875rem; color: var(--ink-2); }
input[type="text"], input[type="date"], input[type="search"], input[type="password"], select, textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 0;
    font-size: var(--fs-body);
    color: var(--ink);
    appearance: none;
}
textarea { resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #66728A; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; }
select {
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2316233A' stroke-width='2'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center;
}
.check {
    display: flex; align-items: center; gap: 12px; cursor: pointer;
    font-size: var(--fs-body); text-transform: none; letter-spacing: 0; font-weight: 400;
}
.check input { width: 22px; height: 22px; accent-color: var(--blu); margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.form-grid .span-2 { grid-column: 1 / -1; }

/* ------------------------------------------------------------------ Login */
.login-screen { margin: 0 calc(50% - 50vw); }
.login-wrap {
    min-height: 100vh; min-height: 100dvh;
    display: grid; grid-template-columns: 1.15fr 1fr;
}
.login-field {
    background: var(--blu); color: #fff;
    padding: var(--pad);
    display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
    position: relative; overflow: hidden;
}
.login-field .logo { font-size: clamp(5rem, 13vw, 11rem); }
.login-field .payoff { color: #DCE5F6; margin-top: 16px; }
.login-field .claim { font-size: var(--fs-title); font-weight: 600; max-width: 22ch; line-height: 1.3; }
.login-band {
    display: grid; grid-template-columns: repeat(4, 1fr); height: 16px;
}
.login-band span:nth-child(1) { background: var(--limone); }
.login-band span:nth-child(2) { background: var(--azzurro); }
.login-band span:nth-child(3) { background: var(--acqua); }
.login-band span:nth-child(4) { background: var(--bg); }
.login-panel {
    display: flex; flex-direction: column; justify-content: center;
    padding: var(--pad);
    width: 100%; max-width: 560px; justify-self: center;
}
.login-panel h2 { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.login-panel .lead { color: var(--ink-2); margin: 12px 0 32px; }
#googleSignInButton { min-height: 44px; }
.login-panel > * { width: 100%; max-width: 400px; }
.login-divider {
    display: flex; align-items: center; gap: 16px; margin: 24px 0;
    color: var(--ink-2); font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
}
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }
.btn-demo { width: 100%; }
.login-steps { list-style: none; padding: 0; margin: 40px 0 0; border-top: 1px solid var(--line); }
.login-steps li {
    display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start;
    padding: 14px 0; border-bottom: 1px solid var(--line-soft);
}
.mark { display: inline-block; flex: none; background: var(--ink); }
.mark-photo { width: 12px; height: 12px; margin-top: 6px; }
.mark-text { width: 18px; height: 3px; margin-top: 10px; }
.mark-voice {
    width: 20px; height: 14px; margin-top: 4px; background: none;
    background-image: linear-gradient(var(--ink), var(--ink)), linear-gradient(var(--ink), var(--ink)), linear-gradient(var(--ink), var(--ink)), linear-gradient(var(--ink), var(--ink));
    background-size: 3px 6px, 3px 14px, 3px 9px, 3px 4px;
    background-position: 0 50%, 5.5px 50%, 11px 50%, 16.5px 50%;
    background-repeat: no-repeat;
}

.business-link {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    margin-top: 32px; padding: 16px 18px;
    border: 1px solid var(--line); background: var(--surface);
    color: var(--ink); text-decoration: none; line-height: 1.35;
    transition: background-color .2s var(--ease), color .2s var(--ease);
}
.bl-text { display: grid; grid-template-columns: 12px 1fr; column-gap: 12px; row-gap: 2px; }
.bl-text::before { content: ""; width: 12px; height: 12px; margin-top: 5px; background: var(--limone); outline: 1px solid var(--ink); }
.bl-text > span { grid-column: 2; color: var(--ink-2); }
.business-link:hover .bl-text > span { color: #DCE5F6; }
.business-link b { font-weight: 800; }
.business-link:hover { background-color: var(--ink); color: #fff; }
.business-link:hover .icon { transform: translate(2px, -2px); }
.business-link .icon { transition: transform .2s var(--ease); }
.business-link:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.about-business { grid-column: 1 / -1; margin-top: 0; }

.legal-links { margin-top: 24px; font-size: 0.8125rem; color: var(--ink-2); }
.legal-links a, .about-foot a { color: inherit; text-underline-offset: 3px; }
.legal-links a:hover, .about-foot a:hover { color: var(--ink); }

/* ------------------------------------------------------------------ Pagine legali */
.legal-body .brand { text-decoration: none; }
.nav-btn.is-current { box-shadow: inset 0 -3px 0 var(--ink); }
.legal {
    max-width: var(--maxw); margin: 0 auto; padding: 56px var(--pad) 96px;
    display: grid; grid-template-columns: 260px minmax(0, 72ch); gap: 32px 64px; align-items: start;
}
.legal-head { grid-column: 1 / -1; padding-bottom: 32px; border-bottom: 1px solid var(--line); }
.legal-head .label { color: var(--ink-2); }
.legal-head h1 { font-size: var(--fs-display); font-weight: 800; letter-spacing: -0.03em; line-height: 1; margin-top: 12px; font-variation-settings: 'wdth' 92; }
.legal-meta { color: var(--ink-2); margin-top: 16px; }
.legal-toc { position: sticky; top: calc(var(--bar) + 32px); }
.legal-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; border-top: 1px solid var(--line); }
.legal-toc li { counter-increment: toc; border-bottom: 1px solid var(--line-soft); }
.legal-toc a {
    display: grid; grid-template-columns: 28px 1fr; padding: 10px 0;
    color: var(--ink); text-decoration: none; font-size: 0.9375rem; font-weight: 600;
}
.legal-toc a::before { content: counter(toc); color: var(--ink-2); font-weight: 400; font-variant-numeric: tabular-nums; }
.legal-toc a:hover { color: var(--blu); }
.legal-text section { padding: 0 0 40px; scroll-margin-top: calc(var(--bar) + 24px); }
.legal-text h2 { font-size: var(--fs-title); font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; margin-bottom: 12px; }
.legal-text p, .legal-text ul { margin: 0 0 14px; }
.legal-text ul { padding-left: 1.1em; }
.legal-text li { margin-bottom: 8px; }
.legal-text a { color: var(--blu); text-underline-offset: 3px; }
.legal-text code { font-size: 0.875em; background: var(--wash); padding: 1px 4px; }
.legal-box { border: 1px solid var(--line); padding: 20px; background: var(--surface); }
.legal-box .label { color: var(--ink-2); margin-bottom: 8px; }
.legal-box p:last-child { margin: 0; }
.legal-table { width: 100%; border-collapse: collapse; margin: 0 0 16px; font-size: 0.9375rem; }
.legal-table th, .legal-table td { text-align: left; vertical-align: top; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line-soft); }
.legal-table thead th { border-bottom: 1px solid var(--line); font-size: var(--fs-label); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.legal-table tbody th { font-weight: 600; }
.legal-foot {
    grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    padding-top: 24px; border-top: 1px solid var(--line); color: var(--ink-2); font-size: 0.875rem;
}
.legal-foot a { color: inherit; text-underline-offset: 3px; }
@media (max-width: 860px) {
    .legal { grid-template-columns: minmax(0, 1fr); padding-top: 32px; }
    .legal-table { font-size: 0.875rem; }
    .legal-table code { overflow-wrap: anywhere; }
    .legal-toc { position: static; }
    .legal-body .brand .payoff { display: none; }
}

/* ------------------------------------------------------------------ Dashboard: persone */
.people {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: 16px;
}
.person {
    display: grid; grid-template-columns: 112px 1fr; grid-template-rows: auto 1fr;
    background: var(--pc); color: var(--on-pc);
    min-height: 176px;
    cursor: pointer;
    text-align: left; border: 0; padding: 0;
    --focus: var(--focus-pc);
    transition: transform 0.25s var(--ease);
}
.person:hover { transform: translateY(-4px); }
.person:hover .person-foot { border-top-width: 3px; }
.person-photo {
    grid-row: 1 / span 2;
    background: var(--wash);
    overflow: hidden;
}
.person-photo img { width: 100%; height: 100%; object-fit: cover; }
.person-photo .initial {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 3rem; font-weight: 800; color: var(--ink); background: var(--wash);
}
.person-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.person h3 { font-size: var(--fs-title); font-weight: 800; letter-spacing: -0.01em; line-height: 1.15; }
.person .meta { color: var(--on-pc-2); }
.person .line {
    color: var(--on-pc); opacity: 0.92; font-size: 0.9375rem; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.person-foot {
    grid-column: 2; align-self: end;
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 20px 14px;
    border-top: 1px solid currentColor;
    margin: 0 20px; padding-left: 0; padding-right: 0;
}
.person-add {
    display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 24px;
    min-height: 176px; padding: 20px;
    background: transparent; color: var(--ink);
    border: 1px dashed var(--ink); cursor: pointer; text-align: left;
}
.person-add:hover { background: var(--surface); border-style: solid; }
.person-add strong { font-size: var(--fs-title); font-weight: 800; }
.person-add .plus { width: 40px; height: 40px; }

/* ------------------------------------------------------------------ Stato vuoto */
.empty-state {
    border: 1px solid var(--line);
    background: var(--surface);
    padding: clamp(24px, 5vw, 56px);
    display: grid; gap: 12px; justify-items: start;
}
.empty-state h3 { font-size: var(--fs-title); font-weight: 800; }
.empty-state p { color: var(--ink-2); max-width: 56ch; }
.empty-state .btn { margin-top: 12px; }
.empty-band { display: grid; grid-template-columns: repeat(4, 48px); height: 10px; margin-bottom: 12px; }
.empty-band span:nth-child(1) { background: var(--blu); }
.empty-band span:nth-child(2) { background: var(--acqua); }
.empty-band span:nth-child(3) { background: var(--limone); }
.empty-band span:nth-child(4) { background: var(--azzurro); }

/* ------------------------------------------------------------------ Form persona */
.avatar-form { max-width: 820px; }
.avatar-form .form-body { padding-top: 8px; }
.photo-pick { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.photo-preview {
    width: 120px; height: 120px; background: var(--wash); border: 1px solid var(--line);
    display: flex; align-items: center; justify-content: center; overflow: hidden;
    color: var(--ink-2); font-size: 0.875rem; text-align: center;
}
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ------------------------------------------------------------------ Timeline: testata */
.timeline-view { padding-bottom: 32px; }
.person-head {
    background: var(--pc); color: var(--on-pc);
    margin: 24px calc(-1 * var(--pad)) 0;
    padding: clamp(24px, 4vw, 48px) var(--pad);
    display: grid; grid-template-columns: auto 1fr auto; gap: clamp(20px, 3vw, 40px); align-items: end;
    --focus: var(--focus-pc);
}
.person-head .portrait {
    width: clamp(112px, 14vw, 180px); aspect-ratio: 1;
    background: var(--wash); border: 4px solid var(--on-pc); overflow: hidden;
}
.person-head .portrait img { width: 100%; height: 100%; object-fit: cover; }
.person-head .portrait .initial {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
    font-size: 4rem; font-weight: 800; color: var(--ink);
}
.person-head h1 {
    font-size: var(--fs-display); font-weight: 800; letter-spacing: -0.035em; line-height: 0.92;
    font-variation-settings: 'wdth' 86;
    overflow-wrap: anywhere;
}
.person-head .meta { color: var(--on-pc-2); margin-top: 14px; }
.person-head .desc { margin-top: 12px; max-width: 62ch; }
.person-head .head-actions { display: flex; gap: 4px; align-self: start; }
.person-head .icon-btn { color: var(--on-pc); }

/* ------------------------------------------------------------------ Aggiungi ricordo */
.upload-section { scroll-margin-top: calc(var(--bar) + 24px); }
.add-bar {
    display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 24px;
    padding: 20px 0;
    border-bottom: 1px solid var(--line);
}
.add-bar h2 { font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.upload-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.upload-btn {
    display: inline-flex; align-items: center; gap: 10px;
    min-height: 48px; padding: 0 18px;
    background: var(--surface); color: var(--ink);
    border: 1px solid var(--line); cursor: pointer;
    font-size: 0.9375rem; font-weight: 600;
    transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.upload-btn:hover { background: var(--ink); color: #fff; }
.upload-btn:hover .pro-badge { background: var(--limone); }
.person-head .btn-add { background: var(--ink); color: #fff; border-color: var(--ink); margin-top: 20px; }
.person-head .btn-add:hover { background: var(--surface); color: var(--ink); border-color: var(--surface); }
.upload-btn.is-recording { background: var(--danger); color: #fff; border-color: var(--danger); }

.recording-status {
    display: flex; align-items: center; gap: 16px;
    margin-top: 16px; padding: 16px 20px;
    background: var(--surface); border: 1px solid var(--danger);
}
.recording-status .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--danger); animation: pulse 1.2s ease-in-out infinite; }
.recording-status .timer { margin-left: auto; font-size: var(--fs-title); font-weight: 700; font-variant-numeric: tabular-nums; }
@keyframes pulse { 50% { opacity: 0.35; } }

.text-form {
    margin-top: 20px; padding: clamp(20px, 3vw, 32px);
    background: var(--surface); border: 1px solid var(--line);
}
.text-form h3 { font-size: var(--fs-title); font-weight: 800; margin-bottom: 24px; }

.upload-progress {
    padding: 16px 20px; margin-bottom: 16px;
    background: var(--surface); border: 1px solid var(--line);
    font-weight: 600;
}

/* ------------------------------------------------------------------ Filtri */
.timeline-filters {
    display: flex; gap: 12px; flex-wrap: wrap; align-items: end;
    padding: 20px 0;
}
.timeline-filters .form-group { margin: 0; min-width: 160px; flex: 1 1 160px; max-width: 240px; }
.timeline-filters .count { margin-left: auto; color: var(--ink-2); align-self: center; }

/* ------------------------------------------------------------------ Fascia del tempo (firma) */
.band-wrap { padding: 8px 0 40px; }
.band-scroll { overflow-x: auto; padding: 8px 0 80px; margin-bottom: -40px; scrollbar-width: thin; }
.band-guide {
    display: flex; justify-content: space-between; align-items: baseline;
    font-size: var(--fs-title); font-weight: 800; font-variant-numeric: tabular-nums;
    margin-bottom: 12px;
}
.band-guide .span-label { font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); }
.band {
    position: relative; height: 24px;
    background: var(--pc, var(--blu));
    margin: 0 18px;
    transform-origin: left center;
    animation: band-in 0.9s var(--ease) both;
}
.band::before, .band::after {
    content: ""; position: absolute; top: 0; bottom: 0; width: 18px; background: var(--pc, var(--blu));
}
.band::before { right: 100%; }
.band::after { left: 100%; }
.stop {
    position: absolute; top: 50%;
    width: 36px; height: 36px; margin: -18px 0 0 -18px;
    border-radius: 50%;
    background: var(--bg); border: 6px solid var(--ink);
    cursor: pointer; padding: 0; z-index: 1;
    animation: stop-in 0.5s var(--ease) both;
    transition: transform 0.2s var(--ease);
}
.stop:hover, .stop:focus-visible { transform: scale(1.18); }
.stop-label {
    position: absolute; top: 34px; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    font-size: var(--fs-label); font-weight: 700; letter-spacing: 0.08em; font-variant-numeric: tabular-nums;
    white-space: nowrap; pointer-events: none;
}
.stop-marks { display: flex; gap: 4px; align-items: center; }
.stop-marks .mark-photo { margin-top: 0; width: 8px; height: 8px; }
.stop-marks .mark-text { margin-top: 0; width: 12px; height: 2px; }
.stop-marks .mark-voice { margin-top: 0; transform: scale(0.7); }
.band-wrap.has-labels { padding-bottom: 32px; }
.stop-label.yr-hide { display: none; }
.icon.flip { transform: rotate(180deg); }
@keyframes band-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes stop-in { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: scale(1); } }

/* ------------------------------------------------------------------ Ricordi */
.year-group {
    display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr); gap: 24px;
    padding: 28px 0 36px;
    border-top: 1px solid var(--line);
    scroll-margin-top: calc(var(--bar) + 16px);
}
.year-head {
    position: sticky; top: calc(var(--bar) + 20px); align-self: start;
    display: flex; flex-direction: column; gap: 4px;
}
.year-head h2::before { content: ""; display: inline-block; width: 14px; height: 14px; margin-right: 10px; background: var(--pc, var(--blu)); vertical-align: 0.12em; }
.year-head h2 { font-size: 2.75rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; font-variation-settings: 'wdth' 88; }
.year-head span { color: var(--ink-2); }
.memories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
    gap: 32px 24px;
}
.memory {
    display: flex; flex-direction: column; gap: 10px;
    min-width: 0;
    border-top: 1px solid var(--line); padding-top: 12px;
}
.memory.has-media { border-top: 0; padding-top: 0; }
.year-group .memories > .memory.is-text:only-child { border-top: 0; padding-top: 0; }
@media (min-width: 861px) {
    /* Solo nella timeline: un ricordo da solo occupa tutta la riga, media a sinistra e testo a destra */
    .year-group .memories > .memory.has-media:first-child:nth-last-child(2) { grid-column: span 2; }
    .year-group .memories > .memory.is-text:only-child { grid-column: 1 / -1; }
    .year-group .memories > .memory.has-media:only-child {
        grid-column: 1 / -1;
        display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
        column-gap: 24px; row-gap: 10px; align-content: start;
    }
    .year-group .memories > .memory.has-media:only-child > * { grid-column: 2; }
    .year-group .memories > .memory.has-media:only-child > .memory-media,
    .year-group .memories > .memory.has-media:only-child > .memory-voice { grid-column: 1; grid-row: 1 / span 8; align-self: start; }
    .year-group .memories > .memory.has-media:only-child > .kind { margin-top: 2px; }
}
.memory-media { order: -1; border: 1px solid var(--line); background: var(--wash); }
.memory-media img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.memory-voice {
    order: -1; padding: 20px 16px;
    background: var(--pc, var(--limone)); color: var(--on-pc, var(--ink));
    display: flex; flex-direction: column; gap: 16px;
}
.memory-voice .player { display: flex; align-items: center; gap: 14px; }
.play {
    width: 48px; height: 48px; flex: none; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--on-pc, var(--ink)); color: var(--pc, var(--limone)); border: 0; cursor: pointer;
}
.play .icon { fill: currentColor; stroke: none; }
.play .i-pause { display: none; }
.is-playing .play .i-play { display: none; }
.is-playing .play .i-pause { display: block; }
.memory-voice .wave {
    flex: 1; display: flex; align-items: center; gap: 3px; height: 56px; cursor: pointer;
    --p: 0%;
}
.memory-voice .wave i { display: block; flex: 1; min-width: 2px; background: currentColor; opacity: 0.35; }
.memory-voice .wave i.on { opacity: 1; }
.memory-voice .time { font-size: var(--fs-label); font-weight: 700; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; }
.memory .kind { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.memory .kind .mark { margin-top: 0; }
.memory h3 { font-size: var(--fs-title); font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; overflow-wrap: anywhere; }
.memory .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.memory .tags { color: var(--blu); font-weight: 600; font-size: 0.9375rem; overflow-wrap: anywhere; }
.memory-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 4px; }
.memory-foot .public { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.memory-foot .icon-btn { color: var(--ink-2); margin-left: auto; }
.memory-foot .icon-btn:hover { color: var(--danger); }
.memory.is-text .body { font-size: 1.125rem; line-height: 1.6; max-width: 62ch; }
.memory.is-text h3 { font-size: 1.625rem; }

/* ------------------------------------------------------------------ Ricordi pubblici */
.public-filters { padding-top: 0; }
.public-list .memory .who { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.public-list .memory .who i { width: 14px; height: 14px; background: var(--pc); display: block; }

/* ------------------------------------------------------------------ Info */
.about {
    display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 24px;
}
.about-lead { grid-column: 1 / span 7; font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.25rem); font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
.about-block { padding: 28px; display: flex; flex-direction: column; gap: 12px; }
.about-block h2 { font-size: var(--fs-title); font-weight: 800; }
.about-block ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.about-block li { display: grid; grid-template-columns: 24px 1fr; gap: 8px; }
.about-block.b1 { grid-column: 1 / span 7; background: var(--blu); color: #fff; }
.about-block.b1 li .mark:not(.mark-voice) { background-color: #fff; }
.about-block.b1 .mark-voice { background-color: transparent; background-image: linear-gradient(#fff,#fff), linear-gradient(#fff,#fff), linear-gradient(#fff,#fff), linear-gradient(#fff,#fff); }
.about-block.b2 { grid-column: 8 / span 5; background: var(--azzurro); color: var(--ink); }
.about-block.b3 { grid-column: 1 / span 5; background: var(--limone); color: var(--ink); }
.about-block.b4 { grid-column: 6 / span 7; background: var(--surface); border: 1px solid var(--line); }
.about-foot { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 24px; border-top: 1px solid var(--line); color: var(--ink-2); }

/* ------------------------------------------------------------------ Schermata password (modalità test) */
#password-overlay {
    position: fixed; inset: 0; z-index: 100;
    background: var(--blu); color: #fff;
    display: flex; align-items: center; justify-content: center;
    padding: var(--pad);
    --focus: var(--limone);
}
#password-box { width: 100%; max-width: 420px; }
.gate-logo { font-size: clamp(4rem, 12vw, 6.5rem); font-weight: 800; letter-spacing: -0.03em; line-height: 1; font-variation-settings: 'wdth' 92; }
.gate-logo .h { color: var(--limone); }
.gate-tagline { color: #DCE5F6; margin-top: 12px; font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; }
.gate-text { margin: 40px 0 16px; font-size: var(--fs-body); line-height: 1.5; }
#gateForm { display: flex; gap: 8px; }
#passwordInput { flex: 1; border-color: #fff; }
#loginButton {
    min-height: 48px; padding: 0 20px; border: 0; cursor: pointer;
    background: var(--limone); color: var(--ink);
    font-size: 0.875rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}
#loginButton:hover { background: #F6DC73; }
#loginButton:disabled { opacity: 0.6; }
.gate-error { margin-top: 12px; padding: 10px 14px; background: #fff; color: var(--danger); font-weight: 600; }
.gate-note { margin-top: 32px; color: #DCE5F6; font-size: 0.9375rem; }
.gate-note a { color: #fff; }
.gate-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.shake { animation: shake 0.4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ------------------------------------------------------------------ Responsive */
@media (max-width: 1080px) {
    .about-lead, .about-block.b1, .about-block.b2, .about-block.b3, .about-block.b4 { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
    .brand { flex-direction: column; align-items: flex-start; gap: 3px; }
    .brand .logo { font-size: 1.5rem; }
    .brand .payoff { font-size: 0.6875rem; letter-spacing: 0.08em; }
    .nav-btn .txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .nav-btn { padding: 0 10px; }
    .login-wrap { grid-template-columns: 1fr; }
    .login-field { min-height: 52vh; }
    .login-panel { max-width: none; padding-bottom: 56px; }
    .person-head { grid-template-columns: auto 1fr; }
    .person-head .head-actions { grid-column: 1 / -1; grid-row: 1; justify-self: end; }
    .year-group { grid-template-columns: 1fr; gap: 16px; }
    .year-head { position: static; flex-direction: row; align-items: baseline; gap: 12px; }
    .year-head h2 { font-size: 2rem; }
    .add-bar { grid-template-columns: 1fr; gap: 12px; }
    .upload-btns { justify-content: flex-start; }
}
@media (max-width: 560px) {
    :root { --fs-title: 1.25rem; }
    .top-nav-content { gap: 8px; }
    .btn-upgrade .txt { display: none; }
    .plan-badge.plan-free { display: none; }
    .form-grid { grid-template-columns: 1fr; }
    .person { grid-template-columns: 96px 1fr; min-height: 152px; }
    .person-head { grid-template-columns: 1fr; }
    .person-head .portrait { width: 112px; }
    .upload-btn { flex: 1 1 calc(50% - 8px); justify-content: center; padding: 0 12px; }
    .timeline-filters .form-group { max-width: none; flex-basis: calc(50% - 6px); min-width: 0; }
    .timeline-filters .form-group:first-child { flex-basis: 100%; }
    .band { height: 16px; }
    .stop { width: 24px; height: 24px; margin: -12px 0 0 -12px; border-width: 4px; }
    .stop-label { top: 26px; }
    .btn-row .btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
    .pro-dialog[open] { animation: none; }
    .pro-wait span { animation: none !important; width: 100%; opacity: .35; }
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
