/* IBRU — same look as ibru.mamify.ai: Archivo + Source Sans 3, ink black, IBRU red. */
@font-face { font-family: "Archivo"; font-style: normal; font-weight: 500 900; font-display: swap;
  src: url(/static/fonts/archivo-latin.woff2) format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/static/fonts/source-sans-3-latin.woff2) format("woff2"); }

:root {
  /* palette from ibru.mamify.ai */
  --ink: #0B0D12;
  --ink-2: #454C5A;
  --ink-3: #767E8C;
  --bg: #F6F7F9;
  --panel: #FFFFFF;
  --line: #E4E7EC;
  --line-2: #D9DEE6;
  --red: #E4002B;
  --red-2: #FF2D4D;
  --red-h: #C70026;
  --red-soft: #FFF1F3;
  --red-line: #FFD0D8;
  --dark: #08090C;
  --dark-2: #12151C;
  --dark-line: #242A36;
  --dark-tx: #EDEFF3;
  --dark-tx-2: #A6ADBB;
  --ok: #12A05C;  --ok-soft: #E9F7EF; --ok-line: #BCE6CF;
  --warn: #B57C0A; --warn-soft: #FFF6E5; --warn-line: #F3DDAE;
  --err: #C70026;  --err-soft: #FFF1F3; --err-line: #FFD0D8;
  --sh-s: 0 1px 2px rgba(11,13,18,.04), 0 4px 14px rgba(11,13,18,.05);
  --sh-m: 0 14px 40px -14px rgba(11,13,18,.22);
  --r-s: 10px;
  --r-m: 16px;
  --r-l: 24px;
  --ease: cubic-bezier(.22,.7,.24,1);
  --head: "Archivo", "Source Sans 3", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  /* names kept for older templates */
  --act: var(--red);
  --navy: var(--dark);
  font-family: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 16px; line-height: 1.5; }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--head); color: var(--ink); }
h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 800; margin: 0 0 .25rem; letter-spacing: -.028em; line-height: 1.1; }
h2 { font-size: 1.14rem; font-weight: 700; margin: 0 0 .85rem; letter-spacing: -.015em; }
h3 { font-size: 1rem; font-weight: 700; margin: 0 0 .5rem; letter-spacing: -.01em; }
.muted { color: var(--ink-3); }
.small { font-size: .88rem; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: .86em; }

/* --- brand --- */
.brand { display: flex; align-items: center; gap: 11px; font-family: var(--head); font-weight: 800; font-size: 1.1rem;
  letter-spacing: -.02em; line-height: 1; color: #fff; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 36px; height: 36px; border-radius: 50%; display: block; flex: none;
  box-shadow: 0 0 0 1px rgba(255,255,255,.16), 0 6px 18px rgba(228,0,43,.3); }
.brand.on-light { color: var(--ink); }
.brand.on-light .logo { box-shadow: 0 0 0 1px var(--line), 0 6px 16px rgba(228,0,43,.18); }

/* --- top bar --- */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1.75rem;
  padding: 12px clamp(16px, 3vw, 32px); background: var(--dark); color: var(--dark-tx);
  border-bottom: 1px solid var(--dark-line); }
#nav { display: flex; gap: 1.5rem; flex: 1; flex-wrap: wrap; font-size: .95rem; }
#nav a { position: relative; color: rgba(255,255,255,.72); padding: 6px 0; font-weight: 500; transition: color .2s; }
#nav a::after { content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 2px; background: var(--red-2);
  transition: right .3s var(--ease); }
#nav a:hover { color: #fff; text-decoration: none; }
#nav a:hover::after, #nav a.active::after { right: 0; }
#nav a.active { color: #fff; }
.who { display: flex; align-items: center; gap: .9rem; font-size: .88rem; color: var(--dark-tx-2); }
.who form { margin: 0; }
.link { background: none; border: 0; color: #fff; cursor: pointer; font: inherit; text-decoration: underline;
  text-underline-offset: 3px; padding: 0; }
.menu-btn { display: none; margin-left: auto; background: none; border: 1px solid var(--dark-line); color: #fff;
  border-radius: var(--r-s); padding: .3rem .65rem; font-size: 1.1rem; cursor: pointer; }
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; gap: .75rem; }
  .menu-btn { display: block; }
  #nav { display: none; flex-basis: 100%; flex-direction: column; gap: .25rem; }
  #nav.open { display: flex; }
  #nav a::after { display: none; }
  #nav a.active { color: var(--red-2); }
  .who { flex-basis: 100%; justify-content: space-between; }
}

