/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #fbfaf8;
  --bg2: #ffffff;
  --bg3: #f5f1f8;
  --surface: #ffffff;
  --surface-low: #f8f6f3;
  --border: #ddd9e1;
  --border2: #bdb5c9;
  --text: #202038;
  --text2: #4e4c5d;
  --text3: #777381;
  --accent: #6550a4;
  --accent2: #9c8bc6;
  --accent3: #ba1a1a;
  --green: #3f7d4c;
  --yellow: #7b5f12;
  --primary-soft: #eee8ff;
  --secondary-soft: #f2eee8;
  --error-soft: #ffdad6;
  --shadow: 0 18px 48px rgba(48, 42, 66, 0.08);
  --font-head: 'Plus Jakarta Sans', sans-serif;
  --font-editorial: 'DM Serif Display', Georgia, serif;
  --font-body: 'Manrope', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --radius: 12px;
  --sidebar-w: 198px;
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
}

body {
  overflow-x: hidden;
}

body::before {
  content: none;
}

button, input, textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

/* ── App Shell ────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  width: var(--sidebar-w);
  background: #fcfaf8;
  border-right: 1px solid #ebe7e3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 28px 18px 22px;
}

.main {
  width: calc(100% - var(--sidebar-w));
  margin-left: var(--sidebar-w);
  padding: 28px 30px 56px;
}

/* ── Navigation ───────────────────────────────────────────── */
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  color: var(--accent);
  font-family: var(--font-editorial);
  padding: 0 8px 28px;
}

.logo-icon {
  display: block;
  flex: 0 0 34px;
  width: 34px;
  height: 48px;
}

.logo-icon img {
  display: block;
  width: 100%;
  height: 100%;
  filter: saturate(1.28) contrast(1.1);
  object-fit: contain;
}

.logo-copy {
  display: grid;
  min-width: 0;
  line-height: 1.05;
}

.logo-text {
  color: #30213b;
  font-size: 19px;
  white-space: nowrap;
}

.logo-subtitle {
  margin-top: 5px;
  color: var(--text3);
  font-family: var(--font-body);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 18px 0;
  border-top: 1px solid rgba(121, 118, 125, 0.14);
}

.nav-btn {
  width: 100%;
  min-height: 48px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text3);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
  padding: 0 16px;
  cursor: pointer;
  transition: color 0.16s ease, background 0.16s ease, transform 0.12s ease;
}

.nav-btn:hover {
  color: var(--accent);
}

.nav-btn:active {
  transform: scale(0.96);
}

.nav-btn.active {
  background: rgba(231, 222, 255, 0.72);
  color: var(--accent);
}

.nav-icon {
  font-size: 17px;
  line-height: 1;
}

.sidebar-footer {
  width: 100%;
  margin-top: auto;
  padding: 18px 8px 0;
  border-top: 1px solid rgba(121, 118, 125, 0.14);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text3);
  font-family: var(--font-mono);
  font-size: 11px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(63, 118, 82, 0.12);
}
.status-dot.loading { background: var(--yellow); box-shadow: 0 0 0 5px rgba(123, 95, 18, 0.12); }
.status-dot.error { background: var(--accent3); box-shadow: 0 0 0 5px rgba(186, 26, 26, 0.12); }

/* ── Views ────────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }
.hidden { display: none !important; }

.view-header {
  margin-bottom: 32px;
}

.view-header h1 {
  color: var(--accent);
  font-family: var(--font-head);
  font-size: clamp(34px, 3.6vw, 52px);
  font-weight: 800;
  line-height: 1.12;
  margin-bottom: 8px;
}

.view-header p {
  max-width: 680px;
  color: var(--text2);
  font-size: 16px;
}

/* ── Panels & Forms ───────────────────────────────────────── */
.resume-upload,
.url-form,
.search-form,
.writer-form,
.result-card,
.job-item,
.pagination-row,
.filter-row,
.empty-state,
.error-block {
  background: var(--bg2);
  backdrop-filter: blur(30px);
  border: 1px solid rgba(121, 118, 125, 0.14);
  box-shadow: 0 18px 50px rgba(52, 48, 43, 0.07);
}

