:root {
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: #0f172a;
  background-color: #f8fafc;
  line-height: 1.5;
}

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

body {
  margin: 0;
}

a {
  color: #2563eb;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  width: min(960px, 90vw);
  margin: 0 auto;
  padding: 2rem 0;
}

.site-header,
.site-footer {
  background: white;
  border-bottom: 1px solid #e2e8f0;
}

.site-footer {
  border-top: 1px solid #e2e8f0;
  border-bottom: none;
  text-align: center;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-weight: 600;
  font-size: 1.2rem;
}

.nav-links a {
  margin-left: 1rem;
  font-size: 0.95rem;
  color: #475569;
}

.hero {
  min-height: 60vh;
  display: grid;
  align-items: center;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  color: #94a3b8;
}

.lead {
  color: #475569;
  max-width: 40ch;
}

.cta-group {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.btn {
  border-radius: 999px;
  padding: 0.6rem 1.6rem;
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.btn.primary {
  background: #2563eb;
  color: white;
}

.btn.primary:hover {
  background: #1d4ed8;
}

.btn.primary.light {
  background: #60a5fa;
  color: white;
}

.btn.primary.light:hover {
  background: #3b82f6;
}

label .btn {
  display: inline-block;
  width: auto;
  max-width: fit-content;
}

.position-picker-wrapper {
  margin-bottom: 1rem;
}

.position-picker-wrapper:last-child {
  margin-bottom: 0;
}

#extract-profile-btn,
#analyze-profile-btn,
button[form="candidate-form"] {
  width: 160px;
  box-sizing: border-box;
}

.btn.ghost {
  border-color: #cbd5f5;
  color: #1e40af;
  background: transparent;
}

.card {
  background: white;
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.1);
  max-width: 520px;
  margin: 4rem auto;
}

.card.wide,
.portal-card {
  max-width: none;
}

.form-grid {
  display: grid;
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: #475569;
}

input,
textarea,
select {
  border-radius: 0.5rem;
  border: 1px solid #cbd5f5;
  padding: 0.65rem 0.75rem;
  font-size: 1rem;
}

textarea {
  font-family: inherit;
  resize: vertical;
}

textarea[readonly] {
  background-color: #f8fafc;
  cursor: not-allowed;
  color: #475569;
}

.token-hint {
  font-size: 0.8rem;
  color: #94a3b8;
}

.form-hint {
  margin-top: 1rem;
  color: #64748b;
  font-size: 0.9rem;
}

.flash-messages {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: grid;
  gap: 0.5rem;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.95rem;
}

.flash.success {
  background: #dcfce7;
  color: #166534;
}

.flash.error {
  background: #fee2e2;
  color: #b91c1c;
}

.flash.pending {
  background: #e2e8f0;
  color: #475569;
}

.status-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  display: grid;
  gap: 0.75rem;
}

.status-label {
  color: #94a3b8;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.status-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: #0f172a;
}

.portal-heading {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: center;
  margin-bottom: 2rem;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.portal-action {
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  background: #f8fafc;
}

.portal-action.positions {
  border-color: #c7d2fe;
}

.portal-action.candidates {
  border-color: #bae6fd;
}

.portal-action.templates {
  border-color: #fecdd3;
}

.portal-action.ghost {
  background: white;
}

.btn.slim {
  padding: 0.45rem 1.2rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.entries-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}

.entry-card {
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  background: #fdfdfd;
}

.entry-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.entry-meta {
  font-size: 0.85rem;
  color: #94a3b8;
}

.entry-meta-sub {
  display: block;
  font-size: 0.8rem;
}

.empty-state {
  color: #94a3b8;
  font-size: 0.95rem;
}

.message-preview {
  background: #0f172a;
  color: #f8fafc;
  padding: 1.25rem;
  border-radius: 0.75rem;
  margin: 1.5rem 0;
  box-shadow: inset 0 0 0 1px rgba(248, 250, 252, 0.1);
}

.message-preview pre {
  margin: 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
}

.message-editable {
  display: grid;
  gap: 0.45rem;
  color: #cbd5f5;
  font-size: 0.9rem;
}

.message-preview textarea {
  width: 100%;
  border-radius: 0.75rem;
  border: 1px solid rgba(248, 250, 252, 0.15);
  background: transparent;
  color: inherit;
  padding: 1rem;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.95rem;
  white-space: pre-wrap;
  resize: vertical;
  min-height: 260px;
}

.message-meta {
  margin-bottom: 1rem;
  gap: 0.35rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.form-actions.compact {
  justify-content: flex-start;
  margin-top: 0.5rem;
}

.analyze-status {
  font-size: 0.9rem;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.analyze-status::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 999px;
  border: 2px solid #cbd5e1;
  border-top-color: #2563eb;
  animation: analyze-spin 0.7s linear infinite;
}

@keyframes analyze-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.position-picker {
  position: relative;
}

.picker-toggle {
  width: 100%;
  text-align: left;
  border: 1px solid #cbd5f5;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font: inherit;
  cursor: pointer;
}

.picker-line {
  display: block;
}

.picker-title {
  font-weight: 600;
  color: #0f172a;
}

.picker-company {
  font-size: 0.85rem;
  color: #94a3b8;
}

.picker-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  right: 0;
  border-radius: 0.75rem;
  border: 1px solid #cbd5f5;
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.15);
  display: none;
  z-index: 10;
  max-height: 260px;
  overflow-y: auto;
}

.position-picker.open .picker-menu {
  display: block;
}

.picker-option {
  width: 100%;
  text-align: left;
  padding: 0.85rem 1rem;
  border: 0;
  border-bottom: 1px solid #f1f5f9;
  background: transparent;
  cursor: pointer;
}

.picker-option:last-child {
  border-bottom: none;
}

.picker-option:hover {
  background: #eff6ff;
}

.option-title {
  display: block;
  font-weight: 600;
  color: #0f172a;
}

.option-company {
  display: block;
  font-size: 0.85rem;
  color: #94a3b8;
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
}

.data-table tr.highlight td {
  font-weight: 600;
  color: #0f172a;
}

.score-table {
  margin-top: 1rem;
}

.data-table th {
  font-weight: 600;
  color: #475569;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 100;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 1rem;
  padding: 1.5rem;
  width: min(540px, 90vw);
  position: relative;
  box-shadow: 0 25px 70px rgba(15, 23, 42, 0.25);
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  cursor: pointer;
  color: #94a3b8;
}

.modal-content pre {
  white-space: pre-wrap;
  background: #0f172a;
  color: #f8fafc;
  padding: 1rem;
  border-radius: 0.75rem;
  margin: 1rem 0 0;
  max-height: 320px;
  overflow-y: auto;
}

@media (max-width: 640px) {
  .header-content {
    flex-direction: column;
    gap: 0.75rem;
  }

  .cta-group {
    flex-direction: column;
    width: 100%;
  }

  .btn {
    width: 100%;
  }

  .portal-heading {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Token list styling */
.token-list {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.token-label {
  font-size: 0.875rem;
  color: #64748b;
  margin-right: 0.25rem;
}

.token-btn {
  padding: 0.25rem 0.5rem;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-family: monospace;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s;
}

.token-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #334155;
}

.token-btn:active {
  background: #cbd5e1;
  transform: scale(0.98);
}

