:root {
  --bg-a: #f4f7fb;
  --bg-b: #ecf2ff;
  --ink: #102038;
  --ink-soft: #5a6d85;
  --line: #d7dfeb;
  --panel: #ffffff;
  --brand: #16529a;
  --brand-dark: #0f2f59;
  --mint: #24b8a6;
  --danger: #da5b5b;
  --radius: 18px;
  --shadow: 0 22px 60px rgba(9, 25, 53, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Plus Jakarta Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(1200px 600px at -5% -20%, #e0f7ff 0%, transparent 70%),
    radial-gradient(900px 500px at 110% 15%, #d9e4ff 0%, transparent 68%),
    linear-gradient(160deg, var(--bg-a) 0%, var(--bg-b) 80%);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Space Grotesk", "Arial", sans-serif;
}

.ambient {
  position: fixed;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(100px);
  opacity: 0.25;
  z-index: 0;
}

.ambient-a {
  width: 340px;
  height: 340px;
  background: #6cc7ff;
  top: -120px;
  right: -110px;
}

.ambient-b {
  width: 380px;
  height: 380px;
  background: #91ffd4;
  bottom: -140px;
  left: -130px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 6;
  backdrop-filter: blur(10px);
  background: rgba(245, 250, 255, 0.85);
  border-bottom: 1px solid rgba(195, 212, 235, 0.8);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 118px;
  max-width: 24vw;
}

.brand-wrap h1 {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.brand-wrap p {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.status-pill {
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.84rem;
  font-weight: 600;
  border: 1px solid transparent;
}

.status-pill.idle {
  color: #334f73;
  background: #edf4ff;
  border-color: #ccddf6;
}

.status-pill.busy {
  color: #0d5b57;
  background: #e8fcf8;
  border-color: #b7ede3;
}

.status-pill.error {
  color: #8f1d1d;
  background: #fff1f1;
  border-color: #f4cccc;
}

.dashboard {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  padding: 22px 24px 32px;
}

.panel {
  background: var(--panel);
  border: 1px solid #dce4f1;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel h2 {
  font-size: 1.15rem;
  margin-bottom: 6px;
}

.panel-note {
  color: var(--ink-soft);
  font-size: 0.88rem;
  margin: 0 0 12px;
}

.panel-upload {
  grid-column: span 4;
}

.panel-request {
  grid-column: span 8;
}

.panel-results,
.panel-output {
  grid-column: span 6;
}

.dropzone {
  border: 1.5px dashed #8fb3e0;
  border-radius: 14px;
  background: #f6faff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  min-height: 140px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.dropzone:hover,
.dropzone.dragging {
  border-color: var(--brand);
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px rgba(22, 82, 154, 0.3);
}

.dropzone.has-file {
  border-color: #138a7f;
  background: #f1fffb;
  box-shadow: inset 0 0 0 1px rgba(19, 138, 127, 0.25);
}

.dropzone input {
  display: none;
}

.dropzone span {
  font-weight: 600;
}

.dropzone small {
  color: var(--ink-soft);
}

.dropzone.has-file small {
  color: #0d5b57;
  font-weight: 600;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
}

.btn:not(:disabled):hover {
  transform: translateY(-1px);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(120deg, var(--brand), #2d79d4 75%);
  box-shadow: 0 12px 24px rgba(26, 83, 153, 0.3);
}

.btn-secondary {
  color: #fff;
  background: linear-gradient(120deg, #138a7f, var(--mint));
  box-shadow: 0 12px 24px rgba(35, 153, 137, 0.28);
}

.btn-ghost {
  color: #265792;
  background: #edf4ff;
  border: 1px solid #d2e1f7;
}

.inline-row {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 10px;
}

.template-row {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.field {
  display: grid;
  gap: 6px;
  margin: 10px 0;
}

.field span {
  font-size: 0.78rem;
  color: #4d6281;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #cfd9e8;
  border-radius: 10px;
  font: inherit;
  padding: 10px;
  color: var(--ink);
  background: #fff;
}

.field textarea {
  resize: vertical;
}

.result-box,
.status-stream {
  margin-top: 10px;
  border: 1px solid #d4deec;
  background: #f8fbff;
  border-radius: 10px;
  min-height: 54px;
  padding: 10px;
  font-size: 0.9rem;
  color: #2a446a;
}

.cards {
  display: grid;
  gap: 12px;
}

.candidate-card {
  border: 1px solid #d9e2f0;
  border-radius: 14px;
  background: #fbfdff;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.card-title {
  font-weight: 700;
}

.score-chip {
  font-size: 0.78rem;
  font-weight: 700;
  background: #e6f5ff;
  color: #155089;
  border: 1px solid #bddcf3;
  border-radius: 999px;
  padding: 5px 10px;
}

.score-track {
  width: 100%;
  height: 8px;
  background: #e4ebf6;
  border-radius: 999px;
  overflow: hidden;
}

.score-fill {
  height: 100%;
  background: linear-gradient(100deg, #2e8ce5, #21cbb4);
}

.card-sub,
.card-reason,
.card-skills,
.gen-status {
  color: #405c81;
  font-size: 0.86rem;
  line-height: 1.4;
}

.card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #c2d8f2;
  border-top-color: #2e8ce5;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.8s linear infinite;
  margin-right: 6px;
}

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

.generated-list {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.generated-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  border: 1px solid #d6e1f0;
  background: #f9fcff;
  border-radius: 10px;
  padding: 8px;
}

.generated-item a {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}

.preview-shell {
  margin-top: 12px;
  border: 1px solid #d7dfeb;
  border-radius: 12px;
  overflow: hidden;
  min-height: 540px;
  background: #fff;
}

.preview-shell iframe {
  width: 100%;
  height: 540px;
  border: 0;
}

@media (max-width: 1160px) {
  .panel-upload,
  .panel-request,
  .panel-results,
  .panel-output {
    grid-column: span 12;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 10px 14px;
  }

  .dashboard {
    padding: 14px;
  }

  .inline-row {
    grid-template-columns: 1fr;
  }

  .generated-item {
    grid-template-columns: 1fr;
  }
}
