/* ===== Builder layout ===== */
.rk-builder-page {
  padding-top: var(--space-7);
  padding-bottom: var(--space-10);
}

.rk-builder-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}

.rk-builder-h1 {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: var(--space-3) 0 var(--space-3);
  max-width: 14ch;
}

.rk-builder-lead {
  max-width: 46ch;
  font-size: var(--step-0);
  line-height: 1.55;
  margin: 0;
}

.rk-builder-top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.rk-flash {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-5);
  background: var(--surface);
  font-size: var(--step-0);
}

.rk-flash-ok {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--border));
  background: color-mix(in srgb, var(--brand) 12%, var(--surface));
}

.rk-builder-bento {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: var(--space-5);
  align-items: start;
}

.rk-builder-editor,
.rk-preview-panel,
.rk-strength {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: none;
}

.rk-builder-editor {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.rk-builder-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  position: sticky;
  top: 88px;
}

/* Editor blocks */
.rk-editor-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--space-4);
  background: color-mix(in srgb, var(--surface-2) 65%, transparent);
}

.rk-editor-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.rk-editor-head h2 {
  font-size: var(--step-1);
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0;
  flex: 1;
}

.rk-editor-num {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--brand);
  border: 1px solid color-mix(in srgb, var(--brand) 40%, var(--border));
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  background: color-mix(in srgb, var(--brand) 12%, transparent);
}

.rk-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.rk-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.rk-field > span {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.rk-field-span2 {
  grid-column: 1 / -1;
}

.rk-field input,
.rk-field select,
.rk-field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  padding: 0.7rem 0.85rem;
  font: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s var(--ease-out);
}

.rk-field input:focus,
.rk-field select:focus,
.rk-field textarea:focus {
  border-color: color-mix(in srgb, var(--brand) 55%, var(--border));
}

.rk-field textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.45;
}

/* Template picker */
.rk-tpl-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 0.55rem;
}

.rk-tpl-chip {
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  transition: border-color 0.15s var(--ease-out), background 0.15s var(--ease-out);
}

.rk-tpl-chip:hover {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--border));
}

.rk-tpl-chip.is-active {
  border-color: color-mix(in srgb, var(--brand) 70%, var(--border));
  background: color-mix(in srgb, var(--brand) 14%, var(--bg));
}

.rk-tpl-chip-name {
  font-weight: 650;
  font-size: 0.9rem;
}

.rk-tpl-chip-tag {
  font-size: 0.72rem;
  color: var(--muted);
}

/* Repeat cards */
.rk-repeat-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.rk-repeat-card {
  border: 1px dashed color-mix(in srgb, var(--border) 80%, var(--brand));
  border-radius: 10px;
  padding: var(--space-3);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
}

.rk-repeat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.rk-repeat-label {
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.rk-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

.rk-icon-btn:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--text) 30%, var(--border));
}

.rk-editor-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-top: var(--space-2);
}

.rk-save-hint {
  margin: 0;
  font-size: 0.85rem;
}

/* Strength calculator */
.rk-strength {
  padding: var(--space-4);
}

.rk-strength-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.rk-strength-head h2 {
  margin: 0;
  font-size: var(--step-1);
  letter-spacing: -0.02em;
}

.rk-strength-score {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3vw, 2.6rem);
  font-weight: 750;
  letter-spacing: -0.04em;
  line-height: 1;
  background: var(--grad, linear-gradient(135deg, var(--brand), var(--accent)));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.rk-strength-bar {
  height: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-2) 80%, var(--border));
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: var(--space-3);
}

.rk-strength-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--accent, var(--brand-2)));
}

.rk-strength-label {
  margin: 0 0 var(--space-3);
  font-size: 0.9rem;
}

.rk-strength-list {
  list-style: none;
  margin: 0 0 var(--space-3);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.rk-strength-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.35;
}

.rk-strength-list li::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-top: 0.35rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  flex-shrink: 0;
  background: transparent;
}

.rk-strength-list li.is-done {
  color: var(--text);
}

.rk-strength-list li.is-done::before {
  background: var(--brand);
  border-color: var(--brand);
}

.rk-strength-tip {
  border-top: 1px solid var(--border);
  padding-top: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.rk-strength-tip p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.45;
}

/* Preview panel */
.rk-preview-panel {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 480px;
}

.rk-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 0 var(--space-2);
}