.resume-upload {
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.resume-status {
  color: var(--text2);
  font-size: 13px;
}

.resume-upload-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn-ghost.danger {
  color: var(--accent3);
}

.btn-ghost.danger:hover {
  background: rgba(186, 26, 26, 0.08);
}

.file-input {
  max-width: 270px;
  color: var(--text2);
  font-size: 12px;
}

.file-input::file-selector-button {
  background: var(--surface);
  border: 1px solid rgba(121, 118, 125, 0.2);
  border-radius: 999px;
  color: var(--accent);
  cursor: pointer;
  font-weight: 700;
  margin-right: 10px;
  padding: 9px 14px;
}

.url-form,
.search-form,
.writer-form {
  border-radius: 22px;
  padding: 24px;
  margin-bottom: 32px;
}

.analysis-mode {
  display: flex;
  width: 100%;
  padding: 4px;
  margin-bottom: 16px;
  background: var(--bg3);
  border-radius: 999px;
}

.analysis-mode .pill {
  flex: 1;
  justify-content: center;
  border-radius: 999px;
}

.provider-mode {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.input-row,
.form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.form-label {
  color: var(--text2);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.url-input,
.text-input,
.job-textarea {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.46);
  border: 1px solid transparent;
  border-bottom-color: rgba(98, 94, 86, 0.34);
  border-radius: 8px 8px 0 0;
  color: var(--text);
  outline: none;
  padding: 14px 12px;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.url-input::placeholder,
.text-input::placeholder,
.job-textarea::placeholder {
  color: rgba(72, 70, 77, 0.48);
}

.url-input:focus,
.text-input:focus,
.job-textarea:focus {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(97, 90, 119, 0.28);
  border-bottom-color: var(--accent);
  box-shadow: 0 8px 22px rgba(97, 90, 119, 0.08);
}

.text-input.small { flex: 0 1 220px; }
.search-location-input { flex: 0 1 320px; }

.job-text-panel {
  margin-bottom: 12px;
}

.job-textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  line-height: 1.6;
}

.writer-question {
  min-height: 150px;
  margin-bottom: 14px;
}

.writer-context {
  min-height: 120px;
}

.writer-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.example-urls {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text3);
  font-size: 12px;
  flex-wrap: wrap;
}

.tag {
  background: var(--secondary-soft);
  border-radius: 999px;
  color: var(--text2);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
}

.search-filter-row {
  justify-content: flex-end;
}

.search-filter-row .text-input.small {
  max-width: 260px;
}

.freshness-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary,
.btn-ghost,
.btn-sm,
.pill,
.tab-btn,
.copy-btn {
  border: 0;
  cursor: pointer;
}

.btn-primary {
  min-height: 50px;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 14px 24px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: 0 16px 34px rgba(97, 90, 119, 0.22);
  transition: opacity 0.15s ease, transform 0.12s ease;
  white-space: nowrap;
}
.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.btn-ghost,
.btn-sm {
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(121, 118, 125, 0.22);
  border-radius: 999px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  padding: 9px 16px;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}
.btn-ghost:hover,
.btn-sm:hover { background: var(--primary-soft); color: var(--accent); }
.btn-sm:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.36);
  color: var(--text3);
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  background: transparent;
  border-radius: 999px;
  color: var(--text2);
  font-size: 12px;
  font-weight: 800;
  padding: 8px 14px;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.pill:hover { color: var(--accent); }
.pill.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 8px 22px rgba(52, 48, 43, 0.08);
}

/* ── Loading ──────────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 0;
  color: var(--text2);
  font-size: 14px;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(97, 90, 119, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Analysis Result ──────────────────────────────────────── */
.result-card {
  border-radius: 24px;
  overflow: hidden;
  animation: fadeUp 0.28s ease;
}

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

