:root {
  --ink: #0e0e0e;
  --paper: #f7f4ef;
  --accent: #c8502a;
  --accent2: #2a6ec8;
  --muted: #888;
  --border: #d8d3cb;
  --card: #fff;
  --success: #2e7d52;
  --warn: #b85c00;
  --r: 10px;
  --sh: 0 2px 16px rgba(0, 0, 0, 0.08);
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: "DM Sans", sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
}

/* ─── APP SHELL ─── */
.app {
  display: flex;
  min-height: 100vh;
}

/* ─── SIDEBAR ─── */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--ink);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 55px;
  height: 100vh;
  overflow-y: auto;
  z-index: 20;
}
.sidebar-logo {
  padding: 24px 20px 16px;
  font-family: "Playfair Display", serif;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}
.sidebar-logo span {
  color: var(--accent);
}
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}
.nav-label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.28);
  padding: 14px 20px 4px;
}
.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 20px;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.55);
  font-family: "DM Sans", sans-serif;
  font-size: 0.84rem;
  font-weight: 400;
  text-align: left;
  transition: all 0.14s;
}
.nav-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}
.nav-btn.active {
  color: #fff;
  background: rgba(200, 80, 42, 0.2);
  border-left: 3px solid var(--accent);
  padding-left: 17px;
}
.nav-btn svg {
  width: 15px;
  height: 15px;
  opacity: 0.65;
  flex-shrink: 0;
}
.nav-btn span {
  flex: 1;
}

/* ─── MAIN AREA ─── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ─── TOPBAR ─── */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 55px;
  z-index: 15;
  flex-shrink: 0;
  overflow: visible;
}
.topbar-left .ttitle {
  font-family: "Playfair Display", serif;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}
.topbar-left .tsub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 1px;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── CONTENT ─── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}
.panel {
  display: none;
}
.panel.active {
  display: block;
}

/* ─── CARDS ─── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--sh);
}
.card-title {
  font-family: "Playfair Display", serif;
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 3px;
}
.card-sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 16px;
}

/* ─── FORMS ─── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-group.full {
  grid-column: 1/-1;
}
label {
  font-size: 0.74rem;
  font-weight: 600;
  color: #555;
}
input,
textarea,
select {
  width: 100%;
  padding: 8px 11px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-family: "DM Sans", sans-serif;
  font-size: 0.85rem;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s;
  outline: none;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent2);
}
textarea {
  resize: vertical;
  min-height: 76px;
  line-height: 1.5;
}

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  font-family: "DM Sans", sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.14s;
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: #b0431e;
}
.btn-secondary {
  background: var(--paper);
  color: var(--ink);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover {
  border-color: var(--accent2);
  color: var(--accent2);
}
.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover {
  background: #236040;
}
.btn-sm {
  padding: 6px 11px;
  font-size: 0.78rem;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── EXPORT DROPDOWN ─── */
