/* ── Design tokens ─────────────────────────────────────────────────────────── */

/* Dark (default) */
:root, [data-theme="dark"] {
  --blue:       #60a5fa;
  --blue-dark:  #3b82f6;
  --blue-pale:  #1e293b;
  --blue-mid:   #1e3a5f;
  --indigo:     #818cf8;

  --green:      #4ade80;
  --green-pale: #052e16;
  --amber:      #fbbf24;
  --red:        #f87171;
  --red-pale:   #450a0a;

  --text:       #e2e8f0;
  --text-2:     #94a3b8;
  --text-3:     #64748b;

  --bg:         #0f1117;
  --bg-card:    #1a1d27;
  --border:     #2a2d3a;
  --border-2:   #1e2130;

  --shadow-xs:  0 1px 2px rgba(0,0,0,.3);
  --shadow-sm:  0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow-md:  0 4px 6px -1px rgba(0,0,0,.4), 0 2px 4px -2px rgba(0,0,0,.3);
  --shadow-lg:  0 10px 15px -3px rgba(0,0,0,.4), 0 4px 6px -4px rgba(0,0,0,.3);
  --shadow-blue: 0 0 0 3px rgba(96,165,250,.25);

  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  14px;
  --radius-xl:  18px;

  --ease:       cubic-bezier(.4,0,.2,1);
  --fast:       120ms;
  --normal:     200ms;
}

[data-theme="light"] {
  --blue:       #2563eb;
  --blue-dark:  #1d4ed8;
  --blue-pale:  #eff6ff;
  --blue-mid:   #dbeafe;
  --indigo:     #4f46e5;

  --green:      #16a34a;
  --green-pale: #f0fdf4;
  --amber:      #d97706;
  --red:        #dc2626;
  --red-pale:   #fef2f2;

  --text:       #0f172a;
  --text-2:     #475569;
  --text-3:     #94a3b8;

  --bg:         #f1f5f9;
  --bg-card:    #ffffff;
  --border:     #e2e8f0;
  --border-2:   #f1f5f9;

  --shadow-xs:  0 1px 2px rgba(15,23,42,.06);
  --shadow-sm:  0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.05);
  --shadow-md:  0 4px 6px -1px rgba(15,23,42,.08), 0 2px 4px -2px rgba(15,23,42,.05);
  --shadow-lg:  0 10px 15px -3px rgba(15,23,42,.08), 0 4px 6px -4px rgba(15,23,42,.05);
  --shadow-blue: 0 0 0 3px rgba(37,99,235,.15);
}

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

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* ── App shell ─────────────────────────────────────────────────────────────── */
.app { display: flex; flex-direction: column; min-height: 100vh; }
.main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 28px;
  width: 100%;
}

/* ── Nav ───────────────────────────────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1.5rem;
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 60%, var(--indigo) 100%);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,.3);
}

.nav-brand {
  font-weight: 800;
  font-size: 1.1rem;
  color: #fff;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-brand:hover { text-decoration: none; opacity: .9; }
.nav-brand-icon { width: 28px; height: 28px; border-radius: 6px; }

.nav-links { display: flex; gap: 2px; min-width: 0; overflow: hidden; }

.nav-link {
  padding: 6px 14px;
  border-radius: 999px;
  color: rgba(255,255,255,.75);
  font-size: 0.88rem;
  font-weight: 500;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.nav-link:hover {
  background: rgba(255,255,255,.15);
  color: #fff;
  text-decoration: none;
}
.nav-link-active {
  background: rgba(255,255,255,.22);
  color: #fff;
  font-weight: 600;
}

.nav-toggles {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.5rem;
  flex-shrink: 0;
}
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.5rem;
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 6px;
  background: transparent;
  color: rgba(255,255,255,.85);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
  min-width: 32px;
  transition: all 0.15s;
}
.nav-toggle:hover {
  color: #fff;
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.4);
}

.page-back-row {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}
.page-back-link {
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--blue);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.page-back-link:hover {
  background: var(--blue-pale);
  border-color: var(--blue-mid);
  text-decoration: none;
}

/* ── Page ──────────────────────────────────────────────────────────────────── */
.page { max-width: 980px; margin: 0 auto; }

