:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --accent: #2563eb;
  --accent-light: #eff6ff;
  --accent-2: #0891b2;
  --muted: #64748b;
  --text: #1e293b;
  --text-light: #475569;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.04);
  --radius: 16px;
  --radius-sm: 10px;
  --success: #059669;
  --success-bg: #ecfdf5;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --info: #2563eb;
  --info-bg: #eff6ff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Password overlay ─────────────────────────────────── */
#password-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(15, 23, 42, .65);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.password-box {
  background: var(--card);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 100%; max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  text-align: center;
}
.password-box .pw-logo {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  font-weight: 800; font-size: 16px; color: #fff;
  margin: 0 auto 20px;
}
.password-box h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.password-box p  { font-size: 13px; color: var(--muted); margin-bottom: 24px; }
.password-box input[type="password"] {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 15px; font-family: inherit; color: var(--text);
  margin-bottom: 12px;
  transition: border-color .15s;
}
.password-box input[type="password"]:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}
.password-error {
  font-size: 13px; color: #dc2626;
  min-height: 18px; margin-bottom: 8px;
}

/* ── Top bar ──────────────────────────────────────────── */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 14px 32px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-sm);
  position: sticky; top: 0; z-index: 100;
}
.topbar-logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center;
  font-weight: 800; font-size: 13px; color: #fff; flex-shrink: 0;
}
.topbar h1 { font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.topbar p  { font-size: 13px; color: var(--muted); }

/* ── Shell ────────────────────────────────────────────── */
.shell { max-width: 1180px; margin: 28px auto 80px; padding: 0 24px; }

/* ── Stepper ──────────────────────────────────────────── */
.stepper {
  display: flex; align-items: center;
  margin-bottom: 24px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 24px;
  box-shadow: var(--shadow-sm);
}
.step { display: flex; align-items: center; gap: 10px; flex: 1; position: relative; }
.step:not(:last-child)::after {
  content: ''; flex: 1; height: 2px;
  background: var(--border); margin: 0 16px; border-radius: 2px;
}
.step:not(:last-child).done::after { background: var(--accent); }
.step-num {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--border-light); border: 2px solid var(--border);
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color: var(--muted); flex-shrink: 0;
  transition: all .3s;
}
.step.active .step-num { background: var(--accent); border-color: var(--accent); color: #fff; }
.step.done   .step-num { background: var(--success); border-color: var(--success); color: #fff; }
.step-label  { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.step.active .step-label { color: var(--accent); }
.step.done   .step-label { color: var(--success); }

/* ── Grid ─────────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }

/* ── Cards ────────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}
.card-title    { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.card-subtitle { font-size: 13px; color: var(--muted); margin-bottom: 16px; }

/* ── Upload drop zone ────────────────────────────────── */
.drop {
  border: 2px dashed var(--border); border-radius: var(--radius-sm);
  padding: 32px 20px; text-align: center;
  transition: border-color .2s, background .2s;
  cursor: pointer; background: var(--border-light);
}
.drop:hover { border-color: var(--accent); background: var(--accent-light); }
.drop-icon { font-size: 32px; margin-bottom: 8px; }
.drop p    { font-size: 14px; font-weight: 500; color: var(--text-light); }
.drop small{ font-size: 12px; color: var(--muted); }
input[type="file"] { display: none; }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: none; color: #fff;
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px; font-family: inherit;
  cursor: pointer; width: 100%;
  transition: transform .1s, box-shadow .2s, opacity .2s;
  box-shadow: 0 4px 12px rgba(37,99,235,.2);
}
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(37,99,235,.25); }

.btn-outline {
  background: transparent; border: 1px solid var(--border);
  color: var(--text); padding: 10px 16px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 13px; font-family: inherit;
  cursor: pointer; transition: all .15s; width: auto;
}
.btn-outline:hover  { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.btn-outline.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Form elements ────────────────────────────────────── */
label.form-label { display: block; font-weight: 600; font-size: 13px; margin: 12px 0 5px; color: var(--text-light); }
input[type="text"], textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  font-size: 14px; font-family: inherit; transition: border-color .15s;
}
input[type="text"]:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}
textarea { min-height: 80px; resize: vertical; }