.export-wrap {
  position: relative;
  display: inline-block;
}
.export-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.14);
  min-width: 220px;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition:
    opacity 0.15s,
    transform 0.15s;
}
.export-menu.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}
.export-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink);
  transition: background 0.1s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.export-item:first-child {
  border-radius: 9px 9px 0 0;
}
.export-item:last-child {
  border-radius: 0 0 9px 9px;
}
.export-item:hover {
  background: var(--paper);
}
.ei-icon {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.ei-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ei-label {
  font-weight: 600;
  font-size: 0.81rem;
}
.ei-desc {
  font-size: 0.7rem;
  color: var(--muted);
}
.export-divider {
  height: 1px;
  background: var(--border);
  margin: 3px 0;
}

/* ─── EXP/EDU ITEMS ─── */
.exp-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.exp-item {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: #fdfcfa;
}
.exp-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
}
.exp-num {
  width: 20px;
  height: 20px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 0.66rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.exp-title {
  font-weight: 600;
  font-size: 0.82rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-del {
  background: none;
  border: none;
  cursor: pointer;
  color: #ccc;
  font-size: 0.9rem;
  line-height: 1;
  padding: 2px 4px;
  transition: color 0.14s;
}
.btn-del:hover {
  color: var(--accent);
}

/* ─── AI RESULT ─── */
.ai-box {
  background: #f0f6ff;
  border: 1.5px solid #b8d0f8;
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 12px;
  font-size: 0.85rem;
  line-height: 1.65;
  display: none;
}
.ai-box.show {
  display: block;
}
.ai-box-label {
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--accent2);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* ─── SCORE ─── */
.score-row {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.score-donut {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  flex-shrink: 0;
  background: conic-gradient(var(--accent) calc(var(--pct, 0) * 1%), #e8e3db 0);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.score-donut::after {
  content: "";
  width: 66px;
  height: 66px;
  background: var(--card);
  border-radius: 50%;
  position: absolute;
}
.score-val {
  position: relative;
  z-index: 1;
  font-family: "Playfair Display", serif;
  font-size: 1.65rem;
  font-weight: 700;
}
.score-meta {
}
.score-grade {
  font-family: "Playfair Display", serif;
  font-size: 1.25rem;
  font-weight: 700;
}
.score-fb {
  font-size: 0.82rem;
  color: #555;
  margin-top: 5px;
  max-width: 360px;
  line-height: 1.5;
}
.score-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.score-col-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.score-col-title.g {
  color: var(--success);
}
.score-col-title.o {
  color: var(--warn);
}
.score-list {
  list-style: none;
}
.score-list li {
  font-size: 0.8rem;
  color: #333;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 7px;
  align-items: flex-start;
  line-height: 1.45;
}
.score-list li::before {
  content: "•";
  flex-shrink: 0;
}
.score-list.g li::before {
  color: var(--success);
}
.score-list.o li::before {
  color: var(--warn);
}

/* ─── TAGS ─── */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.tag {
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
  background: #eef3ff;
  color: var(--accent2);
  border: 1px solid #c0d4f5;
  cursor: pointer;
  transition: all 0.13s;
}
.tag:hover {
  background: var(--accent2);
  color: #fff;
}
.tag.found {
  background: #e6f5ed;
  color: var(--success);
  border-color: #a3d4b5;
}
.tag.missing {
  background: #fff0eb;
  color: var(--accent);
  border-color: #f5c4b0;
}

/* ─── PREVIEW PANEL ─── */
#preview-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}
#resume-frame {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--sh);
  overflow: hidden;
}
#resume-chrome {
  padding: 8px 14px;
  background: #f0ede8;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 6px;
  align-items: center;
}
.chrome-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
#resume-body {
  padding: 32px;
  min-height: 500px;
}

/* ─── TEMPLATE GALLERY ─── */
.tgallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.tcard {
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 12px 8px;
  cursor: pointer;
  transition: all 0.14s;
  background: #fdfcfa;
  text-align: center;
}
.tcard:hover,
.tcard.sel {
  border-color: var(--accent);
  background: #fff6f3;
}
.tcard-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  margin: 0 auto 7px;
  border: 2px solid rgba(0, 0, 0, 0.07);
}
.tcard-name {
  font-weight: 600;
  font-size: 0.8rem;
  margin-bottom: 2px;
}
.tcard-layout {
  color: var(--muted);
  font-size: 0.68rem;
}
.tcard-badge {
  font-size: 0.64rem;
  border-radius: 4px;
  padding: 1px 6px;
  margin-top: 5px;
  display: inline-block;
  font-weight: 600;
}

/* ─── TAILOR COLS ─── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ─── SPINNER ─── */
.spin {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spinning 0.6s linear infinite;
  vertical-align: middle;
}
@keyframes spinning {
  to {
    transform: rotate(360deg);
  }
}
.spin-dark {
  border-color: rgba(0, 0, 0, 0.15);
  border-top-color: var(--accent2);
}

/* ─── TOAST ─── */
#toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #1a1a1a;
  color: #fff;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transform: translateY(16px);
  opacity: 0;
  transition: all 0.22s;
  pointer-events: none;
  z-index: 999999;
  max-width: 320px;
}
#toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ─── ERROR BOX ─── */
.err-box {
  background: #fff0eb;
  border: 1.5px solid #f5c4b0;
  border-radius: 7px;
  padding: 9px 12px;
  margin-top: 10px;
  font-size: 0.8rem;
  color: #9a3416;
  display: none;
  word-break: break-word;
  line-height: 1.5;
}
.err-box.show {
  display: block;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 860px) {
  .sidebar {
    width: 52px;
  }
  .sidebar-logo,
  .nav-label,
  .nav-btn span {
    display: none;
  }
  .nav-btn {
    justify-content: center;
    padding: 12px;
  }
  .content {
    padding: 14px;
  }
  .form-grid,
  .two-col,
  .score-cols {
    grid-template-columns: 1fr;
  }
}

/* ─── PRINT ─── */
@page {
  size: A4;
  margin: 14mm;
}
@media print {
  html,
  body {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .sidebar,
  .topbar,
  .content > *:not(#panel-preview),
  #resume-chrome,
  #preview-toolbar,
  #toast {
    display: none !important;
  }
  .panel {
    display: none !important;
  }
  #panel-preview {
    display: block !important;
    padding: 0 !important;
  }
  #resume-frame {
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }
  .main,
  .content,
  body,
  .app {
    background: #fff !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  #resume-body {
    padding: 0 !important;
  }
}