.rk-preview-title {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.rk-preview-tpl-name {
  font-size: 0.8rem;
}

.rk-preview-frame {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0c0d10;
  overflow: auto;
  max-height: min(72vh, 860px);
  padding: var(--space-3);
}

/* ===== CV templates (shared) ===== */
.cv {
  --cv-bg: #f6f5f2;
  --cv-text: #16171c;
  --cv-muted: #5c6170;
  --cv-line: #d9dbe3;
  --cv-accent: #2f6fed;
  --cv-side: #1a1d27;
  --cv-side-text: #eef0f6;
  --cv-radius: 10px;
  --cv-font: "Segoe UI", system-ui, -apple-system, "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;

  background: var(--cv-bg);
  color: var(--cv-text);
  font-family: var(--cv-font);
  border-radius: var(--cv-radius);
  padding: 1.35rem 1.4rem;
  font-size: 12.5px;
  line-height: 1.45;
  min-height: 520px;
  box-shadow: none;
  border: 1px solid color-mix(in srgb, #fff 8%, transparent);
}

.cv * {
  box-sizing: border-box;
}

.cv-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--cv-line);
}

.cv-name {
  font-size: 1.55rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.cv-headline {
  margin-top: 0.25rem;
  color: var(--cv-accent);
  font-weight: 650;
  font-size: 0.95rem;
}

.cv-contacts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.78rem;
  color: var(--cv-muted);
  text-align: right;
}

.cv-contacts .cv-k {
  display: none;
}

.cv-section {
  margin-bottom: 0.95rem;
}

.cv-h {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cv-accent);
  font-weight: 750;
}

.cv-text {
  margin: 0;
  color: var(--cv-text);
  white-space: pre-wrap;
}

.cv-stack {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.cv-job-top,
.cv-edu-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: baseline;
}

.cv-job-role,
.cv-edu-school {
  font-weight: 700;
  font-size: 0.92rem;
}

