:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --card: #ffffff;
  --card-border: #e4e9f2;
  --accent: #4557ff;
  --accent-strong: #2c3fff;
  --text: #1b2333;
  --text-muted: #636b7a;
  --danger: #ff5572;
  --success: #0f9d58;
  --warning: #ffb648;
  --shadow: 0 24px 40px -16px rgba(48, 63, 159, 0.2);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  margin: 0;
  background: radial-gradient(circle at top left, #f1f3ff 0%, var(--bg) 45%);
  color: var(--text);
  min-height: 100vh;
}

.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 20px 64px;
}

.page__header {
  margin-bottom: 32px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.page__header h1 {
  margin: 0;
  font-size: 2.5rem;
  font-weight: 700;
}

.page__header p {
  margin: 8px 0 0;
  color: var(--text-muted);
  max-width: 640px;
}

.page__header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.page__header-actions button {
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 20px -12px rgba(44, 63, 255, 0.5);
  transition: transform 0.15s ease;
}

.page__header-actions button:hover {
  transform: translateY(-2px);
}

.page__content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.search-card__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.search-card__field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-card__form label {
  display: flex;
  flex-direction: column;
  font-weight: 600;
  gap: 8px;
}

.search-card__input-wrapper {
  position: relative;
  margin-top: 4px;
}

.search-card__form input {
  border-radius: 10px;
  border: 1px solid var(--card-border);
  padding: 14px 16px;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-card__form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(69, 87, 255, 0.18);
}

.search-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.search-card__actions button {
  border: none;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease,
    background-color 0.2s ease;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 20px -12px rgba(44, 63, 255, 0.5);
}

.search-card__actions button.secondary {
  background: #eef0ff;
  color: var(--accent-strong);
  box-shadow: none;
}

.search-card__actions button:hover:not(:disabled) {
  transform: translateY(-2px);
}

.search-card__actions button:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.search-card__hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  border: 1px solid rgba(69, 87, 255, 0.2);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 24px -16px rgba(69, 87, 255, 0.35);
  overflow: hidden;
  z-index: 20;
}

.search-suggestions ul {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
}

.search-suggestions li + li {
  border-top: 1px solid rgba(227, 231, 240, 0.6);
}

.search-suggestions__item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text);
  transition: background 0.15s ease;
}

.search-suggestions__item:hover,
.search-suggestions__item:focus {
  background: rgba(69, 87, 255, 0.08);
  outline: none;
}

.search-suggestions__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(69, 87, 255, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-strong);
}

.search-suggestions__avatar.fallback {
  width: 32px;
  height: 32px;
}

.search-suggestions__login {
  font-weight: 600;
}

.search-suggestions__status {
  padding: 12px 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.leaderboard-view {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.leaderboard-toolbar button {
  border-radius: 10px;
  border: none;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 20px -12px rgba(44, 63, 255, 0.5);
  transition: transform 0.15s ease;
}

.leaderboard-toolbar button.secondary,
.leaderboard-toolbar .secondary {
  background: #eef0ff;
  color: var(--accent-strong);
  box-shadow: none;
}

.leaderboard-toolbar button:hover:not(:disabled) {
  transform: translateY(-2px);
}

.leaderboard-toolbar button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.leaderboard-toolbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.leaderboard-sort {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-muted);
}

.leaderboard-sort select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(69, 87, 255, 0.4);
  background: #fff;
  color: inherit;
  font-weight: 500;
}

.leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.leaderboard-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.leaderboard-card__count {
  background: rgba(69, 87, 255, 0.12);
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 600;
  color: var(--accent-strong);
}

.leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(69, 87, 255, 0.14);
  border-radius: 12px;
  background: rgba(69, 87, 255, 0.05);
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: background 0.2s ease, border-color 0.2s ease,
    transform 0.2s ease;
}

.leaderboard-item:hover,
.leaderboard-item:focus-visible {
  background: rgba(69, 87, 255, 0.12);
  border-color: rgba(69, 87, 255, 0.3);
  outline: none;
}

.leaderboard-item:active {
  transform: translateY(1px);
}

.leaderboard-item__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(69, 87, 255, 0.12);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--accent-strong);
}

.leaderboard-item__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.leaderboard-item__metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.leaderboard-item__name {
  font-weight: 600;
  font-size: 1rem;
}

