/* ==========================================================================
   Torinext — Pannello di gestione (mockup)
   Stessi token del sito: blu #1C39BB, navy #0B1640, angolo basso-destro arrotondato.
   ========================================================================== */

@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Sora"; font-style: normal; font-weight: 600 800; font-display: swap;
  src: url("fonts/sora-latin.woff2") format("woff2");
}

:root {
  --blue: #1C39BB;
  --blue-700: #162E98;
  --blue-500: #3552D1;
  --blue-400: #6077DB;
  --blue-300: #AEBBF2;
  --blue-200: #CDD5F7;
  --blue-100: #E7EBFB;
  --blue-50: #F3F5FE;
  --navy: #0B1640;

  --ink: var(--navy);
  --text: #2B3558;
  --muted: #5A6487;
  --faint: #8A93B3;
  --line: #E6E9F3;
  --line-strong: #CBD2E6;
  --bg: #FFFFFF;
  --bg-alt: #F5F7FC;

  --green: #12805C;
  --green-bg: #E3F5EE;
  --amber: #8A5A00;
  --amber-bg: #FFF3D1;
  --red: #C2283B;
  --red-bg: #FCE8EB;
  --violet: #5B3CC4;
  --violet-bg: #EFEAFD;

  /* Colori della ripartizione */
  --c-sec: #8C98C8;
  --c-exp: #F2B33D;
  --c-reza: #6E86F0;
  --c-luigi: #34C3B0;

  --font-display: "Sora", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  --shape: 10px 10px 28px 10px;
  --shape-sm: 6px 6px 16px 6px;
  --shape-xs: 3px 3px 9px 3px;
  --shadow: 0 18px 40px -18px rgba(11, 22, 64, .28);
  --shadow-blue: 0 14px 30px -12px rgba(28, 57, 187, .55);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-body); font-size: .9375rem; line-height: 1.55; color: var(--text); background: var(--bg-alt); -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-display); color: var(--ink); letter-spacing: -0.02em; line-height: 1.2; margin: 0; font-weight: 700; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 3px solid var(--blue-400); outline-offset: 2px; border-radius: 4px; }
.num { font-variant-numeric: tabular-nums; }

.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i--sm { width: 16px; height: 16px; }
.corner { width: .75em; height: .75em; flex: none; transition: transform .25s var(--ease); }

/* ---------- Bottoni ---------- */
.btn {
  --btn-bg: var(--blue); --btn-fg: #fff; --btn-bd: var(--blue);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 42px; padding: .5rem 1.05rem;
  font-family: var(--font-display); font-weight: 600; font-size: .875rem;
  color: var(--btn-fg); background: var(--btn-bg); border: 1.5px solid var(--btn-bd);
  border-radius: 6px 6px 16px 6px; cursor: pointer; white-space: nowrap;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), box-shadow .25s var(--ease), transform .25s var(--ease);
}
.btn:hover { --btn-bg: var(--blue-700); --btn-bd: var(--blue-700); box-shadow: var(--shadow-blue); transform: translateY(-1px); }
.btn:hover .corner { transform: translate(2px, -2px); }
.btn--ghost { --btn-bg: #fff; --btn-fg: var(--ink); --btn-bd: var(--line-strong); }
.btn--ghost:hover { --btn-bg: var(--blue-50); --btn-fg: var(--blue); --btn-bd: var(--blue-300); box-shadow: none; }
.btn--light { --btn-bg: #fff; --btn-fg: var(--navy); --btn-bd: #fff; }
.btn--light:hover { --btn-bg: var(--blue-100); --btn-bd: var(--blue-100); --btn-fg: var(--navy); box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .5); }
.btn--sm { min-height: 34px; padding: .3rem .75rem; font-size: .8125rem; border-radius: 5px 5px 12px 5px; }
.btn--block { width: 100%; min-height: 50px; font-size: .9375rem; }

.link-arrow { display: inline-flex; align-items: center; gap: .4rem; font-family: var(--font-display); font-weight: 600; font-size: .8125rem; color: var(--blue); }
.link-arrow:hover { color: var(--blue-700); }
.link-arrow:hover .corner { transform: translate(2px, -2px); }

.chip { display: inline-flex; align-items: center; padding: .15rem .55rem; font-size: .75rem; font-weight: 600; line-height: 1.45; white-space: nowrap; border-radius: var(--shape-xs); background: var(--blue-50); color: var(--blue); }
.chip--amber { background: var(--amber-bg); color: var(--amber); }
.chip--green { background: var(--green-bg); color: var(--green); }
.chip--red { background: var(--red-bg); color: var(--red); }
.chip--violet { background: var(--violet-bg); color: var(--violet); }

/* ==========================================================================
   LOGIN
   ========================================================================== */
.login { display: grid; place-items: center; min-height: 100vh; padding: 2rem 1rem; background: var(--bg-alt); }
.login-box { width: 100%; max-width: 360px; padding: 2.25rem 2rem 2rem; background: #fff; border: 1px solid var(--line); border-radius: 10px 10px 32px 10px; box-shadow: var(--shadow); }
.login-logo { height: 30px; width: auto; margin: 0 auto 2rem; }
.form { display: grid; gap: 1.1rem; }
.field label { display: block; margin-bottom: .4rem; font-family: var(--font-display); font-size: .8125rem; font-weight: 600; color: var(--ink); }
.input {
  width: 100%; min-height: 48px; padding: .65rem .9rem;
  background: #fff; border: 1.5px solid var(--line-strong); border-radius: 6px 6px 16px 6px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.input:hover { border-color: var(--blue-300); }
.input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-100); }
.form .btn--block { margin-top: .4rem; }

/* ==========================================================================
   PANNELLO
   ========================================================================== */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .3s var(--ease); }

