/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
  --blue:        #0084D1;
  --blue-dark:   #006aaa;
  --blue-light:  #e8f4fc;
  --success:     #2e7d52;
  --warning:     #b45309;
  --danger:      #b91c1c;
  --ghosted:     #6b7280;
  --bg:          #f0f4f8;
  --surface:     #ffffff;
  --border:      #e2e8f0;
  --text:        #1a202c;
  --text-secondary: #4a5568;
  --muted:       #718096;
  --shadow:      0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:   0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
  --radius:      8px;
  --radius-sm:   5px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ────────────────────────────────────────────────────────────── */
.navbar {
  background: #1a202c;
  display: flex;
  align-items: center;
  padding: 0 2rem;
  height: 56px;
  gap: 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.nav-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 0.25rem;
}

.nav-links a {
  display: block;
  padding: 0.4rem 0.85rem;
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}

.nav-links a:hover  { color: #fff; background: rgba(255,255,255,0.08); }
.nav-links a.active { color: #fff; background: var(--blue); }

/* ── Container ─────────────────────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Page Header ───────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.75rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-title    { font-size: 1.6rem; font-weight: 700; color: var(--text); }
.page-subtitle { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
.header-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.card-title { font-size: 1rem; font-weight: 600; }

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary   { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover:not(:disabled) { background: var(--blue-dark); border-color: var(--blue-dark); text-decoration: none; }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--bg); text-decoration: none; }

.btn-danger    { background: #fee2e2; color: var(--danger); border-color: #fca5a5; }
.btn-danger:hover:not(:disabled) { background: #fecaca; text-decoration: none; }

.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }

/* ── Forms ─────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,132,209,0.12);
}

textarea.form-control { resize: vertical; min-height: 80px; }

/* ── Table ─────────────────────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th {
  text-align: left;
  padding: 0.65rem 1rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

/* ── Badges ────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-applied      { background: var(--blue-light);   color: var(--blue); }
.badge-interviewing { background: #fef3c7;              color: var(--warning); }
.badge-offer        { background: #d1fae5;              color: var(--success); }
.badge-rejected     { background: #fee2e2;              color: var(--danger); }
.badge-ghosted      { background: #f3f4f6;              color: var(--ghosted); }

.badge-select {
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  appearance: auto;
}

/* ── Status filter tabs ────────────────────────────────────────────────── */
.filter-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.filter-tab:hover  { background: var(--bg); }
.filter-tab.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ── Modal ─────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.modal-title { font-size: 1.05rem; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--muted);
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}
.modal-close:hover { background: var(--bg); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ── JSON editor ───────────────────────────────────────────────────────── */
.json-editor {
  width: 100%;
  height: 420px;
  font-family: "Cascadia Code", "Fira Mono", Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.55;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  resize: vertical;
  color: var(--text);
  background: #fafafa;
}

.json-editor:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,132,209,0.1);
}

/* ── Dashboard stats ───────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 1.1rem 1rem;
  text-align: center;
}

.stat-value { font-size: 2rem; font-weight: 700; line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Two-col layout ────────────────────────────────────────────────────── */
.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

/* ── Quick actions ─────────────────────────────────────────────────────── */
.quick-actions { display: flex; flex-direction: column; gap: 0.5rem; }

.quick-action-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: background 0.12s, box-shadow 0.12s;
}

.quick-action-item:hover { background: var(--bg); box-shadow: var(--shadow); text-decoration: none; }
.quick-action-icon { font-size: 1.35rem; flex-shrink: 0; }
.quick-action-title { font-size: 0.9rem; font-weight: 600; }
.quick-action-desc  { font-size: 0.8rem; color: var(--muted); }

/* ── Resume view ───────────────────────────────────────────────────────── */
.resume-view {
  display: flex;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  overflow: hidden;
  min-height: 600px;
}

.rv-sidebar {
  width: 30%;
  background: var(--blue);
  color: #fff;
  padding: 1.75rem 1.25rem;
  flex-shrink: 0;
}

.rv-main {
  flex: 1;
  padding: 1.75rem 2rem;
}

.rv-photo-wrap { text-align: center; margin-bottom: 1rem; }

.rv-photo {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255,255,255,0.4);
}

.rv-photo-placeholder {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.6);
}

.rv-section { margin-bottom: 1.25rem; }

