:root {
  --bg: #0d1626;
  --panel: #111c30;
  --panel-border: rgba(255, 255, 255, 0.08);
  --muted: #9cb0cb;
  --text: #eef3ff;
  --accent: #19b2ae;
  --accent-strong: #2b7ce4;
  --card: rgba(255, 255, 255, 0.03);
  --input-bg: rgba(255, 255, 255, 0.06);
  --shadow: 0 24px 60px rgba(6, 12, 30, 0.35);
  --radius: 16px;
  --font-heading: "Space Grotesk", "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --font-body: "Plus Jakarta Sans", "Space Grotesk", system-ui, -apple-system, sans-serif;
}

[data-theme="light"] {
  --bg: #f6f7fb;
  --panel: #ffffff;
  --panel-border: rgba(12, 18, 36, 0.08);
  --muted: #6f7783;
  --text: #0f172a;
  --accent: #19b2ae;
  --accent-strong: #2b7ce4;
  --card: #f4f7fb;
  --input-bg: #f4f7fb;
  --shadow: 0 12px 30px rgba(12, 18, 36, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0 32px 48px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  background: radial-gradient(circle at 12% 20%, rgba(43, 124, 228, 0.18), transparent 30%),
    radial-gradient(circle at 80% 10%, rgba(25, 178, 174, 0.18), transparent 32%),
    linear-gradient(145deg, #0d1626, #0f1b2f 55%, #0a1422);
  color: var(--text);
  transition: background 0.25s ease, color 0.25s ease;
}

body[data-theme="light"] {
  background: linear-gradient(135deg, #f9fbff, #f1f5fb 50%, #e9eff7);
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand__logo {
  height: 38px;
  width: auto;
}

.masthead h1 {
  margin: 4px 0 0;
  font-size: 26px;
  letter-spacing: -0.01em;
}

.mast-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.eyebrow {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--muted);
  margin: 0;
}

.template-bar {
  margin-bottom: 14px;
}

.template-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.panel,
.preview-shell {
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--panel-border);
  padding: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.panel h2 {
  margin: 4px 0 0;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.button {
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 600;
  padding: 10px 14px;
  color: #0b1224;
  background: #e9ecff;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border 0.15s ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 30px rgba(75, 107, 251, 0.35);
}

.button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
}

.button.ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--text);
}

[data-theme="light"] .button.ghost {
  background: #eef2f7;
  border-color: rgba(12, 18, 36, 0.08);
  color: #0f172a;
}

.site-footer {
  margin-top: 32px;
  padding: 18px 24px 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.footer-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: nowrap;
  align-items: flex-start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--panel-border);
}

.footer-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 12px 24px;
}

.footer-links a {
  display: block;
  color: var(--text);
  text-decoration: none;
  padding: 4px 0;
  font-weight: 600;
}

.footer-links a:hover {
  color: var(--accent-strong);
}

.footer-title {
  margin: 0 0 6px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.small-note {
  margin: 4px 0 0;
  font-size: 12px;
}

.footer-bottom {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.footer-legal {
  display: flex;
  gap: 12px;
}

.footer-legal a {
  color: var(--muted);
  text-decoration: none;
}

.footer-legal a:hover {
  color: var(--text);
}

@media (max-width: 900px) {
  .footer-top {
    flex-wrap: wrap;
  }
  .footer-links {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}

.button.tiny {
  padding: 8px 12px;
  font-size: 13px;
}

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

.template-card {
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: var(--card);
  padding: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border 0.15s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.template-card.active {
  border-color: rgba(75, 107, 251, 0.8);
  box-shadow: 0 15px 40px rgba(75, 107, 251, 0.25);
}

.template-card:hover {
  border-color: rgba(75, 107, 251, 0.6);
  transform: translateY(-2px);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(380px, 480px) minmax(520px, 1fr);
  gap: 16px;
  align-items: start;
  flex: 1;
}

.left-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.thumb {
  width: 48px;
  height: 60px;
  border-radius: 8px;
  border: 1px solid var(--panel-border);
  position: relative;
  overflow: hidden;
}

.thumb::after,
.thumb::before {
  content: "";
  position: absolute;
  border-radius: 6px;
}

.thumb--clean {
  background: linear-gradient(180deg, rgba(31, 178, 166, 0.28), rgba(44, 110, 232, 0.12));
}

.thumb--clean::before {
  width: 4px;
  height: 100%;
  background: #4b6bfb;
  left: 6px;
}

.thumb--modern {
  background: linear-gradient(180deg, rgba(44, 110, 232, 0.28), rgba(109, 208, 255, 0.1));
}

.thumb--modern::before {
  width: 70%;
  height: 14px;
  background: rgba(255, 255, 255, 0.35);
  top: 10px;
  left: 14px;
}

.thumb--sidebar {
  background: linear-gradient(135deg, rgba(31, 178, 166, 0.32), rgba(44, 110, 232, 0.12));
}

.thumb--sidebar::before {
  width: 12px;
  height: 100%;
  background: rgba(255, 255, 255, 0.2);
  left: 8px;
}

.thumb--custom {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(44, 110, 232, 0.18));
}

.template-title {
  margin: 0 0 4px;
  font-weight: 600;
}

.template-meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.field.full {
  grid-column: 1 / -1;
}

.field input,
.field textarea,
.custom-form input,
.custom-form select,
.custom-form textarea,
.swatch select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--input-bg);
  color: var(--text);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  transition: border 0.12s ease, box-shadow 0.12s ease;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: rgba(44, 110, 232, 0.7);
  box-shadow: 0 0 0 3px rgba(44, 110, 232, 0.2);
}

.builder {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  align-items: start;
}

[data-theme="light"] .template-card,
[data-theme="light"] .palette,
[data-theme="light"] .dropzone,
[data-theme="light"] .layout-block {
  border-color: rgba(12, 18, 36, 0.08);
}

[data-theme="light"] .field input,
[data-theme="light"] .field textarea,
[data-theme="light"] .custom-form input,
[data-theme="light"] .custom-form textarea,
[data-theme="light"] .custom-form select,
[data-theme="light"] .swatch select {
  border-color: rgba(12, 18, 36, 0.08);
}

.palette {
  background: var(--card);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 12px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.28);
  cursor: grab;
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  transition: border 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}