.result-header {
  padding: 26px;
  border-bottom: 1px solid rgba(121, 118, 125, 0.14);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.result-job-info h2 {
  color: var(--text);
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 800;
  line-height: 1.22;
  margin-bottom: 6px;
}

.result-job-info .company {
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
}

.result-job-info .location {
  color: var(--text3);
  font-size: 13px;
  margin-top: 3px;
}

.ai-run-meta {
  display: inline-flex;
  margin-top: 9px;
  border: 1px solid rgba(42, 94, 172, 0.22);
  border-radius: 999px;
  background: rgba(42, 94, 172, 0.08);
  color: #2a5eac;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 9px;
}

.match-score {
  text-align: center;
  flex-shrink: 0;
}

.score-circle {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 3px solid;
  background: rgba(255, 255, 255, 0.5);
  margin-bottom: 6px;
}

.score-circle .score-num {
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.score-circle .score-label {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  opacity: 0.75;
}

.score-high { border-color: var(--green); color: var(--green); }
.score-mid { border-color: var(--yellow); color: var(--yellow); }
.score-low { border-color: var(--accent3); color: var(--accent3); }

.match-score > span {
  color: var(--text3);
  font-size: 11px;
}

.result-tabs {
  display: flex;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(121, 118, 125, 0.14);
  overflow-x: auto;
}

.tab-btn {
  flex: 0 0 auto;
  background: transparent;
  border-radius: 999px;
  color: var(--text3);
  font-size: 13px;
  font-weight: 800;
  padding: 10px 14px;
}
.tab-btn:hover { color: var(--accent); }
.tab-btn.active { background: var(--primary-soft); color: var(--accent); }

.result-body { padding: 26px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Content Blocks ───────────────────────────────────────── */
.section-label {
  color: var(--text3);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.prose {
  color: var(--text2);
  font-size: 15px;
  line-height: 1.72;
  margin-bottom: 24px;
}

.gap-block,
.resume-update-item,
.cover-letter-box,
.answer-box,
.rationale-box {
  border-radius: 16px;
}

.gap-block {
  background: rgba(255, 218, 214, 0.58);
  border: 1px solid rgba(186, 26, 26, 0.16);
  color: #7d1111;
  font-size: 14px;
  margin-bottom: 24px;
  padding: 16px 20px;
}

.gap-list {
  list-style-position: outside;
  padding-left: 34px;
}
.gap-list li { margin-bottom: 8px; }
.gap-list li:last-child { margin-bottom: 0; }

.gap-block.no-gap {
  background: rgba(63, 118, 82, 0.12);
  border-color: rgba(63, 118, 82, 0.18);
  color: var(--green);
}

.resume-updates {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 24px;
}

.resume-update-group {
  display: grid;
  gap: 12px;
}

.resume-group-title {
  color: var(--text);
  font-family: var(--font-head);
  font-size: 16px;
  font-weight: 800;
}

.resume-update-item {
  background: rgba(255, 255, 255, 0.44);
  border: 1px solid rgba(121, 118, 125, 0.14);
  padding: 16px 18px;
}

.resume-update-item.safe {
  background: rgba(63, 118, 82, 0.08);
  border-color: rgba(63, 118, 82, 0.18);
}

.resume-update-item.not_recommended {
  background: rgba(255, 218, 214, 0.42);
  border-color: rgba(186, 26, 26, 0.16);
}

.resume-update-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.resume-update-topline span:last-child {
  color: var(--text3);
}

.resume-update-label {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  margin: 12px 0 6px;
  text-transform: uppercase;
}

.resume-update-item pre {
  margin: 0;
  padding: 12px;
  overflow-x: auto;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.resume-update-item p {
  color: var(--text2);
  font-size: 14px;
  line-height: 1.58;
  margin-top: 10px;
}

.resume-update-choice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.resume-update-choice input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.tailored-resume-actions {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-low);
}

.tailored-resume-actions p {
  margin: 9px 0 0;
  color: var(--text2);
  font-size: 13px;
  line-height: 1.5;
}

.resume-filename-choice {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.resume-filename-choice input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.resume-filename-choice span {
  color: var(--text3);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
}

.tailored-resume-status {
  min-height: 20px;
  margin-top: 8px;
  color: var(--text2);
  font-size: 13px;
}

.tailored-resume-status.error {
  color: var(--accent3);
}

.resume-legacy-note {
  border: 1px solid rgba(123, 95, 18, 0.18);
  border-radius: 14px;
  background: rgba(123, 95, 18, 0.08);
  color: var(--text2);
  font-size: 13px;
  line-height: 1.55;
  padding: 12px 14px;
}

.cover-letter-box {
  position: relative;
  background: rgba(255, 255, 255, 0.46);
  border: 1px solid rgba(121, 118, 125, 0.14);
  color: var(--text2);
  font-size: 14px;
  line-height: 1.8;
  padding: 22px 24px;
  white-space: pre-wrap;
}

.answer-box,
.rationale-box {
  background: rgba(255, 255, 255, 0.46);
  border: 1px solid rgba(121, 118, 125, 0.14);
  color: var(--text2);
  font-size: 14px;
  line-height: 1.8;
  padding: 22px 24px;
  white-space: pre-wrap;
}

.answer-box {
  position: relative;
  margin-bottom: 22px;
  padding-right: 92px;
}

.rationale-box {
  background: rgba(63, 118, 82, 0.08);
  border-color: rgba(63, 118, 82, 0.18);
}

.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--surface);
  border-radius: 999px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  padding: 7px 12px;
}

/* ── Job Lists ────────────────────────────────────────────── */
.job-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pagination-row,
.filter-row {
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-row {
  margin-bottom: 24px;
  justify-content: flex-start;
}

.pagination-info,
.page-indicator {
  color: var(--text3);
  font-size: 12px;
  font-weight: 700;
}

.pagination-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.job-item {
  border-radius: 18px;
  padding: 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  transition: border-color 0.15s ease, transform 0.15s ease;
  animation: fadeUp 0.2s ease;
}
.job-item:hover {
  border-color: rgba(97, 90, 119, 0.28);
  transform: translateY(-1px);
}

.job-item.seen {
  background: rgba(245, 236, 229, 0.46);
}

.job-item.seen .job-item-info h3 {
  color: rgba(31, 27, 23, 0.72);
}

.job-item-info h3 {
  color: var(--text);
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 6px;
}

.job-item-info .job-meta {
  color: var(--text2);
  font-size: 13px;
  margin-bottom: 6px;
}

.job-item-info .job-time {
  color: var(--text3);
  font-size: 12px;
  font-weight: 700;
}

.job-item-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.analyzed-badge,
.seen-badge,
.score-badge {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 10px;
}

.analyzed-badge {
  background: rgba(63, 118, 82, 0.12);
  color: var(--green);
}

.seen-badge {
  background: rgba(97, 90, 119, 0.12);
  color: var(--accent);
}

.score-badge.high { background: rgba(63, 118, 82, 0.12); color: var(--green); }
.score-badge.mid { background: rgba(123, 95, 18, 0.12); color: var(--yellow); }
.score-badge.low { background: rgba(186, 26, 26, 0.12); color: var(--accent3); }

/* ── Empty & Error ────────────────────────────────────────── */
.empty-state {
  border-radius: 22px;
  color: var(--text3);
  padding: 56px 24px;
  text-align: center;
}
.empty-state .empty-icon { font-size: 38px; margin-bottom: 14px; }
.empty-state p { font-size: 14px; }

.error-block {
  background: rgba(255, 218, 214, 0.72);
  border-color: rgba(186, 26, 26, 0.18);
  border-radius: 16px;
  color: var(--accent3);
  font-size: 14px;
  padding: 16px 18px;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 860px) {
  .sidebar {
    top: 0;
    bottom: auto;
    right: 0;
    width: auto;
    height: 68px;
    flex-direction: row;
    justify-content: space-between;
    padding: 0 20px;
    border-right: 0;
    border-bottom: 1px solid rgba(121, 118, 125, 0.14);
  }

  .logo {
    font-size: 21px;
    width: auto;
    padding: 0;
  }

  .sidebar-footer span {
    display: none;
  }

  .main {
    width: min(100%, 760px);
    margin: 0 auto;
    padding-top: 100px;
    padding-left: 20px;
    padding-right: 20px;
    padding-bottom: 116px;
  }

  .resume-upload,
  .result-header,
  .job-item {
    flex-direction: column;
  }

  .resume-upload-actions,
  .job-item-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .input-row .btn-primary,
  .form-row .btn-primary {
    width: 100%;
  }

  .text-input.small,
  .search-location-input,
  .search-filter-row .text-input.small {
    flex-basis: 100%;
    max-width: none;
  }

  .search-filter-row {
    justify-content: flex-start;
  }

  .nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    height: 84px;
    width: auto;
    flex-direction: row;
    background: rgba(255, 248, 244, 0.82);
    backdrop-filter: blur(22px);
    border-top: 1px solid rgba(121, 118, 125, 0.14);
    justify-content: space-around;
    gap: 4px;
    padding: 10px 10px 18px;
  }

  .nav-btn {
    min-width: 0;
    flex: 1;
    min-height: 52px;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    border-radius: 999px;
    padding-left: 8px;
    padding-right: 8px;
    font-size: 12px;
  }
}

@media (min-width: 980px) {
  .main {
    width: min(calc(100% - var(--sidebar-w)), 1080px);
  }
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(121, 118, 125, 0.35); border-radius: 999px; }

/* ── Hosted MVP ─────────────────────────────────────────── */
.sidebar-logout {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--text2);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.auth-panel,
.profile-panel {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 24px 28px;
  margin-bottom: 28px;
}

.auth-panel h2 {
  margin: 5px 0 8px;
  font-family: "Plus Jakarta Sans", sans-serif;
}

.auth-panel p {
  margin: 0;
  color: var(--text2);
  max-width: 560px;
}

.auth-form {
  display: flex;
  gap: 10px;
  min-width: min(100%, 430px);
}

.google-login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  width: 100%;
}

.google-mark {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  color: #4285f4;
  font: 800 14px/1 Arial, sans-serif;
  box-shadow: 0 0 0 1px rgba(66, 133, 244, 0.2);
}

.form-message {
  color: var(--text2);
  font-size: 13px;
}

.eyebrow {
  color: var(--accent);
  font-family: "DM Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text2);
  font-size: 13px;
  line-height: 1.55;
  margin: 0 0 18px;
}

.access-notice,
.feature-access-notice {
  border: 1px solid rgba(114, 99, 255, 0.24);
  border-radius: 14px;
  background: rgba(114, 99, 255, 0.07);
  color: var(--text2);
  padding: 18px;
  margin-bottom: 18px;
}

.access-notice strong,
.feature-access-notice strong {
  color: var(--text);
}

.access-notice .consent-row {
  margin: 14px 0 0;
}

.feature-access-notice {
  display: flex;
  align-items: center;
  gap: 12px;
}

.feature-access-notice .btn-ghost {
  margin-left: auto;
  flex: 0 0 auto;
}

.public-locked {
  opacity: 0.55;
  pointer-events: none;
}

.pill:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.consent-row input {
  margin-top: 4px;
}

.profile-panel {
  padding: 22px;
  margin-bottom: 18px;
}

.profile-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.profile-actions {
  display: flex;
  gap: 9px;
}

.profile-textarea {
  min-height: 260px;
}

.override-panel {
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}

.override-panel summary {
  color: var(--text2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.job-textarea.compact {
  min-height: 150px;
  margin-top: 12px;
}

.match-label {
  display: inline-flex;
  padding: 5px 9px;
  margin-bottom: 16px;
  border-radius: 999px;
  background: rgba(114, 99, 255, 0.1);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tailored-summary-box {
  position: relative;
  white-space: pre-wrap;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-low);
  color: var(--text);
  line-height: 1.7;
  padding: 18px 74px 18px 18px;
  margin-bottom: 8px;
}

@media (max-width: 820px) {
  .auth-panel,
  .profile-heading,
  .feature-access-notice {
    align-items: stretch;
    flex-direction: column;
  }

  .auth-form {
    flex-direction: column;
    width: 100%;
  }

  .feature-access-notice .btn-ghost {
    margin-left: 0;
  }

  .demo-grid .job-textarea {
    min-height: 190px;
  }
}

/* ── Document Studio workspace ──────────────────────────────── */
#view-analyze {
  max-width: 1540px;
  margin: 0 auto;
}

.view:not(#view-analyze) {
  max-width: 1080px;
  margin: 28px auto 0;
}

.analyze-topbar {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.workflow-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text3);
  font-size: 11px;
  font-weight: 700;
}

.workflow-state i {
  color: #aaa3b5;
  font-size: 12px;
}

.workflow-state-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(63, 125, 76, 0.1);
}

.analyze-topbar .auth-panel {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
  border-radius: 0;
  align-items: center;
  gap: 14px;
}

.auth-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text3);
  font-size: 11px;
  font-weight: 600;
}

