*,
*::before,
*::after { box-sizing: border-box; }

:root { font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial; }
body { margin: 0; background: #0b1220; color: #e7eefc; }

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

h1 { font-size: 20px; margin: 0 0 12px; line-height: 1.25; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 13px; margin: 14px 0 8px; color: #cfe0ff; }
h4 { font-size: 14px; margin: 10px 0 6px; }

.card {
  background: #111b33;
  border: 1px solid #223055;
  border-radius: 14px;
  padding: 14px;
  margin: 12px 0;
  overflow: hidden;
}

.small { font-size: 11px; color: #b7c7ea; }

/* ===== LAYOUT: Desktop 2 columns ===== */
.layout {
  display: grid;
  grid-template-columns: minmax(360px, 560px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.left, .right { min-width: 0; }

/* ===== Mobile: 1 column ===== */
@media (max-width: 900px) {
  .wrap { padding: 12px; }
  h1 { font-size: 18px; }
  .layout { grid-template-columns: 1fr; }
}

/* ===== Forms ===== */
.grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
}
.field { min-width: 0; }

.labelRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #cfe0ff;
  margin-bottom: 6px;
}

input, select, button { min-width: 0; }

input, select {
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #2b3b66;
  background: #0b1220;
  color: #e7eefc;
  font-size: 14px;
}

button {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #2b3b66;
  background: #16264a;
  color: #e7eefc;
  cursor: pointer;
  white-space: nowrap;
  font-size: 14px;
}
button:hover { background: #1b2e5a; }

.secondaryBtn { background: #0b1220; }
.secondaryBtn:hover { background: #121b2e; }

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

#status { font-size: 12px; color: #b7c7ea; }

/* details/summary */
details { margin-top: 10px; }
summary {
  cursor: pointer;
  color: #cfe0ff;
  display: flex;
  align-items: center;
  gap: 10px;
}
details summary::-webkit-details-marker { display: none; }

.hWithInfo { display: flex; align-items: center; gap: 8px; }

/* info icon */
.infoIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid #2b3b66;
  background: #0b1220;
  color: #cfe0ff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}

/* tooltip */
.tooltip {
  position: fixed;
  max-width: 360px;
  background: #0b1220;
  border: 1px solid #2b3b66;
  border-radius: 12px;
  padding: 10px 12px;
  color: #e7eefc;
  font-size: 13px;
  z-index: 9999;
  box-shadow: 0 8px 22px rgba(0,0,0,0.35);
}
.tooltip .tTitle { font-weight: 700; color: #cfe0ff; margin-bottom: 6px; }

/* modal */
.modalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}
.modalBox {
  width: min(900px, 96vw);
  max-height: min(82vh, 900px);
  overflow: auto;
  background: #0b1220;
  border: 1px solid #2b3b66;
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.5);
  padding: 14px;
}
.modalHeader {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.modalHeader h3 { margin: 0; }
.modalClose {
  background: transparent;
  border: 1px solid #2b3b66;
  padding: 8px 10px;
  border-radius: 10px;
}
.modalClose:hover { background: #121b2e; }

/* tables */
.tableWrap {
  overflow-x: auto;
  border-radius: 12px;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  min-width: 720px; /* ensures horizontal scroll on narrow screens */
}
th, td {
  border-bottom: 1px solid #223055;
  padding: 8px;
  text-align: left;
  font-size: 12px;
  vertical-align: top;
}
th { color: #cfe0ff; }
.resTable th, .resTable td { font-size: 11.5px; }

hr { border: none; border-top: 1px solid #223055; margin: 14px 0; }

.block { margin: 10px 0; }
.principles { margin: 6px 0 8px; }

.totals {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #cfe0ff;
  margin: 6px 0 10px;
}

/* colored % */
.pct { font-weight: 800; }
.pct.good { color: #3ddc84; }
.pct.mid  { color: #ffd166; }
.pct.bad  { color: #ff5c7a; }

/* ===== Employee groups ===== */
.groupList { display: grid; gap: 10px; margin-top: 10px; }

/* Desktop: 4 columns (name, count, net, delete) */
.groupRow{
  display: grid;
  grid-template-columns: 1fr 110px 140px 90px;
  gap: 10px;
  align-items: center;
}
.groupRow input { width: 100%; }
.groupRow .del { width: auto; }

/* Mobile: stacked layout (name, count+net, delete full width) */
@media (max-width: 900px) {
  .grid2 { grid-template-columns: 1fr; } /* form fields become 1 column */
  .labelRow { font-size: 13px; }
  input, select, button { font-size: 15px; }

  .groupRow{
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "name name"
      "count net"
      "del del";
  }
  .groupRow .gname { grid-area: name; }
  .groupRow .cnt { grid-area: count; }
  .groupRow .net { grid-area: net; }
  .groupRow .del { grid-area: del; width: 100%; }

  button, .secondaryBtn { width: 100%; }
}