/* --- layout --- */
.page { max-width: 1240px; margin: 0 auto; padding: 1.75rem clamp(16px, 3vw, 32px) 4rem; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.head p { margin: .3rem 0 0; color: var(--ink-2); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.grid { display: grid; gap: 1rem; }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 1.25rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); align-items: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-m); padding: 1.25rem 1.35rem;
  box-shadow: var(--sh-s); }
.card + .card { margin-top: 1rem; }
.grid > .card + .card { margin-top: 0; }
.card.accent { background: var(--red-soft); border-color: var(--red-line); }
.kpi .label { font-family: var(--head); font-size: .72rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--ink-3); font-weight: 700; }
.kpi .value { font-family: var(--head); font-size: 1.65rem; font-weight: 800; letter-spacing: -.02em; margin-top: .3rem;
  font-variant-numeric: tabular-nums; }
.kpi .hint { font-size: .85rem; color: var(--ink-3); margin-top: .15rem; }
/* the IBRU tile: dark like the site's hero */
.kpi.gold { background: var(--dark); border-color: var(--dark); color: var(--dark-tx);
  background-image: radial-gradient(260px 140px at 100% 0%, rgba(228,0,43,.35), transparent 70%); }
.kpi.gold .label, .kpi.gold .hint { color: var(--dark-tx-2); }
.kpi.gold .ibru { color: #fff; }
.kpi.green { background: var(--ok-soft); border-color: var(--ok-line); }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.1rem; margin: 0; }
dl.facts dt { color: var(--ink-3); }
dl.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

/* --- tables --- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--panel); box-shadow: var(--sh-s); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .65rem .8rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-family: var(--head); font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3);
  background: var(--bg); font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #FAFBFC; }
tfoot td { font-weight: 700; background: var(--bg); border-top: 2px solid var(--line-2); border-bottom: 0; }
td.num, th.num { text-align: right; }

/* --- forms --- */
form.stack { display: grid; gap: .95rem; }
.fields { display: grid; gap: .95rem 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
label { display: grid; gap: .35rem; font-size: .88rem; font-weight: 600; color: var(--ink-2); }
label.check { display: flex; align-items: flex-start; gap: .55rem; font-weight: 500; }
label.check input { margin-top: .2rem; accent-color: var(--red); }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line-2);
  border-radius: var(--r-s); padding: .6rem .8rem; width: 100%; transition: border-color .2s, box-shadow .2s; }
input[type=checkbox] { width: auto; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(228,0,43,.14); }
textarea { min-height: 80px; resize: vertical; }
.hint { font-weight: 400; color: var(--ink-3); font-size: .82rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border: 1px solid var(--line);
  background: #fff; color: var(--ink); padding: .62rem 1.1rem; border-radius: 12px; font-family: var(--head);
  font-size: .92rem; font-weight: 600; line-height: 1.2; cursor: pointer; box-shadow: var(--sh-s);
  transition: transform .22s var(--ease), box-shadow .22s var(--ease), background .22s, border-color .22s; }