.info-button {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 0;
  background: transparent;
  color: var(--text3);
  cursor: help;
}

.analyze-topbar .auth-form {
  width: auto;
  min-width: 0;
}

.analyze-topbar .google-login-btn {
  min-height: 39px;
  width: auto;
  padding: 8px 14px;
  background: var(--surface);
  border-radius: 8px;
}

.analyze-topbar .form-message {
  max-width: 220px;
}

.analyze-layout {
  display: grid;
  grid-template-columns: minmax(330px, 390px) minmax(560px, 1fr);
  gap: 24px;
  align-items: start;
}

.workflow-column {
  min-width: 0;
  padding: 4px 6px 24px 8px;
}

.workflow-column .view-header {
  margin-bottom: 26px;
}

.workflow-column .view-header .section-label {
  color: var(--accent);
  margin-bottom: 9px;
}

.workflow-column .view-header h1 {
  margin-bottom: 12px;
  color: #252540;
  font-family: var(--font-editorial);
  font-size: clamp(36px, 2.6vw, 38px);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.018em;
  word-spacing: 0.03em;
}

.workflow-column .view-header p {
  color: var(--text2);
  font-size: 13px;
  line-height: 1.7;
}

.workflow-step {
  position: relative;
  margin-bottom: 22px;
  padding-left: 41px;
}

