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

:root {
  --navy: #1a2b4b;
  --navy-mid: #1e3a5f;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-light: #3b82f6;
  --bg: #f0f4f8;
  --card: #ffffff;
  --text: #0f172a;
  --text-secondary: #64748b;
  --muted: #94a3b8;
  --border: #e2e8f0;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow-nav: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.04);
  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.05), 0 8px 24px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }

body.admin-app {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* —— White top bar —— */
.pt-header {
  background: var(--card);
  box-shadow: var(--shadow-nav);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 0.7rem 1.25rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem 1rem;
}

.pt-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}

.pt-brand:hover { color: var(--text); opacity: 0.9; }

.pt-brand-logo {
  height: 48px;
  width: auto;
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}

.pt-brand-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.pt-brand-sub {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
}

.pt-nav-pill {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.26rem 0.32rem;
  box-shadow: var(--shadow-nav);
  grid-column: 2;
  justify-self: center;
  width: max-content;
  max-width: 100%;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.pt-nav-pill::-webkit-scrollbar {
  height: 4px;
}

.pt-nav-pill::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.pt-nav-link {
  padding: 0.48rem 0.74rem;
  border-radius: var(--radius-pill);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.pt-nav-link:hover {
  color: var(--blue);
  background: #f1f5f9;
}

.pt-nav-link.active {
  color: var(--blue);
  background: #eff6ff;
  font-weight: 600;
}

.pt-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  grid-column: 3;
  justify-self: end;
}

.pt-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pt-user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pt-user-name {
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.2;
}

.pt-user-role {
  font-size: 0.72rem;
  color: var(--muted);
}

.btn-signout {
  padding: 0.46rem 0.95rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s;
}

.btn-signout:hover {
  border-color: #cbd5e1;
  color: var(--text);
  background: #f8fafc;
}

.pt-nav-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
  grid-column: 3;
  justify-self: end;
}

/* —— Hero banner —— */
.hero-banner {
  margin: 1.25rem auto 0;
  padding: 1.75rem 2rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(105deg, var(--navy) 0%, var(--navy-mid) 35%, var(--blue) 100%);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  box-shadow: 0 12px 40px rgba(37, 99, 235, 0.25);
  width: calc(100% - 3rem);
  max-width: 1600px;
}

.hero-eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: 0.35rem;
}

.hero-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.5rem;
  line-height: 1.2;
}

.hero-desc {
  font-size: 0.875rem;
  opacity: 0.9;
  margin: 0;
  max-width: 520px;
  line-height: 1.5;
}

.hero-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn-hero-primary {
  background: #fff;
  color: var(--blue);
  border: none;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.8125rem;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.btn-hero-primary:hover {
  color: var(--blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.btn-hero-ghost {
  background: transparent;
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-pill);
  font-weight: 500;
  font-size: 0.8125rem;
  text-decoration: none;
  transition: all 0.15s;
}

.btn-hero-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: #fff;
}

.hero-banner--compact {
  padding: 1.25rem 1.75rem;
}

.hero-banner--compact .hero-title {
  font-size: 1.35rem;
}

/* —— Toolbar card —— */
.toolbar-card {
  margin: 1rem auto 0;
  padding: 1rem 1.25rem;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  width: calc(100% - 3rem);
  max-width: 1600px;
}

.toolbar-card .toolbar-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.date-filter-form .form-control {
  min-width: 170px;
}

.date-filter-form .form-label {
  color: var(--muted);
  font-weight: 600;
}

.shortlist-summary {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.shortlist-pill {
  min-width: 150px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
}

.shortlist-pill__label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.shortlist-pill__value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
}

/* —— Page content —— */
.admin-page {
  min-height: calc(100vh - 60px);
  display: flex;
  flex-direction: column;
  padding-bottom: 1rem;
}

.admin-content {
  padding: 1.25rem 1.5rem 1.5rem;
  flex: 1;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

.admin-footer {
  margin: 0 1.5rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
}

/* —— Stats —— */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 1400px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .stat-grid { grid-template-columns: 1fr; } }

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.2rem 1.25rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  transition: transform 0.15s;
}

.stat-card:hover { transform: translateY(-2px); }