.page-header { margin-bottom: 32px; }
.page-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text) 0%, var(--blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.subtitle { color: var(--text-2); margin-top: 6px; font-size: 0.95rem; }
.row-between { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.header-actions { display: flex; gap: 8px; align-items: center; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: 999px;
  border: none;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--normal) var(--ease);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  letter-spacing: .01em;
}
.btn:disabled, .btn-disabled {
  opacity: .4;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--blue) 0%, var(--indigo) 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,.35);
}
.btn-primary:hover {
  box-shadow: 0 4px 14px rgba(37,99,235,.45);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  background: var(--bg);
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.btn-outline {
  background: transparent;
  color: var(--blue);
  border: 1.5px solid var(--blue);
}
.btn-outline:hover {
  background: var(--blue-pale);
  box-shadow: var(--shadow-blue);
}

.btn-lg { padding: 12px 28px; font-size: 0.95rem; }
.btn-full { width: 100%; }

.mode-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.mode-btn {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg);
  border: none;
  border-right: 1px solid var(--border);
  color: var(--text-3);
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.mode-btn:last-child { border-right: none; }
.mode-btn:hover { background: var(--bg-hover, #1a2332); color: var(--text-2); }
.mode-btn.active {
  background: var(--blue-pale);
  color: var(--blue);
  font-weight: 600;
}

.btn-text {
  background: none;
  border: none;
  color: var(--blue);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px 0;
  font-weight: 500;
}
.btn-text:hover { text-decoration: underline; }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  color: var(--text-3);
  font-size: 1rem;
  border-radius: var(--radius-sm);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.btn-icon:hover { background: var(--red-pale); color: var(--red); }
.btn-icon:disabled {
  color: var(--text-4, #4a5568);
  cursor: not-allowed;
}
.btn-icon:disabled:hover { background: none; color: var(--text-4, #4a5568); }

.btn-edit {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  color: var(--text-3);
  font-size: 1rem;
  border-radius: var(--radius-sm);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.btn-edit:hover { background: var(--blue-pale); color: var(--blue); }

.btn-edit-sm {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 5px;
  color: var(--text-3);
  font-size: 0.82rem;
  line-height: 1;
  border-radius: 4px;
  transition: color var(--fast);
}
.btn-edit-sm:hover { color: var(--blue); }

.btn-icon-sm {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 5px;
  color: var(--text-3);
  font-size: 0.82rem;
  line-height: 1;
  border-radius: 4px;
  transition: color var(--fast);
}
.btn-icon-sm:hover { color: var(--red); }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}
.form-section h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}
.lang-edit-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 10px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-2, #eef2ff);
  color: var(--primary, #4f46e5);
  vertical-align: middle;
}
.form-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text-2);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-top: 18px;
}
.form-row-tight { gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-btn { justify-content: flex-end; }

.label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.required { color: var(--red); }
.hint { color: var(--text-2); font-size: 0.875rem; margin-bottom: 18px; line-height: 1.6; }
.model-load-status { margin-top: 6px; margin-bottom: 12px; }
.model-load-status .hint { margin-bottom: 8px; }
.hint-success { color: var(--green, #2e7d32); }
.hint-error { color: var(--red, #c62828); }

.input {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg-card);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
  width: 100%;
  font-family: inherit;
}
.input::placeholder { color: var(--text-3); }
.input:hover { border-color: #cbd5e1; }
.input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: var(--shadow-blue);
}

.textarea { resize: vertical; min-height: 88px; line-height: 1.6; }

/* Month + year CV date picker (replaces free-text date entry — see
   services::cv_date). Month/year selects share the row; the "Present"
   checkbox, when shown, sits after them and disables both when checked. */
.date-picker-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.date-picker-month { flex: 1.3 1 0; min-width: 108px; }
.date-picker-year { flex: 1 1 0; min-width: 84px; }
.date-picker-present {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-2);
  white-space: nowrap;
}
.date-picker-present input[type="checkbox"] { margin: 0; accent-color: var(--blue); }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.inline-form {
  margin-top: 20px;
  background: var(--bg);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}
.inline-form-compact { padding: 16px; }
.inline-form h3 { margin-bottom: 14px; }

.form-actions { display: flex; gap: 10px; margin-top: 18px; }
.form-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border-2);
}

.bullet-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bullet-dot { color: var(--blue); font-size: 1.2rem; flex-shrink: 0; }

/* Bold-toggle "B" button paired with a boldable input/textarea (see
   BoldableField/BoldableTextarea in cv_editor.rs). Sits flush against the
   field so it reads as one control, not two. */
.boldable-field { display: flex; align-items: stretch; gap: 6px; flex: 1; min-width: 0; }
.boldable-field .input { flex: 1; min-width: 0; }
.boldable-field-textarea { align-items: flex-start; }
.btn-bold {
  flex-shrink: 0;
  align-self: center;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-2);
}
.boldable-field-textarea .btn-bold { align-self: flex-start; margin-top: 2px; }
.btn-bold:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-pale, #eff6ff); }
.btn-bold strong { font-size: 0.85rem; }

.subsection { margin-top: 28px; padding-top: 28px; border-top: 1px solid var(--border-2); }
.subsection:first-child { margin-top: 0; padding-top: 0; border-top: none; }

/* ── Steps progress ────────────────────────────────────────────────────────── */
.steps {
  display: flex;
  margin-bottom: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background var(--fast) var(--ease);
  border-right: 1px solid var(--border);
  position: relative;
}
.step:last-child { border-right: none; }
.step:hover { background: var(--bg); }

.step-active {
  background: linear-gradient(135deg, var(--blue-pale), var(--blue-mid));
}
.step-active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--indigo));
}