.rv-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: rgba(255,255,255,0.6);
  border-bottom: 1px solid rgba(255,255,255,0.2);
  padding-bottom: 4px;
  margin-bottom: 8px;
}

.rv-main .rv-section-title {
  font-size: 0.85rem;
  color: var(--blue);
  border-color: var(--blue);
  border-bottom-width: 2px;
  margin-bottom: 10px;
}

.rv-contact-item {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.85);
  margin-bottom: 4px;
  word-break: break-word;
}

.rv-contact-item a { color: rgba(255,255,255,0.85); text-decoration: underline; }

.rv-skill {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.88);
  padding: 2px 0 2px 10px;
  position: relative;
  margin-bottom: 3px;
}

.rv-skill::before { content: "▸"; position: absolute; left: 0; color: rgba(255,255,255,0.45); }

.rv-vol-item { margin-bottom: 0.75rem; }
.rv-vol-org  { font-size: 0.85rem; font-weight: 700; color: #fff; }
.rv-vol-meta { font-size: 0.75rem; color: rgba(255,255,255,0.6); margin-bottom: 3px; }
.rv-vol-desc { font-size: 0.78rem; color: rgba(255,255,255,0.82); }
.rv-vol-desc ul { padding-left: 14px; }
.rv-vol-desc li { margin-bottom: 2px; }

.rv-name     { font-size: 1.6rem; font-weight: 700; line-height: 1.2; margin-bottom: 2px; }
.rv-headline { font-size: 0.95rem; color: var(--blue); margin-bottom: 0.75rem; }

.rv-summary {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  border-left: 3px solid var(--blue);
  padding-left: 10px;
  margin-bottom: 1.25rem;
}

.rv-exp-item    { margin-bottom: 1rem; }
.rv-exp-header  { display: flex; justify-content: space-between; align-items: baseline; }
.rv-exp-company { font-size: 1rem; font-weight: 700; }
.rv-exp-period  { font-size: 0.8rem; color: var(--muted); }
.rv-exp-position { font-size: 0.9rem; font-weight: 600; color: var(--blue); margin-top: 1px; }
.rv-exp-location { font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.rv-exp-desc ul  { padding-left: 16px; margin-top: 4px; }
.rv-exp-desc li  { font-size: 0.875rem; margin-bottom: 3px; color: var(--text-secondary); }

.rv-role-item   { margin: 6px 0 6px 8px; padding-left: 10px; border-left: 2px solid var(--border); }
.rv-role-header { display: flex; justify-content: space-between; align-items: baseline; }
.rv-role-position { font-size: 0.875rem; font-weight: 600; color: var(--blue); }

.rv-edu-item   { margin-bottom: 0.6rem; }
.rv-edu-school { font-size: 0.95rem; font-weight: 700; }
.rv-edu-degree { font-size: 0.875rem; color: var(--text-secondary); }
.rv-edu-meta   { font-size: 0.8rem; color: var(--muted); }

/* ── Tailor page ───────────────────────────────────────────────────────── */
.analysis-block { margin-bottom: 1rem; }

.analysis-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.keyword-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.chip {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: #e2e8f0;
  color: var(--text-secondary);
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
}

.keyword-list.incorporated .chip {
  background: var(--blue-light);
  color: var(--blue);
}

/* ── Spinner ───────────────────────────────────────────────────────────── */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

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

/* ── Toast ─────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: #fff;
  background: #1a202c;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 2000;
  max-width: 320px;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }

/* ── Utility ───────────────────────────────────────────────────────────── */
.text-muted    { color: var(--muted); }
.text-secondary { color: var(--text-secondary); }
.link-muted    { font-size: 0.85rem; color: var(--muted); }
.link-primary  { color: var(--blue); font-size: 0.875rem; }
.empty-state   { color: var(--muted); font-size: 0.9rem; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .stats-grid      { grid-template-columns: repeat(3, 1fr); }
  .two-col-grid    { grid-template-columns: 1fr; }
  .resume-view     { flex-direction: column; }
  .rv-sidebar      { width: 100%; }
}

@media (max-width: 600px) {
  .stats-grid      { grid-template-columns: repeat(2, 1fr); }
  .container       { padding: 1rem; }
  .navbar          { padding: 0 1rem; gap: 1rem; }
  .page-header     { flex-direction: column; }
}
