:root {
  --primary: #0b5ed7; /* royal blue */
  --accent: #f59e0b; /* amber */
  --bg: #f8fafc; /* neutral-100 */
  --fg: #0f172a; /* neutral-900 */
  --muted: #64748b; /* slate-500 */
  --border: #e5e7eb; /* neutral-200 */
  --radius: 12px;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px / 1.5 "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
.wrap {
  max-width: 1200px;
  margin-inline: auto;
  padding: 0 16px;
}
.site-header {
  position: sticky;
  top: 0;
  background: #fff;
  border-bottom: 1px solid var(--border);
  z-index: 10;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}
.titles h1 {
  margin: 0;
  font-size: 18px;
}
.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.select,
.btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
  color: var(--fg);
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-secondary {
  background: #fff;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-ghost {
  background: #fff;
}
.btn-danger {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
}
.btn-sm {
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 8px;
}

.layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 16px;
  max-width: 1200px;
  margin: 18px auto;
  padding: 0 16px;
}
.pane {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.pane-form {
  padding: 16px;
}
.pane-preview {
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.preview-hint {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

.section-title {
  margin: 16px 0 8px;
  font-size: 18px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.field input,
.field textarea {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card-inline {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 10px;
}
.form-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}
.table th,
.table td {
  padding: 8px;
  border-top: 1px solid var(--border);
  text-align: left;
}
.auth-note {
  color: var(--muted);
  font-size: 13px;
}

.paper {
  width: 794px;
  height: 1123px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 0;
  overflow: hidden;
  position: relative;
}
.A4 {
  aspect-ratio: 794 / 1123;
}
.resume {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* Sections shared */
.resume .header {
  padding: 24px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
}
.resume .header .photo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary);
  background: #f1f5f9;
}
.resume .header .info h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}
.resume .header .info p {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 600;
}
.row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 18px;
  padding: 18px 24px;
}
.sidebar {
  border-right: 1px solid var(--border);
  padding-right: 18px;
}
.section h3 {
  margin: 0 0 8px 0;
  color: var(--primary);
  font-size: 16px;
}
.section ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.item .meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}
.item .title {
  font-weight: 700;
}
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.badge {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
}

/* Templates (layout + accents) */
/* Classic: left sidebar personal details */
.tpl-classic .row {
  grid-template-columns: 0.9fr 2.1fr;
}
.tpl-classic .sidebar .section h3 {
  border-bottom: 2px solid var(--primary);
  padding-bottom: 6px;
}

/* Modern: top bar ribbon */
.tpl-modern .header {
  background: linear-gradient(90deg, var(--primary), color-mix(in oklab, var(--primary), #000 10%));
  color: #fff;
}
.tpl-modern .header .photo {
  border-color: #fff;
}
.tpl-modern .section h3 {
  color: color-mix(in oklab, var(--primary), #000 25%);
}

/* Elegant: block cards */
.tpl-elegant .row {
  grid-template-columns: 1fr;
}
.tpl-elegant .block {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
}
.tpl-elegant .section h3 {
  border-left: 6px solid var(--primary);
  padding-left: 8px;
}

/* Minimal: clean, dense */
.tpl-minimal .header {
  border-bottom: none;
}
.tpl-minimal .section h3 {
  color: #111;
}
.tpl-minimal .badge {
  border-color: #cbd5e1;
}

/* Photo Sidebar template */
.tpl-photo .row {
  grid-template-columns: 1fr 2fr;
  padding: 0;
}
.tpl-photo .header {
  border-bottom: none;
  padding: 16px 20px 0 20px;
}
.tpl-photo .sidebar {
  border-right: none;
  padding: 22px 18px;
  background: var(--primary);
  color: #fff;
}
.tpl-photo .sidebar .section h3 {
  color: #fff;
  border-bottom: 1px solid color-mix(in oklab, #ffffff, transparent 60%);
  padding-bottom: 6px;
}
.tpl-photo .sidebar .personal-photo {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  display: block;
  margin-bottom: 12px;
}
.tpl-photo .sidebar ul {
  gap: 6px;
}
.tpl-photo .content {
  padding: 18px 24px;
}
.tpl-photo .section h3 {
  color: color-mix(in oklab, var(--primary), #000 20%);
}
.tpl-photo .header .photo {
  display: none;
}

/* A4 Sahil-style template and page-break rules */
.a4-page {
  /* A4 canvas for on-screen preview; html2pdf will render to A4 */
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid var(--border);
  display: grid;
  grid-template-columns: 28% 72%;
  overflow: hidden;
}

.template-sahil .left {
  background: #1f4ea8; /* brand blue aligned to palette */
  color: #ffffff;
  padding: 18mm 10mm 14mm;
  display: flex;
  flex-direction: column;
  gap: 10mm;
}
.template-sahil .left .photo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}
.template-sahil .left .photo-wrap img {
  width: 38mm;
  height: 38mm;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.template-sahil .left .person .name {
  margin: 0;
  font-size: 18pt;
  line-height: 1.1;
}
.template-sahil .left .person .title {
  margin-top: 2mm;
  opacity: 0.95;
  font-weight: 600;
}
.template-sahil .left .contact {
  display: grid;
  gap: 3mm;
  font-size: 10pt;
  line-height: 1.4;
}
.template-sahil .left .sidebar-group h3 {
  margin: 0 0 3mm 0;
  font-size: 11pt;
  font-weight: 700;
  opacity: 0.98;
}
.template-sahil .left .sidebar-group .bullets {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 2mm;
  font-size: 10pt;
}
.template-sahil .left .sidebar-group .bullets li::before {
  content: "•";
  margin-right: 3mm;
}

.template-sahil .right {
  padding: 12mm 12mm 12mm 10mm;
  color: var(--fg);
  background: #fff;
}
.template-sahil .right .block {
  padding: 0 0 8mm 0;
  margin: 0 0 8mm 0;
  border-bottom: 1px solid var(--border);
}
.template-sahil .right .block:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.template-sahil .right h2 {
  color: #1f4ea8;
  font-size: 13pt;
  margin: 0 0 3mm 0;
}
.template-sahil .right .multiline {
  white-space: pre-line; /* preserve line breaks from textareas */
  font-size: 10.5pt;
}

/* Page-break helpers for multi-page export */
.avoid-break {
  break-inside: avoid;
  page-break-inside: avoid;
}
.page-break {
  display: none;
}

@media print {
  /* ensure clean print and respect page-break markers */
  .page-break {
    display: block;
    break-before: page;
    page-break-before: always;
  }
  .avoid-break {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  body {
    background: #fff;
  }
  .site-header,
  .pane-form,
  .site-footer,
  .preview-hint {
    display: none;
  }
  .pane-preview {
    padding: 0;
  }
  .paper {
    border: none;
    width: auto;
    height: auto;
  }
}

/* Color themes (swap --primary and subtle accents) */
.theme-blue {
  --primary: #0b5ed7;
}
.theme-teal {
  --primary: #0f766e;
}
.theme-amber {
  --primary: #d97706;
}
.theme-slate {
  --primary: #334155;
}

/* Responsive */
@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .pane-preview .paper {
    transform: scale(0.9);
    transform-origin: top center;
  }
}
