.preview-shell {
  min-height: 100vh;
  padding: 28px 16px 80px;
  background: #dfe8f1;
}

.preview-actions {
  width: min(980px, 100%);
  margin: 0 auto 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.resume-page {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  background: #fff;
  color: #162a3a;
  box-shadow: 0 18px 50px rgba(16, 42, 67, 0.2);
  padding: 18mm;
  font-family: "Cairo", Tahoma, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  position: relative;
  overflow: hidden;
}

.resume-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 16px;
  border-bottom: 3px solid var(--accent, #0b3a67);
}

.resume-head h1 {
  font-size: 30px;
  line-height: 1.1;
  margin: 0 0 6px;
  color: var(--accent, #0b3a67);
  letter-spacing: 0;
}

.resume-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #3a5065;
}

.resume-contact {
  display: grid;
  gap: 3px;
  text-align: end;
  color: #4c6277;
  font-size: 11px;
  max-width: 46%;
  overflow-wrap: anywhere;
}

.resume-section {
  margin-top: 15px;
}

.resume-section h2 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--accent, #0b3a67);
  margin: 0 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #d9e2ec;
}

.resume-item {
  margin-bottom: 11px;
  break-inside: avoid;
}

.resume-item-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
}

.resume-item-head span {
  color: #62748a;
  font-weight: 600;
  white-space: nowrap;
}

.resume-page ul {
  margin: 7px 0 0;
  padding-inline-start: 18px;
}

.resume-page li {
  margin-bottom: 4px;
}

.resume-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.resume-tags span {
  font-size: 11px;
  border-radius: 6px;
  color: #243b53;
  background: #eef4fa;
}

.resume-compact {
  font-size: 12px;
  padding: 14mm;
}

