/* Disinfestart Gestionale — design tokens + componenti base. Palette dal sito ufficiale. */
@font-face {
  font-family: "Inter";
  src: url("../fonts/Inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --teal-50: #f3faf8; --teal-100: #e2f2ef; --teal-200: #b7e4db; --teal-300: #7fcbbd;
  --teal-400: #3fa596; --teal-500: #0f7d78; --teal: #015d61; --teal-700: #014a4e;
  --teal-800: #013a3d; --teal-900: #0b2a2c; --teal-950: #071f21;
  --yellow: #ffd42a; --yellow-600: #f2c200;
  --green: #3c9a3f; --orange: #e8891c; --red: #c4382f; --blue: #2f6fb5;

  --ink: #0f2426; --text: #3b4a4c; --muted: #64777a;
  --surface: #f5f9f8; --card: #ffffff; --border: #dbe7e4; --border-strong: #b9cdc9;
  --primary: var(--teal); --primary-hover: var(--teal-700); --on-primary: #fff;
  --accent: var(--yellow); --on-accent: var(--ink);
  --success: var(--green); --warning: var(--orange); --danger: var(--red); --info: var(--blue);
  --success-bg: #e6f4e6; --warning-bg: #fdf0df; --danger-bg: #fbe7e5; --info-bg: #e5eef8;

  --radius-sm: 10px; --radius: 16px; --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(1, 93, 97, .06), 0 1px 3px rgba(1, 93, 97, .08);
  --shadow: 0 4px 14px rgba(1, 93, 97, .10);
  --shadow-lg: 0 12px 32px rgba(1, 93, 97, .16);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sidebar-w: 248px; --topbar-h: 60px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--surface); }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; margin: 0 0 .5em; font-weight: 650; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
a { color: var(--primary); }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid var(--yellow-600); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Layout */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--teal-900); color: #cfe3df; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { display: block; padding: 6px 10px 18px; }
.sidebar .brand img { width: 170px; filter: brightness(0) invert(1); opacity: .95; }
.nav-section { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #8fb0ab; margin: 18px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); color: #dcebe8; text-decoration: none; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav a[aria-current="page"] { background: var(--teal); color: #fff; box-shadow: inset 3px 0 0 var(--yellow); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 24px; background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar .spacer { flex: 1; }
.menu-toggle { display: none; }
.content { padding: 24px; max-width: 1400px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 20px; }
.page-head h1 { margin: 0; flex: 1; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(80vw, 280px); transform: translateX(-100%); transition: transform .2s; z-index: 50; }
  .shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .menu-toggle { display: inline-flex; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
}

/* Components */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px; }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.8rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; background: var(--primary); color: var(--on-primary); }
.btn:hover { background: var(--primary-hover); color: var(--on-primary); }
.btn-secondary { background: var(--card); color: var(--primary); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--teal-50); color: var(--primary-hover); }
.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-accent:hover { background: var(--yellow-600); color: var(--on-accent); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #a32c24; }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: var(--teal-50); color: var(--ink); }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: .9rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; color: var(--ink); margin-bottom: 4px; font-size: .92rem; }
.field .hint { color: var(--muted); font-size: .82rem; margin-top: 3px; }
.field .error { color: var(--danger); font-size: .85rem; margin-top: 3px; }
.input, select.input, textarea.input { width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font: inherit; color: var(--ink); background: #fff; }
.input:focus { border-color: var(--primary); outline: 3px solid var(--teal-100); }
.field.has-error .input { border-color: var(--danger); }
.form-row { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--teal-50); }
.table tbody tr:hover { background: #fafdfc; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--teal-100); color: var(--teal-800); }
.badge-success { background: var(--success-bg); color: #24692a; }
.badge-warning { background: var(--warning-bg); color: #8a4d08; }
.badge-danger { background: var(--danger-bg); color: #8e2219; }
.badge-muted { background: #eef2f1; color: var(--muted); }

.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid transparent; }
.alert-success { background: var(--success-bg); border-color: #bfe1c0; color: #1f5a23; }
.alert-danger { background: var(--danger-bg); border-color: #f0c2bd; color: #7d1d15; }
.alert-warning { background: var(--warning-bg); border-color: #f3d2a8; color: #774206; }
.alert-info { background: var(--info-bg); border-color: #c4d7ee; color: #1d4a7c; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.muted { color: var(--muted); }

/* Auth pages */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, var(--teal-50), var(--surface) 60%); }
.auth .card { width: 100%; max-width: 400px; padding: 28px; }
.auth .logo { display: block; width: 220px; margin: 0 auto 20px; }

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
}
