/* =====================================================================
   CV Editor — chrome + token-driven preview
   The CV design is driven entirely by CSS custom properties on #cvRoot,
   so changing one token re-themes the whole sheet at runtime.
   ===================================================================== */

:root {
  --ui-bg: #0f172a;
  --ui-panel: #ffffff;
  --ui-panel-2: #f8fafc;
  --ui-line: #e2e8f0;
  --ui-line-strong: #cbd5e1;
  --ui-text: #1e293b;
  --ui-muted: #64748b;
  --ui-accent: #4f46e5;
  --ui-accent-soft: #eef2ff;
  --ui-danger: #e11d48;
  --ui-shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .08);
  --ui-radius: 10px;
  --panel-w: 300px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  color: var(--ui-text);
  background: #eef1f6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; cursor: pointer; }

/* ───────────── App shell ───────────── */
.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: var(--panel-w) 1fr var(--panel-w);
  min-height: 0;
}

/* ───────────── Toolbar ───────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid var(--ui-line);
  box-shadow: 0 1px 0 rgba(15,23,42,.02);
  z-index: 30;
}
.toolbar__brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.toolbar__logo {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--ui-accent), #6366f1);
  color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .04em;
}
.toolbar__titles { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.toolbar__title {
  font-weight: 700; font-size: 14px; color: var(--ui-text);
  outline: none; border-radius: 4px; padding: 1px 3px; max-width: 280px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.toolbar__title:focus { background: var(--ui-accent-soft); }
.toolbar__save { font-size: 11px; color: var(--ui-muted); }
.toolbar__save.is-dirty { color: #b45309; }
.toolbar__actions { display: flex; align-items: center; gap: 6px; }
.toolbar__sep { width: 1px; height: 22px; background: var(--ui-line); margin: 0 4px; }

/* language toggle (NL / EN) */
.lang-toggle { display: inline-flex; gap: 2px; background: var(--ui-panel-2); border: 1px solid var(--ui-line); border-radius: 8px; padding: 2px; }
.lang-toggle button { border: none; background: transparent; font-size: 12px; font-weight: 700; color: var(--ui-muted); padding: 5px 10px; border-radius: 6px; }
.lang-toggle button:hover { color: var(--ui-text); }
.lang-toggle button.is-active { background: #fff; color: var(--ui-accent); box-shadow: var(--ui-shadow); }

/* ───────────── Buttons ───────────── */
.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ui-text);
  background: transparent;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
  white-space: nowrap;
}
.btn--ghost { color: var(--ui-muted); }
.btn--ghost:hover { background: var(--ui-panel-2); color: var(--ui-text); }
.btn--primary { background: var(--ui-accent); color: #fff; }
.btn--primary:hover { background: #4338ca; }
.btn--accent { background: linear-gradient(135deg, #7c3aed, #d946ef); color: #fff; }
.btn--accent:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.is-busy, .minibtn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after, .minibtn.is-busy::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 15px; height: 15px;
  border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%;
  color: #fff; animation: spin .7s linear infinite;
}
.minibtn.is-busy::after { color: var(--ui-accent); }
@keyframes spin { to { transform: rotate(360deg); } }

.iconbtn {
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 7px;
  border: 1px solid var(--ui-line); background: #fff; color: var(--ui-text);
  font-size: 15px; line-height: 1;
}
.iconbtn:hover { background: var(--ui-panel-2); }

/* Export dropdown menu */
.menu { position: relative; }
.menu__list {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: #fff; border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius); box-shadow: var(--ui-shadow);
  padding: 6px; min-width: 210px; z-index: 40; display: flex; flex-direction: column; gap: 2px;
}
.menu__list[hidden] { display: none; }
.menu__list button, .menu__file {
  display: flex; align-items: center; gap: 8px;
  text-align: left; border: none; background: transparent;
  padding: 8px 10px; border-radius: 7px; font-size: 13px; color: var(--ui-text);
  width: 100%; font-weight: 500;
}
.menu__list button:hover, .menu__file:hover { background: var(--ui-accent-soft); color: var(--ui-accent); }
.menu__file { cursor: pointer; }

/* ───────────── Panels ───────────── */
.panel {
  background: var(--ui-panel);
  display: flex; flex-direction: column;
  min-height: 0;
}
.panel--left { border-right: 1px solid var(--ui-line); }
.panel--right { border-left: 1px solid var(--ui-line); }

.tabs {
  display: flex; gap: 2px; padding: 8px 8px 0;
  border-bottom: 1px solid var(--ui-line); background: var(--ui-panel-2);
}
.tab {
  flex: 1; border: none; background: transparent;
  padding: 9px 6px; font-size: 12.5px; font-weight: 600; color: var(--ui-muted);
  border-radius: 8px 8px 0 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ui-text); }
.tab.is-active { color: var(--ui-accent); background: #fff; border-bottom-color: var(--ui-accent); }

.panel__scroll { flex: 1; overflow-y: auto; padding: 14px; min-height: 0; }
.tabpane { display: none; }
.tabpane.is-active { display: block; }

.hint { font-size: 12px; color: var(--ui-muted); margin: 0 0 12px; line-height: 1.5; }

/* ───────────── Palette (draggable blocks) ───────────── */
.palette { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.palette__item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 11px 10px; border: 1px solid var(--ui-line); border-radius: 10px;
  background: #fff; cursor: grab; transition: border-color .15s, box-shadow .15s, transform .05s;
  user-select: none;
}
.palette__item:hover { border-color: var(--ui-accent); box-shadow: 0 2px 10px rgba(79,70,229,.12); }
.palette__item:active { cursor: grabbing; transform: scale(.98); }
.palette__item.is-dragging { opacity: .45; }
.palette__icon { font-size: 18px; line-height: 1; }
.palette__label { font-size: 12px; font-weight: 600; }
.palette__sub { font-size: 10.5px; color: var(--ui-muted); }

/* ───────────── Layers list ───────────── */
.layers { display: flex; flex-direction: column; gap: 6px; }
.layer {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border: 1px solid var(--ui-line); border-radius: 8px; background: #fff;
  font-size: 12.5px; cursor: grab; transition: border-color .15s, background .15s;
}
.layer:hover { border-color: var(--ui-line-strong); }
.layer.is-selected { border-color: var(--ui-accent); background: var(--ui-accent-soft); }
.layer.is-dragging { opacity: .45; }
.layer__grip { color: var(--ui-line-strong); cursor: grab; }
.layer__icon { font-size: 14px; }
.layer__name { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer__col { font-size: 10px; color: var(--ui-muted); padding: 2px 6px; background: var(--ui-panel-2); border-radius: 999px; }
.layer__del { border: none; background: transparent; color: var(--ui-muted); font-size: 14px; padding: 2px 4px; border-radius: 6px; }
.layer__del:hover { color: var(--ui-danger); background: #fee2e2; }

/* ───────────── Form controls ───────────── */
.field { margin-bottom: 16px; }
.field__label { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--ui-muted); margin-bottom: 7px; }
.field__row { display: flex; align-items: center; gap: 8px; }
.group { border-top: 1px solid var(--ui-line); padding-top: 16px; margin-top: 4px; }
.group:first-child { border-top: none; padding-top: 0; }
.group__title { font-size: 12px; font-weight: 800; color: var(--ui-text); margin: 0 0 12px; display: flex; align-items: center; gap: 6px; }

.input, .select, .textarea {
  width: 100%; border: 1px solid var(--ui-line); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; color: var(--ui-text); background: #fff; font-family: inherit;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ui-accent); box-shadow: 0 0 0 3px var(--ui-accent-soft); }
.textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }

/* color picker row */
.swatch { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--ui-line); padding: 0; overflow: hidden; cursor: pointer; flex-shrink: 0; }
.swatch input { width: 150%; height: 150%; margin: -25%; border: none; cursor: pointer; background: none; }
.color-hex { flex: 1; font-family: 'JetBrains Mono', monospace; font-size: 12px; text-transform: uppercase; }

/* swatch grid (theme presets) */
.themes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.theme {
  height: 40px; border-radius: 9px; border: 2px solid transparent; cursor: pointer; position: relative;
  display: grid; place-items: end center; padding-bottom: 4px; transition: transform .08s;
}
.theme:hover { transform: translateY(-2px); }
.theme.is-active { border-color: #0f172a; box-shadow: 0 0 0 2px #fff inset; }
.theme span { font-size: 9px; font-weight: 700; color: rgba(255,255,255,.95); text-shadow: 0 1px 2px rgba(0,0,0,.4); }

/* segmented control */
.seg { display: flex; gap: 4px; background: var(--ui-panel-2); padding: 4px; border-radius: 9px; }
.seg button {
  flex: 1; border: none; background: transparent; padding: 7px 6px; border-radius: 7px;
  font-size: 12px; font-weight: 600; color: var(--ui-muted); line-height: 1.2;
}
.seg button.is-active { background: #fff; color: var(--ui-accent); box-shadow: var(--ui-shadow); }

/* range with value */
.range { display: flex; align-items: center; gap: 10px; }
.range input[type=range] { flex: 1; accent-color: var(--ui-accent); }
.range__val { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ui-muted); min-width: 42px; text-align: right; }

/* font preview chips */
.fontchip { font-size: 13px; }

/* small button used in inspector */
.minibtn {
  border: 1px dashed var(--ui-line-strong); background: #fff; color: var(--ui-muted);
  border-radius: 8px; padding: 8px; font-size: 12px; font-weight: 600; width: 100%;
}
.minibtn:hover { border-color: var(--ui-accent); color: var(--ui-accent); background: var(--ui-accent-soft); }
.minibtn--danger:hover { border-color: var(--ui-danger); color: var(--ui-danger); background: #fee2e2; }

/* ───────────── Version history ───────────── */
.versions { display: flex; flex-direction: column; gap: 8px; }
.version { border: 1px solid var(--ui-line); border-radius: 10px; padding: 10px 12px; background: #fff; }
.version.is-selected { border-color: var(--ui-accent); background: var(--ui-accent-soft); }
.version__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.version__name { font-size: 13px; }
.version__lang { font-size: 10px; font-weight: 700; color: var(--ui-muted); padding: 2px 7px; background: var(--ui-panel-2); border-radius: 999px; }
.version__meta { font-size: 11px; color: var(--ui-muted); margin-top: 2px; }
.version__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.version__actions .minibtn { width: auto; flex: 1 1 auto; min-width: 64px; padding: 6px 8px; }

/* AI panel */
.ai-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ai-check { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; margin-top: 4px; }
.ai-check input { margin-top: 2px; accent-color: var(--ui-accent); }
.ai-check span { font-size: 12.5px; color: var(--ui-text); line-height: 1.4; }
.ai-status { font-size: 12px; line-height: 1.45; margin-top: 8px; min-height: 0; color: var(--ui-muted); word-break: break-word; }
.ai-status.is-busy { color: var(--ui-accent); }
.ai-status.is-ok { color: #059669; }
.ai-status.is-error { color: var(--ui-danger); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px);
  background: #0f172a; color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 600; box-shadow: 0 12px 32px rgba(0,0,0,.3);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; max-width: 80vw;
}
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.toast--ok { background: #047857; }
.toast--error { background: #be123c; }
.toast--warn { background: #b45309; }

.inspector__empty { font-size: 13px; color: var(--ui-muted); line-height: 1.6; padding: 12px; text-align: center; }
.inspector__head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.inspector__icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: var(--ui-accent-soft); }
.inspector__title { font-size: 14px; font-weight: 800; }
.inspector__type { font-size: 11px; color: var(--ui-muted); }

.dropzone {
  border: 2px dashed var(--ui-line-strong); border-radius: 10px;
  padding: 18px; text-align: center; font-size: 12px; color: var(--ui-muted);
  background: var(--ui-panel-2); cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--ui-accent); background: var(--ui-accent-soft); color: var(--ui-accent); }
.dropzone img { max-width: 100%; border-radius: 8px; margin-bottom: 8px; }

/* =====================================================================
   CANVAS / STAGE
   ===================================================================== */
.canvas { position: relative; overflow: auto; background: #e9edf3; display: flex; flex-direction: column; }
.canvas__zoombar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 8px; background: rgba(233,237,243,.85); backdrop-filter: blur(6px);
}
.canvas__zoom { font-size: 12px; font-weight: 600; color: var(--ui-muted); min-width: 42px; text-align: center; }
.canvas__stage {
  flex: 1; display: flex; justify-content: center; align-items: flex-start;
  padding: 24px 24px 120px;
}

/* =====================================================================
   CV SHEET — fully token-driven
   ===================================================================== */
/* token defaults live on the container so every page inherits them */
#cvRoot, .cv-root {
  --cv-primary: #4f46e5;
  --cv-primary-700: #4338ca;
  --cv-accent: #6366f1;
  --cv-page-bg: #f1f5f9;
  --cv-sheet-bg: #ffffff;
  --cv-text: #1f2937;
  --cv-muted: #64748b;
  --cv-soft: #eef2ff;
  --cv-line: #e2e8f0;
  --cv-font: 'Inter', system-ui, sans-serif;
  --cv-heading-font: 'Inter', system-ui, sans-serif;
  --cv-fs: 15px;
  --cv-radius: 16px;
  --cv-gap: 32px;
  --cv-sheet-w: 820px;
  --cv-header-fg: #ffffff;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
  font-family: var(--cv-font);
  color: var(--cv-text);
  font-size: var(--cv-fs);
  transform-origin: top center;
}

.cv-pagewrap { width: var(--cv-sheet-w); max-width: 100%; }
.cv-page {
  width: 100%;
  background: var(--cv-sheet-bg);
  color: var(--cv-text);
  font-family: var(--cv-font);
  font-size: var(--cv-fs);
  line-height: 1.55;
  border-radius: calc(var(--cv-radius) * 1.1);
  box-shadow: 0 10px 40px rgba(15, 23, 42, .14);
  overflow: hidden;
  position: relative;
  transition: box-shadow .2s;
}
.cv-page h1, .cv-page h2, .cv-page h3 { font-family: var(--cv-heading-font); margin: 0; }

/* page chrome (editor only) */
.cv-page__label { font-size: 11px; font-weight: 700; color: var(--ui-muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.cv-page__label .a4 { font-weight: 600; color: var(--ui-line-strong); text-transform: none; letter-spacing: 0; }
.cv-page__label button { border: none; background: transparent; color: var(--ui-muted); cursor: pointer; font-size: 12px; padding: 2px 5px; border-radius: 5px; }
.cv-page__label button:hover { color: var(--ui-danger); background: #fee2e2; }
.cv-addpage { margin-top: 2px; border: 2px dashed var(--ui-line-strong); background: #fff; color: var(--ui-muted); border-radius: 12px; padding: 12px 22px; font-size: 13px; font-weight: 600; cursor: pointer; }
.cv-addpage:hover { border-color: var(--ui-accent); color: var(--ui-accent); background: var(--ui-accent-soft); }
/* faint A4 page-height guide so you can see how much fits before scaling */
.cv-page::after { content: ""; position: absolute; left: 0; right: 0; top: calc(var(--cv-sheet-w) * 1.4142); border-top: 2px dashed rgba(225, 29, 72, .35); pointer-events: none; }
.preview-mode .cv-page::after { display: none; }

/* editable text */
[contenteditable] { outline: none; }
[data-bind]:focus { box-shadow: 0 0 0 2px var(--cv-accent); border-radius: 4px; background: rgba(99,102,241,.06); }
.is-editing [data-bind]:hover { background: rgba(99,102,241,.06); border-radius: 4px; }

/* Header */
.cv-header { padding: clamp(28px, 4vw, 44px); color: var(--cv-header-fg); position: relative; background-size: cover; background-position: center; }
.cv-header--gradient { background: linear-gradient(120deg, var(--cv-primary-700), var(--cv-accent)); }
.cv-header--solid { background: var(--cv-primary); }
.cv-header--minimal { background: var(--cv-sheet-bg); color: var(--cv-text); border-bottom: 3px solid var(--cv-primary); }
.cv-header--image::after { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, rgba(15,23,42,.72), rgba(15,23,42,.35)); }
.cv-header__inner { position: relative; z-index: 1; display: flex; align-items: center; gap: clamp(16px, 3vw, 28px); flex-wrap: wrap; }
.cv-avatar {
  width: 96px; height: 96px; border-radius: 999px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 30px; font-weight: 800; letter-spacing: .02em;
  background: rgba(255,255,255,.16); border: 4px solid rgba(255,255,255,.3); overflow: hidden;
  object-fit: cover;
}
.cv-header--minimal .cv-avatar { background: var(--cv-soft); color: var(--cv-primary); border-color: var(--cv-line); }
.cv-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cv-name { font-size: clamp(28px, 4vw, 40px); font-weight: 800; letter-spacing: -.01em; line-height: 1.05; }
.cv-role { margin-top: 4px; font-size: 1.1rem; font-weight: 500; opacity: .92; }
.cv-contacts { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .82rem; opacity: .95; }
.cv-contact { display: inline-flex; align-items: center; gap: 6px; }
.cv-contact .ico { opacity: .9; }

/* Body / columns */
.cv-body { display: grid; gap: var(--cv-gap); padding: clamp(26px, 4vw, 44px); }
.cv-body--one { grid-template-columns: 1fr; }
.cv-body--sidebar-left { grid-template-columns: 0.62fr 1fr; }
.cv-body--sidebar-right { grid-template-columns: 1fr 0.62fr; }
.cv-col { display: flex; flex-direction: column; gap: var(--cv-gap); min-width: 0; }

/* Section */
.cv-section { position: relative; }
.cv-section__title {
  font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--cv-primary); margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.cv-section__title::after { content: ""; flex: 1; height: 1px; background: var(--cv-line); }
.cv-p { color: var(--cv-muted); font-size: .92rem; line-height: 1.65; }
.cv-link { color: var(--cv-primary); text-decoration: underline; text-underline-offset: 2px; }
.cv-link:hover { text-decoration-thickness: 2px; }
.cv-header .cv-link { color: inherit; }

/* selection + drag affordances (hidden in print/preview) */
.cv-section.is-selected { box-shadow: 0 0 0 2px var(--cv-accent), 0 8px 24px rgba(99,102,241,.18); border-radius: 10px; }
.cv-section { border-radius: 10px; transition: box-shadow .15s; }
.is-editing .cv-section:hover { box-shadow: 0 0 0 1px var(--cv-line); }
.cv-section__bar {
  position: absolute; top: -10px; right: 6px; display: none; gap: 3px; z-index: 5;
  background: #fff; border: 1px solid var(--ui-line); border-radius: 8px; padding: 2px; box-shadow: var(--ui-shadow);
}
.is-editing .cv-section:hover .cv-section__bar, .cv-section.is-selected .cv-section__bar { display: flex; }
.cv-section__bar button { border: none; background: transparent; font-size: 13px; padding: 3px 5px; border-radius: 6px; line-height: 1; color: var(--ui-muted); }
.cv-section__bar button:hover { background: var(--ui-panel-2); color: var(--ui-text); }
.cv-section__bar button.ai:hover { background: #f3e8ff; color: #7c3aed; }
.cv-section__bar button[disabled] { opacity: .5; }
.cv-section__bar .grip { cursor: grab; }

/* floating per-field AI button */
#fieldAIBtn {
  position: fixed; z-index: 60; width: 26px; height: 26px; border-radius: 999px;
  border: 1px solid var(--ui-line); background: #fff; color: #7c3aed; font-size: 13px; line-height: 1;
  box-shadow: 0 4px 14px rgba(124, 58, 237, .28); cursor: pointer; padding: 0; display: grid; place-items: center;
}
#fieldAIBtn:hover { background: #faf5ff; transform: scale(1.08); }
#fieldAIBtn[hidden] { display: none; }
#fieldAIBtn.is-busy { color: transparent; pointer-events: none; }
#fieldAIBtn.is-busy::after { content: ""; position: absolute; inset: 0; margin: auto; width: 13px; height: 13px; border: 2px solid #7c3aed; border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@media print { #fieldAIBtn { display: none !important; } }

/* lists / items */
.cv-items { display: flex; flex-direction: column; gap: 16px; }
.cv-item { position: relative; }
.cv-item__top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; }
.cv-item__title { font-weight: 700; font-size: .98rem; }
.cv-item__period { font-size: .72rem; font-weight: 600; color: var(--cv-muted); }
.cv-item__org { font-size: .85rem; font-weight: 600; color: var(--cv-primary); }
.cv-bullets { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.cv-bullets li { font-size: .86rem; color: var(--cv-muted); line-height: 1.55; }

/* timeline variant */
.cv-item--timeline { padding-left: 20px; border-left: 2px solid var(--cv-line); }
.cv-item--timeline::before { content: ""; position: absolute; left: -7px; top: 5px; width: 12px; height: 12px; border-radius: 999px; background: var(--cv-primary); border: 2px solid var(--cv-sheet-bg); }

/* skills */
.cv-skill { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .88rem; padding: 3px 0; }
.cv-dots { display: inline-flex; gap: 4px; }
.cv-dot { width: 9px; height: 9px; border-radius: 999px; background: var(--cv-line); cursor: default; }
.is-editing .cv-dot { cursor: pointer; }
.cv-dot.on { background: var(--cv-primary); }
.cv-bar { flex: 1; max-width: 120px; height: 6px; border-radius: 999px; background: var(--cv-line); overflow: hidden; }
.cv-bar > span { display: block; height: 100%; background: var(--cv-primary); border-radius: 999px; }

/* languages */
.cv-lang { display: flex; justify-content: space-between; gap: 10px; font-size: .88rem; padding: 2px 0; }
.cv-lang__lvl { color: var(--cv-muted); }

/* projects */
.cv-projects { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cv-project { border: 1px solid var(--cv-line); border-radius: calc(var(--cv-radius) * .7); padding: 14px; overflow: hidden; }
.cv-project img { width: 100%; height: 110px; object-fit: cover; border-radius: 8px; margin-bottom: 10px; }
.cv-project h3 { font-size: .9rem; font-weight: 700; }
.cv-project p { font-size: .82rem; color: var(--cv-muted); margin: 4px 0 0; }

/* tags / interests */
.cv-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.cv-tag { font-size: .74rem; font-weight: 600; padding: 5px 12px; border-radius: 999px; background: var(--cv-soft); color: var(--cv-primary); }

/* image block */
.cv-imageblock img { width: 100%; border-radius: calc(var(--cv-radius) * .7); display: block; }
.cv-imageblock__empty {
  border: 2px dashed var(--cv-line); border-radius: calc(var(--cv-radius) * .7);
  padding: 28px; text-align: center; color: var(--cv-muted); font-size: .85rem; cursor: pointer;
}

/* divider */
.cv-divider { height: 1px; background: var(--cv-line); border: none; margin: 0; }

/* empty column hint while editing */
.cv-col__empty {
  border: 2px dashed var(--cv-line); border-radius: 12px; padding: 20px; text-align: center;
  color: var(--cv-muted); font-size: .8rem;
}

/* footer */
.cv-footer { padding: 18px; text-align: center; font-size: .72rem; color: var(--cv-muted); border-top: 1px solid var(--cv-line); }

/* ───────────── Drag & drop indicators ───────────── */
.dnd-placeholder { height: 10px; margin: -4px 0; border-radius: 999px; background: var(--cv-accent); opacity: .55; }
.cv-col.is-droptarget { outline: 2px dashed var(--cv-accent); outline-offset: 6px; border-radius: 12px; }
.cv-section.is-dragging { opacity: .4; }

/* ───────────── Preview mode hides editor affordances ───────────── */
.preview-mode .cv-section__bar,
.preview-mode .cv-ui { display: none !important; }
.preview-mode .cv-section.is-selected { box-shadow: none; }

/* ───────────── Print ───────────── */
@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; color-adjust: exact !important; }
  .no-print, .canvas__zoombar, .cv-section__bar, .cv-ui { display: none !important; }
  body { background: #fff; }
  .app, .workspace { display: block; height: auto; overflow: visible; }
  .panel, .toolbar { display: none !important; }
  .canvas, .canvas__stage { padding: 0; background: #fff; overflow: visible; }
  #cvRoot { transform: none !important; gap: 0; }
  .cv-page { box-shadow: none; border-radius: 0; break-after: page; }
  .cv-page::after { display: none; }
  @page { size: A4; margin: 12mm; }
}

/* ───────────── Responsive (stack panels on small screens) ───────────── */
@media (max-width: 1100px) {
  :root { --panel-w: 260px; }
}
@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
  .panel { max-height: 38vh; }
  .panel--left { order: 2; } .canvas { order: 1; } .panel--right { order: 3; }
}