/* Color accents for all 30 templates */
.tpl-classic-ats { --accent: #0b3a67; --soft-accent: rgba(11, 58, 103, 0.08); }
.tpl-clean-professional { --accent: #355070; --soft-accent: rgba(53, 80, 112, 0.08); }
.tpl-executive-plain { --accent: #4b5d6b; --soft-accent: rgba(75, 93, 107, 0.08); }
.tpl-modern-one-column { --accent: #1f5c7a; --soft-accent: rgba(31, 92, 122, 0.08); }
.tpl-compact-ats { --accent: #0f4c5c; --soft-accent: rgba(15, 76, 92, 0.08); }
.tpl-corporate-minimal { --accent: #465c69; --soft-accent: rgba(70, 92, 105, 0.08); }
.tpl-fresh-graduate-ats { --accent: #1f7a8c; --soft-accent: rgba(31, 122, 140, 0.08); }
.tpl-technical-ats { --accent: #145da0; --soft-accent: rgba(20, 93, 160, 0.09); }
.tpl-sales-ats { --accent: #c7502c; --soft-accent: rgba(199, 80, 44, 0.09); }
.tpl-academic-simple { --accent: #5a6c7d; --soft-accent: rgba(90, 108, 125, 0.08); }
.tpl-modern-blue { --accent: #0d63a5; --soft-accent: rgba(13, 99, 165, 0.09); }
.tpl-elegant-gray { --accent: #5d6670; --soft-accent: rgba(93, 102, 112, 0.09); }
.tpl-executive-line { --accent: #30475e; --soft-accent: rgba(48, 71, 94, 0.09); }
.tpl-startup-pro { --accent: #2a9d8f; --soft-accent: rgba(42, 157, 143, 0.08); }
.tpl-business-premium { --accent: #7a5c2e; --soft-accent: rgba(122, 92, 46, 0.1); }
.tpl-consultant { --accent: #1c6e8c; --soft-accent: rgba(28, 110, 140, 0.09); }
.tpl-managerial { --accent: #6b705c; --soft-accent: rgba(107, 112, 92, 0.09); }
.tpl-finance-pro { --accent: #2b4f81; --soft-accent: rgba(43, 79, 129, 0.09); }
.tpl-healthcare-clean { --accent: #2b9348; --soft-accent: rgba(43, 147, 72, 0.08); }
.tpl-teacher-professional { --accent: #386fa4; --soft-accent: rgba(56, 111, 164, 0.09); }
.tpl-designer-light { --accent: #6a4c93; --soft-accent: rgba(106, 76, 147, 0.09); }
.tpl-marketing-bold { --accent: #d94f30; --soft-accent: rgba(217, 79, 48, 0.1); }
.tpl-portfolio-style { --accent: #4d9078; --soft-accent: rgba(77, 144, 120, 0.08); }
.tpl-sidebar-modern { --accent: #457b9d; --soft-accent: rgba(69, 123, 157, 0.09); }
.tpl-color-accent { --accent: #8b5cf6; --soft-accent: rgba(139, 92, 246, 0.09); }
.tpl-creative-minimal { --accent: #3d5a80; --soft-accent: rgba(61, 90, 128, 0.09); }
.tpl-product-designer { --accent: #9d4edd; --soft-accent: rgba(157, 78, 221, 0.09); }
.tpl-social-media-cv { --accent: #ee6c4d; --soft-accent: rgba(238, 108, 77, 0.09); }
.tpl-visual-profile { --accent: #588157; --soft-accent: rgba(88, 129, 87, 0.09); }
.tpl-premium-elegant { --accent: #7f5539; --soft-accent: rgba(127, 85, 57, 0.1); }

/* Layout 1: classic */
.layout-1 .resume-section h2 {
  border-bottom-width: 2px;
}

/* Layout 2: centered header */
.layout-2 .resume-head {
  display: block;
  text-align: center;
  border-bottom: 0;
  background: linear-gradient(180deg, var(--soft-accent), transparent);
  border-radius: 10px;
  padding: 16px;
}
.layout-2 .resume-contact {
  text-align: center;
  max-width: 100%;
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px 10px;
}

/* Layout 3: left rail */
.layout-3 {
  padding-inline-start: 26mm;
}
.layout-3::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  bottom: 0;
  width: 18mm;
  background: linear-gradient(180deg, var(--accent), rgba(11, 58, 103, 0.85));
}
.layout-3 .resume-head {
  border-bottom: 0;
  background: var(--soft-accent);
  padding: 12px;
  border-radius: 8px;
}
.layout-3 .resume-section h2 {
  border-bottom: 0;
  background: var(--soft-accent);
  padding: 6px 8px;
  border-radius: 6px;
}

/* Layout 4: contact card */
.layout-4 .resume-head {
  align-items: stretch;
  border-bottom: 0;
}
.layout-4 .resume-contact {
  background: var(--soft-accent);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 8px;
  padding: 10px;
  min-width: 220px;
}
.layout-4 .resume-section h2 {
  border-left: 4px solid var(--accent);
  border-bottom: 0;
  padding-left: 8px;
}

/* Layout 5: boxed sections */
.layout-5 .resume-section {
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}
.layout-5 .resume-section h2 {
  border-bottom: 0;
  margin-bottom: 7px;
}

/* Layout 6: minimal premium */
.layout-6 .resume-page,
.layout-6 {
  color: #253b52;
}
.layout-6 .resume-head {
  border-bottom: 1px solid #c6d3df;
}
.layout-6 .resume-item-head {
  font-weight: 600;
}
.layout-6 .resume-section h2 {
  font-size: 13px;
  letter-spacing: .4px;
}

/* Layout 7: timeline style */
.layout-7 .resume-item {
  padding-inline-start: 14px;
  border-inline-start: 2px solid var(--accent);
  position: relative;
}
.layout-7 .resume-item::before {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  inset-inline-start: -5px;
  top: 6px;
}

/* Layout 8: strong top bar */
.layout-8::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 9mm;
  background: linear-gradient(90deg, var(--accent), rgba(20, 93, 160, 0.7));
}
.layout-8 .resume-head {
  margin-top: 4mm;
}
.layout-8 .resume-section h2 {
  border-bottom: 2px dashed rgba(0, 0, 0, 0.16);
}

/* Layout 9: vibrant chips */
.layout-9 .resume-tags span {
  background: var(--soft-accent);
  color: var(--accent);
  border: 1px solid rgba(0, 0, 0, 0.04);
}
.layout-9 .resume-section h2 {
  display: inline-block;
  border-bottom: 0;
  background: var(--soft-accent);
  padding: 4px 10px;
  border-radius: 999px;
}

/* Layout 10: elegant serif-like spacing */
.layout-10 {
  letter-spacing: 0.1px;
}
.layout-10 .resume-head h1 {
  font-weight: 800;
  text-transform: uppercase;
}
.layout-10 .resume-section {
  margin-top: 18px;
}
.layout-10 .resume-section h2 {
  font-size: 12px;
  letter-spacing: 0.7px;
}

/* Keep highly creative templates distinctive */
.tpl-sidebar-modern .resume-head,
.tpl-visual-profile .resume-head,
.tpl-social-media-cv .resume-head,
.tpl-creative-minimal .resume-head {
  background: var(--accent);
  color: #fff;
  padding: 12px;
  border-radius: 8px;
  border-bottom: 0;
}
.tpl-sidebar-modern .resume-head h1,
.tpl-visual-profile .resume-head h1,
.tpl-social-media-cv .resume-head h1,
.tpl-creative-minimal .resume-head h1,
.tpl-sidebar-modern .resume-title,
.tpl-visual-profile .resume-title,
.tpl-social-media-cv .resume-title,
.tpl-creative-minimal .resume-title,
.tpl-sidebar-modern .resume-contact,
.tpl-visual-profile .resume-contact,
.tpl-social-media-cv .resume-contact,
.tpl-creative-minimal .resume-contact {
  color: #fff;
}

@media screen and (max-width: 820px) {
  .resume-page {
    width: 100%;
    min-height: auto;
    padding: 22px;
  }
  .resume-head,
  .resume-item-head,
  .resume-two-col {
    display: block;
  }
  .resume-contact {
    text-align: start;
    max-width: 100%;
    margin-top: 12px;
  }
  .layout-3 {
    padding-inline-start: 22px;
  }
  .layout-3::before {
    width: 10px;
  }
}

/* --- Resume Preview Polish --- */
.preview-shell {
  padding: 22px 14px 62px;
  background: radial-gradient(circle at top, #ecf4fb 0%, #dfe8f1 55%, #d9e3ed 100%);
}

.preview-actions {
  margin-bottom: 14px;
  gap: 8px;
}

.resume-page {
  box-shadow: 0 14px 44px rgba(16, 42, 67, 0.18);
  font-size: 12.8px;
  line-height: 1.5;
}

.resume-head {
  gap: 18px;
  padding-bottom: 14px;
}

.resume-head h1 {
  font-size: 29px;
  margin-bottom: 5px;
}

.resume-section {
  margin-top: 14px;
}

.resume-section h2 {
  margin-bottom: 7px;
  padding-bottom: 3px;
}

.resume-item {
  margin-bottom: 10px;
}

.resume-page li {
  margin-bottom: 3px;
}

.resume-tags span {
  font-weight: 700;
}

@media screen and (max-width: 820px) {
  .preview-shell {
    padding: 16px 10px 44px;
  }
  .preview-actions {
    justify-content: flex-start;
  }
  .resume-page {
    padding: 18px;
    font-size: 12.4px;
  }
  .resume-head h1 {
    font-size: 25px;
  }
}
