:root {
  --bg: #f4f2ec;
  --surface: #ffffff;
  --surface-2: #f9f8f4;
  --ink: #1b2230;
  --ink-2: #4a5263;
  --muted: #7a8090;
  --line: #e4e1d8;
  --accent: #0e6b63;
  --accent-ink: #ffffff;
  --accent-soft: #dcefeb;
  --pos: #1c7a45;
  --neg: #b23a2c;
  --vinc: #5a48b0;
  --vinc-soft: #ebe8f8;
  --acc: #b26a00;
  --acc-soft: #fbefdc;
  --warn-soft: #fff4dc;
  --giro: #2a5ea8;
  --giro-soft: #e3ecf8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(27, 34, 48, .05), 0 4px 16px rgba(27, 34, 48, .04);
  --font: ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151b; --surface: #1a1e26; --surface-2: #20252f; --ink: #e9ebf0; --ink-2: #bfc4cf;
    --muted: #8a91a0; --line: #2c323d; --accent: #3fb3a7; --accent-ink: #0c1512; --accent-soft: #173431;
    --pos: #4cc27f; --neg: #ef7a6a; --vinc: #a597ef; --vinc-soft: #26223d; --acc: #e9a948; --acc-soft: #33281a;
    --warn-soft: #2e2716; --giro: #7fa8e8; --giro-soft: #1b2638; --shadow: none; color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); font-variant-numeric: tabular-nums; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .25rem; letter-spacing: -.02em; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; letter-spacing: -.01em; }
h2.section { margin: 1.75rem 0 .75rem; color: var(--ink-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 1.25rem 0 .5rem; }
p { margin: .25rem 0 .75rem; }
code, .mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.small, small { font-size: .85rem; }
.fine { font-size: .8rem; color: var(--muted); margin: -.25rem 0 .5rem; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .vinc { color: var(--vinc); }
.r { text-align: right; }

/* ---------- layout ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 1.25rem 1rem 6rem; }
.wrap.narrow { max-width: 640px; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand .mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: .95rem; }
.brand.big { justify-content: center; font-size: 1.2rem; margin-bottom: 1.25rem; }
.brand.big .mark { width: 36px; height: 36px; border-radius: 10px; }
.nav { display: flex; gap: .25rem; margin: 0 auto; }
.nav a { padding: .45rem .8rem; border-radius: 999px; color: var(--ink-2); font-weight: 500; display: flex; gap: .4rem; align-items: center; }
.nav a:hover { background: var(--surface); text-decoration: none; }
.nav a.on { background: var(--ink); color: var(--bg); }
.nav .ico { font-size: .9rem; opacity: .8; }
.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; width: 34px; height: 34px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 600; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu .menu { position: absolute; right: 0; top: 42px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.12); padding: .35rem; min-width: 180px; display: flex; flex-direction: column; }
.usermenu .menu a, .usermenu .menu .linkbtn { padding: .55rem .75rem; border-radius: 8px; color: var(--ink); text-align: left; }
.usermenu .menu a:hover, .usermenu .menu .linkbtn:hover { background: var(--surface-2); text-decoration: none; }
.linkbtn { background: none; border: 0; font: inherit; cursor: pointer; width: 100%; }

@media (max-width: 760px) {
  .nav { position: fixed; bottom: 0; left: 0; right: 0; margin: 0; justify-content: space-around; background: var(--surface);
    border-top: 1px solid var(--line); padding: .3rem .25rem calc(.3rem + env(safe-area-inset-bottom)); z-index: 20; }
  .nav a { flex-direction: column; gap: 0; font-size: .7rem; padding: .3rem .4rem; border-radius: 10px; flex: 1; }
  .nav a.on { background: var(--accent-soft); color: var(--accent); }
  .nav .ico { font-size: 1.15rem; }
  .topbar { justify-content: space-between; backdrop-filter: none; background: var(--bg); }
  h1 { font-size: 1.35rem; }
}

.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.pagehead p { margin: 0; }
.crumb { margin: 0 0 .15rem; font-size: .85rem; color: var(--muted); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.actions.center { justify-content: center; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.15rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--acc) 35%, var(--line)); }
.cardhead { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem; }
.cardhead h2 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid2 > .card { margin: 0; }
.grid2 { margin-bottom: 1rem; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1rem; align-items: start; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.cards > .card { margin: 0; }
@media (max-width: 860px) { .grid2, .grid-main { grid-template-columns: 1fr; } }

/* ---------- numeri ---------- */
.hero { display: grid; grid-template-columns: 1.1fr 2fr; gap: 1rem; margin-bottom: 1rem; }
.hero-main { background: var(--ink); color: var(--bg); border-radius: var(--radius); padding: 1.25rem; display: flex; flex-direction: column; justify-content: center; }
.hero-main .lbl { opacity: .7; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.hero-main .val.big { font-size: 2.2rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; }
.hero-main .hint { opacity: .6; font-size: .85rem; }
.hero-main .neg { color: #ff9b8c; }
.hero-grid, .statrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.statrow { margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; display: flex; flex-direction: column; gap: .1rem; }
.stat .lbl { font-size: .75rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.stat .val { font-size: 1.3rem; font-weight: 650; letter-spacing: -.02em; }
.stat .hint { font-size: .78rem; color: var(--muted); }
.stat.vinc { background: var(--vinc-soft); border-color: transparent; } .stat.vinc .val { color: var(--vinc); }
.stat.acc { background: var(--acc-soft); border-color: transparent; } .stat.acc .val { color: var(--acc); }
.stat.ok .val { color: var(--pos); } .stat.neg .val, .stat .val.neg { color: var(--neg); }
.stat.pos .val { color: var(--pos); }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; } .hero-grid { grid-template-columns: 1fr 1fr; } .stat .val { font-size: 1.1rem; } }

.kv > div { display: flex; justify-content: space-between; padding: .35rem 0; gap: 1rem; }
.kv .sep { border-top: 1px solid var(--line); margin-top: .25rem; padding-top: .55rem; }
.kv .dim { color: var(--muted); font-size: .9rem; }

/* ---------- barre ---------- */
.bar { display: block; width: 100%; height: 6px; }
.bar .track { fill: var(--line); }
.bar .fill { fill: var(--accent); }
.bar.vinc .fill, .bar .fill.vinc { fill: var(--vinc); }
.bar.acc .fill { fill: var(--acc); }
.catbars { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.catbars li { display: grid; grid-template-columns: 1fr auto; gap: .2rem .5rem; font-size: .9rem; }
.catbars .bar { grid-column: 1 / -1; }
.catbars .bar .fill { fill: var(--neg); opacity: .75; }

/* ---------- liste movimenti ---------- */
.txlist { list-style: none; margin: 0; padding: 0; }
.tx { display: flex; align-items: center; gap: .85rem; padding: .65rem 0; border-bottom: 1px solid var(--line); }
.tx:last-child { border-bottom: 0; }
.tx-date { width: 2.6rem; text-align: center; line-height: 1.1; flex: none; }
.tx-date b { display: block; font-size: 1.1rem; }
.tx-date span { font-size: .7rem; color: var(--muted); }
.tx-main { flex: 1; min-width: 0; }
.tx-desc { color: var(--ink); font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-meta { font-size: .8rem; color: var(--muted); }
.tx-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; }
.tx.pianificato .amt { opacity: .7; }
.tx.late .tx-date b { color: var(--acc); }
.amt { font-weight: 600; white-space: nowrap; }
.amt.pos { color: var(--pos); } .amt.neg { color: var(--ink); } .amt.neu { color: var(--muted); }
.amt.giro { color: var(--giro); }
.tag.giro { background: var(--giro-soft); border-color: transparent; color: var(--giro); }
.stat.giro .val { color: var(--giro); }
.giro-pair { display: grid; gap: .8rem; position: relative; }
#txform[data-tipo=giroconto] .giro-pair { background: var(--giro-soft); border-radius: 12px; padding: .75rem; gap: .35rem; }
.swap { justify-self: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--giro); font-size: 1.1rem; cursor: pointer; }
.swap:hover { border-color: var(--giro); }
.monthsep { padding: .9rem 0 .3rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border-bottom: 1px solid var(--line); }
.totline { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; border-top: 2px solid var(--line); padding-top: .65rem; margin-top: .25rem; font-size: .9rem; }
.tag { display: inline-block; padding: .05rem .45rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: .72rem; color: var(--ink-2); font-weight: 500; }
.tag.plan { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.tag.vinc { background: var(--vinc-soft); border-color: transparent; color: var(--vinc); }
.tag.warn { background: var(--warn-soft); border-color: var(--acc); color: var(--acc); }
.count { display: inline-grid; place-items: center; min-width: 1.4rem; height: 1.4rem; padding: 0 .35rem; border-radius: 999px; background: var(--acc); color: #fff; font-size: .75rem; margin-left: .25rem; }

/* ---------- conti ---------- */
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: var(--accent); flex: none; }
.dot.libretto { background: var(--vinc); } .dot.contanti { background: var(--acc); } .dot.altro { background: var(--muted); }
.acclist { list-style: none; margin: 0; padding: 0; }
.acclist li a { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.acclist li:last-child a { border-bottom: 0; }
.acclist a:hover { text-decoration: none; background: var(--surface-2); }
.acc-name { display: flex; align-items: center; gap: .5rem; font-weight: 550; flex-wrap: wrap; }
.acc-name small { width: 100%; padding-left: 1.1rem; color: var(--muted); font-weight: 400; margin-top: -.2rem; }
.acc-bal { text-align: right; display: flex; flex-direction: column; }
.acc-bal small.vinc { font-size: .78rem; }
.acc-bal b, .acc-bal small { white-space: nowrap; }
.acccard { color: var(--ink); display: flex; flex-direction: column; gap: .6rem; }
.acccard:hover { text-decoration: none; border-color: var(--accent); }
.acccard-head { display: flex; justify-content: space-between; gap: .5rem; }
.acccard .bigbal { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }
.acccard .foot { font-size: .8rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: .5rem; margin-top: auto; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.split > div { display: flex; flex-direction: column; }
.split .lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.split b { font-size: 1.25rem; letter-spacing: -.02em; }
.split .vinc b { color: var(--vinc); }
.archived { margin-top: 1.5rem; }
.archived summary { cursor: pointer; color: var(--muted); }

.interest-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; background: var(--vinc-soft); border-radius: 12px; padding: .9rem 1rem; margin-bottom: 1rem; }
.interest-summary > div { display: flex; flex-direction: column; }
.interest-summary .lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.interest-summary b { font-size: 1.15rem; color: var(--vinc); }
.vlist { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.vincolo { border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; }
.vincolo.svincolato { opacity: .65; }
.vincolo.expired { border-color: var(--acc); background: var(--warn-soft); }
.v-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; flex-wrap: wrap; }
.v-head > div { display: flex; flex-direction: column; }
.v-amt { font-size: 1.2rem; letter-spacing: -.02em; }
.v-dates { display: grid; grid-template-columns: auto 1fr auto; gap: .6rem; align-items: center; font-size: .78rem; color: var(--muted); margin: .65rem 0; }
.v-nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .5rem; margin: 0 0 .5rem; }
.v-nums dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.v-nums dd { margin: 0; font-weight: 600; }
.v-nums dd small { font-weight: 400; }
.v-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ---------- accantonamenti ---------- */
.goal { display: flex; flex-direction: column; gap: .5rem; }
.goal.off { opacity: .6; }
.goal.new { border-style: dashed; background: transparent; box-shadow: none; }
.goal-head h2 { margin: 0; }
.goal-amt { display: flex; align-items: baseline; gap: .4rem; }
.goal-amt b { font-size: 1.4rem; color: var(--acc); letter-spacing: -.02em; }
.goal-amt .pct { margin-left: auto; font-weight: 600; color: var(--ink-2); }
.goalmove { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.goalmove input[name=nota], .goalmove .btns { grid-column: 1 / -1; }
.goalmove .btns { display: flex; gap: .4rem; }
.goalmove .btns .btn { flex: 1; }
.goal details summary, .hist summary { cursor: pointer; font-size: .85rem; color: var(--muted); }
.goals-mini, .vinc-mini { list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; }
.goals-mini .row, .vinc-mini li { display: flex; justify-content: space-between; gap: .5rem; font-size: .9rem; margin-bottom: .2rem; }
.vinc-mini li { border-bottom: 1px solid var(--line); padding-bottom: .4rem; }

.plainlist { list-style: none; margin: 0; padding: 0; }
.plainlist li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.plainlist li:last-child { border-bottom: 0; }
.x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1.1rem; padding: 0 .3rem; }
.x:hover { color: var(--neg); }

/* ---------- tabelle e grafico ---------- */
.tablewrap { overflow-x: auto; margin: 0 -.25rem; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: .5rem .5rem; border-bottom: 1px solid var(--line); }
table.data th.r { text-align: right; }
table.data td { padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.off { opacity: .55; }
table.data tr.neg td { color: var(--neg); }
.chart { width: 100%; height: auto; display: block; margin: .5rem 0 1rem; overflow: visible; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--accent); opacity: .08; }
.chart .zero { stroke: var(--line); stroke-dasharray: 4 4; }
.chart circle { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.chart circle.neg { stroke: var(--neg); }
.chart text { font-size: 11px; fill: var(--muted); }

/* ---------- form ---------- */
.form { display: flex; flex-direction: column; gap: .8rem; }
label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; font-weight: 550; color: var(--ink-2); }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 500; }
input, select, textarea { font: inherit; font-size: 1rem; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .75rem; width: 100%; min-height: 44px; }
input[type=checkbox] { width: 1.15rem; height: 1.15rem; min-height: 0; accent-color: var(--accent); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; background: var(--surface); }
input.money { font-size: 1.35rem; font-weight: 600; letter-spacing: -.01em; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 480px) { .row2 { grid-template-columns: 1fr; } }
.formactions { display: flex; gap: .5rem; margin-top: .25rem; }
.inlineform, .filterform { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.inlineform input, .filterform input, .filterform select, .inlineform select { width: auto; flex: 1 1 160px; }
.filters { margin-bottom: 1rem; }
.filters summary { cursor: pointer; color: var(--ink-2); font-weight: 500; margin-bottom: .5rem; }
.dangerzone { margin-top: 1.5rem; }
.dangerzone.card { border-color: color-mix(in srgb, var(--neg) 35%, var(--line)); display: flex; flex-direction: column; gap: .6rem; }
.dangerzone h3 { margin: 0; color: var(--neg); }
.preview { display: block; background: var(--vinc-soft); color: var(--vinc); border-radius: 10px; padding: .6rem .8rem; font-size: .9rem; font-weight: 500; }
.preview:empty { display: none; }
form.inline { display: inline; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; }
.seg label { margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: .55rem; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg .seg-uscita input:checked + span { color: var(--neg); }
.seg .seg-entrata input:checked + span { color: var(--pos); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; font: inherit; font-weight: 600; font-size: .92rem; padding: .6rem 1rem; min-height: 42px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: var(--ink-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface); }
.btn.danger { background: var(--neg); border-color: var(--neg); color: #fff; }
.btn.small { padding: .35rem .7rem; min-height: 34px; font-size: .85rem; }
.btn.wide { width: 100%; }
.danger-text { color: var(--neg); }
.mini { font: inherit; font-size: .75rem; font-weight: 600; padding: .2rem .5rem; border-radius: 7px; border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent); cursor: pointer; white-space: nowrap; }
.pills { display: flex; gap: .25rem; }
.pills a { padding: .2rem .6rem; border-radius: 999px; font-size: .8rem; color: var(--ink-2); border: 1px solid var(--line); }
.pills a.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.monthnav { display: flex; align-items: center; gap: .25rem; }
.monthnav h1 { margin: 0; min-width: 10ch; text-align: center; justify-content: center; }
.monthnav .btn { font-size: 1.4rem; padding: 0 .7rem; }

/* ---------- messaggi e vuoti ---------- */
.flashes { display: grid; gap: .5rem; margin-bottom: 1rem; }
.flash { padding: .7rem .9rem; border-radius: 10px; font-size: .9rem; background: var(--accent-soft); color: var(--ink); border-left: 4px solid var(--accent); }
.flash.error { background: color-mix(in srgb, var(--neg) 12%, var(--surface)); border-color: var(--neg); }
.flash.info { background: var(--warn-soft); border-color: var(--acc); }
.empty { text-align: center; padding: 2.5rem 1rem; }
.empty.big { padding: 5rem 1rem; }

/* ---------- autenticazione ---------- */
.authwrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem 1rem; }
.authcard { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 2rem 1.75rem; box-shadow: var(--shadow); }
.authcard h1 { justify-content: center; font-size: 1.35rem; margin-bottom: .5rem; }
.authcard > p.muted { text-align: center; }
.authwrap .flashes { width: 100%; max-width: 400px; margin: 0 auto -1rem; }
.otp { font-family: var(--mono); font-size: 1.8rem; text-align: center; letter-spacing: .35em; padding: .55rem; }
.otp.sm { font-size: 1.1rem; letter-spacing: .2em; max-width: 12rem; }
.alt { margin-top: 1.25rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.alt summary { cursor: pointer; font-size: .88rem; color: var(--ink-2); margin-bottom: .75rem; }
.steps { padding-left: 1.2rem; display: grid; gap: .6rem; font-size: .92rem; }
.steps li.qr { list-style: none; margin-left: -1.2rem; text-align: center; }
.steps li.qr svg { width: 200px; height: 200px; border-radius: 10px; }
.secret { display: inline-block; margin-top: .3rem; padding: .3rem .5rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; word-break: break-all; user-select: all; }
.codes { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; margin: 1rem 0 1.25rem; }
.codes code { display: block; text-align: center; padding: .4rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; user-select: all; }
h2.formsec { margin: .9rem 0 0; padding-top: .9rem; border-top: 1px solid var(--line); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