.step-done { background: var(--bg); }

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-2);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.step-active .step-num {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,.4);
}
.step-done .step-num {
  background: var(--green);
  color: #fff;
}
.step-done .step-num::before { content: '✓'; font-size: 0.8rem; }

.step-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.step-active .step-label { color: var(--blue); font-weight: 700; }
.step-done .step-label { color: var(--text-2); }

.editor-body { margin-bottom: 16px; }

/* ── Item list ─────────────────────────────────────────────────────────────── */
.item-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }

.item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  gap: 12px;
  transition: box-shadow var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.item-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.btn-move {
  cursor: pointer;
  color: var(--text-2);
  font-size: 0.85rem;
  flex-shrink: 0;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.btn-move:hover { background: var(--bg-hover, #f1f5f9); color: var(--text); }

.project-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
}
.project-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.item-card-body { flex: 1; min-width: 0; }
.item-title {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.item-sub { font-size: 0.8rem; color: var(--text-2); margin-top: 2px; }
.item-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }

/* ── Experience drill-down ──────────────────────────────────────────────────── */
.drill { display: flex; flex-direction: column; gap: 14px; }
.drill-missing { padding: 12px 0; }
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.85rem;
}
.breadcrumb-crumb { color: var(--blue); font-weight: 600; padding: 0; }
.breadcrumb-sep { color: var(--text-3); user-select: none; }
.breadcrumb-current { color: var(--text-2); font-weight: 500; }
.clickable { cursor: pointer; }
.clickable:hover .item-title { color: var(--blue); }
.count-badge { margin-left: 8px; }
.exp-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 13px 16px;
}
.exp-meta .item-title { flex: 1; min-width: 0; font-size: 1rem; }
.exp-meta .item-sub { flex-basis: 100%; }
.project-list { margin-bottom: 10px; }
.item-project-context {
  font-size: 0.8rem;
  color: var(--text-2);
  margin-top: 4px;
  line-height: 1.5;
}
.project-detail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.project-detail .item-title { white-space: normal; font-size: 1rem; }

