@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --md-bg: #f7f9fc;
  --md-surface: #ffffff;
  --md-soft: #f2f5f9;
  --md-text: #17233b;
  --md-muted: #69758a;
  --md-line: #e1e8f2;
  --md-primary: #1c2d52;
  --md-primary-2: #243a66;
  --md-success: #176b4d;
  --md-danger: #9f2f2f;
  --md-radius: 10px;
  --md-shadow: 0 8px 22px rgba(15, 23, 42, .055);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--md-bg);
  color: var(--md-text);
  font-size: 14px;
}

a { color: inherit; text-decoration: none; }

.md-container {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.md-page-main {
  flex: 1 0 auto;
}

.md-navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--md-bg);
  border-bottom: 3px solid var(--md-primary);
}

.md-nav-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.md-brand,
.md-nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.md-brand-logo {
  width: auto;
  height: 42px;
  display: block;
  object-fit: contain;
}

.md-brand-mark {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--md-primary);
  color: #fff;
  font-weight: 800;
}

.md-brand-text,
.md-nav-links a,
.md-nav-links button {
  color: var(--md-text);
  font-weight: 650;
  font-size: 14px;
}

.md-nav-links form { margin: 0; }

.macronav-btn,
.md-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid var(--md-primary);
  border-radius: 999px;
  background: var(--md-primary);
  color: #fff !important;
  font-weight: 750;
}

.md-btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid #cfd8e6;
  border-radius: 999px;
  background: #fff;
  color: var(--md-primary);
  font-weight: 750;
}

.md-btn:hover { opacity: .94; }

.md-card {
  background: var(--md-surface);
  border: 1px solid var(--md-line);
  border-radius: var(--md-radius);
  box-shadow: var(--md-shadow);
}

.md-pad { padding: 22px; }

.md-alert {
  width: min(900px, calc(100% - 32px));
  margin: 14px auto 0;
  padding: 12px 16px;
  border-radius: 10px;
  font-weight: 650;
}

.md-alert-success {
  background: #eaf7f1;
  color: var(--md-success);
  border: 1px solid #cbe9dd;
}

.md-alert-error {
  background: #fff0f0;
  color: var(--md-danger);
  border: 1px solid #ffd2d2;
}

.md-hero {
  background:
    linear-gradient(135deg, rgba(28, 45, 82, .94), rgba(36, 58, 102, .86)),
    linear-gradient(45deg, #243a66, #f7f9fc);
  color: #fff;
}

.md-hero-grid {
  min-height: 245px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 28px;
  align-items: center;
  padding: 34px 0 46px;
}

.md-kicker {
  display: inline-flex;
  align-items: center;
  margin-bottom: 8px;
  padding: 5px 9px;
  border-radius: 999px;
  color: #7fdbff;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.md-hero .md-kicker {
  background: rgba(255, 222, 128, .15);
  color: #ffe08a;
}

.md-hero h1,
.md-toolbar h1,
.md-thanks h1,
.auth-card h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 800;
  letter-spacing: 0;
}

.md-hero p {
  max-width: 680px;
  margin: 12px 0 0;
  color: rgba(255, 255, 255, .84);
  font-size: 16px;
  line-height: 1.6;
}

.md-hero-panel {
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 10px;
  background: rgba(255, 255, 255, .08);
}

.md-hero-panel strong,
.md-hero-panel span {
  display: block;
}

.md-hero-panel span {
  margin-top: 6px;
  color: rgba(255, 255, 255, .78);
}

.md-section,
.md-admin {
  padding: 20px 0 44px;
}

.md-form-card {
  max-width: 980px;
  margin: -34px auto 0;
  overflow: hidden;
  padding: 24px;
}

.md-cardhead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--md-line);
}

.md-cardhead-gap { margin-top: 28px; }

.md-cardhead h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}

.md-cardhead p {
  margin: 4px 0 0;
  color: var(--md-muted);
}

.md-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  padding-top: 18px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--md-text);
  font-size: 13px;
  font-weight: 750;
}

