/* =========================================================
   Xupus Fiscale — Design system "REGISTRO"
   Soggetto: studio commercialista → documenti, registri, timbri
   ========================================================= */
:root {
  --ink: #14293b;
  --ink-deep: #0b1c2a;
  --paper: #f6f3ec;
  --surface: #fdfcfa;
  --rule: #e4ddcc;
  --rule-strong: #cfc5ad;
  --stamp: #16735d;
  --stamp-deep: #0f5c49;
  --text: #1e2a33;
  --muted: #66757f;
  --danger: #b23a3a;
  --warn: #b7791f;
  --radius: 3px;
  --shadow: 0 1px 2px rgba(20, 41, 59, 0.06), 0 8px 24px rgba(20, 41, 59, 0.06);
}

* { scrollbar-width: thin; scrollbar-color: #c8bfa8 transparent; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--text);
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 0.95rem;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Numeri da registro: colonne monetarie */
.num-tab { font-variant-numeric: tabular-nums; }

/* ---------- Accessibilità ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--stamp);
  outline-offset: 2px;
  border-radius: 2px;
}
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 2000;
}
.skip-link:focus { left: 0; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Intestazione "lettera ufficiale" ---------- */
.navbar-xupus {
  background: var(--surface);
  border-bottom: 2px solid var(--ink);
  box-shadow: none;
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}
.navbar-xupus .navbar-brand {
  font-family: "Lora", Georgia, serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--ink);
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.navbar-xupus .navbar-brand img { height: 30px; width: 30px; }
.navbar-xupus .nav-link {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius);
  padding: 0.4rem 0.85rem;
}
.navbar-xupus .nav-link:hover { color: var(--ink); background: #efe9db; }
.navbar-xupus .nav-link.active {
  color: var(--ink);
  background: transparent;
  border-bottom: 2px solid var(--stamp);
}
.brand-sub {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
@media (max-width: 991px) { .brand-sub { display: none; } }

/* ---------- Titoli di sezione (etichette da registro) ---------- */
.pagetitle {
  font-family: "Lora", Georgia, serif;
  font-weight: 600;
  color: var(--ink);
}
.page-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--stamp);
  font-weight: 600;
}
.page-eyebrow::before { content: "— "; }

/* ---------- Schede "foglio" ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.card:hover { box-shadow: 0 4px 18px rgba(20, 41, 59, 0.1); }
.card-header {
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  font-weight: 600;
  color: var(--ink);
}

/* ---------- Statistiche ---------- */
.stat-card { border-left: 3px solid var(--stamp); }
.stat-card .num {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat-card .lbl {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-icon {
  width: 42px; height: 42px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  color: var(--stamp);
  background: #f1ece1;
}
.stat-card.text-danger .num { color: var(--danger); }
.stat-card.text-success .num { color: var(--stamp); }
.stat-card.text-warning .num { color: var(--warn); }

/* ---------- Tabelle "registro" ---------- */
.table thead th {
  background: var(--paper);
  color: var(--ink);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border-bottom: 1px solid var(--rule-strong);
  white-space: nowrap;
}
.table tbody tr { border-bottom: 1px solid var(--rule); }
.table tbody tr:hover { background: #f3efe4; }
.table td { vertical-align: middle; }

/* ---------- Pulsanti ---------- */
.btn-xupus {
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  font-weight: 600;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.btn-xupus:hover { background: var(--stamp-deep); border-color: var(--stamp-deep); color: #fff; }
.btn-xupus:active { background: var(--ink-deep); color: #fff; }
.btn-outline-primary {
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  font-weight: 600;
}
.btn-outline-primary:hover { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- Badge ---------- */
.badge { font-weight: 600; border-radius: 2px; letter-spacing: 0.02em; }

/* ---------- Form ---------- */
.form-control, .form-select {
  border-radius: var(--radius);
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  color: var(--text);
}
.form-control:focus, .form-select:focus {
  border-color: var(--stamp);
  box-shadow: 0 0 0 3px rgba(22, 115, 93, 0.15);
}
.form-label {
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
}
.input-group-text { background: #f1ece1; border: 1px solid var(--rule-strong); }

/* ---------- Stati vuoti: invito all'azione ---------- */
.empty-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--muted);
}
.empty-stamp {
  width: 56px; height: 56px;
  margin: 0 auto 0.9rem;
  border: 2px solid var(--rule-strong);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-family: "Lora", Georgia, serif;
  font-weight: 700;
  font-size: 1.4rem;
  color: var(--stamp);
  transform: rotate(-4deg);
}
.empty-state .empty-title { font-family: "Lora", Georgia, serif; font-weight: 600; color: var(--ink); }
.empty-state .empty-cta { margin-top: 0.75rem; }

/* ---------- Login: "cartolina bollata" ---------- */
.login-bg {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1100px circle at 15% 10%, rgba(22, 115, 93, 0.10), transparent 45%),
    radial-gradient(900px circle at 90% 90%, rgba(20, 41, 59, 0.16), transparent 55%),
    var(--paper);
  padding: 1.5rem;
}
.login-card {
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-top: 4px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.login-stamp {
  width: 74px; height: 74px;
  margin: 0 auto 1rem;
  border: 2px solid var(--stamp);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transform: rotate(-4deg);
}
.login-stamp img { width: 56px; height: 56px; }
.login-brand {
  font-family: "Lora", Georgia, serif;
  font-weight: 700;
  color: var(--ink);
  font-size: 1.7rem;
}

/* ---------- Footer ---------- */
.app-footer {
  margin-top: 3rem;
  padding: 1.25rem 0 1.5rem;
  border-top: 1px solid var(--rule);
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}
.app-footer .foot-brand { font-family: "Lora", Georgia, serif; font-weight: 700; color: var(--ink); }

/* ---------- Vari ---------- */
a { color: var(--stamp-deep); }
a:hover { color: var(--stamp); }
.alert { border-radius: var(--radius); border: 1px solid var(--rule); background: var(--surface); }
.table-responsive { -webkit-overflow-scrolling: touch; }