/* ── Skill chips ───────────────────────────────────────────────────────────── */
.skill-group { margin-bottom: 14px; }
.skill-group-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  margin-bottom: 8px;
  display: inline-block;
  margin-right: 8px;
}
.skill-group-total {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--blue);
  background: linear-gradient(135deg, var(--blue-pale), var(--blue-mid));
  border: 1px solid var(--blue-mid);
  border-radius: 999px;
  padding: 1px 8px;
  vertical-align: 1px;
}
.skill-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.skill-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  background: linear-gradient(135deg, var(--blue-pale), var(--blue-mid));
  border: 1px solid var(--blue-mid);
  border-radius: 999px;
  font-size: 0.83rem;
  font-weight: 500;
  transition: box-shadow var(--fast);
}
.skill-chip:hover { box-shadow: 0 2px 8px rgba(37,99,235,.15); }
.chip-level { font-size: 0.72rem; color: var(--text-3); }
.chip-years {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--blue);
  background: var(--bg);
  border: 1px solid var(--blue-mid);
  border-radius: 999px;
  padding: 0 6px;
  white-space: nowrap;
}
.skill-picker { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 6px; }
.skill-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  transition: background var(--fast), border-color var(--fast);
}
.skill-check:hover { background: var(--bg-hover, #f1f5f9); border-color: var(--blue); }
.skill-check input[type="checkbox"] { margin: 0; accent-color: var(--blue); }
.skill-check-name { font-weight: 500; }
.skill-check-cat { font-size: 0.72rem; color: var(--text-3); }

/* ── Skill experience summary ──────────────────────────────────────────────── */
.skill-summary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.skill-summary summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text-1);
  font-size: 0.85rem;
}
.skill-summary-body { margin-top: 10px; }
.skill-summary .item-list { margin-top: 8px; }
.skill-group-summary {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}
.skill-bars {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.skill-bar-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}
.skill-bar-row-name { font-size: 0.8rem; font-weight: 600; }
.skill-bar {
  background: var(--border);
  border-radius: 999px;
  height: 7px;
  overflow: hidden;
}
.skill-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--blue-dark, #1d4ed8));
  transition: width var(--fast);
}
.skill-untagged {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--text-3);
}
/* ── Tags ──────────────────────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  background: var(--blue-pale);
  color: var(--blue);
  letter-spacing: .01em;
}
.tag-small {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 500;
}
.tag-matched {
  background: var(--green-pale);
  color: var(--green);
  border: 1px solid rgba(74,222,128,.3);
}
.tag-missing {
  background: var(--red-pale);
  color: var(--red);
  border: 1px solid rgba(248,113,113,.3);
}

/* ── Home page ─────────────────────────────────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--normal) var(--ease), transform var(--normal) var(--ease);
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-icon { font-size: 2rem; flex-shrink: 0; }
.card-body { flex: 1; min-width: 0; }
.card-body h3 { font-size: 0.88rem; font-weight: 700; color: var(--text); }
.card-body p { font-size: 0.8rem; color: var(--text-2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  flex-shrink: 0;
}
.badge-ok { background: var(--green-pale); color: var(--green); }
.badge-warn { background: #422006; color: #fbbf24; }

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.action-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--normal) var(--ease), transform var(--normal) var(--ease);
  display: flex;
  flex-direction: column;
}
.action-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.action-card h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}
.action-card p {
  font-size: 0.87rem;
  color: var(--text-2);
  line-height: 1.65;
  margin-bottom: 20px;
  flex: 1;
}

.action-card-highlight {
  border-color: transparent;
  background: linear-gradient(var(--bg-card), var(--bg-card)) padding-box,
              linear-gradient(135deg, var(--blue), var(--indigo)) border-box;
  border: 2px solid transparent;
}
.action-card-highlight h2 { color: var(--blue); }

/* ── CV iframe ─────────────────────────────────────────────────────────────── */
/* Height starts at a floor and is then set inline, in px, by
   resize_iframe_to_content_js() once the srcdoc has loaded and its real
   content height is known — see views/mod.rs. A fixed height here (the
   box used to always be 900px/820px regardless of content) left a large
   blank strip below short CVs, which tailoring produces far more often
   than the full lifetime CV does, since it's specifically the feature
   that drops projects/skills/experiences. min-height is just the
   before-JS-runs floor, not the steady-state size. */
.cv-iframe {
  width: 100%;
  min-height: 200px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-md);
}

/* ── Tailor layout ─────────────────────────────────────────────────────────── */
.tailor-layout { display: grid; grid-template-columns: 390px 1fr; gap: 24px; align-items: start; }
.tailor-input { position: sticky; top: 76px; }
.jd-textarea { min-height: 340px; }