.form-control,
.form-select {
  min-height: 42px;
  border: 1px solid #cfd8e6;
  border-radius: 8px;
  box-shadow: none !important;
}

.form-control:focus,
.form-select:focus {
  border-color: #98a8c1;
  box-shadow: 0 0 0 3px rgba(28, 45, 82, .09) !important;
}

.md-question-list {
  display: block;
}

.md-question {
  padding: 0;
  border: 0;
  background: transparent;
}

.md-question-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.md-question-top strong { font-size: 15px; }
.md-question-top small { color: var(--md-muted); text-align: right; }
.md-question > span:nth-child(2) { color: #344054; line-height: 1.5; }

.md-step-progress {
  display: grid;
  gap: 10px;
  margin: -4px 0 20px;
  padding: 14px 16px;
  border: 1px solid var(--md-line);
  border-radius: 10px;
  background: #fbfcfe;
}

.md-step-progress > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.md-step-progress strong {
  color: var(--md-primary);
  font-size: 15px;
}

.md-step-progress span {
  color: var(--md-muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.md-step-progress progress {
  width: 100%;
  height: 9px;
  accent-color: var(--md-primary);
}

.md-form-step {
  display: none;
}

.md-form-step.is-active {
  display: block;
  animation: mdStepIn .16s ease-out;
}

.md-form-step.md-question.is-active {
  min-height: 330px;
  padding: 22px;
  border: 1px solid var(--md-line);
  border-radius: 10px;
  background: #fbfcfe;
}

.md-form-step.md-question textarea {
  margin-top: 14px;
  min-height: 150px;
  resize: vertical;
}

.md-form-step.md-question > span:nth-child(2) {
  display: block;
  margin-top: 16px;
  font-size: 17px;
}

@keyframes mdStepIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.md-submitbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--md-line);
}

.md-submitbar span {
  display: block;
  color: var(--md-muted);
}

.md-step-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.auth-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.auth-shell {
  width: min(100% - 32px, 410px);
  flex: 1 0 auto;
  display: grid;
  place-items: center;
  margin: 0 auto;
  padding: 54px 0 42px;
}

.auth-card {
  display: grid;
  gap: 14px;
  padding: 28px 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}

.auth-logo {
  width: 138px;
  height: auto;
  display: block;
  margin: 0 auto 14px;
}

.auth-card .md-brand-mark { margin-bottom: 8px; }
.auth-card p { margin: -6px 0 4px; color: var(--md-muted); }

.md-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.md-toolbar .md-kicker { color: var(--md-primary); }

.md-admin {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.md-admin > .md-toolbar {
  padding: 24px 0 4px;
}

.md-admin > .md-card {
  box-shadow: none;
}

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

.md-stat {
  padding: 18px 20px;
  border: 1px solid var(--md-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
}

.md-stat span {
  display: block;
  color: var(--md-muted);
  font-weight: 700;
}

.md-stat strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  line-height: 1;
}

.md-filterbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}

.md-filter-search {
  position: relative;
}

.md-filter-search i {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--md-muted);
}

.md-filter-search input {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px 9px 38px;
  border: 1px solid #cfd8e6;
  border-radius: 999px;
}

.md-aptitude-bars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  margin-bottom: 20px;
}

.md-aptitude-bars div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  align-items: center;
}

