@import url("https://fonts.googleapis.com/css2?family=Fira+Code:wght@500;600;700&family=Fira+Sans:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #dbe3ee;
  --brand: #1e40af;
  --brand-dark: #1e3a8a;
  --brand-soft: #dbeafe;
  --cta: #f59e0b;
  --cta-dark: #d97706;
  --blue: #3b82f6;
  --blue-soft: #dbeafe;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.18), transparent 34rem),
    linear-gradient(180deg, #eef6ff 0%, #f8fafc 42%, #f5f7fb 100%);
  font-family: "Fira Sans", "Segoe UI", Arial, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: min(1240px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0 40px;
}

.start-screen,
.test-screen,
.result-screen {
  width: 100%;
}

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--brand-dark);
  font-weight: 800;
}

.brand-mark::before {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--blue));
  content: "HR";
}

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

.start-screen {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 24px;
  align-items: stretch;
}

.hero-panel,
.insight-panel,
.progress-panel,
.question-panel,
.result-card,
.stat-card,
.admin-table-wrap {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.hero-panel {
  min-height: 650px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 6vw, 72px);
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(38px, 5vw, 66px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(25px, 3vw, 34px);
  line-height: 1.16;
}

h3 {
  margin: 0;
}

.lead {
  max-width: 720px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.trust-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 30px;
}

.trust-card {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-soft);
}

.trust-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.trust-card strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

.identity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 30px;
}

.field-label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input {
  min-height: 50px;
  padding: 0 14px;
}

textarea {
  min-height: 118px;
  resize: vertical;
  padding: 13px 14px;
  line-height: 1.5;
}

input:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.16);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.option input:focus-visible + span {
  outline: 3px solid rgba(245, 158, 11, 0.8);
  outline-offset: 3px;
}

.start-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 28px;
}

.primary-btn,
.secondary-btn,
.primary-link,
.secondary-link {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.primary-btn,
.primary-link {
  color: #fff;
  background: var(--cta);
}

.primary-btn:hover,
.primary-link:hover {
  background: var(--cta-dark);
}

.secondary-btn,
.secondary-link {
  color: var(--brand-dark);
  background: var(--brand-soft);
}

.primary-btn:disabled {
  cursor: wait;
  opacity: 0.72;
}

.insight-panel {
  position: relative;
  min-height: 650px;
  overflow: hidden;
  padding: 24px;
  background:
    linear-gradient(160deg, rgba(30, 64, 175, 0.96), rgba(15, 23, 42, 0.96)),
    #0f172a;
}

.insight-panel::before {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 36px 36px;
  content: "";
}

.dashboard-preview {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 16px;
  height: 100%;
  align-content: center;
}

.preview-header,
.risk-card,
.chart-card,
.mini-row {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(16px);
}

.preview-header {
  padding: 18px;
  color: #fff;
}

.preview-header span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
  font-weight: 700;
}

.preview-header strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

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

.risk-card {
  min-height: 118px;
  padding: 16px;
  color: #fff;
}

.risk-card span {
  display: block;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.risk-card strong {
  display: block;
  margin-top: 12px;
  font-family: "Fira Code", Consolas, monospace;
  font-size: 30px;
}

.risk-card small {
  display: block;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.72);
}

.chart-card {
  padding: 18px;
}

.chart-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #fff;
  font-weight: 800;
}

.chart-bars {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.chart-line {
  display: grid;
  grid-template-columns: 88px 1fr 36px;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
}

.chart-line b,
.mini-row strong,
.stat-card strong {
  font-family: "Fira Code", Consolas, monospace;
}

.bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cta), #fde68a);
}

.mini-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 16px;
  color: rgba(255, 255, 255, 0.78);
}

.mini-row strong {
  color: #fff;
}

.test-screen {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.progress-panel,
.question-panel,
.result-card {
  padding: 24px;
}

.progress-panel {
  position: sticky;
  top: 24px;
}

.progress-track {
  height: 10px;
  margin-top: 28px;
  overflow: hidden;
  background: #e2e8f0;
  border-radius: 999px;
}

#progressBar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--cta));
  transition: width 0.22s ease;
}

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

.step-list {
  display: grid;
  gap: 10px;
  margin-top: 26px;
}

.step-chip {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 13px;
  font-weight: 800;
}

.step-chip.is-active {
  color: var(--brand-dark);
  border-color: rgba(59, 130, 246, 0.3);
  background: var(--brand-soft);
}

.question-panel {
  min-height: 650px;
}

.question-group {
  display: grid;
  gap: 16px;
}

.question {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--surface-soft);
}

.question h3 {
  margin-bottom: 14px;
  font-size: 17px;
  line-height: 1.38;
}

.options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: 10px;
}

.option {
  position: relative;
  min-width: 0;
}

.option input {
  position: absolute;
  opacity: 0;
}

.option span {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.option input:checked + span {
  color: var(--brand-dark);
  border-color: rgba(59, 130, 246, 0.45);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.28);
}