/* ════════════════════════════════════════════
   PHOTO & SIGNATURE ADDITIONS (new — do not edit above)
   ════════════════════════════════════════════ */

/* Upload drop zones */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition:
    border-color 0.15s,
    background 0.15s;
  background: #fdfcfa;
}
.upload-zone:hover {
  border-color: var(--accent);
  background: #fff6f3;
}
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
}
.upload-zone-icon {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 5px;
}
.upload-zone-text {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}
.upload-zone-text strong {
  color: var(--accent);
}

/* Preview strip shown after upload */
.img-preview-strip {
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 10px;
  background: #f7f4ef;
  border: 1px solid var(--border);
  border-radius: 7px;
}
.img-preview-strip.visible {
  display: flex;
}
.img-preview-strip img {
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.img-preview-strip img.thumb-photo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
}
.img-preview-strip img.thumb-sign {
  width: 110px;
  height: 40px;
  border-radius: 4px;
  object-fit: contain;
  background: #fff;
}
.img-preview-strip .img-name {
  font-size: 0.75rem;
  color: #555;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-remove-img {
  background: none;
  border: none;
  cursor: pointer;
  color: #bbb;
  font-size: 0.82rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition:
    color 0.13s,
    background 0.13s;
  flex-shrink: 0;
}
.btn-remove-img:hover {
  color: var(--accent);
  background: #fff0eb;
}

/* ─── PDF PAGE BREAK FIX ─── */

/* prevent resume sections from splitting across pages */
.rt-entry,
.rt-tag-list,
.rt-pill-list,
.rt-sign-wrap {
  page-break-inside: avoid;
  break-inside: avoid;
}

/* keep section title with its content */
.rt-section-title {
  page-break-after: avoid;
  break-after: avoid;
}

/* prevent tags/skills from splitting */
.rt-tag,
.rt-pill {
  page-break-inside: avoid;
}

/* Resume-level photo & signature rendered inside #resume-body */
.rt-photo {
  display: block;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.7);
  flex-shrink: 0;
}
.rt-photo-sq {
  border-radius: 8px; /* square variant used by some themes */
}
.rt-sign-wrap {
  margin-top: 14px;
  padding-top: 10px;
  display: inline-block;
}
.rt-sign {
  display: block;
  max-width: 140px;
  height: 44px;
  object-fit: contain;
}

/* Header layout helper when photo is present */
.rt-header-with-photo {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.rt-header-with-photo .rt-header-text {
  flex: 1;
  min-width: 0;
}

/* ════════════════════════════════════════════
   PHOTO EDITOR MODAL
   ════════════════════════════════════════════ */

/* Shared overlay backdrop */
.img-editor-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 20, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.img-editor-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* Shared modal shell */
.img-editor-modal {
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.28);
  width: min(560px, 96vw);
  overflow: hidden;
  transform: translateY(24px) scale(0.97);
  transition: transform 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.img-editor-overlay.open .img-editor-modal {
  transform: translateY(0) scale(1);
}

/* Modal header */
.img-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid #f0f0f0;
}
.img-editor-header h3 {
  font-family: "Playfair Display", serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}
.img-editor-close {
  background: var(--paper);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  color: var(--ink);
  flex-shrink: 0;
}
.img-editor-close:hover {
  background: #e8e4df;
}

/* ── Photo editor: two-column body ── */
.img-editor-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

/* Left: live preview */
.img-editor-preview-col {
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f8f9ff 0%, #f0f2fb 100%);
  border-right: 1px solid #f0f0f0;
  min-height: 270px;
}
.img-editor-preview-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
#photo-preview-img {
  display: block;
  object-fit: cover;
  transition: all 0.2s;
  max-width: 160px;
  max-height: 160px;
}

/* Right: controls */
.img-editor-controls-col {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  max-height: 340px;
}

/* Control group */
.iec-group label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: #444;
  margin-bottom: 7px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.iec-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Range slider — reset to avoid inheriting global input styles */
.iec-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 99px;
  background: #e0dcd6;
  outline: none;
  cursor: pointer;
  border: none;
  padding: 0;
  min-height: unset;
  width: auto;
}
.iec-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(200, 80, 42, 0.4);
  border: none;
}
.iec-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}
.iec-val {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink);
  min-width: 38px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Shape quick-pick and border-width buttons */
.iec-shape-row,
.iec-border-width-wrap {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.iec-bw-btn {
  padding: 4px 11px;
  border-radius: 99px;
  border: 1.5px solid var(--border);
  font-size: 0.71rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--card);
  color: #555;
  font-family: "DM Sans", sans-serif;
  transition: all 0.16s;
}
.iec-bw-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.iec-bw-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Border color swatches */
.iec-border-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.iec-color-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition:
    transform 0.15s,
    border-color 0.15s;
  flex-shrink: 0;
}
.iec-color-btn:hover,
.iec-color-btn.active {
  transform: scale(1.2);
  border-color: var(--ink) !important;
}