.chip:hover {
  border-color: rgba(44, 110, 232, 0.8);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.dropzone {
  min-height: 200px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--card);
  transition: border 0.12s ease, background 0.12s ease;
}

.dropzone.active {
  border-color: rgba(44, 110, 232, 0.85);
  background: rgba(44, 110, 232, 0.08);
}

.drop-hint {
  color: var(--muted);
  text-align: center;
  padding: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
}

.layout-block {
  background: var(--card);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: grab;
}

.layout-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.layout-meta .pill-sm {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--text);
}

.layout-block span {
  font-weight: 600;
}

.layout-block button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: var(--text);
  padding: 4px 8px;
  cursor: pointer;
  transition: border 0.12s ease, color 0.12s ease;
}

.layout-block button:hover {
  border-color: rgba(44, 110, 232, 0.7);
  color: #e8edff;
}

.layout-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.swatch {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.swatch input[type="color"] {
  width: 44px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: transparent;
}

.custom-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.tiplist {
  padding-left: 18px;
  color: var(--muted);
}

.preview-shell {
  position: sticky;
  top: 16px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.muted {
  color: var(--muted);
  margin: 0;
}

.cv-preview {
  margin-top: 12px;
  background: #f7f9fc;
  color: #0f172a;
  border-radius: 16px;
  min-height: 297mm;
  width: 210mm;
  padding: 36px;
  box-shadow: 0 18px 50px rgba(3, 6, 20, 0.15);
  font-family: var(--font-body);
  --accent-color: #1fb2a6;
  border: 1px solid rgba(12, 18, 36, 0.06);
  box-sizing: border-box;
}

.cv-preview h1,
.cv-preview h2,
.cv-preview h3 {
  margin: 0;
  font-family: var(--font-heading);
}

.cv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding-bottom: 12px;
  page-break-inside: avoid;
}

.cv-name {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.cv-role {
  color: #111827;
  font-weight: 600;
  margin-top: 4px;
}

.cv-contact {
  color: #475467;
  font-size: 14px;
}

.cv-section {
  margin-top: 18px;
  page-break-inside: avoid;
  break-inside: avoid;
}

.cv-section h3 {
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #334155;
  margin-bottom: 6px;
}

.cv-body {
  color: #1f2937;
  line-height: 1.6;
  white-space: pre-wrap;
}

.taglist {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.tag {
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(44, 110, 232, 0.12);
  color: #1d2a6f;
  font-weight: 600;
  font-size: 12px;
}

.pill {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.15);
  color: #0f172a;
  font-weight: 700;
  font-size: 12px;
}

.pill-sm {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.15);
  color: #0f172a;
  font-weight: 700;
  font-size: 11px;
}

.split-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  page-break-inside: avoid;
}

.split-row.split-1 {
  grid-template-columns: 1fr;
}

@media (max-width: 720px) {
  .split-row {
    grid-template-columns: 1fr;
  }
}

.bullet-list {
  margin: 0;
  padding-left: 18px;
  color: #1f2937;
}

.template-clean {
  border-left: 12px solid var(--accent-color);
}

.template-clean .cv-section {
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: 12px;
  padding: 12px 14px;
  background: white;
  page-break-inside: avoid;
}

.template-modern .cv-header {
  background: linear-gradient(135deg, rgba(44, 110, 232, 0.14), rgba(31, 178, 166, 0.14));
  border: none;
  padding: 16px;
  border-radius: 12px;
}

.template-modern .cv-section {
  background: white;
  border-radius: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(0, 0, 0, 0.04);
  page-break-inside: avoid;
}

.template-modern .tag {
  background: rgba(31, 178, 166, 0.18);
  color: #0f172a;
}

.template-columns {
  display: grid;
  gap: 14px;
}

.template-columns .columns-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 16px;
  background: white;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
}

.template-columns .columns-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 16px;
}

.template-columns .col-main .cv-section,
.template-columns .col-aside .cv-section {
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
  margin-top: 14px;
}

.template-columns .col-aside .cv-section {
  background: #f7f9fc;
}

.template-columns .cv-contact {
  text-align: right;
}

.template-columns .tag {
  padding: 6px 9px;
  font-size: 11px;
}

@media (max-width: 900px) {
  .template-columns .columns-grid {
    grid-template-columns: 1fr;
  }
  .template-columns .cv-contact {
    text-align: left;
  }
}

.template-custom .cv-section {
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.05);
  background: white;
  page-break-inside: avoid;
}

.hidden {
  display: none;
}

@media (max-width: 960px) {
  body {
    padding: 0 18px 32px;
  }
  .builder {
    grid-template-columns: 1fr;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .preview-shell {
    position: relative;
    top: 0;
  }
  .template-row {
    grid-auto-columns: minmax(200px, 1fr);
  }
}
