:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #111827;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #5b5cf0;
  --primary-dark: #4546d7;
  --primary-soft: #eef0ff;
  --accent: #18a8a6;
  --success: #11845b;
  --danger: #c83c51;
  --shadow: 0 18px 50px rgba(15, 23, 42, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button, a, label { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
img { max-width: 100%; display: block; }

.skip-link {
  position: fixed; left: 12px; top: 12px; z-index: 1000;
  padding: 10px 14px; background: #111827; color: #fff; border-radius: 10px;
  transform: translateY(-180%); transition: transform .2s;
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92); backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(226,232,240,.9);
}
.nav-shell {
  width: min(1200px, calc(100% - 32px)); margin: 0 auto;
  min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.brand img { width: 132px; height: auto; }
.top-nav { display: flex; align-items: center; gap: 26px; color: #475569; font-weight: 700; font-size: 14px; }
.top-nav a { text-decoration: none; }
.top-nav a:hover { color: var(--primary); }
.icon-button { border: 0; background: transparent; cursor: pointer; }
.mobile-menu-button { display: none; width: 44px; height: 44px; padding: 10px; }
.mobile-menu-button span { display: block; height: 2px; background: #111827; margin: 5px 0; border-radius: 2px; }
.mobile-menu { background: #fff; border-top: 1px solid var(--line); padding: 12px 16px 18px; }
.mobile-menu a { display: block; text-decoration: none; padding: 12px; border-radius: 10px; font-weight: 700; color: #475569; }
.mobile-menu a:hover { background: var(--surface-soft); }

.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(circle at 12% 20%, rgba(91,92,240,.16), transparent 28%),
    radial-gradient(circle at 86% 28%, rgba(24,168,166,.16), transparent 25%),
    linear-gradient(180deg, #fff 0%, #f7f8ff 100%);
  border-bottom: 1px solid var(--line);
}
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 999px; pointer-events: none;
}
.hero::before { width: 240px; height: 240px; right: -110px; top: -85px; border: 36px solid rgba(91,92,240,.08); }
.hero::after { width: 160px; height: 160px; left: -65px; bottom: -95px; border: 30px solid rgba(24,168,166,.08); }
.hero-inner { width: min(980px, calc(100% - 32px)); margin: 0 auto; padding: 70px 0 48px; text-align: center; position: relative; z-index: 1; }
.eyebrow { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 800; color: #4f46e5; background: #eef2ff; border: 1px solid #dfe3ff; border-radius: 999px; padding: 7px 12px; }
.eyebrow span { background: #4f46e5; color: #fff; border-radius: 999px; padding: 2px 7px; }
.hero h1 { margin: 17px 0 12px; font-size: clamp(38px, 6vw, 66px); letter-spacing: -.045em; line-height: 1; }
.hero > .hero-inner > p { max-width: 760px; margin: 0 auto; color: #526175; font-size: clamp(16px, 2vw, 19px); }
.trust-row { margin: 24px auto 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.trust-row span { background: #fff; border: 1px solid var(--line); padding: 8px 11px; border-radius: 999px; font-size: 13px; font-weight: 700; color: #475569; box-shadow: 0 5px 18px rgba(15,23,42,.04); }
.quote-card { max-width: 760px; margin: 26px auto 0; display: flex; gap: 12px; align-items: flex-start; background: rgba(255,255,255,.8); border: 1px solid #e8eaf4; border-radius: 14px; padding: 14px 18px; text-align: left; box-shadow: 0 10px 35px rgba(15,23,42,.04); }
.quote-card p { margin: 0; color: #475569; font-size: 14px; }
.quote-mark { color: var(--primary); font-size: 30px; line-height: 1; font-family: Georgia, serif; }

.page-grid {
  width: min(1540px, calc(100% - 24px));
  margin: 36px auto 44px;
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 150px;
  grid-template-areas: "left-rail workspace right-rail";
  gap: 18px;
  align-items: start;
}
/* Keep the editor in the centre track even when an ad blocker hides either ad box. */
.side-rail { position: sticky; top: 88px; min-height: 620px; min-width: 0; }
.side-rail-left { grid-area: left-rail; }
.side-rail-right { grid-area: right-rail; }
.ad-box { min-height: 600px; border: 1px dashed #cbd5e1; border-radius: 16px; background: #f8fafc; display: grid; place-items: center; color: #94a3b8; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; overflow: hidden; }
.ad-box ins { width: 100%; min-height: 600px; display: block; }

.workspace {
  grid-area: workspace;
  width: 100%;
  max-width: 1160px;
  min-width: 0;
  justify-self: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.workspace-head { padding: 24px 26px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.workspace-head h2 { margin: 3px 0 5px; font-size: 26px; letter-spacing: -.02em; }
.workspace-head p { margin: 0; color: var(--muted); }
.section-kicker { margin: 0; color: var(--primary); text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 900; }

.template-row { padding: 18px 24px; display: flex; gap: 12px; overflow-x: auto; border-bottom: 1px solid var(--line); background: #fbfcff; scrollbar-width: thin; }
.template-choice { flex: 0 0 150px; min-height: 106px; border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 8px; cursor: pointer; text-align: left; color: #334155; position: relative; transition: border-color .18s, box-shadow .18s, transform .18s; }
button.template-choice:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(15,23,42,.07); }
.template-choice.is-active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,92,240,.11); }
.template-choice img { width: 100%; aspect-ratio: 1.414 / 1; object-fit: cover; border-radius: 9px; background: #eef2f7; }
.template-choice > span:not(.upload-icon) { display: block; margin-top: 7px; font-size: 12px; font-weight: 800; }
.upload-choice { border-style: dashed; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; min-height: 106px; cursor: pointer; }
.upload-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 900; font-size: 22px; }
.upload-choice small { color: var(--muted); font-size: 10px; }

.generator-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, .75fr); min-height: 700px; }
.preview-column { padding: 22px; border-right: 1px solid var(--line); min-width: 0; }
.preview-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 13px; }
.preview-toolbar div { min-width: 0; }
.preview-toolbar strong { display: block; font-size: 14px; }
.preview-toolbar span { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }
.canvas-shell { width: 100%; min-height: 360px; background: #e7ebf2; border-radius: 16px; padding: 12px; display: grid; place-items: center; overflow: auto; touch-action: pan-x pan-y; }
#certificateCanvas { display: block; width: 100%; max-width: 100%; height: auto; background: white; box-shadow: 0 18px 40px rgba(15,23,42,.18); border-radius: 4px; touch-action: none; cursor: default; }
#certificateCanvas.is-dragging { cursor: grabbing; }
.drag-hint { margin: 12px 2px 0; color: var(--muted); font-size: 12px; }

.editor-panel { background: #fbfcff; min-width: 0; }
.panel-section { padding: 20px; border-bottom: 1px solid var(--line); }
.panel-section:last-child { border-bottom: 0; }
.panel-title-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-title-row > div { display: flex; align-items: center; gap: 9px; }
.panel-title-row h3 { margin: 0; font-size: 16px; }
.panel-step { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 900; }
.text-button { border: 0; background: none; color: var(--primary); font-weight: 800; cursor: pointer; font-size: 12px; padding: 7px; }
.field-list { display: grid; gap: 9px; }
.field-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: grid; grid-template-columns: 1fr auto; gap: 7px; align-items: end; cursor: pointer; }
.field-card.is-selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,92,240,.09); }
.field-card label { display: block; color: #64748b; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 5px; }
.field-card input { width: 100%; border: 1px solid #dbe2eb; border-radius: 9px; padding: 9px 10px; outline: none; color: #1f2937; background: #fff; }
.field-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,92,240,.09); }
.delete-field { width: 38px; height: 38px; border-radius: 9px; border: 1px solid #f0d6dc; background: #fff6f8; color: var(--danger); cursor: pointer; font-size: 18px; }
.delete-field:hover { background: #ffe9ee; }
.format-grid { display: grid; grid-template-columns: 1fr 86px; gap: 10px; }
.format-grid label { font-size: 11px; color: #64748b; font-weight: 800; }
.format-grid input, .format-grid select { width: 100%; min-height: 42px; border: 1px solid #dbe2eb; background: #fff; border-radius: 10px; padding: 8px 9px; color: #1f2937; margin-top: 5px; }
.format-grid input[type="color"] { padding: 4px; }
.toggle-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 10px; }
.toggle-button { min-height: 40px; border: 1px solid #dbe2eb; background: #fff; border-radius: 10px; cursor: pointer; color: #475569; }
.toggle-button[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary); border-color: #cfd3ff; }
.selection-note { margin: 10px 0 0; color: var(--muted); font-size: 11px; }
.export-section > p { color: var(--muted); font-size: 12px; margin: 0 0 13px; }
.download-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }

.button { min-height: 42px; border-radius: 11px; border: 1px solid transparent; font-weight: 800; cursor: pointer; padding: 9px 14px; transition: transform .16s, box-shadow .16s, background .16s; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 18px rgba(91,92,240,.2); }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { background: #0f766e; color: #fff; }
.button-ghost { background: #fff; border-color: var(--line); color: #475569; }
.button-ghost:hover { background: #f8fafc; }
.button-small { min-height: 34px; padding: 6px 10px; font-size: 11px; }
.button-full { width: 100%; margin-top: 9px; }
.privacy-note { margin-top: 11px !important; color: var(--success) !important; }

.content-section { background: #fff; border-top: 1px solid var(--line); }
.content-inner { width: min(1160px, calc(100% - 32px)); margin: 0 auto; padding: 54px 0 64px; }
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.info-grid article { padding: 22px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.info-grid h2 { margin: 12px 0 7px; font-size: 18px; }
.info-grid p { margin: 0; color: var(--muted); font-size: 14px; }
.info-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: var(--primary-soft); color: var(--primary); font-weight: 900; }
.seo-copy { margin-top: 42px; display: grid; grid-template-columns: 1.3fr .7fr; gap: 42px; align-items: start; }
.seo-copy h2, .faq-block h2, .related-tools h2 { margin: 6px 0 13px; font-size: 29px; letter-spacing: -.025em; }
.seo-copy p { color: #526175; }
.feature-list { background: #f8fafc; border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.feature-list h3 { margin: 0 0 12px; }
.feature-list ul { margin: 0; padding-left: 20px; color: #526175; display: grid; gap: 7px; }
.faq-block { margin-top: 45px; max-width: 900px; }
.faq-block details { border-top: 1px solid var(--line); padding: 15px 0; }
.faq-block details:last-child { border-bottom: 1px solid var(--line); }
.faq-block summary { cursor: pointer; font-weight: 800; }
.faq-block details p { color: var(--muted); margin-bottom: 0; }
.related-tools { margin-top: 46px; }
.section-heading-row { display: flex; justify-content: space-between; gap: 20px; align-items: end; }
.section-heading-row a { color: var(--primary); font-weight: 800; text-decoration: none; font-size: 13px; }
.related-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.related-card { padding: 17px; border: 1px solid var(--line); border-radius: 16px; text-decoration: none; display: flex; gap: 13px; align-items: center; transition: transform .16s, box-shadow .16s; }
.related-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(15,23,42,.06); }
.related-card > span { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 20px; font-weight: 900; }
.related-card strong, .related-card small { display: block; }
.related-card small { color: var(--muted); margin-top: 2px; }

.site-footer { background: #0b1220; color: #cbd5e1; }
.footer-inner { width: min(1160px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0; display: grid; grid-template-columns: 1.2fr 1fr auto; gap: 30px; align-items: center; }
.footer-brand img { filter: brightness(0) invert(1); width: 120px; height: auto; }
.footer-brand p { margin: 9px 0 0; color: #94a3b8; font-size: 13px; max-width: 380px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 11px 18px; font-size: 12px; }
.footer-links a { color: #cbd5e1; text-decoration: none; }
.footer-links a:hover { color: #fff; }
.visitor-card { min-width: 106px; text-align: center; border: 1px solid #263246; border-radius: 13px; padding: 10px 14px; background: #101a2b; }
.visitor-card span { display: block; color: #94a3b8; font-size: 9px; text-transform: uppercase; letter-spacing: .12em; }
.visitor-card strong { color: #fff; font-size: 18px; }
.footer-bottom { border-top: 1px solid #1d293a; text-align: center; padding: 14px 16px; color: #728096; font-size: 11px; }

.cookie-banner { position: fixed; z-index: 100; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(860px, calc(100% - 24px)); background: #111827; color: #fff; border: 1px solid #273449; box-shadow: 0 20px 60px rgba(0,0,0,.32); border-radius: 16px; padding: 16px; display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.cookie-banner[hidden] { display: none; }
.cookie-banner strong { font-size: 14px; }
.cookie-banner p { margin: 4px 0 0; color: #cbd5e1; font-size: 12px; }
.cookie-banner a { color: #fff; }
.cookie-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.cookie-banner .button-ghost { background: transparent; color: #e5e7eb; border-color: #435069; }

.toast { position: fixed; z-index: 120; right: 18px; bottom: 18px; max-width: 340px; background: #111827; color: #fff; border-radius: 12px; padding: 12px 15px; box-shadow: 0 14px 40px rgba(0,0,0,.24); opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s, transform .2s; font-size: 13px; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.noscript { position: fixed; inset: auto 12px 12px; z-index: 200; background: #7f1d1d; color: #fff; padding: 14px; border-radius: 12px; text-align: center; }

@media (max-width: 1320px) {
  .page-grid { display: block; width: min(1160px, calc(100% - 24px)); }
  .workspace { max-width: none; }
  .side-rail { position: static; min-height: 90px; margin: 12px 0; }
  .ad-box { min-height: 90px; }
  .side-rail-left { display: none; }
  .side-rail-right { margin-top: 18px; }
  .generator-layout { grid-template-columns: minmax(0, 1fr) 350px; }
}
@media (max-width: 880px) {
  .top-nav { display: none; }
  .mobile-menu-button { display: block; }
  .hero-inner { padding-top: 48px; }
  .generator-layout { grid-template-columns: 1fr; }
  .preview-column { border-right: 0; border-bottom: 1px solid var(--line); }
  .workspace-head { align-items: flex-start; }
  .seo-copy { grid-template-columns: 1fr; gap: 20px; }
  .info-grid, .related-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; text-align: left; }
  .visitor-card { width: 120px; }
}
@media (max-width: 600px) {
  .nav-shell { min-height: 62px; width: min(100% - 20px, 1200px); }
  .brand img { width: 112px; }
  .hero-inner { width: min(100% - 24px, 980px); padding: 40px 0 34px; }
  .hero h1 { font-size: 42px; }
  .trust-row { gap: 7px; }
  .trust-row span { font-size: 11px; }
  .page-grid { width: calc(100% - 12px); margin-top: 16px; }
  .workspace { border-radius: 17px; }
  .workspace-head { padding: 18px 16px; display: block; }
  .workspace-head .button { margin-top: 14px; }
  .template-row { padding: 13px; }
  .template-choice { flex-basis: 126px; }
  .preview-column { padding: 13px; }
  .canvas-shell { padding: 7px; min-height: 220px; border-radius: 12px; }
  .preview-toolbar span { max-width: 230px; }
  .panel-section { padding: 16px; }
  .format-grid { grid-template-columns: 1fr 88px; }
  .download-grid { grid-template-columns: 1fr; }
  .content-inner { width: calc(100% - 24px); padding: 42px 0 50px; }
  .seo-copy h2, .faq-block h2, .related-tools h2 { font-size: 25px; }
  .section-heading-row { display: block; }
  .cookie-banner { align-items: stretch; flex-direction: column; }
  .cookie-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .cookie-actions .button { padding-left: 8px; padding-right: 8px; font-size: 12px; }
}

/* Excel / CSV batch certificate tools */
.edit-help {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
}
.field-card-body { min-width: 0; }
.field-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field-heading label { margin-bottom: 5px; }
.excel-badge {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e8fff7;
  color: #087a52;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.column-bind {
  width: 100%;
  margin-top: 7px;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid #dbe2eb;
  border-radius: 9px;
  background: #f8fafc;
  color: #526175;
  font-size: 11px;
  outline: none;
}
.column-bind:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,92,240,.09); }
.batch-intro { margin: -2px 0 12px; color: var(--muted); font-size: 12px; }
.batch-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.file-button { display: grid; place-items: center; text-align: center; }
.batch-status {
  margin-top: 10px;
  padding: 10px 11px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #fff;
  color: #64748b;
  font-size: 11px;
}
.batch-status.has-data { border-style: solid; border-color: #bce8d7; background: #f3fff9; color: #176449; }
.batch-status strong, .batch-status span { display: block; overflow-wrap: anywhere; }
.batch-status span { margin-top: 2px; opacity: .82; }
.batch-control-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 11px; }
.batch-control-grid label { color: #64748b; font-size: 10px; font-weight: 800; }
.batch-control-grid label:last-child { grid-column: 1 / -1; }
.batch-control-grid select {
  width: 100%; min-height: 39px; margin-top: 4px; padding: 7px 8px;
  border: 1px solid #dbe2eb; border-radius: 9px; background: #fff; color: #1f2937;
}
.batch-tools { margin-top: 9px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.batch-tools .button { min-height: 36px; padding: 7px 9px; font-size: 11px; }
.danger-text { color: var(--danger); }
.batch-progress { margin-top: 10px; }
.batch-progress progress { width: 100%; height: 9px; accent-color: var(--primary); }
.batch-progress span { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.button:disabled { opacity: .55; cursor: wait; transform: none; }

@media (max-width: 600px) {
  .batch-actions { grid-template-columns: 1fr; }
  .batch-control-grid { grid-template-columns: 1fr; }
  .batch-control-grid label:last-child { grid-column: auto; }
  .batch-tools { align-items: stretch; flex-direction: column; }
}