.btn:hover { text-decoration: none; transform: translateY(-1px); border-color: #CDD2DA; box-shadow: var(--sh-m); }
.btn.primary { background: linear-gradient(180deg, var(--red-2), var(--red)); border-color: transparent; color: #fff;
  box-shadow: 0 10px 24px -12px rgba(228,0,43,.85), inset 0 1px 0 rgba(255,255,255,.25); }
.btn.primary:hover { box-shadow: 0 16px 32px -12px rgba(228,0,43,.95), inset 0 1px 0 rgba(255,255,255,.3); }
.btn.danger { color: var(--err); border-color: var(--err-line); }
.btn.danger:hover { background: var(--err-soft); }
.btn.small { padding: .35rem .75rem; font-size: .84rem; border-radius: var(--r-s); }
.inline { display: inline; }
details.box { border: 1px solid var(--line); border-radius: var(--r-m); background: var(--panel); padding: .2rem 1.35rem; box-shadow: var(--sh-s); }
details.box + details.box { margin-top: .75rem; }
details.box summary { cursor: pointer; font-family: var(--head); font-weight: 700; padding: .85rem 0; }
details.box summary::marker { color: var(--red); }
details.box[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 1rem; }
details.box > :last-child { margin-bottom: 1rem; }

/* --- badges & messages --- */
.badge { display: inline-block; padding: .14rem .55rem; border-radius: 999px; font-family: var(--head); font-size: .72rem;
  font-weight: 700; letter-spacing: .03em; }
.badge.BOZZA { background: var(--warn-soft); color: var(--warn); }
.badge.CONFERMATA, .badge.ESEGUITO, .badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.ANNULLATA, .badge.ANNULLATO, .badge.err { background: var(--err-soft); color: var(--err); }
.badge.off { background: #EEF0F3; color: var(--ink-3); }
.ibru { display: inline-flex; align-items: center; gap: .35rem; font-weight: 800; color: var(--ink); }
.ibru::before { content: ""; width: .62em; height: .62em; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, var(--red-2), var(--red) 70%); box-shadow: 0 0 0 2px rgba(228,0,43,.15); }
.flash { padding: .8rem 1.05rem; border-radius: 12px; margin-bottom: 1rem; border: 1px solid; }
.flash.ok { background: var(--ok-soft); border-color: var(--ok-line); color: #0B7A45; }
.flash.err { background: var(--err-soft); border-color: var(--err-line); color: var(--err); }
.flash.warn { background: var(--warn-soft); border-color: var(--warn-line); color: #8A5E06; font-weight: 600; }
.error-box { background: var(--err-soft); color: var(--err); border: 1px solid var(--err-line); padding: .75rem 1rem; border-radius: 12px; }
.pos { color: var(--ok); }
.neg { color: var(--err); }

/* --- the distribution formula strip --- */
.formula { display: flex; flex-wrap: wrap; align-items: stretch; gap: .5rem; margin-bottom: 1.25rem; }
.formula .term { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-m); padding: .75rem 1.05rem;
  min-width: 150px; box-shadow: var(--sh-s); }
.formula .term.result { background: var(--dark); border-color: var(--dark); color: #fff; }
.formula .term.result span { color: var(--dark-tx-2); }
.formula .op { display: grid; place-items: center; font-size: 1.4rem; color: var(--ink-3); padding: 0 .1rem; }
.formula .term b { display: block; font-family: var(--head); font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.formula .term span { font-family: var(--head); font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-3); font-weight: 700; }

/* --- bar chart --- */
.bars { display: flex; align-items: flex-end; gap: .5rem; height: 180px; padding-top: .5rem; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bars .bar:hover { text-decoration: none; }
.bars .bar i { display: block; width: 100%; max-width: 48px; background: linear-gradient(180deg, var(--red-2), var(--red));
  border-radius: 8px 8px 3px 3px; min-height: 2px; }
.bars .bar:hover i { background: var(--dark); }
.bars .bar small { font-size: .72rem; color: var(--ink-3); margin-top: .35rem; white-space: nowrap; }
.bars .bar em { font-style: normal; font-size: .72rem; color: var(--ink-2); margin-bottom: .2rem; white-space: nowrap; }
.empty { padding: 2rem; text-align: center; color: var(--ink-3); }
.progress { height: 8px; background: #E9ECF1; border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--red), var(--red-2)); }
.kpi.green .progress i { background: var(--ok); }

/* --- login / registration: dark hero with the animated chart --- */
.auth { position: relative; min-height: 100vh; overflow: hidden; background: var(--dark); color: var(--dark-tx);
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 460px); align-items: center;
  gap: clamp(2rem, 6vw, 6rem); padding: clamp(1.5rem, 5vw, 4.5rem) clamp(1.25rem, 6vw, 6rem); }
#auth-bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.auth-glow { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(800px 500px at 88% -5%, rgba(228,0,43,.30), transparent 62%),
              radial-gradient(600px 420px at 0% 105%, rgba(228,0,43,.16), transparent 60%),
              linear-gradient(90deg, rgba(8,9,12,.82) 0%, rgba(8,9,12,.35) 55%, rgba(8,9,12,.55) 100%); }
.auth > :not(canvas):not(.auth-glow) { position: relative; z-index: 1; }
.auth > .flash { grid-column: 1 / -1; }
.auth-intro .brand { color: #fff; font-size: 1.35rem; margin-bottom: clamp(2rem, 6vh, 4rem); }
.auth-intro .brand .logo { width: 48px; height: 48px; }
.auth-intro .brand em { display: block; font-style: normal; font-family: "Source Sans 3", sans-serif; font-weight: 500;
  font-size: .72rem; letter-spacing: .05em; color: var(--dark-tx-2); margin-top: 5px; }
.eyebrow { display: inline-flex; align-items: center; gap: 11px; font-family: var(--head); font-size: .75rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--red-2); margin: 0 0 1.1rem; }
.eyebrow::before { content: ""; width: 28px; height: 2px; background: var(--red-2); border-radius: 2px; }
.auth-intro h1 { color: #fff; font-size: clamp(2.2rem, 4.6vw, 3.9rem); line-height: 1.02; letter-spacing: -.03em; margin: 0 0 1.5rem; }
.auth-intro h1 span { background: linear-gradient(90deg, var(--red-2), #FF6B80); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-points { list-style: none; padding: 0; margin: 0; display: grid; gap: .7rem; color: var(--dark-tx); font-size: 1.05rem; }
.auth-points li { display: flex; align-items: center; gap: .7rem; }
.auth-points li::before { content: ""; width: 20px; height: 20px; flex: none; border-radius: 50%;
  background: rgba(228,0,43,.18) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 10.5l2.5 2.5L14 7.5' fill='none' stroke='%23FF2D4D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/100% no-repeat;
  box-shadow: inset 0 0 0 1px rgba(255,45,77,.4); }
.auth-card { background: rgba(255,255,255,.97); color: var(--ink); border-radius: var(--r-l); padding: clamp(1.5rem, 3vw, 2.25rem);
  box-shadow: 0 40px 90px -30px rgba(0,0,0,.85), 0 0 0 1px rgba(255,255,255,.08), 0 0 80px -20px rgba(228,0,43,.35);
  animation: rise .6s var(--ease) both; }
.auth-card h2 { font-size: 1.55rem; font-weight: 800; letter-spacing: -.025em; margin: 0 0 .25rem; }
.auth-card > p.muted { margin: 0 0 1.25rem; }
.auth-card .error-box { margin-bottom: 1rem; }
.fields.two { grid-template-columns: 1fr 1fr; }
.btn.block { width: 100%; padding: .85rem 1.1rem; font-size: 1rem; }
.auth-divider { display: flex; align-items: center; gap: .8rem; margin: 1.5rem 0 1rem; color: var(--ink-3);
  font-family: var(--head); font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn.register { background: var(--dark); color: #fff; border-color: var(--dark);
  box-shadow: 0 10px 24px -12px rgba(8,9,12,.7), inset 0 0 0 1px rgba(255,45,77,.55); }
.btn.register:hover { background: var(--dark-2); box-shadow: 0 16px 32px -12px rgba(228,0,43,.6), inset 0 0 0 1px var(--red-2); }
.btn.register span { color: var(--red-2); transition: transform .25s var(--ease); }
.btn.register:hover span { transform: translateX(4px); }
.auth-note { text-align: center; margin: .6rem 0 0; }
.auth-switch { text-align: center; margin: 1.25rem 0 0; font-size: .95rem; }
.auth-switch a { font-weight: 700; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; align-content: start; gap: 1.5rem; }
  .auth-intro .brand { margin-bottom: 1.25rem; }
  .auth-intro h1 { font-size: clamp(1.8rem, 8vw, 2.4rem); margin-bottom: 0; }
  .auth-intro .eyebrow, .auth-points { display: none; }
  .auth-glow { background: radial-gradient(500px 360px at 100% 0%, rgba(228,0,43,.3), transparent 62%), rgba(8,9,12,.45); }
}
@media (max-width: 420px) { .fields.two { grid-template-columns: 1fr; } }
.pager { display: flex; gap: .5rem; justify-content: center; margin-top: 1rem; }

/* --- printable statement --- */
.statement { background: #fff; max-width: 900px; margin: 0 auto; padding: 2rem; border: 1px solid var(--line); border-radius: var(--r-m); }
.statement header { display: flex; justify-content: space-between; border-bottom: 2px solid var(--red); padding-bottom: 1rem; margin-bottom: 1.25rem; }
@media print {
  .topbar, .no-print, .flash { display: none !important; }
  body, :root { background: #fff; }
  .page { padding: 0; max-width: none; }
  .statement { border: 0; padding: 0; }
  a { color: inherit; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .btn:hover { transform: none; }
}