.workflow-step:not(:last-child)::before {
  content: "";
  position: absolute;
  top: 34px;
  bottom: -17px;
  left: 15px;
  width: 1px;
  background: #ded8e5;
}

.step-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-left: -41px;
  margin-bottom: 12px;
}

.step-number {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.step-heading h2 {
  color: var(--text);
  font-family: var(--font-head);
  font-size: 14px;
  line-height: 1.3;
}

.step-heading p {
  margin-top: 2px;
  color: var(--text3);
  font-size: 11px;
  line-height: 1.4;
}

.workflow-column .resume-upload,
.workflow-column .url-form,
.workflow-column .profile-panel {
  background: var(--surface);
  border: 1px solid #e3dfe6;
  box-shadow: none;
}

.workflow-column .resume-upload {
  display: block;
  margin: 0;
  padding: 12px;
  border-radius: 9px;
}

.resume-upload-copy {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.resume-upload-copy > i {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--accent);
  font-size: 20px;
}

.resume-upload-copy > div {
  min-width: 0;
}

.resume-upload-copy .resume-status {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resume-upload-copy span {
  color: var(--text3);
  font-size: 10px;
}

.workflow-column .resume-upload-actions {
  justify-content: flex-start;
  gap: 7px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #eeeaf0;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.file-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid #d9d3de;
  border-radius: 8px;
  background: #faf9fb;
  color: var(--accent);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.workflow-column .btn-ghost {
  min-height: 34px;
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 11px;
}

.workflow-column .profile-panel {
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 9px;
}

.workflow-column .profile-heading {
  align-items: flex-start;
  margin-bottom: 9px;
}

.workflow-column .profile-actions {
  gap: 6px;
}

.workflow-column .profile-actions .btn-primary {
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 8px;
  box-shadow: none;
  font-size: 11px;
}

.workflow-column .profile-textarea {
  min-height: 130px;
}

.workflow-column .override-panel {
  margin: 9px 0 0;
  padding: 9px 11px;
  border-color: #e3dfe6;
  border-radius: 8px;
  background: #fbfafc;
}

.workflow-column .override-panel summary,
.provider-details summary {
  color: var(--accent);
  font-size: 11px;
}

.workflow-column .job-textarea.compact {
  min-height: 130px;
}

.workflow-column .url-form {
  margin: 0;
  padding: 10px;
  border-radius: 9px;
}

.workflow-column .analysis-mode {
  width: fit-content;
  min-width: 230px;
  margin: 0 0 9px;
  padding: 3px;
  border: 1px solid #e0dbe5;
  border-radius: 8px;
  background: #f8f6fa;
}

.workflow-column .analysis-mode .pill {
  min-height: 29px;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 10px;
}

.workflow-column .input-row {
  position: relative;
  margin: 0;
}

.input-icon {
  position: absolute;
  left: 12px;
  z-index: 1;
  color: var(--accent);
  font-size: 16px;
}

.workflow-column .url-input {
  height: 42px;
  padding-left: 38px;
  border: 1px solid #e1dce5;
  border-radius: 7px;
  background: var(--surface);
  font-size: 11px;
}

.workflow-column .job-text-panel {
  margin: 9px 0 0;
}

.workflow-column .form-row {
  gap: 8px;
  margin-bottom: 8px;
}

.workflow-column .text-input,
.workflow-column .job-textarea {
  border: 1px solid #e1dce5;
  border-radius: 7px;
  background: var(--surface);
  font-size: 11px;
}

.workflow-column .text-input {
  padding: 10px;
}

.workflow-column .job-textarea {
  min-height: 190px;
  padding: 11px;
  line-height: 1.55;
}

.provider-details {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid #eeeaf0;
}

.provider-details .provider-mode {
  gap: 5px;
  margin: 8px 0 0;
}

.provider-details .form-label {
  margin-right: 3px;
  font-size: 10px;
}

.provider-details .pill {
  min-height: 28px;
  padding: 5px 9px;
  font-size: 10px;
}

.privacy-step {
  margin-bottom: 0;
}

.workflow-column .access-notice {
  margin: 0 0 10px;
  padding: 10px;
  border-color: #dcd5e8;
  border-radius: 8px;
  background: #f8f5fd;
}

.privacy-note {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--accent);
  font-size: 10px;
}

.privacy-note i {
  font-size: 15px;
}

.workflow-column .access-notice .consent-row {
  margin: 8px 0 0;
  font-size: 10px;
  line-height: 1.45;
}

.consent-row input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.analyze-cta {
  width: 100%;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 9px;
  background: #6550a4;
  box-shadow: 0 12px 26px rgba(77, 57, 129, 0.17);
}

.analyze-cta i {
  font-size: 17px;
}

.cta-note {
  margin-top: 8px;
  color: var(--text3);
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

.analysis-stage {
  position: sticky;
  top: 28px;
  min-width: 0;
  min-height: calc(100vh - 108px);
  border: 1px solid #e2dde5;
  background: #f7f5f2;
  box-shadow: 0 22px 55px rgba(43, 38, 54, 0.08);
}

.document-toolbar {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid #e2dde5;
  background: rgba(255, 255, 255, 0.72);
}

.preview-tabs {
  display: inline-flex;
  padding: 3px;
  border: 1px solid #d8d2dc;
  border-radius: 8px;
  background: #faf9fb;
}

.preview-tabs button {
  min-height: 30px;
  padding: 6px 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text3);
  font-size: 10px;
  font-weight: 800;
}

.preview-tabs button.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 4px 12px rgba(44, 39, 58, 0.07);
}

.document-toolbar > span {
  color: var(--text3);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.empty-stage-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 16px;
  padding: 20px;
}

.resume-preview {
  min-height: calc(100vh - 213px);
  padding: clamp(30px, 5vw, 58px);
  border: 1px solid #ded9df;
  background: var(--surface);
  box-shadow: 0 13px 28px rgba(47, 42, 55, 0.08);
}

.preview-eyebrow {
  margin-bottom: 18px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.13em;
}

.resume-preview h2 {
  max-width: 560px;
  color: #252540;
  font-family: var(--font-editorial);
  font-size: clamp(29px, 2.5vw, 38px);
  font-weight: 400;
  line-height: 1.13;
  letter-spacing: -0.015em;
}

.preview-lede {
  max-width: 610px;
  margin-top: 18px;
  padding-bottom: 30px;
  border-bottom: 2px solid #7a64b6;
  color: var(--text2);
  font-size: 13px;
  line-height: 1.75;
}

.preview-section {
  margin-top: 31px;
}

.preview-section > span {
  display: block;
  margin-bottom: 13px;
  color: var(--text);
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.11em;
}

.preview-section ul {
  display: grid;
  gap: 10px;
  list-style: none;
}

.preview-section li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text2);
  font-size: 12px;
}