.output-placeholder {
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: var(--radius-xl);
  padding: 72px 24px;
  text-align: center;
  color: var(--text-2);
}
.placeholder-icon { font-size: 3.5rem; margin-bottom: 16px; opacity: .6; }
.output-placeholder p { font-size: 0.9rem; max-width: 320px; margin: 0 auto; line-height: 1.7; }

/* ── Score banner ──────────────────────────────────────────────────────────── */
.score-banner {
  display: flex;
  gap: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 20px 24px;
  margin-bottom: 16px;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
}
.score-left { flex-shrink: 0; }
.score-circle {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 4px solid var(--blue);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--blue-pale);
}
.score-number { font-size: 1.2rem; font-weight: 800; line-height: 1; }
.score-label { font-size: 0.6rem; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }
.score-right { flex: 1; min-width: 0; }
.kw-section { margin-bottom: 12px; }
.kw-label { font-size: 0.78rem; font-weight: 700; margin-bottom: 6px; }
.kw-ok { color: var(--green); }
.kw-miss { color: var(--red); }
.kw-cloud { display: flex; flex-wrap: wrap; gap: 5px; }
.output-actions { margin-bottom: 14px; }

/* ── Manual project selection (tailor view) ─────────────────────────────────── */
.manual-selection-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: var(--bg-card);
}
.manual-selection-title { font-weight: 700; font-size: 0.92rem; margin: 0 0 4px; }
.manual-selection-count { font-size: 0.8rem; color: var(--text-2); margin: 0 0 10px; }
.manual-selection-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.manual-selection-applied { margin-top: 8px; }
.manual-selection-exp { margin-bottom: 10px; }
/* The standalone "Personal projects" group sits below the per-experience
   sub-project lists and is a different section of the document, not another
   job's sub-projects — the divider is what stops it reading as one more
   experience entry. */
.manual-selection-top { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); }
.manual-selection-exp-header { font-weight: 600; font-size: 0.85rem; color: var(--text-2); margin-bottom: 4px; }
.manual-selection-project { display: flex; align-items: center; gap: 8px; padding: 3px 0 3px 14px; font-size: 0.88rem; cursor: pointer; }
.manual-selection-project input[type="checkbox"] { cursor: pointer; }
.manual-selection-marker {
  margin-left: auto;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--border);
  color: var(--text-2);
  white-space: nowrap;
}
.manual-selection-marker.hand-added { background: rgba(22, 163, 74, 0.18); color: #16a34a; }
.manual-selection-marker.hand-removed { background: rgba(220, 38, 38, 0.15); color: #dc2626; }
.manual-selection-marker.not-selected { background: transparent; border: 1px dashed var(--border); }
.manual-selection-project-removed { opacity: 0.55; }
.manual-selection-project-excluded { opacity: 0.55; }

/* ── Saved tailoring sessions ──────────────────────────────────────────────── */
.saved-sessions-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: var(--bg-card);
}
.saved-sessions-title { font-weight: 700; font-size: 0.88rem; margin: 0 0 8px; }
.saved-session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background var(--fast) var(--ease);
}
.saved-session-row:hover { background: var(--bg-hover, rgba(255, 255, 255, 0.03)); }
.saved-session-row.active {
  border: 1px solid var(--blue);
  background: var(--blue-pale);
}
.saved-session-name { flex: 1; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-session-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.saved-session-loaded-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--blue);
  padding: 4px 6px;
  white-space: nowrap;
}
/* Inline delete confirmation, swapped in for the trash icon so a single
   accidental click can no longer destroy a saved/tracked session. */
.confirm-delete {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--red, #dc2626);
  white-space: nowrap;
}
/* "Save as…" row: a visible label, then the name field beside its button,
   then a hint. The row is a column (label above, controls below) so the
   label can be real text instead of screen-reader-only — with the label
   hidden, the disabled Save button gave no visible reason for being
   disabled. The hint's line is reserved with min-height because the hint
   only has text while the name is empty; without the reservation, typing
   the first character would delete the line and jump the fields below. */
