* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Roboto Flex", sans-serif;
  background: radial-gradient(1200px 520px at 80% -12%, #1f3b4d 0%, transparent 52%),
    radial-gradient(980px 480px at -10% 12%, #1a3345 0%, transparent 46%),
    linear-gradient(180deg, #122431 0%, #0e1d28 100%);
  color: var(--text-inverse);
  position: relative;
  overflow-x: hidden;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(42px);
  opacity: 0.45;
  z-index: 0;
}

.bg-shape-a {
  width: 280px;
  height: 280px;
  background: rgba(160, 142, 96, 0.3);
  top: -90px;
  right: -60px;
}

.bg-shape-b {
  width: 320px;
  height: 320px;
  background: rgba(156, 156, 156, 0.28);
  bottom: -120px;
  left: -80px;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 16px 40px;
}

.shell-header {
  margin-bottom: 18px;
  animation: fade-in 350ms ease;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.brand-logo {
  width: 190px;
  height: auto;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25));
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
  color: var(--brand-gold);
  font-family: "Montserrat", sans-serif;
  font-weight: 600;
}

h1 {
  margin: 8px 0 2px;
  font-size: clamp(1.7rem, 2.5vw, 2.6rem);
  font-family: "Montserrat", sans-serif;
  font-weight: 700;
  color: var(--text-inverse);
}

.subtitle {
  margin: 0;
  color: #c8cdd2;
}

.card {
  background: linear-gradient(180deg, var(--surface) 0%, #eeede8 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.auth {
  max-width: 520px;
}

.auth h2,
.dashboard h2 {
  font-family: "Montserrat", sans-serif;
  color: var(--text);
}

.auth p {
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

label {
  font-size: 0.88rem;
  color: var(--muted);
  font-family: "Montserrat", sans-serif;
  font-weight: 500;
}

input {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 11px 12px;
  font-family: inherit;
  background: #f1f0eb;
  color: var(--text);
}

select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 11px 12px;
  font-family: inherit;
  background: #f1f0eb;
  color: var(--text);
}

input:focus {
  outline: 2px solid rgba(160, 142, 96, 0.35);
  border-color: var(--brand-gold);
}

select:focus {
  outline: 2px solid rgba(160, 142, 96, 0.35);
  border-color: var(--brand-gold);
}

button {
  border: none;
  background: var(--primary);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 14px;
  font-weight: 700;
  font-family: "Montserrat", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  background: var(--primary-strong);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.button-secondary {
  background: var(--brand-charcoal);
  color: var(--text-inverse);
}

.button-secondary:hover {
  background: #1d1d20;
}

.row {
  display: flex;
  gap: 10px;
}

.dashboard {
  display: grid;
  gap: 14px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.filters,
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kpi {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface-strong);
}

.kpi p {
  margin: 0;
  color: var(--muted);
  font-family: "Montserrat", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.78rem;
}

.kpi h3 {
  margin: 6px 0 0;
  font-size: 1.4rem;
  color: var(--text);
}

.employee-view {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-strong);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.employee-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.employee-header h3 {
  margin: 0;
  color: #122431;
  font-family: "Montserrat", sans-serif;
}

.employee-select-field {
  display: grid;
  gap: 6px;
  min-width: 260px;
}

.employee-select-field span {
  color: #2a4256;
  font-family: "Montserrat", sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
}

.employee-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.employee-visuals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.employee-chart-wrap {
  height: clamp(260px, 34vh, 360px);
}

.chart-wrap {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: clamp(300px, 48vh, 520px);
}

.chart-wrap canvas {
  width: 100% !important;
  height: auto !important;
  flex: 1 1 auto;
  min-height: 0;
}

.table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 52vh;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  color: #1a2733;
}

.table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #ecebe6;
}

.search {
  margin-bottom: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

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

td {
  color: #132637;
  font-weight: 520;
}

tbody tr:nth-child(even) {
  background: rgba(18, 36, 49, 0.04);
}

tbody tr:hover {
  background: rgba(18, 36, 49, 0.1);
}

th {
  color: var(--text);
  font-family: "Montserrat", sans-serif;
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.status {
  min-height: 24px;
  margin-top: 14px;
  font-family: "Roboto Flex", sans-serif;
  font-weight: 500;
  color: #d7dbde;
}

.chart-toolbar {
  display: flex;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.chart-caption {
  margin: 0 2px;
  color: #2e4659;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: "Montserrat", sans-serif;
  flex: 0 0 auto;
}

.target-editor {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface-strong);
}

.target-editor h3 {
  margin: 0 0 10px;
  font-family: "Montserrat", sans-serif;
  color: #122431;
}

.target-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.target-field {
  display: grid;
  gap: 6px;
}

.target-field span {
  color: #22394d;
  font-family: "Montserrat", sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
}

.target-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 800px) {
  .brand-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .brand-logo {
    width: 160px;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .employee-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .employee-visuals {
    grid-template-columns: 1fr;
  }

  .employee-select-field {
    min-width: 100%;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .filters,
  .actions {
    width: 100%;
  }

  .actions button {
    flex: 1;
  }

  .chart-wrap {
    height: clamp(300px, 48vh, 440px);
  }

  .target-grid {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    max-height: 46vh;
  }
}

@media (max-width: 520px) {
  .employee-kpi-grid {
    grid-template-columns: 1fr;
  }

  .chart-wrap {
    height: clamp(280px, 46vh, 360px);
  }
}
