:root {
  --navy: #1B2A4A;
  --navy-light: #283593;
  --slate: #37474F;
  --bg: #F3F6FA;
  --card: #FFFFFF;
  --border: #D5DCE6;
  --text: #1E293B;
  --muted: #64748B;
  --green: #15803D;
  --green-bg: #DCFCE7;
  --red: #B91C1C;
  --red-bg: #FEE2E2;
  --amber: #B45309;
  --amber-bg: #FEF3C7;
  --blue: #1D4ED8;
  --blue-bg: #DBEAFE;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1B2A4A 0%, #283593 100%);
  padding: 16px;
}
.login-card {
  background: #fff;
  border-radius: 14px;
  padding: 32px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.login-card h1 { margin: 0 0 8px; font-size: 22px; color: var(--navy); }
.login-card p { margin: 0 0 20px; color: var(--muted); font-size: 13px; }

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--navy);
  color: #fff;
  padding: 10px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
}
.sandbox-pill {
  background: #F59E0B;
  color: #111827;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}
.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Tabs */
.nav-tabs {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 14px;
  display: flex;
  overflow-x: auto;
  gap: 4px;
}
.tab-btn {
  border: none;
  background: transparent;
  padding: 12px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--slate);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tab-btn:hover { background: #F8FAFC; color: var(--navy); }
.tab-btn.active {
  color: var(--navy-light);
  border-bottom-color: var(--navy-light);
  background: #EEF2FF;
}
.badge {
  background: #DC2626;
  color: #fff;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
}
.badge-amber { background: #D97706; }

/* Buttons & Inputs */
.btn {
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: filter 0.12s;
}
.btn:hover { filter: brightness(0.95); }
.btn-primary { background: var(--navy-light); color: #fff; }
.btn-success { background: #15803D; color: #fff; }
.btn-danger  { background: #DC2626; color: #fff; }
.btn-warning { background: #F59E0B; color: #111827; }
.btn-light   { background: #fff; color: var(--text); border-color: var(--border); }
.btn-topbar  { background: rgba(255,255,255,0.14); color: #fff; border-color: rgba(255,255,255,0.25); }
.btn-sm { padding: 4px 8px; font-size: 12px; border-radius: 5px; }

input[type="text"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13.5px;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid #6366F1;
  border-color: transparent;
}

/* Containers & Cards */
.container { padding: 16px; max-width: 100%; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card-title {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi-box {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--navy-light);
  border-radius: 8px;
  padding: 12px 14px;
}
.kpi-box .lbl { font-size: 11.5px; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.kpi-box .val { font-size: 18px; font-weight: 800; color: var(--navy); margin-top: 4px; }

/* Toast / Banner */
.toast-banner {
  background: #EEF2FF;
  border: 1px solid #6366F1;
  color: #1E1B4B;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Monthly Planning Grid */
.table-scroll {
  overflow: auto;
  max-height: 73vh;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}
table.plan-grid {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  font-size: 11.5px;
}
table.plan-grid th, table.plan-grid td {
  border-right: 1px solid #E2E8F0;
  border-bottom: 1px solid #E2E8F0;
  padding: 4px 5px;
  text-align: center;
  white-space: nowrap;
}
table.plan-grid thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--navy);
  color: #fff;
  font-weight: 700;
}
table.plan-grid thead th.we-hdr { background: #37474F; color: #FDE68A; }
table.plan-grid thead th.ferie-hdr { background: #7C2D12; color: #FED7AA; }
table.plan-grid .sticky-col-1 {
  position: sticky;
  left: 0;
  z-index: 15;
  background: #F8FAFC;
  font-weight: 700;
  min-width: 64px;
}
table.plan-grid .sticky-col-2 {
  position: sticky;
  left: 64px;
  z-index: 15;
  background: #F8FAFC;
  text-align: left;
  min-width: 145px;
}
table.plan-grid thead .sticky-col-1,
table.plan-grid thead .sticky-col-2 { z-index: 30; background: var(--navy); }

td.pcell {
  cursor: pointer;
  min-width: 78px;
  max-width: 112px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  transition: transform 0.06s;
}
td.pcell:hover {
  outline: 2px solid #2563EB;
  z-index: 5;
}

/* Official Cell Colors (matching Excel workbook) */
.c-M   { background: #E3F2FD; color: #0D47A1; }
.c-S   { background: #E8F5E9; color: #1B5E20; }
.c-13H { background: #F3E5F5; color: #4A148C; }
.c-C   { background: #FFF3E0; color: #E65100; }
.c-MN, .c-N { background: #C5CAE9; color: #1A237E; font-weight: 700; }
.c-DN  { background: #E2E8F0; color: #475569; }
.c-RH  { background: #F8FAFC; color: #64748B; }
.c-RH_DISPO { background: #D1F2EB; color: #0E6251; font-weight: 800; }
.c-CA  { background: #FEF08A; color: #854D0E; font-weight: 700; }
.c-AM, .c-AT, .c-AI { background: #FECACA; color: #991B1B; font-weight: 800; }
.c-FORM, .c-ART12 { background: #CFFAFE; color: #155E75; font-weight: 700; }
.c-A_ETABLIR { background: #F1F5F9; color: #94A3B8; font-style: italic; }
.c-RENF { border-bottom: 2px dashed #0284C7 !important; }

/* Standard tables */
table.std-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.std-table th, table.std-table td {
  border-bottom: 1px solid #E2E8F0;
  padding: 8px 10px;
  text-align: left;
}
table.std-table th {
  background: #F1F5F9;
  color: var(--navy);
  font-weight: 700;
}
table.std-table tr:hover td { background: #F8FAFC; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff;
  border-radius: 12px;
  max-width: 660px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}
.modal h3 { margin: 0 0 12px; color: var(--navy); font-size: 17px; }
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 13px; color: var(--slate); }
.form-row input, .form-row select, .form-row textarea { width: 100%; }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}
.pill-ok { background: var(--green-bg); color: var(--green); }
.pill-ko { background: var(--red-bg); color: var(--red); }
.pill-wait { background: var(--amber-bg); color: var(--amber); }
.pill-prot { background: #EDE9FE; color: #5B21B6; }

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 8px;
  background: #F8FAFC;
}
.check-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  cursor: pointer;
}
