:root {
  --bg: #1e1f22;
  --bg-card: #2b2d31;
  --bg-input: #17181a;
  --text: #e3e5e8;
  --text-muted: #949ba4;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --border: #3f4147;
  --danger: #da373c;
  --danger-hover: #a52a2e;
  --ok: #23a55a;
}

* { box-sizing: border-box; }

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

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

nav.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

nav.topbar a.brand { color: var(--text); text-decoration: none; font-weight: 700; font-size: 15px; letter-spacing: 0.2px; }
nav.topbar .user { color: var(--text-muted); font-size: 14px; }
nav.topbar .user a { color: var(--text-muted); }
nav.topbar .user a:hover { color: var(--text); }

.azienda-head { margin-bottom: 18px; }
.azienda-head h1 { margin: 4px 0 2px; }
.azienda-head .muted:first-child { margin-bottom: 6px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

h1 { font-size: 23px; }
h2 { font-size: 17px; margin-top: 0; margin-bottom: 6px; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.1s ease;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: translateY(1px); }

.btn-danger { background: var(--danger); padding: 6px 12px; font-size: 13px; }
.btn-danger:hover { background: var(--danger-hover); }

label { display: block; margin: 14px 0 5px; font-size: 13px; color: var(--text-muted); font-weight: 600; }

.hint { color: var(--text-muted); font-size: 12px; margin: 4px 0 0; }

select + input[type="text"] {
  margin-top: 6px;
  font-size: 12px;
  padding: 6px 10px;
  opacity: 0.85;
}

input[type="text"], select {
  width: 100%;
  padding: 9px 11px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

input[type="text"]:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

.grid-check {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 2px 16px;
}

.checkbox-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.checkbox-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }

.azienda-list { list-style: none; padding: 0; }
.azienda-list li { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.azienda-list a { color: var(--text); text-decoration: none; font-weight: 600; font-size: 15px; }
.azienda-list a:hover { color: var(--accent); }

table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th {
  text-align: left;
  padding: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); font-size: 14px; }
td input[type="text"] { padding: 6px 8px; font-size: 13px; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; background: var(--accent); }

.muted { color: var(--text-muted); font-size: 13px; }

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  font-family: inherit;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--text); border-bottom-color: var(--accent); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }
