/* =========================================================
   🎨 WAINZUA BRAND THEME
   ========================================================= */

:root{
  /* base */
  --bg:#0b1220;
  --card:#0f1a30;
  --border:#1b2a4a;
  --text:#e7eefc;
  --muted:#a9b6d6;

  /* Wainzua palette */
  --primary:#2C683E;
  --primary-soft:#36724B;
  --accent:#F6DA59;
  --accent-strong:#F2A43A;

  --danger:#b23a3a;
}

/* ========================================================= */

*{ box-sizing:border-box; }

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

a{ color:inherit; text-decoration:none; }
a:hover{ opacity:.85; }

.container{ max-width:1400px; margin:0 auto; padding:18px; }

/* =========================================================
   HEADER
   ========================================================= */

.topbar{
  position:sticky;
  top:0;
  z-index:10;
  background:linear-gradient(90deg,var(--primary),var(--primary-soft));
  border-bottom:1px solid var(--border);
}

.topbar .container{
  display:flex;
  justify-content:space-between;
  align-items:center;
}

.brand{
  font-weight:700;
  letter-spacing:.3px;
}

/* =========================================================
   LAYOUT HELPERS
   ========================================================= */

.row{ display:flex; align-items:center; }
.row.space{ justify-content:space-between; }
.row.gap{ gap:10px; }

.grid2{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:16px;
}

.stack > *{ margin-bottom:10px; }

/* =========================================================
   CARDS
   ========================================================= */

.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:14px;
  padding:14px;
}

/* =========================================================
   TABLES
   ========================================================= */

table{
  width:100%;
  border-collapse:collapse;
  font-size:14px;
}

th,td{
  padding:8px 10px;
  border-bottom:1px solid var(--border);
}

th{
  text-align:left;
  color:var(--muted);
  font-weight:600;
}

tr:hover td{
  background:rgba(255,255,255,.02);
}

/* =========================================================
   BUTTONS
   ========================================================= */

.btn{
  background:var(--primary);
  color:white;
  border:none;
  border-radius:10px;
  padding:8px 14px;
  cursor:pointer;
}

.btn:hover{ background:var(--primary-soft); }

.btn.ghost{
  background:transparent;
  border:1px solid var(--border);
}

.pill{
  background:rgba(44,104,62,.2);
  color:var(--primary);
  border:none;
  border-radius:999px;
  padding:4px 10px;
  font-size:12px;
  cursor:pointer;
}

.pill.danger{
  background:var(--danger);
  color:white;
}

/* =========================================================
   BADGES
   ========================================================= */

.badge{
  padding:3px 8px;
  border-radius:999px;
  font-size:12px;
}

.badge.ok{
  background:rgba(44,104,62,.25);
  color:#9fe0b9;
}

.badge.warn{
  background:rgba(246,218,89,.3);
  color:#e6c84d;
}

.badge.danger{
  background:rgba(178,58,58,.35);
  color:#ffb3b3;
}

.badge.muted{
  background:rgba(255,255,255,.08);
  color:var(--muted);
}

/* =========================================================
   FORMS
   ========================================================= */

input,select{
  background:#0b1428;
  color:var(--text);
  border:1px solid var(--border);
  border-radius:8px;
  padding:8px;
}

input:focus,select:focus{
  outline:none;
  border-color:var(--primary);
}

.gridform{
  display:grid;
  grid-template-columns:160px 1fr;
  gap:10px;
}

/* =========================================================
   TEXT
   ========================================================= */

.muted{ color:var(--muted); }
.small{ font-size:12px; }

/* =========================================================
   LINKS
   ========================================================= */

nav a{
  margin-left:14px;
}

/* =========================================================
   SCROLLBAR (optional nice touch)
   ========================================================= */

::-webkit-scrollbar{ width:8px; }
::-webkit-scrollbar-thumb{
  background:var(--primary);
  border-radius:8px;
}

/* ===== Fix leggibilità topbar ===== */
.topbar, .topbar a { color: #ffffff !important; }

.topbar nav a{
  display:inline-block;
  padding:6px 10px;
  border-radius:999px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  font-weight:600;
}

.topbar nav a:hover{
  background: rgba(255,255,255,0.22);
}

/* Brand a sinistra più evidente */
.brand{
  color:#ffffff !important;
}

/* Se hai bottoni nella topbar */
.topbar .btn.ghost{
  border-color: rgba(255,255,255,0.35) !important;
  color:#ffffff !important;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stack label {
  font-weight: 500;
}

.stack input,
.stack select {
  width: 100%;
}

/* ✅ FORCE: la form "stack" deve essere sempre verticale */
form.stack{
  display:flex !important;
  flex-direction:column !important;
  gap:10px !important;
}

form.stack label{
  display:block;
  font-weight:500;
}

form.stack input,
form.stack select,
form.stack button{
  width:100%;
}

.date-red { color: #ff6b6b; font-weight: 700; }
.date-yellow { color: #ffd166; font-weight: 700; }

/* =========================================================
   Dual-tone table rows (entrambe colorate, soft)
   ========================================================= */
table tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.035);
}

table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

table tbody tr:hover {
  background: rgba(255, 255, 255, 0.07);
}

/* micro separazione tra righe */
table tbody tr td {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 120ms ease;
}

table {
  border-radius: 10px;
  overflow: hidden;
}