.preview-section li i {
  color: var(--green);
  font-size: 16px;
}

.preview-section p {
  max-width: 610px;
  color: var(--text2);
  font-size: 12px;
  line-height: 1.7;
}

.insight-preview {
  align-self: start;
  padding: 18px;
  border: 1px solid #e0dbe2;
  background: rgba(255, 255, 255, 0.8);
}

.preview-score {
  display: flex;
  align-items: center;
  gap: 10px;
}

.preview-score > i {
  color: var(--green);
  font-size: 36px;
}

.preview-score div {
  display: grid;
  gap: 2px;
}

.preview-score strong {
  font-family: var(--font-head);
  font-size: 12px;
}

.preview-score span {
  color: var(--text3);
  font-size: 9px;
}

.insight-rule {
  height: 1px;
  margin: 16px 0;
  background: #e6e1e5;
}

.insight-preview h3 {
  color: var(--text);
  font-family: var(--font-head);
  font-size: 13px;
  line-height: 1.35;
}

.insight-preview ol {
  display: grid;
  gap: 12px;
  margin-top: 15px;
  list-style: none;
}

.insight-preview li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text2);
  font-size: 10px;
  line-height: 1.35;
}

.insight-preview li span {
  display: grid;
  place-items: center;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--accent);
  font-weight: 800;
}