/* ---------- Sidebar chiara ---------- */
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 1.75rem;
  padding: 1.5rem 1rem 1rem; background: #fff; border-right: 1px solid var(--line);
}
.side-brand { display: flex; align-items: center; justify-content: space-between; padding: 0 .6rem; }
.side-brand img { height: 26px; width: auto; }
.side-brand .logo-mark { display: none; }
.lbl { white-space: nowrap; overflow: hidden; }
.side-close { display: none; }
.side-nav { display: grid; gap: .2rem; }
.side-label { padding: 0 .75rem .35rem; font-family: var(--font-display); font-size: .6875rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.side-nav + .side-nav { margin-top: 1.1rem; }
.side-link {
  display: flex; align-items: center; gap: .75rem; min-height: 40px; padding: .45rem .75rem;
  font-family: var(--font-display); font-size: .875rem; font-weight: 500; color: var(--muted);
  border-radius: 6px 6px 14px 6px; transition: background-color .2s var(--ease), color .2s var(--ease);
}
.side-link .i { color: var(--faint); transition: color .2s var(--ease); }
.side-link:hover { background: var(--bg-alt); color: var(--ink); }
.side-link:hover .i { color: var(--blue); }
.side-link[aria-current="page"] { background: var(--blue-50); color: var(--blue); font-weight: 600; }
.side-link[aria-current="page"] .i { color: var(--blue); }
.side-count { margin-left: auto; min-width: 20px; padding: 0 .4rem; font-size: .6875rem; font-weight: 700; line-height: 20px; text-align: center; color: #fff; background: var(--blue); border-radius: 3px 3px 8px 3px; }
.side-foot { margin-top: auto; display: grid; gap: .5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.side-user { display: flex; align-items: center; gap: .7rem; padding: .35rem .5rem .35rem .6rem; }
.avatar { width: 36px; height: 36px; flex: none; object-fit: cover; border-radius: 5px 5px 14px 5px; }
.top-avatar { width: 48px; height: 48px; flex: none; object-fit: cover; border-radius: 6px 6px 18px 6px; box-shadow: 0 6px 16px -8px rgba(11, 22, 64, .45); }
.side-user strong { display: block; font-family: var(--font-display); font-size: .875rem; color: var(--ink); line-height: 1.2; }
.side-user span { font-size: .75rem; color: var(--muted); }
.side-user a { margin-left: auto; display: grid; place-items: center; width: 34px; height: 34px; color: var(--faint); border-radius: 6px; }
.side-user a:hover { color: var(--blue); background: var(--blue-50); }
.scrim { display: none; }

/* ---------- Topbar ---------- */
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: 1.75rem clamp(1rem, 3vw, 2.5rem) 0; }
.menu-btn { display: grid; width: 42px; height: 42px; flex: none; place-items: center; border: 1.5px solid var(--line-strong); background: #fff; border-radius: 6px 6px 14px 6px; cursor: pointer; color: var(--text); transition: border-color .2s var(--ease), color .2s var(--ease); }
.menu-btn:hover { border-color: var(--blue-300); color: var(--blue); }

/* ---------- Menu compresso (solo desktop): restano le icone ---------- */
@media (min-width: 901px) {
  .side-collapsed .app { grid-template-columns: 76px minmax(0, 1fr); }
  .side-collapsed .side { padding-inline: .75rem; overflow-x: hidden; }
  .side-collapsed .side-brand { justify-content: center; padding: 0; }
  .side-collapsed .side-brand .logo-full { display: none; }
  .side-collapsed .side-brand .logo-mark { display: block; height: 28px; }
  .side-collapsed .side-label { visibility: hidden; height: 0; padding: 0; }
  .side-collapsed .side-link { position: relative; justify-content: center; padding-inline: 0; }
  .side-collapsed .lbl { display: none; }
  .side-collapsed .side-count { position: absolute; top: 3px; right: 3px; min-width: 16px; padding: 0 .25rem; font-size: .625rem; line-height: 16px; }
  .side-collapsed .side-user { justify-content: center; padding-inline: 0; }
  .side-collapsed .side-user-txt, .side-collapsed .side-user a { display: none; }
}
.topbar h1 { font-size: clamp(1.375rem, 1.1rem + .8vw, 1.75rem); letter-spacing: -0.03em; }
.topbar p { margin-top: .15rem; font-size: .875rem; color: var(--muted); }
.topbar-tools { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.month {
  display: inline-flex; align-items: center; gap: .45rem; min-height: 42px; padding: 0 .85rem;
  font-family: var(--font-display); font-size: .8125rem; font-weight: 600; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line-strong); border-radius: 6px 6px 14px 6px; cursor: pointer;
}
.month:hover { border-color: var(--blue-300); }
.add { position: relative; }
.add-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 230px; padding: .4rem;
  background: #fff; border: 1px solid var(--line); border-radius: var(--shape); box-shadow: var(--shadow);
  opacity: 0; transform: translateY(-6px); pointer-events: none; transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.add.is-open .add-menu { opacity: 1; transform: none; pointer-events: auto; }
.add-menu a { display: flex; align-items: center; gap: .7rem; padding: .6rem .7rem; font-size: .875rem; border-radius: 6px 6px 12px 6px; }
.add-menu a:hover { background: var(--blue-50); color: var(--blue); }
.add-menu .i { color: var(--blue); }

.content { padding: 1.5rem clamp(1rem, 3vw, 2.5rem) 2.5rem; display: grid; gap: 1.25rem; }

/* ---------- Hero: il mese in una riga ---------- */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  padding: clamp(1.4rem, 2.5vw, 2rem); background: var(--navy); color: #B4BDE0; border-radius: 12px 12px 36px 12px;
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 55% 80% at 0% 0%, rgba(53, 82, 209, .5), transparent 70%),
    radial-gradient(ellipse 45% 70% at 100% 100%, rgba(28, 57, 187, .35), transparent 70%);
}
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .6;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: linear-gradient(90deg, transparent 30%, #000);
  mask-image: linear-gradient(90deg, transparent 30%, #000);
}
.hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.hero-label { display: inline-flex; align-items: center; gap: .55rem; font-family: var(--font-display); font-size: .75rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--blue-300); }
.hero-label::before { content: ""; width: 10px; height: 10px; border-top: 2.5px solid currentColor; border-right: 2.5px solid currentColor; }
.hero-num { margin-top: .6rem; font-family: var(--font-display); font-weight: 700; font-size: clamp(2.5rem, 1.6rem + 3vw, 3.75rem); line-height: 1; letter-spacing: -0.045em; color: #fff; font-variant-numeric: tabular-nums; }
.hero-num small { font-size: .5em; color: var(--blue-300); margin-right: .12em; letter-spacing: 0; }
.hero-sub { margin-top: .7rem; font-size: .875rem; color: #93A0CF; }
.hero-sub b { color: #7EE2B8; font-weight: 600; }
.hero-actions { display: flex; align-items: center; gap: .75rem; }
.hero-state { display: inline-flex; align-items: center; gap: .45rem; font-size: .8125rem; color: #C9D0EA; }
.hero-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c-exp); box-shadow: 0 0 0 4px rgba(242, 179, 61, .2); }

.seg { display: flex; gap: 4px; height: 14px; margin-top: 2rem; }
.seg i { display: block; height: 100%; border-radius: 3px; }
.seg i:first-child { border-radius: 4px 3px 3px 4px; }
.seg i:last-child { border-radius: 3px 4px 10px 3px; }
.seg .s-sec { background: repeating-linear-gradient(135deg, var(--c-sec) 0 5px, #6F7BA8 5px 10px); }
.seg .s-exp { background: var(--c-exp); }
.seg .s-reza { background: var(--c-reza); }
.seg .s-luigi { background: var(--c-luigi); }

.seg-legend { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.seg-legend li { padding-left: .9rem; border-left: 3px solid var(--dot); }
.seg-legend span { display: block; font-size: .8125rem; color: #93A0CF; }
.seg-legend .who { display: flex; align-items: center; gap: .5rem; }
.seg-legend .who img { width: 32px; height: 32px; flex: none; border-radius: 4px 4px 10px 4px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .15); }
.seg-legend strong { display: block; margin-top: .15rem; font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; color: #fff; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.seg-legend em { display: block; margin-top: .1rem; font-style: normal; font-size: .75rem; color: #7F8BB8; }

/* ---------- Griglia ---------- */
.grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.col { display: grid; gap: 1.25rem; min-width: 0; }
.card { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--shape); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.2rem 1.35rem 0; }
.card-head h2 { font-size: 1.0625rem; }
.card-head .count { margin-left: .4rem; font-size: .8125rem; font-weight: 600; color: var(--faint); }
.card-body { padding: 1rem 1.35rem 1.35rem; }

/* ---------- Da fare ---------- */
.todo { padding: .5rem 0 .4rem; }
.todo li { display: flex; align-items: center; gap: .9rem; padding: .8rem 1.35rem; }
.todo li + li { border-top: 1px solid var(--line); }
.todo-ico { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 4px 4px 12px 4px; background: var(--blue-50); color: var(--blue); }
.todo-ico .i { width: 18px; height: 18px; }
.todo-ico--red { background: var(--red-bg); color: var(--red); }
.todo-ico--amber { background: var(--amber-bg); color: var(--amber); }
.todo-txt { min-width: 0; flex: 1; }
.todo-txt strong { display: block; font-size: .875rem; font-weight: 600; color: var(--ink); line-height: 1.35; }
.todo-txt span { font-size: .8125rem; color: var(--muted); }

/* ---------- Lead ---------- */
.pipe { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.pipe a { position: relative; padding: .75rem .85rem .8rem; background: var(--bg-alt); border-radius: var(--shape-sm); transition: background-color .2s var(--ease); }
.pipe a:hover { background: var(--blue-50); }
.pipe b { display: block; font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; line-height: 1.1; color: var(--ink); letter-spacing: -0.03em; }
.pipe span { font-size: .75rem; color: var(--muted); }
.pipe a::after { content: ""; position: absolute; top: .8rem; right: .8rem; width: 7px; height: 7px; border-radius: 50%; background: var(--pc, var(--blue)); }

.rows { margin-top: 1rem; }
.row { display: flex; align-items: center; gap: .85rem; padding: .75rem 0; }
.row + .row { border-top: 1px solid var(--line); }
.row-main { min-width: 0; flex: 1; }
.row-main strong { display: block; font-size: .875rem; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-main span { display: block; font-size: .8125rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-end { text-align: right; flex: none; }
.row-end small { display: block; margin-top: .2rem; font-size: .75rem; color: var(--faint); }
.initials { display: grid; place-items: center; width: 36px; height: 36px; flex: none; font-family: var(--font-display); font-size: .75rem; font-weight: 700; color: var(--blue); background: var(--blue-50); border-radius: 4px 4px 12px 4px; }

/* Progetti */
.bar { height: 5px; margin-top: .45rem; border-radius: 5px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 5px; background: var(--blue); }
.money { font-family: var(--font-display); font-size: .875rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.money span { color: var(--faint); font-weight: 500; }
.row-main .soon { color: var(--red); font-weight: 600; }

/* ---------- Tasse ---------- */
.tax-big { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.tax-big strong { font-family: var(--font-display); font-size: 2rem; font-weight: 700; letter-spacing: -0.04em; color: var(--ink); font-variant-numeric: tabular-nums; }
.tax-big span { font-size: .8125rem; color: var(--muted); }
.cover { display: flex; height: 10px; margin-top: 1rem; border-radius: 4px 4px 10px 4px; overflow: hidden; background: var(--green-bg); }
.cover i { display: block; height: 100%; background: var(--blue); }
.cover-legend { display: flex; justify-content: space-between; gap: 1rem; margin-top: .55rem; font-size: .8125rem; color: var(--muted); }
.cover-legend b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.cover-legend .ok b { color: var(--green); }
.deadline { display: flex; align-items: center; gap: .85rem; margin-top: 1.25rem; padding: .8rem .9rem; background: var(--red-bg); border-radius: var(--shape-sm); }
.deadline-date { display: grid; place-items: center; align-content: center; width: 44px; height: 46px; flex: none; background: #fff; border-radius: 4px 4px 12px 4px; line-height: 1; }
.deadline-date b { font-family: var(--font-display); font-size: 1.125rem; color: var(--ink); }
.deadline-date small { margin-top: 2px; font-size: .625rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--red); }
.deadline strong { display: block; font-size: .875rem; color: var(--ink); }
.deadline span { font-size: .8125rem; color: var(--muted); }
.deadline .money { margin-left: auto; }
.limit { margin-top: 1.25rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.limit-head { display: flex; justify-content: space-between; gap: 1rem; font-size: .8125rem; color: var(--muted); }
.limit-head b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(280px, 86vw);
    transform: translateX(-100%); transition: transform .3s var(--ease);
  }
  .nav-open .side { transform: none; box-shadow: 20px 0 60px rgba(5, 11, 36, .25); }
  .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(5, 11, 36, .4); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease); }
  .nav-open .scrim { opacity: 1; pointer-events: auto; }
  .side-close { display: grid; place-items: center; width: 36px; height: 36px; border: 0; background: var(--bg-alt); border-radius: 6px; cursor: pointer; }
  .seg-legend { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 1.25rem; }
}
@media (max-width: 640px) {
  .topbar { padding-top: 1rem; flex-wrap: wrap; }
  .topbar-tools { width: 100%; }
  .topbar-tools .month { flex: 1; justify-content: center; }
  .hero-actions { width: 100%; justify-content: space-between; }
  .pipe { grid-template-columns: repeat(2, 1fr); }
  .todo li { flex-wrap: wrap; row-gap: .6rem; }
  .todo-txt { flex-basis: calc(100% - 36px - .9rem); }
  .todo li .btn { margin-left: calc(36px + .9rem); }
}

/* ==========================================================================
   PANNELLO REALE — componenti aggiuntivi
   ========================================================================== */
.i--xs { width: 13px; height: 13px; vertical-align: -2px; }
.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; }
.chip--muted { background: var(--bg-alt); color: var(--muted); }
.muted { color: var(--faint); }
.nowrap { white-space: nowrap; }
.pos { color: var(--green); }
.neg { color: var(--muted); }

/* Sidebar: voci future e uscita */
.side-link.is-soon { cursor: default; opacity: .6; }
.side-link.is-soon:hover { background: none; color: var(--muted); }
.side-soon { margin-left: auto; padding: 0 .4rem; font-size: .625rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); border: 1px solid var(--line); border-radius: 3px 3px 8px 3px; }
.side-user form { margin-left: auto; }
.side-out { display: grid; place-items: center; width: 34px; height: 34px; color: var(--faint); background: none; border: 0; border-radius: 6px; cursor: pointer; }
.side-out:hover { color: var(--blue); background: var(--blue-50); }
.side-user-txt { min-width: 0; }
.side-user-txt span { display: block; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 901px) {
  .side-collapsed .side-user form, .side-collapsed .side-soon { display: none; }
}

/* Barra in alto: mese e anno */
.month-nav, .year-nav { display: inline-flex; align-items: center; gap: .25rem; min-height: 42px; padding: 0 .3rem; background: #fff; border: 1.5px solid var(--line-strong); border-radius: 6px 6px 14px 6px; }
.month-nav a, .year-nav a { display: grid; place-items: center; width: 32px; height: 32px; color: var(--muted); border-radius: 5px; }
.month-nav a:hover, .year-nav a:hover { color: var(--blue); background: var(--blue-50); }
.month-nav span { display: inline-flex; align-items: center; gap: .4rem; padding: 0 .35rem; font-family: var(--font-display); font-size: .8125rem; font-weight: 600; color: var(--ink); white-space: nowrap; }
.month-nav .lock { color: var(--green); }
.year-nav { justify-self: start; }
.year-nav strong { padding: 0 .6rem; font-family: var(--font-display); color: var(--ink); }
.add-menu button { display: flex; align-items: center; gap: .7rem; width: 100%; padding: .6rem .7rem; font-size: .875rem; text-align: left; background: none; border: 0; border-radius: 6px 6px 12px 6px; cursor: pointer; }
.add-menu button:hover { background: var(--blue-50); color: var(--blue); }

/* Messaggi */
.flash, .notice { display: flex; align-items: center; gap: .7rem; padding: .8rem 1rem; font-size: .875rem; border-radius: var(--shape-sm); }
.flash .i, .notice .i { width: 18px; height: 18px; }
.flash--ok { background: var(--green-bg); color: var(--green); }
.flash--err { background: var(--red-bg); color: var(--red); }
.notice { background: var(--blue-50); color: var(--blue-700); }
.notice--amber { background: var(--amber-bg); color: var(--amber); margin-top: 1rem; }
.empty { display: flex; align-items: center; gap: .6rem; padding: 1.25rem 1.35rem 1.4rem; font-size: .875rem; color: var(--muted); }
.empty .i { color: var(--faint); }
.empty a { color: var(--blue); font-weight: 600; }
.hint { margin-top: .9rem; font-size: .8125rem; color: var(--muted); }

/* Hero: stati aggiuntivi */
.hero-sub b.down { color: #FFB4A8; }
.hero-state.is-closed::before { background: #7EE2B8; box-shadow: 0 0 0 4px rgba(126, 226, 184, .2); }
.seg .s-carry { background: repeating-linear-gradient(135deg, #E06C75 0 5px, #B8505A 5px 10px); }
.seg--empty i { flex: 1; background: rgba(255, 255, 255, .1); border-radius: 4px 4px 10px 4px; }
.hero-warn { display: flex; align-items: center; gap: .5rem; margin-top: 1.25rem; font-size: .8125rem; color: #FFD58A; }

/* Righe progetti */
.card-body--rows { padding-top: .5rem; }
.row-end--bar { width: 140px; }
.row-main b { font-weight: 500; }
.row-main b.soon { color: var(--red); font-weight: 600; }
.bar--warn i { background: var(--c-exp); }
.bar--lg { height: 10px; }

/* Tasse: varianti */
.cover--short { background: var(--red-bg); }
.cover--short i { background: var(--red); }
.cover-legend .ko b { color: var(--red); }
.deadline { background: var(--blue-50); }
.deadline-date small { color: var(--blue); }
.deadline.is-near { background: var(--red-bg); }
.deadline.is-near .deadline-date small { color: var(--red); }
.deadline--dark { background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .14); }
.deadline--dark strong { color: #fff; }
.deadline--dark span { color: #93A0CF; }
.limit-head--big { align-items: baseline; margin-bottom: .6rem; }
.limit-head--big strong { font-family: var(--font-display); font-size: 1.5rem; color: var(--ink); letter-spacing: -0.03em; }

.card--navy { position: relative; overflow: hidden; isolation: isolate; background: var(--navy); border-color: var(--navy); color: #B4BDE0; }
.card--navy::after { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(ellipse 80% 60% at 100% 0%, rgba(53, 82, 209, .5), transparent 70%); }
.card--navy h2 { color: #fff; }
.fund-big { display: flex; align-items: baseline; gap: .3rem; font-family: var(--font-display); font-weight: 700; font-size: 2.5rem; letter-spacing: -0.04em; color: #fff; font-variant-numeric: tabular-nums; }
.fund-big small { font-size: .5em; color: var(--blue-300); }
.fund-list { display: grid; gap: .6rem; margin-top: 1.1rem; font-size: .875rem; }
.fund-list li { display: flex; justify-content: space-between; gap: 1rem; }
.fund-list b { color: #fff; font-weight: 600; font-variant-numeric: tabular-nums; }
.fund-list .good b { color: #7EE2B8; }
.fund-list .bad b { color: #FFB4A8; }

/* Riepilogo numeri */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.stat { display: flex; flex-direction: column; gap: .2rem; padding: 1rem 1.2rem; background: #fff; border: 1px solid var(--line); border-radius: var(--shape); }
.stat span { font-size: .8125rem; color: var(--muted); }
.stat strong { font-family: var(--font-display); font-size: 1.375rem; font-weight: 700; color: var(--ink); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat strong.pos { color: var(--green); }
.stat em { font-style: normal; font-size: .75rem; color: var(--faint); }
.stat .link-arrow { margin-top: .2rem; }

/* Schede e tabelle */
.card-head--tabs { flex-wrap: wrap; }
.tabs { display: flex; gap: .25rem; padding: .25rem; background: var(--bg-alt); border-radius: 6px 6px 14px 6px; }
.tabs a { padding: .4rem .85rem; font-family: var(--font-display); font-size: .8125rem; font-weight: 600; color: var(--muted); border-radius: 5px 5px 11px 5px; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { background: #fff; color: var(--blue); box-shadow: 0 1px 3px rgba(11, 22, 64, .1); }
.head-actions { display: flex; gap: .5rem; }

.table-wrap { overflow-x: auto; margin-top: .75rem; }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th { padding: .6rem .75rem; text-align: left; font-family: var(--font-display); font-size: .6875rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 1.35rem; }
.table th:last-child, .table td:last-child { padding-right: 1.35rem; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover, .table tr.is-selected { background: var(--blue-50); }
.table .r { text-align: right; }
.table .who strong { display: block; font-weight: 600; color: var(--ink); }
.table .who span { display: block; font-size: .75rem; color: var(--muted); }
.table .who a { color: var(--blue); font-weight: 600; white-space: nowrap; }
.table .amount { font-family: var(--font-display); font-weight: 600; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .amount.pos { color: var(--green); }
.table--log td { font-size: .8125rem; padding-block: .55rem; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; color: var(--faint); background: none; border: 1px solid transparent; border-radius: 6px 6px 12px 6px; cursor: pointer; }
.icon-btn:hover { color: var(--red); background: var(--red-bg); }
a.icon-btn:hover { color: var(--blue); background: var(--blue-50); }
.progress { display: flex; align-items: center; gap: .6rem; min-width: 190px; }
.progress .bar { flex: 1; margin: 0; }
.progress small { font-size: .75rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.person { display: inline-flex; align-items: center; gap: .5rem; }
.person img { width: 26px; height: 26px; border-radius: 4px 4px 10px 4px; }
.person--big img { width: 44px; height: 44px; border-radius: 6px 6px 16px 6px; }
.person--big strong { display: block; font-family: var(--font-display); color: var(--ink); }
.person--big span { font-size: .875rem; color: var(--muted); }

/* Conto del mese */
.calc { display: grid; grid-template-columns: 1fr auto; gap: .55rem 1rem; margin: 0; font-size: .9375rem; }
.calc dt { color: var(--text); }
.calc dd { margin: 0; text-align: right; font-family: var(--font-display); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.calc dd.neg { color: var(--muted); font-weight: 500; }
.calc .sub { padding-bottom: .55rem; border-bottom: 1px solid var(--line); color: var(--ink); font-weight: 600; }
.calc .tot { padding-top: .7rem; border-top: 1px dashed var(--line-strong); font-family: var(--font-display); font-weight: 700; color: var(--ink); font-size: 1.0625rem; }
.calc dd.tot { color: var(--green); }
.calc--sm { font-size: .875rem; padding: 0 1.35rem 1.35rem; }

.partner { border-top: 4px solid var(--pc); }
.partner-head { display: flex; align-items: center; gap: .9rem; padding: 1.2rem 1.35rem 1rem; }
.partner-head img { width: 52px; height: 52px; border-radius: 6px 6px 18px 6px; }
.partner-head h2 { font-size: 1.0625rem; }
.partner-head span { font-size: .8125rem; color: var(--muted); }
.partner-due { margin-left: auto; text-align: right; }
.partner-due strong { display: block; font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--ink); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.partner-due strong.neg { color: var(--red); }
.closed-info { display: flex; align-items: flex-start; gap: .55rem; margin-bottom: 1rem; font-size: .875rem; color: var(--muted); }
.closed-info .i { color: var(--green); }

/* Impostazioni */
.server-body { display: flex; align-items: center; gap: .9rem; padding-block: 1rem; }
.server-body > .i { width: 26px; height: 26px; }
.server-body strong { display: block; font-family: var(--font-display); color: var(--ink); }
.server-body span { font-size: .875rem; color: var(--muted); }
.server--ok .server-body > .i { color: var(--green); }
.server--ko { border-color: var(--red); background: var(--red-bg); }
.server--ko .server-body > .i { color: var(--red); }
.split-now { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.form--top { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.history { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); display: grid; gap: .4rem; font-size: .8125rem; }
.history li { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); }
.history b { color: var(--ink); font-weight: 600; }

/* Moduli */
.row-2, .row-3, .row-4 { display: grid; gap: 1rem; }
.row-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
select.input { appearance: none; padding-right: 2.4rem; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235A6487' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right .8rem center / 16px; cursor: pointer; }
textarea.input { min-height: 90px; resize: vertical; line-height: 1.5; }
.input-money { position: relative; }
.input-money span { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); font-weight: 600; color: var(--muted); pointer-events: none; }
.input-money .input { padding-left: 2rem; font-variant-numeric: tabular-nums; }
.input-file { padding: .55rem .7rem; min-height: auto; font-size: .875rem; }
.input-file::file-selector-button { margin-right: .8rem; padding: .35rem .8rem; font: inherit; font-weight: 600; color: var(--blue); background: var(--blue-50); border: 0; border-radius: 4px 4px 10px 4px; cursor: pointer; }
.form-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .25rem; }
.btn--danger { --btn-fg: var(--red); margin-right: auto; }
.btn--danger:hover { --btn-bg: var(--red-bg); --btn-fg: var(--red); --btn-bd: var(--red); }

/* Finestre "Registra" */
.dlg { width: min(520px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); padding: 0; color: var(--text); background: #fff; border: 0; border-radius: 12px 12px 32px 12px; box-shadow: 0 30px 80px -20px rgba(5, 11, 36, .5); }
.dlg::backdrop { background: rgba(5, 11, 36, .45); backdrop-filter: blur(2px); }
.dlg[open] { animation: dlg-in .22s var(--ease); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.dlg .form { padding: 1.4rem 1.5rem 1.5rem; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.dlg-head h2 { font-size: 1.25rem; }
.dlg-x { display: grid; place-items: center; width: 36px; height: 36px; color: var(--muted); background: var(--bg-alt); border: 0; border-radius: 6px; cursor: pointer; }
.dlg-x:hover { color: var(--ink); }
.dlg-intro { margin-top: -.4rem; font-size: .875rem; color: var(--muted); }
.dlg-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .4rem; }

/* Accesso e configurazione */
.login-msg { margin-bottom: 1.25rem; padding: .7rem .9rem; font-size: .875rem; border-radius: var(--shape-sm); }
.login-msg--err { background: var(--red-bg); color: var(--red); }
.login-msg--ok { background: var(--green-bg); color: var(--green); }
.login-msg code { font-size: .8125rem; }
.login-box--wide { max-width: 520px; }
.setup-title { margin-bottom: 1.25rem; text-align: center; font-size: 1.25rem; }
.setup-user { display: grid; gap: 1rem; margin: 0; padding: 1rem 1.1rem 1.1rem; border: 1px solid var(--line); border-radius: var(--shape-sm); }
.setup-user legend { display: flex; align-items: center; gap: .5rem; padding: 0 .4rem; font-family: var(--font-display); font-weight: 600; color: var(--ink); }
.setup-user legend img { width: 28px; height: 28px; border-radius: 4px 4px 10px 4px; }

@media (max-width: 1180px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .row-2, .row-3, .row-4 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; gap: .6rem; }
  .stat strong { font-size: 1.125rem; }
  .month-nav { flex: 1; justify-content: space-between; }
  .topbar-tools .add .btn span { display: none; }
  .partner-head { flex-wrap: wrap; }
  .dlg .form { padding: 1.1rem 1.1rem 1.2rem; }
}
