/* forfettario.org — design system, ported from design/forfettario.dc.html (Claude Design).
   Palette: teal primary + terracotta accent; semantic green/amber/red; ink neutrals.
   Fonts: Hanken Grotesk (UI) + IBM Plex Mono (money/codes, tabular). */

@import url('https://fonts.googleapis.com/css2?family=Hanken+Grotesk:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #F4F6F5; --surface: #FFFFFF; --surface-2: #FBFCFB;
  --ink: #132523; --ink-2: #42544F; --ink-3: #7C8C87;
  --line: #E4E9E6; --line-2: #EFF2F0;
  --teal: #0E4E51; --teal-700: #0A3C3E; --teal-50: #E7F0EF; --teal-100: #D1E2E0;
  --accent: #B65A2C; --accent-700: #98481F; --accent-50: #F7ECE4;
  --green: #1E7A47; --green-50: #E3F1E9;
  --amber: #9A6E12; --amber-50: #F6EDD6;
  --red: #B0231C; --red-50: #F7E4E2;
  --radius: 14px; --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(19,37,35,.04), 0 8px 24px rgba(19,37,35,.05);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-700); }
::selection { background: var(--teal-100); }
h1, h2, h3, h4 { letter-spacing: -.02em; margin: 0; }

/* money / codes — tabular monospaced figures so columns align */
.mono, .money { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.money { letter-spacing: -.01em; white-space: nowrap; }
.num-hero { font-family: 'IBM Plex Mono', monospace; font-weight: 600; letter-spacing: -.02em; }

/* ---- layout shell ---- */
.app { min-height: 100vh; }
.page { max-width: 1180px; margin: 0 auto; padding: 22px; }

.appbar {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 18px; box-shadow: var(--shadow);
}
.appbar .brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 18px; }
.appbar .brand .logo {
  width: 30px; height: 30px; border-radius: 8px; background: var(--teal); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-style: italic;
}
.appbar .brand .tld { color: var(--ink-3); font-weight: 600; font-size: 12px; }
.appbar .spacer { flex: 1; }

.switcher, .yearsel {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px;
}
.switcher .av {
  width: 26px; height: 26px; border-radius: 7px; background: var(--teal-50); color: var(--teal-700);
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
}
.switcher .nm { font-weight: 700; font-size: 13.5px; line-height: 1.1; }
.switcher .cf { color: var(--ink-3); font-size: 11px; font-family: 'IBM Plex Mono', monospace; }
.avatar {
  width: 32px; height: 32px; border-radius: 9px; background: var(--ink); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.iconbtn { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--surface-2); display: grid; place-items: center; cursor: pointer; position: relative; }
.iconbtn .dot { position: absolute; top: 6px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

/* ---- workspace tabs ---- */
.tabs { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line);
  margin-top: 14px; padding: 0 4px; }
.tabs .who { font-weight: 800; margin-right: 12px; display: flex; align-items: center; gap: 8px; }
.tab { padding: 11px 14px; color: var(--ink-3); font-weight: 600; font-size: 14px;
  border-bottom: 2px solid transparent; cursor: pointer; }
.tab:hover { color: var(--ink-2); }
.tab.active { color: var(--ink); border-bottom-color: var(--teal); }

/* ---- cards ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); }
.card.pad { padding: 18px; }
.card-hd { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font: inherit;
  font-weight: 700; font-size: 14px; border-radius: 10px; padding: 9px 15px; border: 1px solid transparent; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-700); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-700); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---- badges ---- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); }
.badge .dt { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.teal { background: var(--teal-50); color: var(--teal-700); border-color: var(--teal-100); }
.badge.accent { background: var(--accent-50); color: var(--accent-700); border-color: #ecd6c8; }
.badge.green { background: var(--green-50); color: var(--green); border-color: #cfe6d8; }
.badge.amber { background: var(--amber-50); color: var(--amber); border-color: #ecdcae; }
.badge.red { background: var(--red-50); color: var(--red); border-color: #eecac6; }

/* ---- fields ---- */
.field { display: block; margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.input { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); }
.input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-50); }
.input.mono { font-family: 'IBM Plex Mono', monospace; }

/* ---- tables ---- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 700; padding: 9px 14px; }
.table td { padding: 11px 14px; border-top: 1px solid var(--line-2); font-size: 14px; }
.table td.r, .table th.r { text-align: right; }
.table tr:hover td { background: var(--surface-2); }

/* ---- derivation ledger (Calcolo) ---- */
.ledger { display: flex; flex-direction: column; }
.lrow { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-bottom: 1px dashed var(--line-2); }
.lrow .op { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: var(--ink-3); background: var(--surface-2); border: 1px solid var(--line-2); }
.lrow .lbl { flex: 1; color: var(--ink-2); }
.lrow .val { font-family: 'IBM Plex Mono', monospace; font-variant-numeric: tabular-nums; font-weight: 500; }
.lrow.total .lbl { font-weight: 800; color: var(--ink); }
.lrow.total .val { font-weight: 700; }
.lrow.result { background: var(--teal-50); border-radius: 10px; border-bottom: none; padding: 11px 12px; }
.lrow.result .lbl, .lrow.result .val { color: var(--teal-700); font-weight: 800; }
.lrow .neg { color: var(--red); }
.why { font-size: 12.5px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: 10px; padding: 10px 12px; margin: 6px 0 8px 32px; }

/* total-da-versare hero (Calcolo sidebar) */
.hero { background: var(--teal); color: #fff; border-radius: var(--radius); padding: 18px; }
.hero .kicker { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .7; }
.hero .big { font-family: 'IBM Plex Mono', monospace; font-weight: 600; font-size: 34px; letter-spacing: -.02em; margin: 6px 0; }
.hero .sub { font-size: 12.5px; opacity: .85; }
.hero .brk { display: flex; justify-content: space-between; padding: 6px 0; border-top: 1px solid rgba(255,255,255,.14); font-size: 13px; }
.hero .brk .money { opacity: .95; }

/* F24 sezione headers */
.sez { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.sez-hd { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; color: #fff; }
.sez-hd .money { font-weight: 600; }
.sez.erario .sez-hd { background: var(--teal); }
.sez.inps .sez-hd { background: var(--ink); }

/* misc */
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.strike { text-decoration: line-through; color: var(--ink-3); }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 4px; }
.spin { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--teal);
  border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sk { background: linear-gradient(90deg,#eef1f0 25%,#e3e7e6 37%,#eef1f0 63%); background-size: 760px 100%;
  animation: shim 1.3s infinite linear; border-radius: 6px; display: inline-block; }
@keyframes shim { 0% { background-position: -380px 0; } 100% { background-position: 380px 0; } }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 11px; box-shadow: var(--shadow); z-index: 50; }

/* auth screen */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 22px; }
.auth .card { width: 100%; max-width: 400px; padding: 26px; }
.auth h1 { font-size: 22px; font-weight: 800; }
.auth .logo-lg { width: 42px; height: 42px; border-radius: 11px; background: var(--teal); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-style: italic; font-size: 22px; margin-bottom: 14px; }
.err { color: var(--red); font-size: 13px; margin-top: 4px; }
.disclaimer { color: var(--ink-3); font-size: 12px; margin-top: 16px; text-align: center; }