.saved-session-save-row { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.saved-session-save-controls { display: flex; gap: 8px; }
.saved-session-save-row .input { flex: 1; }
.saved-session-save-hint {
  margin-bottom: 0;
  min-height: 1.4em;
  font-size: 0.8rem;
}
.btn-text-danger { color: var(--red, #dc2626); }

/* ── Done screen ───────────────────────────────────────────────────────────── */
.done-screen { text-align: center; padding: 56px 32px; }
.done-icon { font-size: 3.5rem; margin-bottom: 18px; display: block; }
.done-screen h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 10px; }
.done-screen p { color: var(--text-2); margin: 0 0 28px; font-size: 0.95rem; }
.done-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 72px 24px;
  color: var(--text-2);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
}
.empty-state p { margin-bottom: 16px; font-size: 0.95rem; }

/* ── Scrollbar (webkit) ────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-3); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-2); }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .tailor-layout { grid-template-columns: 1fr; }
  .tailor-input { position: static; }
}

@media (max-width: 768px) {
  .main { padding: 24px 16px; }
  .nav { padding: 0 16px; flex-wrap: wrap; }
  .nav-links { overflow-x: auto; flex-wrap: wrap; }
  .form-section { padding: 22px 18px; }
  .steps { flex-wrap: wrap; border-radius: var(--radius); }
  .step { flex: none; width: 50%; border-bottom: 1px solid var(--border); }
  .step:nth-child(2n) { border-right: none; }
  .action-grid { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 1.4rem; }
  .nav-link { padding: 5px 10px; font-size: 0.8rem; }
  .cards { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .btn-lg { padding: 11px 20px; font-size: 0.9rem; }
  .done-actions { flex-direction: column; align-items: stretch; }
  .score-banner { flex-direction: column; }
}

/* ── Sync page ─────────────────────────────────────────────────────────────── */
.sync-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.sync-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.sync-card-icon { font-size: 1.3rem; }
.sync-card-desc { font-size: 0.85rem; color: var(--text-2); margin-bottom: 20px; line-height: 1.6; }

/* Signed-in state */
.sync-signed-in-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--green-pale);
  border: 1px solid rgba(74,222,128,.3);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}
.sync-token-ok {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--green);
  flex: 1;
}
.sync-dot-green {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(22,163,74,.2);
  flex-shrink: 0;
}
.sync-token-badge {
  font-family: monospace;
  font-size: 0.78rem;
  color: var(--green);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(74,222,128,.3);
}

/* Actions row */
.sync-drive-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Google sign-in button */
.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: box-shadow var(--normal) var(--ease), transform var(--normal) var(--ease);
  margin-bottom: 20px;
}
.btn-google:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
  transform: translateY(-2px);
}
.btn-google:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: var(--shadow-sm); }
.btn-google-done {
  background: var(--green-pale);
  border-color: rgba(74,222,128,.3);
  color: var(--green);
}
.btn-google-done:hover { background: var(--green-pale); }
.sync-google-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* Client ID collapsible */
.sync-cid-section { margin-top: 4px; }
.sync-cid-summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text-2);
  padding: 8px 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.sync-cid-summary::-webkit-details-marker { display: none; }
.sync-cid-summary:hover { color: var(--blue); }
.sync-cid-masked {
  font-family: monospace;
  font-size: 0.78rem;
  color: var(--text-3);
  background: var(--bg);
  padding: 1px 6px;
  border-radius: 4px;
}
.sync-cid-body {
  padding-top: 12px;
  border-top: 1px solid var(--border-2);
  margin-top: 6px;
}
.sync-cid-help {
  font-size: 0.8rem;
  color: var(--text-2);
  line-height: 1.8;
  background: var(--blue-pale);
  border: 1px solid var(--blue-mid);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
}
.sync-cid-help code {
  font-size: 0.78rem;
  background: var(--blue-pale);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--blue);
}
.sync-cid-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.sync-cid-row .input { flex: 1; min-width: 200px; }

/* Status */
.sync-status {
  margin-top: 16px;
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  font-size: 0.88rem;
  font-weight: 500;
}
.sync-status-ok  { background: var(--green-pale); border: 1px solid rgba(74,222,128,.3); color: var(--green); }
.sync-status-err { background: var(--red-pale);   border: 1px solid rgba(248,113,113,.3); color: var(--red); }

@media (max-width: 600px) {
  .sync-drive-actions, .sync-cid-row { flex-direction: column; align-items: stretch; }
  .btn-google { width: 100%; justify-content: center; }
}