/* ── Status / loader ──────────────────────────────────── */
.status  { margin-top: 12px; color: var(--muted); font-size: 13px; }
.loader  { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-size: 14px; font-weight: 500; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(37,99,235,.15); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Analysis panel ───────────────────────────────────── */
.analysis-panel { display: none; }
.analysis-panel.visible { display: block; }
.analysis-section {
  background: var(--border-light); border-radius: var(--radius-sm);
  padding: 16px; margin-bottom: 12px;
}
.analysis-section:last-child { margin-bottom: 0; }
.analysis-section h4 { font-size: 13px; font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.analysis-section p  { font-size: 13px; line-height: 1.6; color: var(--text-light); }
.analysis-section ul { list-style: none; padding: 0; }
.analysis-section li { font-size: 13px; color: var(--text-light); padding: 4px 0 4px 20px; position: relative; line-height: 1.5; }
.analysis-section li::before { content: ''; position: absolute; left: 4px; top: 11px; width: 6px; height: 6px; border-radius: 50%; }
.missing-list  li::before { background: var(--warning); }
.suggest-list  li::before { background: var(--accent); }

/* ── Suggestion cards ─────────────────────────────────── */
.suggestion-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px; margin-bottom: 8px;
}
.suggestion-card:last-child { margin-bottom: 0; }
.suggestion-card .sg-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  color: var(--accent); letter-spacing: .4px; margin-bottom: 4px;
}
.suggestion-card .sg-value  { font-size: 13px; color: var(--text-light); line-height: 1.5; margin-bottom: 10px; white-space: pre-wrap; }
.suggestion-card .sg-actions{ display: flex; gap: 8px; }
.sg-btn { padding: 5px 14px; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; border: none; transition: opacity .15s; }
.sg-btn:hover { opacity: .85; }
.sg-btn-apply   { background: var(--accent); color: #fff; }
.sg-btn-dismiss { background: var(--border-light); color: var(--muted); border: 1px solid var(--border); }
.suggestion-card.applied  { opacity: .5; pointer-events: none; }
.suggestion-card.applied .sg-actions { display: none; }
.suggestion-card.applied .sg-label::after { content: ' — Applied'; color: var(--success); text-transform: none; font-weight: 600; letter-spacing: 0; }
.suggestion-card.dismissed { display: none; }

.tag-missing {
  display: inline-block;
  background: var(--warning-bg); color: var(--warning);
  font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px; margin: 2px 4px 2px 0;
}

/* ── Skills toggle ────────────────────────────────────── */
.skills-toggle-bar {
  display: none;
  background: var(--info-bg); border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm); padding: 12px 16px;
  margin-bottom: 10px; align-items: center; gap: 12px;
}
.skills-toggle-bar.visible { display: flex; flex-wrap: wrap; }
.skills-toggle-bar p { font-size: 13px; color: var(--accent); font-weight: 500; flex: 1; min-width: 200px; }
.toggle-group {
  display: flex; border-radius: 8px; overflow: hidden; border: 1px solid var(--border);
}
.toggle-group .btn-outline { border-radius: 0; border: none; padding: 7px 14px; font-size: 12px; }
.toggle-group .btn-outline:first-child { border-right: 1px solid var(--border); }

/* ── Section title ────────────────────────────────────── */
.section-title {
  font-size: 14px; font-weight: 700;
  margin: 20px 0 8px; display: flex; align-items: center; gap: 6px;
}
.section-title:first-child { margin-top: 0; }

/* ── Array items ──────────────────────────────────────── */
.array-item {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px; margin-bottom: 10px;
  background: var(--border-light); position: relative;
}
.btn-delete {
  background: #fee2e2; border: none; color: #dc2626;
  width: 26px; height: 26px; border-radius: 6px;
  cursor: pointer; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0; margin-left: 6px; vertical-align: middle; transition: background .15s;
}
.btn-delete:hover { background: #fecaca; }
.btn-delete-item  { position: absolute; top: 10px; right: 10px; }
.detail-row { display: flex; align-items: center; margin-bottom: 6px; }
.detail-row input { flex: 1; }
.btn-small  { padding: 8px 14px; font-size: 12px; width: auto; display: inline-block; margin-right: 6px; }
.two-col    { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Success box ──────────────────────────────────────── */
.success-box {
  margin-top: 16px; padding: 32px; text-align: center;
  border: 1px solid #a7f3d0; border-radius: var(--radius-sm);
  background: var(--success-bg);
}
.success-box .check { color: var(--success); font-size: 18px; font-weight: 700; }
.success-box .sub   { color: var(--muted); font-size: 13px; margin-top: 8px; }

/* ── Language radio ───────────────────────────────────── */
.lang-selector { display: flex; gap: 16px; margin-bottom: 14px; }
.lang-selector label { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; color: var(--text-light); cursor: pointer; }
.lang-selector input[type="radio"] { accent-color: var(--accent); }
.lang-hint { font-size: 12px; color: var(--muted); margin-top: -8px; margin-bottom: 14px; }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 900px) {
  .grid       { grid-template-columns: 1fr; }
  .shell      { margin-top: 20px; }
  .stepper    { flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; }
  .step:not(:last-child)::after { display: none; }
}