.stat-card-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.stat-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 0.35rem;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.icon-green { background: #ecfdf5; color: #059669; }
.icon-blue { background: #eff6ff; color: var(--blue); }
.icon-purple { background: #f5f3ff; color: #7c3aed; }
.icon-teal { background: #f0fdfa; color: #0d9488; }
.icon-red { background: #fef2f2; color: #dc2626; }

/* —— Charts —— */
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1.2fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 1200px) { .chart-grid { grid-template-columns: 1fr; } }

.chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
}

.chart-card h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0 0 1rem;
  color: var(--text);
}

.chart-wrap { height: 220px; position: relative; }
.chart-wrap canvas { max-height: 220px; }

.chart-empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem;
  font-size: 0.875rem;
}

.chart-empty i { display: block; font-size: 1.75rem; margin-bottom: 0.5rem; opacity: 0.35; }

/* —— Panels —— */
.panel-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h3 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.sks-table {
  width: 100%;
  font-size: 0.8125rem;
  border-collapse: collapse;
}

.sks-table th {
  background: #f8fafc;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.sks-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #f1f5f9;
}

.sks-table tbody tr:hover { background: #f8fafc; }
.sks-table tbody tr:last-child td { border-bottom: none; }

.badge-sks {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.28rem 0.6rem;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
}

.badge-submitted { background: #ecfdf5; color: #047857; }
.badge-in_progress { background: #fff7ed; color: #c2410c; }
.badge-pending { background: #eff6ff; color: #1d4ed8; }
.badge-passed { background: #ecfdf5; color: #047857; }
.badge-failed { background: #fef2f2; color: #b91c1c; }

.btn-sks {
  background: var(--blue);
  border: none;
  color: #fff !important;
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-pill);
  transition: all 0.15s;
}

.btn-sks:hover {
  background: var(--blue-dark);
  color: #fff !important;
  transform: translateY(-1px);
}

.btn-outline-sks {
  color: var(--blue);
  border: 1px solid var(--border);
  font-weight: 500;
  font-size: 0.8125rem;
  border-radius: var(--radius-pill);
  background: var(--card);
  padding: 0.35rem 0.75rem;
}

.btn-outline-sks:hover {
  background: #eff6ff;
  border-color: var(--blue);
  color: var(--blue) !important;
}

.btn-reset {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.45rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
}

.warnings-pill {
  background: #fff7ed;
  color: #c2410c;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
}

.form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.form-page {
  width: 100%;
}

.form-card--invite {
  padding: 1.75rem 2rem 2rem;
}

.form-card-head {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.form-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

.form-card-lead {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.assessment-pill {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1rem 1.15rem;
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  color: var(--text);
}

.assessment-pill .bi {
  font-size: 1.35rem;
  color: var(--blue);
  margin-top: 0.1rem;
}

.assessment-pill-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.assessment-pill-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.info-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.35rem;
  box-shadow: var(--shadow-card);
  height: 100%;
}

.info-card-title {
  font-size: 0.9375rem;
  font-weight: 700;
  margin: 0 0 1rem;
  color: var(--text);
}

.info-card-title .bi {
  color: var(--blue);
}

.info-card-list {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.info-card-list li + li {
  margin-top: 0.65rem;
}

.invite-form .form-label {
  font-size: 0.8125rem;
  margin-bottom: 0.35rem;
}

.invite-form .form-control,
.invite-form .form-select {
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
  border-color: var(--border);
}

.invite-form .form-control:focus,
.invite-form .form-select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.page-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.page-toolbar p { margin: 0; color: var(--text-secondary); font-size: 0.875rem; }

.text-link {
  color: var(--blue);
  font-weight: 600;
  text-decoration: none;
}

.text-link:hover { color: var(--blue-dark); }

.question-type-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--text);
  height: 100%;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.question-type-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--blue);
  color: var(--text);
}

.question-type-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.question-type-card__title {
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: -0.02em;
}

.question-type-card__desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.add-question-bar {
  background: #f8fafc;
  margin: 0 -1.5rem -1.5rem;
  padding: 1rem 1.5rem !important;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* Login */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(105deg, var(--navy) 0%, var(--blue) 100%);
  padding: 2rem;
}

.login-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2);
}

.login-logo {
  display: block;
  height: 72px;
  width: auto;
  max-width: 100%;
  margin: 0 auto 1rem;
  object-fit: contain;
}

.login-card h1 {
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 0.25rem;
}

.login-tagline {
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.login-card .form-control {
  border-radius: 10px;
  border-color: var(--border);
  padding: 0.65rem 0.85rem;
}

.login-card .form-control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Candidate */
.candidate-shell {
  min-height: 100vh;
  background: var(--bg);
  padding: 2rem 1rem;
}

.candidate-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  padding: 2rem;
}

.candidate-mark {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin: 0 auto 1rem;
}

.candidate-title {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.timer-bar {
  background: linear-gradient(90deg, var(--navy), var(--blue));
  color: #fff;
  text-align: center;
  padding: 0.65rem;
  font-weight: 600;
  font-size: 0.875rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Mobile */
@media (max-width: 1100px) {
  .pt-header {
    grid-template-columns: 1fr auto auto;
    gap: 0.5rem 0.65rem;
    padding: 0.55rem 0.9rem;
  }

  .pt-brand {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .pt-brand-title {
    font-size: 0.9rem;
  }

  .pt-brand-logo {
    height: 42px;
  }

  .pt-nav-toggle {
    display: block;
    grid-column: 2;
    grid-row: 1;
  }

  .pt-header-actions {
    grid-column: 3;
    grid-row: 1;
  }

  .pt-header-actions .pt-user-meta {
    display: none;
  }

  .pt-nav-pill {
    display: none;
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
    flex-wrap: wrap;
    justify-content: flex-start;
    overflow-x: visible;
  }

  .pt-nav-pill.show {
    display: flex;
  }
}

@media (min-width: 1101px) {
  .pt-nav-pill {
    display: flex !important;
  }

  .pt-nav-toggle {
    display: none !important;
  }
}

@media (max-width: 576px) {
  .hero-banner { margin: 1rem; padding: 1.25rem; }
  .toolbar-card { margin: 0.75rem 1rem 0; }
  .admin-content { padding: 1rem; }
  .admin-footer { margin: 0 1rem; flex-direction: column; gap: 0.25rem; }
}