.cv-job-period {
  color: var(--cv-muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.cv-job-company,
.cv-edu-degree {
  color: var(--cv-muted);
  font-size: 0.82rem;
  margin-bottom: 0.25rem;
}

.cv-bullets {
  margin: 0;
  padding-left: 1.05rem;
}

.cv-bullets li {
  margin-bottom: 0.25rem;
}

.cv-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.cv-tag {
  border: 1px solid var(--cv-line);
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.72rem;
  color: var(--cv-text);
  background: color-mix(in srgb, var(--cv-bg) 70%, #fff);
}

/* classic */
.cv-classic {
  --cv-accent: #1f3a5f;
  --cv-bg: #fbfaf7;
}

.cv-classic .cv-name {
  font-size: 1.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cv-classic .cv-h {
  border-bottom: 1px solid var(--cv-line);
  padding-bottom: 0.25rem;
}

/* minimal */
.cv-minimal {
  --cv-accent: #111;
  --cv-bg: #fff;
  --cv-line: #ececec;
  padding: 1.7rem 1.6rem;
}

.cv-minimal .cv-header {
  border-bottom-color: #111;
  border-bottom-width: 2px;
}

.cv-minimal .cv-headline {
  color: #444;
  font-weight: 500;
}

.cv-minimal .cv-tag {
  border-radius: 4px;
  background: #f4f4f4;
}

/* modern — two columns feel via header band */
.cv-modern {
  --cv-accent: #3d6cf5;
  --cv-bg: #f3f6ff;
  --cv-side: #243356;
  padding: 0;
  overflow: hidden;
}

.cv-modern .cv-header {
  background: var(--cv-side);
  color: #fff;
  border: 0;
  margin: 0;
  padding: 1.2rem 1.3rem;
  border-radius: 0;
}

.cv-modern .cv-name {
  color: #fff;
}

.cv-modern .cv-headline {
  color: #9db7ff;
}

.cv-modern .cv-contacts {
  color: #c9d4f0;
  text-align: left;
}

.cv-modern .cv-section,
.cv-modern .cv-section-skills {
  padding: 0 1.25rem;
}

.cv-modern .cv-section:first-of-type {
  padding-top: 1rem;
}

.cv-modern .cv-section:last-child {
  padding-bottom: 1.2rem;
}

/* executive */
.cv-executive {
  --cv-bg: #111216;
  --cv-text: #f2efe8;
  --cv-muted: #a39e93;
  --cv-line: #2a2b31;
  --cv-accent: #c6a15b;
}

.cv-executive .cv-name {
  font-size: 1.75rem;
  color: #f7f1e4;
}

.cv-executive .cv-tag {
  background: #1a1b21;
  border-color: #33343c;
  color: #e8e2d6;
}

/* creative */
.cv-creative {
  --cv-bg: #14101c;
  --cv-text: #f6f0ff;
  --cv-muted: #b5a8c9;
  --cv-line: #2e2540;
  --cv-accent: #d85cff;
  background:
    radial-gradient(circle at 100% 0%, rgba(216, 92, 255, 0.18), transparent 40%),
    radial-gradient(circle at 0% 100%, rgba(64, 140, 255, 0.14), transparent 42%),
    #14101c;
}

.cv-creative .cv-header {
  border-bottom: 0;
  position: relative;
}

.cv-creative .cv-name {
  font-size: 1.85rem;
  background: linear-gradient(90deg, #fff, #d9a6ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.cv-creative .cv-tag {
  border-color: #5a3d7a;
  background: rgba(216, 92, 255, 0.1);
}

/* engineer */
.cv-engineer {
  --cv-bg: #0f1412;
  --cv-text: #e7f2ea;
  --cv-muted: #8fa399;
  --cv-line: #24302a;
  --cv-accent: #3dcaa0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

.cv-engineer .cv-name {
  font-size: 1.35rem;
}

.cv-engineer .cv-h::before {
  content: "// ";
  opacity: 0.7;
}

.cv-engineer .cv-tag {
  border-radius: 4px;
  border-color: #2f4a3e;
  background: #15201b;
  font-size: 0.68rem;
}

/* compact */
.cv-compact {
  --cv-accent: #0b5cab;
  --cv-bg: #fafafa;
  padding: 1rem 1.05rem;
  font-size: 11.5px;
  min-height: 0;
}

.cv-compact .cv-name {
  font-size: 1.25rem;
}

.cv-compact .cv-section {
  margin-bottom: 0.55rem;
}

.cv-compact .cv-stack {
  gap: 0.4rem;
}

.cv-compact .cv-header {
  margin-bottom: 0.6rem;
  padding-bottom: 0.5rem;
}

/* timeline */
.cv-timeline {
  --cv-accent: #e85d4c;
  --cv-bg: #fffaf7;
  --cv-line: #f0ddd6;
}

.cv-timeline #cv-experience {
  border-left: 2px solid color-mix(in srgb, var(--cv-accent) 55%, var(--cv-line));
  padding-left: 0.9rem;
  margin-left: 0.25rem;
  gap: 0.9rem;
}

.cv-timeline .cv-job {
  position: relative;
}

.cv-timeline .cv-job::before {
  content: "";
  position: absolute;
  left: -1.18rem;
  top: 0.35rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--cv-accent);
  border: 2px solid var(--cv-bg);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--cv-accent) 50%, transparent);
}

/* aurora */
.cv-aurora {
  --cv-bg: #0b1220;
  --cv-text: #ecf3ff;
  --cv-muted: #9aafc9;
  --cv-line: #1c2a44;
  --cv-accent: #5eead4;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(94, 234, 212, 0.2), transparent 50%),
    radial-gradient(ellipse 70% 45% at 100% 0%, rgba(99, 102, 241, 0.22), transparent 45%),
    #0b1220;
}

.cv-aurora .cv-headline {
  color: #7dd3fc;
}

.cv-aurora .cv-tag {
  border-color: #234;
  background: rgba(94, 234, 212, 0.08);
}

/* bureau */
.cv-bureau {
  --cv-bg: #f7f4ee;
  --cv-text: #1c1a16;
  --cv-muted: #6d675c;
  --cv-line: #ddd4c4;
  --cv-accent: #6b4f2c;
}

.cv-bureau .cv-name {
  font-variant: small-caps;
  letter-spacing: 0.06em;
  font-size: 1.6rem;
}

.cv-bureau .cv-header {
  border-bottom: 2px solid #6b4f2c;
}

.cv-bureau .cv-h {
  color: #6b4f2c;
  letter-spacing: 0.16em;
}

.cv-bureau .cv-tag {
  border-radius: 2px;
  border-color: #cbbfa8;
  background: #efe8da;
}

/* Empty / placeholder tone inside CV */
.cv.is-placeholder .cv-name,
.cv.is-placeholder .cv-headline,
.cv.is-placeholder .cv-text,
.cv.is-placeholder .cv-job-role,
.cv.is-placeholder .cv-job-company,
.cv.is-placeholder .cv-edu-school {
  opacity: 0.55;
}

/* Print */
@media print {
  body * {
    visibility: hidden !important;
  }

  .rk-preview-frame,
  .rk-preview-frame * {
    visibility: visible !important;
  }

  .rk-preview-frame {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    max-height: none;
    overflow: visible;
    border: 0;
    padding: 0;
    background: #fff;
  }

  .cv {
    min-height: 0;
    border: 0;
    border-radius: 0;
  }

  .rk-bg,
  .rk-header,
  .rk-footer,
  .rk-builder-editor,
  .rk-strength,
  .rk-builder-top,
  .rk-preview-toolbar {
    display: none !important;
  }
}

/* Responsive */
@media (max-width: 980px) {
  .rk-builder-bento {
    grid-template-columns: 1fr;
  }

  .rk-builder-side {
    position: static;
  }

  .rk-preview-frame {
    max-height: 640px;
  }
}

@media (max-width: 560px) {
  .rk-field-grid {
    grid-template-columns: 1fr;
  }

  .rk-field-span2 {
    grid-column: auto;
  }

  .rk-builder-editor {
    padding: var(--space-3);
  }

  .rk-builder-h1 {
    max-width: none;
  }
}