.no-paywall-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid #e6e1e5;
  color: var(--text3);
  font-size: 9px;
  line-height: 1.45;
}

.no-paywall-note i {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 15px;
}

#analyze-loading {
  min-height: calc(100vh - 108px);
  justify-content: center;
  padding: 48px;
}

#analyze-loading strong {
  display: block;
  color: var(--text);
  font-family: var(--font-head);
  font-size: 15px;
}

#analyze-loading p {
  margin-top: 3px;
  color: var(--text3);
  font-size: 11px;
}

#analyze-loading:not(.hidden) ~ .analysis-empty,
#analyze-result:not(.hidden) ~ .analysis-empty {
  display: none;
}

#analyze-result {
  padding: 18px;
}

#analyze-result .result-card {
  border: 1px solid #ded9df;
  border-radius: 0;
  background: var(--surface);
  box-shadow: 0 13px 28px rgba(47, 42, 55, 0.08);
}

#analyze-result .result-header {
  padding: 24px;
  background: #fbfaf8;
}

#analyze-result .result-job-info h2 {
  color: #252540;
  font-family: var(--font-editorial);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.01em;
}

#analyze-result .result-tabs {
  padding: 10px 18px;
  background: var(--surface);
}

#analyze-result .tab-btn {
  border-radius: 7px;
  font-size: 11px;
}

