:root {
  --bg: #070b16;
  --surface: #10192b;
  --surface-strong: #0b1220;
  --surface-soft: #15233a;
  --ink: #edf6ff;
  --muted: #93a8c6;
  --line: #223b61;
  --blue: #2f8cff;
  --blue-dark: #0b4db7;
  --blue-soft: #102f5d;
  --cyan: #23d1ff;
  --green: #40d29b;
  --amber: #ffbd4a;
  --red: #ff6b7a;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 28% 8%, rgba(35, 209, 255, 0.24), transparent 32%),
    radial-gradient(circle at 78% 0%, rgba(47, 140, 255, 0.22), transparent 30%),
    linear-gradient(135deg, #070b16 0%, #0d1930 48%, #07101f 100%),
    var(--bg);
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  background: linear-gradient(180deg, #08111f 0%, #0b1730 48%, #050915 100%);
  color: #fff;
  padding: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(47, 140, 255, 0.24);
  box-shadow: 12px 0 36px rgba(0, 0, 0, 0.28);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(47, 140, 255, 0.24);
}

.mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #23d1ff 0%, #2f8cff 54%, #153cff 100%);
  border-radius: 8px;
  font-weight: 800;
  font-size: 22px;
  box-shadow: 0 0 24px rgba(47, 140, 255, 0.42);
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 17px; line-height: 1.2; }
.brand p, .topbar p, .form-head p, .import-box p { color: var(--muted); margin-top: 5px; }
.brand p { color: #8fa7c8; font-size: 12px; }

nav { display: grid; gap: 8px; margin-top: 22px; }

button, .nav {
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #2f8cff, #1359d8);
  color: white;
  min-height: 40px;
  padding: 0 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.button-link {
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #2f8cff, #1359d8);
  color: white;
  min-height: 44px;
  padding: 0 16px;
  font-weight: 700;
  text-decoration: none;
  display: grid;
  place-items: center;
}

.secondary-link {
  background: #142847;
  color: #c9e6ff;
  border: 1px solid #244a79;
}

button:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(47, 140, 255, 0.30); }
button:active { transform: translateY(0); }
button.danger {
  background: #35101a;
  color: #ffd6dc;
  border: 1px solid rgba(255, 107, 122, 0.55);
}

.nav {
  background: transparent;
  color: #98abd0;
  text-align: left;
}

.nav:hover, .nav.active {
  background: linear-gradient(90deg, rgba(47, 140, 255, 0.22), rgba(35, 209, 255, 0.08));
  color: #fff;
  box-shadow: inset 3px 0 0 var(--cyan);
}
.secondary {
  background: #142847;
  color: #c9e6ff;
  border: 1px solid #244a79;
}

.tiny {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

main { min-width: 0; padding: 24px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.acting-user {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.acting-user select {
  width: 220px;
}

.view {
  display: none;
  opacity: 0;
  transform: translateY(8px);
}
.view.active {
  display: block;
  animation: viewIn 220ms ease forwards;
}

@keyframes viewIn {
  to { opacity: 1; transform: translateY(0); }
}

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

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

.landing-actions button {
  min-height: 48px;
  font-size: 14px;
}

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

.report-board {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  background:
    linear-gradient(155deg, rgba(47, 140, 255, 0.24), transparent 48%),
    linear-gradient(180deg, rgba(16, 25, 43, 0.98), rgba(8, 15, 29, 0.98));
  border: 1px solid rgba(47, 140, 255, 0.34);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.report-board h3 {
  margin-top: 8px;
  font-size: 20px;
}

.report-board p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.45;
}

.eyebrow {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.report-panel {
  overflow: hidden;
}

.report-toolbar {
  align-items: flex-start;
  gap: 14px;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}

.kpi, .panel {
  background: linear-gradient(180deg, rgba(16, 25, 43, 0.96), rgba(11, 18, 32, 0.96));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.kpi { padding: 18px; position: relative; overflow: hidden; }
.kpi::before {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 3px solid rgba(35, 209, 255, 0.75);
  opacity: 0.9;
  pointer-events: none;
}
.kpi.clickable { cursor: pointer; }
.kpi.clickable:hover, .kpi.clickable.active { border-color: var(--cyan); box-shadow: 0 20px 46px rgba(35, 209, 255, 0.18); transform: translateY(-2px); }
.kpi { transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease; }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi strong { display: block; font-size: 30px; margin-top: 8px; color: #ffffff; text-shadow: 0 0 18px rgba(47, 140, 255, 0.28); }
.kpi.warning strong { color: var(--amber); }

.daily-milestones {
  margin-bottom: 16px;
}

.milestone-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 10px;
}

.milestone-card {
  padding: 12px;
  background: rgba(35, 209, 255, 0.08);
  border: 1px solid rgba(47, 140, 255, 0.22);
  border-radius: 8px;
  min-height: 72px;
  text-align: left;
  box-shadow: none;
}

.milestone-card:hover, .milestone-card.active {
  border-color: var(--cyan);
  box-shadow: 0 16px 34px rgba(35, 209, 255, 0.16);
}

.milestone-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.milestone-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dashboard-lower { margin-top: 16px; }
.hidden { display: none; }
.kpi-detail-panel { margin-bottom: 16px; }

.panel { padding: 18px; }
.panel h3 { font-size: 17px; margin-bottom: 14px; }

.bars, .funnel, .results { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 220px) 1fr 50px; gap: 10px; align-items: center; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #dbeafe; }
.bar-track { height: 10px; background: #0c1728; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--cyan)); }
.bar-count { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }

.form { max-width: 1180px; }
.form-head { margin-bottom: 14px; }

.file-drop {
  border: 1px dashed #9aa7bb;
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 16px;
  display: grid;
  gap: 3px;
  margin-bottom: 16px;
}

.file-drop input { margin-bottom: 6px; }
.file-drop span { color: var(--muted); font-size: 13px; }

.fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  gap: 12px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.export-panel {
  margin: 14px 0;
  padding: 16px;
  background: rgba(35, 209, 255, 0.06);
  border: 1px solid rgba(47, 140, 255, 0.24);
  border-radius: 8px;
}

.export-panel h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.dump-filters {
  grid-template-columns: minmax(180px, 1.3fr) minmax(170px, 1fr) repeat(2, minmax(150px, 0.8fr)) auto;
  align-items: end;
  margin: 14px 0 0;
}

label { display: grid; gap: 6px; color: #c9d8ee; font-weight: 650; font-size: 13px; }

input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 40px;
  padding: 8px 10px;
  font: inherit;
  background: #091321;
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

option {
  background: #0b1220;
  color: var(--ink);
}

textarea {
  background: #091321;
  color: var(--ink);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(35, 209, 255, 0.15);
}
input::placeholder, textarea::placeholder { color: #5f7698; }

.actions, .toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}
.compact-actions { margin-top: 0; margin-bottom: 14px; }

.toolbar { margin-top: 0; margin-bottom: 14px; justify-content: space-between; }
.toolbar.compact { margin-bottom: 12px; }
.toolbar.compact h3 { margin-bottom: 0; }
.toolbar input { flex: 1; }
.toolbar select { width: 150px; }

.inline-field {
  min-height: 34px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
}

.inline-save-state {
  display: block;
  min-height: 16px;
  margin-top: 4px;
  font-size: 11px;
}

.period-toggle {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pipeline-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pipeline-controls select {
  width: 150px;
  min-height: 32px;
}

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #08111f; }
.requisition-scroll { max-height: 580px; }
table { width: 100%; border-collapse: collapse; min-width: 900px; background: #0b1220; }
.requisition-scroll table { min-width: 1120px; }
.performance-table { min-width: 1080px; }
.daily-pipeline-table { min-width: 980px; }
.wide-report-table { min-width: 1500px; }
.detail-table { min-width: 1080px; }
.compact-table table { min-width: 520px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 13px; vertical-align: top; }
th { background: #101d33; color: #9ecbff; position: sticky; top: 0; }
tbody tr { transition: background 140ms ease; }
tbody tr:hover { background: #10223c; }
tr:last-child td { border-bottom: 0; }
.tag { display: inline-block; border-radius: 999px; padding: 3px 8px; background: #11345f; color: #9fd3ff; font-weight: 700; font-size: 12px; }
.tag.priority { background: #3b2a0e; color: #ffd072; }
.tag.closed { background: #103226; color: var(--green); }
.dupe { color: var(--red); font-weight: 800; }
.muted { color: var(--muted); font-size: 13px; }
.status-select {
  min-height: 32px;
  min-width: 105px;
  padding: 4px 8px;
}

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

.inline-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d1728;
}

.jd-box {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d1728;
}

.jd-box textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font: inherit;
}

.inline-form button {
  min-width: 150px;
}

.stack-form {
  display: grid;
  gap: 12px;
}

.locked {
  opacity: 0.58;
  pointer-events: none;
}

.pipeline-board {
  display: grid;
  gap: 10px;
  max-height: 390px;
  overflow: auto;
}

.pipeline-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d1728;
  padding: 12px;
}

.pipeline-card-head,
.mini-periods,
.stage-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pipeline-card-head {
  justify-content: space-between;
  margin-bottom: 8px;
}

.pipeline-card-head span,
.mini-periods span,
.stage-chips span {
  font-size: 12px;
  color: var(--muted);
}

.stage-chips {
  margin-top: 8px;
}

.stage-chips span {
  background: #12365f;
  color: #a7d8ff;
  border-radius: 999px;
  padding: 4px 8px;
}

.stage-chips strong {
  color: #ffffff;
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #0d1728;
}
.result-card h4 { margin: 0 0 4px; }
.result-card p { color: var(--muted); font-size: 13px; margin-top: 5px; }

.integration-card {
  min-height: 230px;
}

.integration-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.integration-head h3 {
  margin-bottom: 0;
}

.integration-steps {
  display: grid;
  gap: 10px;
}

.integration-steps div {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d1728;
}

.integration-steps span {
  color: var(--muted);
}

pre {
  background: #050914;
  color: #d8e3f8;
  border-radius: 8px;
  padding: 12px;
  overflow: auto;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 7, 18, 0.76);
}

.modal.hidden { display: none; }

.modal-card {
  width: min(1120px, 100%);
  max-height: min(86vh, 920px);
  overflow: auto;
  display: grid;
  gap: 14px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(16, 25, 43, 0.98), rgba(8, 15, 29, 0.98));
  border: 1px solid rgba(47, 140, 255, 0.4);
  border-radius: 8px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.48);
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, rgba(35, 209, 255, 0.26), transparent 34%),
    radial-gradient(circle at 82% 12%, rgba(47, 140, 255, 0.24), transparent 32%),
    linear-gradient(135deg, #050914, #0d1930 52%, #07101f);
}

.auth-pending .login-screen { display: grid; }
.auth-pending .sidebar,
.auth-pending main {
  filter: blur(5px);
  pointer-events: none;
  user-select: none;
}

.login-card {
  width: min(440px, 100%);
  background: rgba(11, 18, 32, 0.94);
  border: 1px solid rgba(35, 209, 255, 0.26);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  padding: 26px;
}

.login-brand,
.user-badge,
.dev-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.login-card h2 {
  margin-top: 24px;
  font-size: 28px;
}

.login-copy {
  color: var(--muted);
  margin: 10px 0 18px;
}

.dev-login {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 14px;
}

.access-code-form {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.dev-buttons { flex-wrap: wrap; }

.user-badge {
  justify-content: flex-end;
  min-width: 180px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 17, 31, 0.78);
}

.user-badge strong,
.user-badge span {
  display: block;
}

.user-badge {
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.user-badge span {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 750;
}

@media (max-width: 980px) {
  body { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis, .grid.two, .fields, .filter-grid, .dump-filters, .landing-actions, .report-board-grid, .milestone-grid { grid-template-columns: 1fr; }
  .topbar, .top-actions, .report-toolbar, .report-actions { align-items: stretch; flex-direction: column; }
  .acting-user select { width: 100%; }
  .inline-form { grid-template-columns: 1fr; }
}
