:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --border: #e0e4e9;
  --text: #1f2d3d;
  --text-muted: #6b7785;
  --accent: #2b5fb8;
  --accent-dark: #1f2d3d;
  --pos: #1b7a3d;
  --neg: #b3261e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--accent-dark);
  color: #fff;
  padding: 0.75rem 1.5rem;
}

.brand {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.05rem;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.topbar-nav a {
  color: #dce3ec;
  text-decoration: none;
  font-size: 0.92rem;
}

.topbar-nav a:hover { color: #fff; }

.topbar-user {
  color: #9fb0c3;
  font-size: 0.85rem;
}

.logout {
  border: 1px solid #4a5b70;
  border-radius: 4px;
  padding: 0.3rem 0.7rem;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.page-title {
  margin: 0 0 0.25rem;
  font-size: 1.6rem;
}

.page-subtitle {
  color: var(--text-muted);
  margin-top: 0;
}

.flash-list { margin-bottom: 1rem; }
.flash {
  padding: 0.6rem 0.9rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  font-size: 0.92rem;
}
.flash-error { background: #fbe4e2; color: var(--neg); }
.flash-success { background: #e2f4e8; color: var(--pos); }

/* Login */
.login-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80vh;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2.5rem;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 4px 18px rgba(20, 30, 45, 0.08);
}
.login-card h1 { margin: 0 0 0.25rem; font-size: 1.4rem; }
.login-card .subtitle { color: var(--text-muted); margin-top: 0; margin-bottom: 1.5rem; font-size: 0.9rem; }
.login-card label { display: block; font-size: 0.85rem; margin-bottom: 0.3rem; color: var(--text-muted); }
.login-card input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
}
.login-card button {
  width: 100%;
  padding: 0.65rem;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 0.95rem;
  cursor: pointer;
}
.login-card button:hover { background: #244d97; }

/* Menu */
.menu-list { list-style: none; padding: 0; margin-top: 1.5rem; }
.menu-item {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.menu-item:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(43, 95, 184, 0.12);
}
.menu-item-title { display: block; font-weight: 600; font-size: 1.02rem; }
.menu-item-desc { display: block; color: var(--text-muted); font-size: 0.86rem; margin-top: 0.2rem; }

/* Report */
.report-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
}
.report-actions { display: flex; gap: 0.6rem; }
.btn {
  display: inline-block;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 0.88rem;
  border: none;
  cursor: pointer;
}
.btn:hover { background: #244d97; }
.btn-secondary { background: var(--surface); color: var(--accent); border: 1px solid var(--accent); }
.btn-secondary:hover { background: #eef3fb; }

.empty-state {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  color: var(--text-muted);
  margin-top: 1.5rem;
}

.table-scroll { overflow-x: auto; margin-top: 1.25rem; }

.report-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 1000px;
  background: var(--surface);
  font-size: 0.85rem;
}
.report-table th, .report-table td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.6rem;
}
.report-table thead th {
  background: var(--accent-dark);
  color: #fff;
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}
.report-table thead th.col-label { text-align: left; }
.report-table td.col-label { text-align: left; }
.report-table td.col-number { text-align: right; font-variant-numeric: tabular-nums; }
.report-table tbody tr:nth-child(even) { background: #f8fafc; }
.report-table tfoot td {
  font-weight: 700;
  background: #e7edf5;
}
.report-table td.pos { color: var(--pos); }
.report-table td.neg { color: var(--neg); }

/* Cards / forms */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-top: 1.25rem;
}
.card h2 { margin-top: 0; font-size: 1.1rem; }
.inline-form {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.inline-form label { font-size: 0.82rem; color: var(--text-muted); display: block; margin-bottom: 0.25rem; }
.inline-form input {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.simple-table { width: 100%; border-collapse: collapse; margin-top: 0.75rem; }
.simple-table th, .simple-table td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

/* Stampa in A4 orizzontale */
@media print {
  @page { size: A4 landscape; margin: 1cm; }
  .topbar, .report-actions, .flash-list { display: none !important; }
  body { background: #fff; }
  .container { max-width: none; padding: 0; }
  .report-table { font-size: 10px; }
  .table-scroll { overflow: visible; }
}