#analyze-result .result-body {
  padding: 24px;
}

#analyze-result .tailored-resume-actions {
  border-color: #dcd5e5;
  background: #f8f5fd;
}

#analyze-result .tailored-resume-actions .btn-primary {
  border-radius: 8px;
  box-shadow: none;
}

@media (max-width: 1180px) {
  .analyze-layout {
    grid-template-columns: 350px minmax(470px, 1fr);
  }

  .empty-stage-grid {
    grid-template-columns: 1fr;
  }

  .insight-preview {
    display: none;
  }
}

@media (max-width: 980px) {
  .main {
    width: calc(100% - var(--sidebar-w));
    padding: 24px 22px 56px;
  }

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

  .analysis-stage {
    position: static;
    min-height: 680px;
  }

  .resume-preview {
    min-height: 600px;
  }
}

@media (max-width: 860px) {
  .main {
    width: min(100%, 760px);
    margin: 0 auto;
    padding: 88px 16px 112px;
  }

  .analyze-topbar {
    align-items: stretch;
    flex-direction: column-reverse;
    margin-bottom: 18px;
  }

  .sidebar-footer {
    display: none;
  }

  .workflow-state {
    justify-content: center;
  }

  .analyze-topbar .auth-panel {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border: 1px solid #e3dfe6;
    border-radius: 10px;
    background: var(--surface);
  }

  .analyze-topbar .google-login-btn {
    width: 100%;
  }

  .workflow-column {
    padding: 0;
  }

  .workflow-column .view-header h1 {
    font-size: clamp(40px, 11vw, 50px);
  }

  .analysis-stage {
    min-height: 560px;
  }

  .document-toolbar {
    padding: 10px 12px;
  }

  .empty-stage-grid {
    padding: 10px;
  }

  .resume-preview {
    min-height: 520px;
    padding: 28px 22px;
  }

  #analyze-result {
    padding: 10px;
  }
}

@media (max-width: 520px) {
  .workflow-state {
    display: none;
  }

  .workflow-column .view-header .section-label {
    display: none;
  }

  .workflow-step {
    padding-left: 37px;
  }

  .step-heading {
    margin-left: -37px;
  }

  .resume-upload-actions {
    align-items: stretch;
  }

  .file-picker,
  .workflow-column .resume-upload-actions .btn-ghost {
    flex: 1;
  }

  .workflow-column .analysis-mode {
    width: 100%;
    min-width: 0;
  }

  .workflow-column .form-row {
    align-items: stretch;
    flex-direction: column;
  }

  .workflow-column .text-input.small {
    flex-basis: auto;
  }

  .resume-preview h2 {
    font-size: 30px;
  }
}
