@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --fg: #0F172A;
  --muted: #64748B;
  --border: #E2E8F0;
  --primary: #DC2626;
  --primary-hover: #B91C1C;
  --accent: #E8A317;
  --success: #16A34A;
  --error: #DC2626;
  --radius: 0.5rem;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --trans: all 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
body {
  margin: 0; font-family: Inter, system-ui, sans-serif;
  background: var(--bg); color: var(--fg); line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
button { cursor: pointer; font-family: inherit; }

/* Header */
.app-header {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem; display: flex; align-items: center;
  justify-content: space-between; position: sticky; top: 0; z-index: 10;
}
.app-header .logo { height: 32px; }
.app-header .user { color: var(--muted); font-size: 0.875rem; }

/* Container */
.container { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }

/* Card */
.card { background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  min-height: 44px; padding: 0 1.25rem; border: none;
  border-radius: var(--radius); font-weight: 500; font-size: 0.9375rem;
  transition: var(--trans);
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--fg); }
.btn-block { width: 100%; justify-content: center; }

/* Form */
.form-field { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 1rem; }
.form-field label { font-weight: 500; font-size: 0.875rem; }
.form-field input {
  min-height: 48px; padding: 0 0.875rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 1rem; font-family: inherit; background: var(--card);
}
.form-field input:focus { border-color: var(--primary); }
.form-error { color: var(--error); font-size: 0.875rem; margin-top: 0.5rem; }

/* Login */
.login-card { max-width: 420px; margin: 4rem auto; }

/* Table */
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th, .table td {
  padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border);
}
.table th { font-weight: 600; font-size: 0.8125rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em; }
.table td.num { text-align: right; }
.table tr:hover { background: #F1F5F9; }

/* Badge sconto */
.badge-sconto {
  display: inline-block; padding: 0.125rem 0.5rem;
  background: var(--accent); color: white; border-radius: 9999px;
  font-size: 0.8125rem; font-weight: 600; font-variant-numeric: tabular-nums;
}

/* Intestazione DT2 */
.dt2-head { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem; }
.dt2-head dl { margin: 0; }
.dt2-head dt { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; }
.dt2-head dd { margin: 0 0 0.5rem; font-weight: 500; }

/* Totali */
.totali { margin-top: 1rem; padding: 1rem; background: #F1F5F9;
  border-radius: var(--radius); text-align: right; font-variant-numeric: tabular-nums; }
.totali .totale-finale { font-size: 1.25rem; font-weight: 700; margin-top: 0.5rem; }

/* Mobile */
@media (max-width: 640px) {
  .container { padding: 1rem; }
  .dt2-head { grid-template-columns: 1fr; }
  .table-responsive table thead { display: none; }
  .table-responsive table tr {
    display: block; margin-bottom: 0.75rem; padding: 1rem;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--card);
  }
  .table-responsive table td { display: flex; justify-content: space-between;
    border: none; padding: 0.25rem 0; }
  .table-responsive table td::before {
    content: attr(data-label); font-weight: 500; color: var(--muted);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