.md-aptitude-bars span {
  overflow: hidden;
  color: var(--md-text);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.md-aptitude-bars strong { color: var(--md-primary); }
.md-aptitude-bars progress {
  grid-column: 1 / -1;
  width: 100%;
  height: 9px;
  accent-color: var(--md-primary);
}

.md-table { margin: 0; }
.md-table thead th {
  color: #5e6b80;
  background: #ffffff;
  border-bottom: 1px solid var(--md-line);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.md-table td {
  border-color: var(--md-line);
  vertical-align: middle;
}

.md-table td small {
  display: block;
  color: var(--md-muted);
}

.md-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: rgba(28, 45, 82, .09);
  color: var(--md-primary);
  font-weight: 800;
}

.md-badge {
  display: inline-flex;
  padding: 6px 10px;
  border: 1px solid #cfd8e6;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--md-primary);
  font-weight: 750;
}

.md-profile-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.md-profile-aside {
  position: sticky;
  top: 86px;
  display: grid;
  gap: 18px;
}

.md-score-circle {
  width: 168px;
  height: 168px;
  display: grid;
  place-items: center;
  justify-self: center;
  border: 10px solid rgba(28, 45, 82, .12);
  border-radius: 50%;
}

.md-score-circle strong {
  font-size: 44px;
  line-height: 1;
}

.md-score-circle span {
  color: var(--md-muted);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.md-info-list {
  display: grid;
  gap: 9px;
}

.md-info-list p {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--md-line);
}

.md-info-list strong { color: var(--md-muted); }
.md-info-list span { text-align: right; font-weight: 700; }

.md-profile-main {
  display: grid;
  gap: 18px;
}

.md-answer-list {
  display: grid;
  gap: 12px;
}

.md-answer {
  padding: 16px;
  border: 1px solid var(--md-line);
  border-radius: 10px;
  background: #fbfcfe;
}

.md-answer div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.md-answer div span,
.md-answer small {
  color: var(--md-muted);
  font-weight: 700;
}

.md-answer p {
  margin: 10px 0;
  color: #344054;
}

.md-answer blockquote {
  margin: 0 0 10px;
  padding: 12px;
  border-left: 4px solid var(--md-primary);
  border-radius: 6px;
  background: #fff;
}

.md-status-form {
  display: grid;
  gap: 14px;
}

.md-empty,
.md-thanks {
  text-align: center;
}

.md-thanks {
  display: grid;
  min-height: calc(100vh - 64px);
  place-items: center;
}

.md-thanks .md-card {
  max-width: 560px;
  padding: 34px;
}

.md-thanks i {
  color: var(--md-success);
  font-size: 48px;
  margin-bottom: 12px;
}

.md-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--md-line);
  background: #ffffff;
}

.md-footer-row {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0;
}

.md-footer strong,
.md-footer span {
  display: block;
}

.md-footer strong {
  color: var(--md-text);
  font-size: 13px;
  font-weight: 800;
}

.md-footer span {
  color: var(--md-muted);
  font-size: 12px;
  line-height: 1.45;
}

.md-footer-links {
  display: flex;
  align-items: center;
  gap: 18px;
  text-align: right;
}

.md-footer-auth {
  width: 100%;
}

@media (max-width: 900px) {
  .md-hero-grid,
  .md-profile-grid {
    grid-template-columns: 1fr;
  }

  .md-profile-aside {
    position: static;
  }

  .md-form-grid,
  .md-aptitude-bars {
    grid-template-columns: 1fr;
  }

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

  .md-filterbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .md-container { width: calc(100% - 22px); }
  .md-nav-links { gap: 9px; }
  .md-nav-links a:not(.macronav-btn) { display: none; }
  .md-brand-text { font-size: 12px; }
  .md-brand-logo { height: 36px; }
  .md-hero-grid { min-height: 250px; padding: 28px 0; }
  .md-pad,
  .md-form-card { padding: 14px; }
  .md-submitbar,
  .md-toolbar,
  .md-question-top,
  .md-answer div {
    align-items: stretch;
    flex-direction: column;
  }

  .md-btn,
  .md-submitbar .btn {
    width: 100%;
  }

  .md-stats {
    grid-template-columns: 1fr;
  }

  .md-step-actions {
    width: 100%;
    flex-direction: column-reverse;
  }

  .table { min-width: 1040px; }

  .auth-shell {
    padding: 32px 0 28px;
  }

  .md-footer-row,
  .md-footer-links {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    text-align: left;
  }

  .md-footer-row {
    min-height: auto;
    padding: 16px 0;
  }
}