/* Custom color picker — override global input styles */
.iec-color-picker-wrap input[type="color"] {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border);
  padding: 0;
  cursor: pointer;
  background: none;
  outline: none;
  min-height: unset;
}

/* Modal footer — shared by both modals */
.img-editor-footer,
.sign-editor-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 22px 18px;
  border-top: 1px solid #f0f0f0;
  background: #fafafa;
}
.ied-btn {
  padding: 9px 22px;
  border-radius: 8px;
  border: none;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: "DM Sans", sans-serif;
  transition: all 0.16s;
}
.ied-btn-cancel {
  background: var(--paper);
  color: #555;
  border: 1.5px solid var(--border);
}
.ied-btn-cancel:hover {
  background: #ece9e4;
}
.ied-btn-apply {
  background: var(--accent);
  color: #fff;
}
.ied-btn-apply:hover {
  background: #b0431e;
}

/* ════════════════════════════════════════════
   SIGNATURE EDITOR MODAL
   ════════════════════════════════════════════ */

/* Modal body for sign editor */
.sign-editor-body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Side-by-side original / result preview */
.sign-preview-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.sign-preview-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sign-preview-box {
  border-radius: 10px;
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  padding: 12px;
  background: #f9f8f6;
}
/* Checkerboard = transparency indicator */
.sign-preview-box.checker {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #ccc 25%, transparent 25%),
    linear-gradient(-45deg, #ccc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ccc 75%),
    linear-gradient(-45deg, transparent 75%, #ccc 75%);
  background-size: 12px 12px;
  background-position:
    0 0,
    0 6px,
    6px -6px,
    -6px 0px;
}
.sign-preview-box img {
  max-width: 100%;
  max-height: 72px;
  object-fit: contain;
  display: block;
  border: none;
  background: none;
}
.sign-preview-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
}

/* BG removal control panel */
.bg-remove-controls {
  background: #f8f9ff;
  border-radius: 12px;
  padding: 16px;
  border: 1.5px solid #e4e8f8;
}
.bg-remove-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.bg-remove-hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 10px;
  line-height: 1.45;
}

/* Method selector buttons */
.bg-remove-row {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.bg-method-btn {
  padding: 5px 13px;
  border-radius: 99px;
  border: 1.5px solid var(--border);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--card);
  color: #555;
  font-family: "DM Sans", sans-serif;
  transition: all 0.16s;
}
.bg-method-btn:hover {
  border-color: var(--accent2);
  color: var(--accent2);
}
.bg-method-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

/* Tolerance slider row */
.bg-threshold-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.bg-threshold-row label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #555;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: 0;
}
.bg-threshold-hint {
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 10px;
}

/* Remove BG action button */
.bg-remove-btn {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--ink) 0%, #2d2d4e 100%);
  color: #fff;
  border: none;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: "DM Sans", sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    opacity 0.2s,
    transform 0.2s;
  margin-top: 6px;
}
.bg-remove-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}
.bg-remove-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Restore original button */
.bg-restore-btn {
  width: 100%;
  padding: 8px;
  border-radius: 10px;
  background: var(--paper);
  color: #555;
  border: 1.5px solid var(--border);
  font-size: 0.76rem;
  font-weight: 600;
  font-family: "DM Sans", sans-serif;
  cursor: pointer;
  margin-top: 7px;
  transition: background 0.16s;
}
.bg-restore-btn:hover {
  background: #ece9e4;
}

/* ── Edit button in preview strip ── */
.btn-edit-img {
  background: #eef3ff;
  border: 1px solid #c0d4f5;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent2);
  cursor: pointer;
  font-family: "DM Sans", sans-serif;
  transition:
    background 0.16s,
    color 0.16s;
  flex-shrink: 0;
  white-space: nowrap;
}
.btn-edit-img:hover {
  background: var(--accent2);
  color: #fff;
}

/* ── Spinner used inside bg-remove-btn ── */
@keyframes spin-icon {
  to {
    transform: rotate(360deg);
  }
}
.spin-icon {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin-icon 0.65s linear infinite;
  vertical-align: middle;
}

/* ── Responsive: stack modal columns on small screens ── */
@media (max-width: 600px) {
  .img-editor-body {
    grid-template-columns: 1fr;
  }
  .img-editor-preview-col {
    border-right: none;
    border-bottom: 1px solid #f0f0f0;
    min-height: 160px;
  }
  .img-editor-controls-col {
    max-height: none;
  }
  .sign-preview-wrap {
    grid-template-columns: 1fr;
  }
}