.leaderboard-item__login {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.leaderboard-item__pill {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

.leaderboard-errors {
  border: 1px dashed rgba(69, 87, 255, 0.3);
  border-radius: 12px;
  padding: 12px 16px;
  background: rgba(69, 87, 255, 0.05);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.leaderboard-errors summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 8px;
}

.leaderboard-errors ul {
  margin: 0;
  padding-left: 18px;
}

.alert {
  border-radius: 12px;
  padding: 16px 20px;
  font-weight: 500;
}

.alert--error {
  background: rgba(255, 85, 114, 0.12);
  color: var(--danger);
  border: 1px solid rgba(255, 85, 114, 0.3);
}

.loading-banner {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  align-self: flex-start;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(44, 63, 255, 0.1);
  color: var(--accent-strong);
  font-weight: 600;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 3px solid rgba(44, 63, 255, 0.2);
  border-top-color: var(--accent-strong);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  border: 2px dashed rgba(69, 87, 255, 0.18);
  border-radius: 18px;
  background: rgba(69, 87, 255, 0.05);
}

.empty-state h2 {
  margin-top: 0;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--text-muted);
}

.layout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.profile-card__header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 22px;
}

.profile-card__avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(69, 87, 255, 0.2);
}

.profile-card__avatar.fallback {
  display: grid;
  place-items: center;
  background: rgba(69, 87, 255, 0.12);
  color: var(--accent-strong);
  font-weight: 700;
}

.profile-card__title-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.profile-card__subtitle {
  margin: 4px 0 10px;
  color: var(--text-muted);
}

.profile-card__meta {
  display: flex;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.profile-card__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
  margin: 0;
}

.profile-card__grid div {
  background: rgba(69, 87, 255, 0.06);
  border-radius: 12px;
  padding: 14px;
}

.profile-card__grid dt {
  margin: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.profile-card__grid dd {
  margin: 6px 0 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.contact-card h3 {
  margin-top: 0;
}

.contact-card dl {
  margin: 0;
  display: grid;
  gap: 14px;
}

.contact-card dt {
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.contact-card dd {
  margin: 4px 0 0;
  font-weight: 600;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pill--success {
  background: rgba(15, 157, 88, 0.16);
  color: var(--success);
}

.pill--danger {
  background: rgba(255, 85, 114, 0.16);
  color: var(--danger);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge--exam {
  background: rgba(69, 87, 255, 0.15);
  color: var(--accent-strong);
  margin-left: 8px;
}

.badge--warning {
  background: rgba(255, 182, 72, 0.2);
  color: var(--warning);
  margin-top: 12px;
  width: fit-content;
}

.cursus-section__header {
  margin-bottom: 18px;
}

.cursus-section__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.cursus-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid rgba(69, 87, 255, 0.14);
  background: rgba(69, 87, 255, 0.06);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease,
    background 0.18s ease;
  text-align: left;
}

.cursus-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 28px -18px rgba(69, 87, 255, 0.5);
}

.cursus-card--active {
  background: linear-gradient(140deg, #2c3fff 0%, #5b6bff 100%);
  color: #fff;
  box-shadow: 0 24px 36px -16px rgba(44, 63, 255, 0.6);
}

.cursus-card--active .cursus-card__meta {
  color: rgba(255, 255, 255, 0.85);
}

.cursus-card__header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cursus-card__grade {
  font-weight: 700;
}

.cursus-card__progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.3);
  overflow: hidden;
}

.cursus-card__progress-bar {
  height: 100%;
  background: rgba(44, 63, 255, 0.8);
  border-radius: inherit;
}

.cursus-card--active .cursus-card__progress {
  background: rgba(0, 0, 0, 0.25);
}

.cursus-card--active .cursus-card__progress-bar {
  background: #fff;
}

.cursus-card__meta {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.projects-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.projects-card__count {
  background: rgba(69, 87, 255, 0.12);
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
  color: var(--accent-strong);
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  padding: 12px 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--card-border);
}

tbody td {
  padding: 14px 10px;
  border-bottom: 1px solid rgba(227, 231, 240, 0.7);
  vertical-align: middle;
}

tbody tr:hover {
  background: rgba(69, 87, 255, 0.04);
}

.project-name {
  font-weight: 600;
}

.muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .page {
    padding: 32px 16px 48px;
  }

  .card {
    padding: 20px;
  }

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

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

  .page__header-actions {
    justify-content: flex-start;
  }
}