.form-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.result-screen {
  min-height: calc(100vh - 48px);
  display: grid;
  place-items: center;
}

.result-card {
  width: min(780px, 100%);
}

#resultTitle {
  font-size: clamp(36px, 5vw, 56px);
}

.path-list {
  display: grid;
  gap: 10px;
  margin: 26px 0;
}

.path-item {
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--muted);
  background: var(--blue-soft);
}

.admin-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

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

.admin-header h1 {
  font-size: clamp(34px, 5vw, 56px);
}

.admin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  padding: 18px;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 36px;
}

.admin-table-wrap {
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.92);
}

.login-panel {
  min-height: 520px;
  display: grid;
  place-items: center;
}

.login-card {
  width: min(460px, 100%);
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.login-card .primary-btn {
  width: 100%;
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-weight: 700;
}

.admin-table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 15px;
  text-align: left;
  vertical-align: top;
}

.admin-table tbody tr {
  transition: background 0.18s ease;
}

.admin-table tbody tr:hover {
  background: #eff6ff;
}

.admin-table th {
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  text-transform: uppercase;
}

.result-pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 800;
}

.result-pill.qisqa {
  color: #991b1b;
  background: var(--red-soft);
}

.result-pill.orta {
  color: #92400e;
  background: var(--amber-soft);
}

.result-pill.uzoq {
  color: #166534;
  background: var(--green-soft);
}

.start-left {
  min-height: 660px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  padding: clamp(28px, 5vw, 64px);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--brand-dark);
  background: #eff6ff;
  font-size: 13px;
  font-weight: 800;
}

.hero-kicker span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.16);
}

.process-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 30px;
}

.process-strip div,
.start-card,
.screen-preview,
.risk-summary,
.factor-card,
.preview-footer {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.process-strip div {
  padding: 16px;
  background: var(--surface-soft);
}

.process-strip span {
  display: inline-flex;
  margin-bottom: 12px;
  color: var(--cta-dark);
  font-family: "Fira Code", Consolas, monospace;
  font-weight: 700;
}

.process-strip strong {
  display: block;
  font-size: 16px;
}

.process-strip p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.start-card {
  display: grid;
  gap: 18px;
  margin-top: 22px;
  padding: 20px;
}

.start-card h2 {
  font-size: 24px;
}

.form-note {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.start-right {
  min-height: 660px;
  display: grid;
  align-items: center;
  border-radius: 8px;
  padding: clamp(18px, 3vw, 34px);
  background:
    linear-gradient(160deg, rgba(30, 64, 175, 0.96), rgba(15, 23, 42, 0.96)),
    #0f172a;
  box-shadow: var(--shadow);
}

.screen-preview {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: rgba(248, 250, 252, 0.96);
}

.preview-top,
.preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.preview-top span,
.preview-footer span,
.risk-summary span,
.cluster-item small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.preview-top strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

.preview-top b {
  border-radius: 999px;
  padding: 7px 10px;
  color: #166534;
  background: var(--green-soft);
  font-size: 12px;
}

.risk-summary {
  display: grid;
  gap: 12px;
  padding: 18px;
  background: #fff7ed;
}

.risk-summary strong {
  display: block;
  margin-top: 4px;
  color: #9a3412;
  font-size: 28px;
}

.risk-summary p {
  margin: 0;
  color: #7c2d12;
  line-height: 1.45;
}

.risk-meter {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #fed7aa;
}

.risk-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cta), var(--red));
}

.cluster-list {
  display: grid;
  gap: 10px;
}

.cluster-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fff;
}

.cluster-item > span {
  width: 10px;
  height: 42px;
  border-radius: 999px;
}

.cluster-item.danger > span {
  background: var(--red);
}

.cluster-item.warning > span {
  background: var(--cta);
}

.cluster-item.stable > span {
  background: var(--green);
}

.cluster-item strong {
  display: block;
}

.cluster-item b {
  font-family: "Fira Code", Consolas, monospace;
  font-size: 13px;
}

.factor-card {
  padding: 16px;
}

.preview-footer {
  padding: 14px 16px;
  background: var(--surface-soft);
}

.preview-footer strong {
  font-family: "Fira Code", Consolas, monospace;
  color: var(--brand-dark);
}

@media (max-width: 900px) {
  .app-shell,
  .admin-shell {
    width: min(100% - 20px, 1240px);
    padding-top: 10px;
  }

  .topbar,
  .admin-header {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .admin-actions {
    width: 100%;
  }

  .start-screen,
  .test-screen {
    grid-template-columns: 1fr;
  }

  .hero-panel,
  .insight-panel,
  .start-left,
  .start-right {
    min-height: auto;
  }

  .progress-panel {
    position: static;
  }

  .trust-row,
  .process-strip,
  .identity-grid,
  .risk-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .start-actions,
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .primary-btn,
  .secondary-btn,
  .primary-link,
  .secondary-link {
    width: 100%;
  }

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
