:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #111827;
  --muted: #667085;
  --line: #d9e0ea;
  --line-strong: #c7d0dd;
  --primary: #0f766e;
  --primary-hover: #0b5f59;
  --primary-soft: #e6f4f1;
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --warning: #946200;
  --warning-soft: #fff4ce;
  --ok: #067647;
  --ok-soft: #dcfae6;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 10px 28px rgba(16, 24, 40, .06);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(180deg, #ffffff 0, var(--bg) 260px),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.wrap {
  width: min(100% - 32px, 1320px);
  margin: 0 auto;
  padding: 26px 0 42px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

h1,
h2 {
  letter-spacing: 0;
  line-height: 1.15;
}

h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 760;
}

h2 {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 730;
}

p {
  margin: 0 0 12px;
}

nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: #344054;
  font-weight: 680;
  box-shadow: 0 1px 1px rgba(16, 24, 40, .03);
}

nav a:hover {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpis div,
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.kpis div {
  padding: 16px;
}

.kpis b {
  display: block;
  margin-bottom: 2px;
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
  color: #101828;
}

.kpis span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.card {
  padding: 18px;
}

.search {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 220px auto;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

label {
  display: block;
  margin-bottom: 12px;
  color: #344054;
  font-size: 13px;
  font-weight: 680;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  margin-top: 6px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.search input,
.search select {
  margin-top: 0;
}

textarea {
  min-height: 104px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .16);
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 16px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
}

button:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

button:active {
  transform: translateY(1px);
}

table {
  width: 100%;
  border-spacing: 0;
  border-collapse: separate;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef4f3;
  color: #344054;
  font-size: 12px;
  font-weight: 780;
  text-transform: uppercase;
}

td {
  color: #344054;
}

tbody tr:hover td {
  background: var(--surface-soft);
}

tr:last-child td {
  border-bottom: 0;
}

.badge,
.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 780;
  white-space: nowrap;
}

.badge.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge.no {
  background: var(--danger-soft);
  color: var(--danger);
}

.status {
  background: #eef2f6;
  color: #475467;
}

.status.completato {
  background: var(--ok-soft);
  color: var(--ok);
}

.status.bloccato {
  background: var(--danger-soft);
  color: var(--danger);
}

.status.in_lavorazione {
  background: var(--warning-soft);
  color: var(--warning);
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: #344054;
}

.checks input {
  width: 16px;
  min-height: 16px;
  margin: 0;
  accent-color: var(--primary);
}

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  border: 1px solid transparent;
  font-weight: 680;
}

.okbox {
  background: var(--ok-soft);
  border-color: #abefc6;
  color: var(--ok);
}

.danger {
  border-color: #fda29b;
}

.alert.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.note {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}

.note:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.big {
  margin: 0 0 12px;
  font-size: 36px;
  line-height: 1;
  font-weight: 820;
}

ul {
  padding-left: 18px;
  margin: 0;
}

li {
  margin: 8px 0;
}

small {
  color: var(--muted);
}

@media (max-width: 980px) {
  .kpis,
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .wrap {
    width: min(100% - 22px, 1320px);
    padding-top: 18px;
  }

  header {
    display: block;
  }

  nav {
    margin-top: 14px;
  }

  h1 {
    font-size: 24px;
  }

  .kpis,
  .grid,
  .checks {
    grid-template-columns: 1fr;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}
