:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --ink: #1b1b1f;
  --muted: #6b6b73;
  --line: #e7e4dc;
  --brand: #E0452F;
  --brand-dark: #b83624;
  --ok: #047857;
  --warn: #b45309;
  --bad: #b91c1c;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(20, 20, 30, .07), 0 6px 24px rgba(20, 20, 30, .05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;
  line-height: 1.6;
}

/* ===== Header ===== */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; max-width: 1180px; margin: 0 auto; }
.brand-mark {
  background: var(--brand);
  color: #fff;
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand h1 { font-size: 1.15rem; margin: 0; font-weight: 800; }
.brand p { margin: 0; font-size: .8rem; color: var(--muted); }

/* ===== Layout ===== */
.layout {
  max-width: 1180px;
  margin: 18px auto 40px;
  padding: 0 14px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 960px) {
  .layout { grid-template-columns: 1.15fr .85fr; align-items: start; }
  .preview-col { position: sticky; top: 86px; }
}

/* ===== Cards ===== */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}
.card h2 { font-size: .98rem; font-weight: 700; margin: 0 0 12px; }

/* ===== Type grid ===== */
.type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
@media (min-width: 560px) { .type-grid { grid-template-columns: repeat(4, 1fr); } }
.type-btn {
  border: 1.5px solid var(--line);
  background: #fbfaf7;
  border-radius: 10px;
  padding: 9px 4px;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.type-btn:hover { border-color: var(--brand); }
.type-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* ===== Templates ===== */
.tpl-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tpl-btn {
  border: 1.5px dashed var(--line);
  background: #fbfaf7;
  border-radius: 999px;
  padding: 7px 14px;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.tpl-btn:hover { border-color: var(--brand); color: var(--brand); }

/* ===== Forms ===== */
.field-group { margin-bottom: 12px; }
.fld-label { display: block; font-size: .8rem; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.hint { font-weight: 400; }
input[type="text"], input[type="url"], input[type="tel"], input[type="email"], input[type="password"], textarea, select {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  font-family: inherit;
  font-size: .9rem;
  background: #fbfaf7;
  color: var(--ink);
}
textarea { resize: vertical; min-height: 64px; }
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(224, 69, 47, .35); border-color: var(--brand); }
input[type="color"] {
  width: 100%; height: 40px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #fbfaf7;
  padding: 3px;
  cursor: pointer;
}
input[type="range"] { width: 100%; accent-color: var(--brand); }
.field-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grad-row { display: flex; align-items: center; gap: 8px; }
.chk { display: flex; align-items: center; gap: 6px; font-size: .82rem; white-space: nowrap; }
.chk input { accent-color: var(--brand); }
.logo-row { display: flex; gap: 8px; }
.hidden { display: none !important; }

/* ===== Themes ===== */
.theme-row { display: flex; gap: 10px; }
.theme-dot {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 0 0 1.5px var(--line);
  cursor: pointer;
  transition: transform .12s;
}
.theme-dot:hover { transform: scale(1.12); }
.theme-dot.active { box-shadow: 0 0 0 2.5px var(--brand); }

/* ===== Buttons ===== */
.btn {
  border: none;
  border-radius: 10px;
  padding: 11px 18px;
  font-family: inherit;
  font-size: .92rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s;
}
.btn.primary { background: var(--brand); color: #fff; flex: 1; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.ghost { background: #fbfaf7; border: 1.5px solid var(--line); color: var(--ink); flex: 1; }
.btn.ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn.danger { color: var(--bad); }

/* ===== Preview ===== */
.preview-stage {
  display: flex;
  justify-content: center;
  padding: 18px 8px;
  background:
    repeating-conic-gradient(#f1efe9 0% 25%, #fbfaf7 0% 50%) 0 0 / 22px 22px;
  border-radius: 12px;
  border: 1px solid var(--line);
}
.frame-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 14px;
  background: #fff;
  border-radius: 10px;
}
.frame-wrap.frame-simple { border: 3px solid #111; border-radius: 16px; }
.frame-wrap.frame-bold { border: 7px solid #111; border-radius: 20px; }
.frame-wrap.frame-ticket {
  border: 3px dashed #111;
  border-radius: 22px;
  padding: 18px;
}
.frame-wrap.frame-none { border: none; padding: 4px; background: transparent; }
.cta-label {
  font-weight: 800;
  font-size: 1rem;
  margin-top: 10px;
  color: #111;
  text-align: center;
  max-width: 240px;
}
.frame-wrap.frame-none .cta-label { display: none; }
.qr-holder canvas, .qr-holder svg { display: block; border-radius: 6px; }

/* ===== Scan check ===== */
.scan-check {
  margin-top: 12px;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: .85rem;
  background: #f0fdf6;
  border: 1px solid #c8ecd9;
}
.scan-check.warn { background: #fffbeb; border-color: #f0dfb0; }
.scan-check.bad { background: #fef2f2; border-color: #f3caca; }
.scan-row { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.scan-issues { margin: 6px 0 0; padding: 0 20px 0 0; color: var(--muted); font-size: .8rem; }
.scan-issues li { margin: 2px 0; overflow-wrap: anywhere; }

/* ===== Export ===== */
.export-box { margin-top: 14px; }
.export-btns { display: flex; gap: 8px; margin-top: 8px; }
.micro-note { font-size: .75rem; color: var(--muted); margin: 12px 0 0; }

/* ===== Quota ===== */
.quota-row {
  margin-top: 10px;
  text-align: center;
  font-size: .8rem;
  color: var(--muted);
}
.quota-row .empty { color: var(--bad); font-weight: 700; }

/* ===== Modal / ad slot ===== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 18, 14, .55);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  padding: 16px;
}
.modal {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 400px;
  width: 100%;
  padding: 20px;
  text-align: center;
}
.modal h3 { margin: 0 0 6px; font-size: 1.05rem; }
.modal-sub { color: var(--muted); font-size: .85rem; margin: 0 0 14px; }
.ad-slot {
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  background: #fbfaf7;
  min-height: 180px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
  overflow: hidden;
}
.ad-placeholder { padding: 18px; }
.ad-badge {
  display: inline-block;
  background: var(--line);
  color: var(--muted);
  border-radius: 999px;
  font-size: .7rem;
  padding: 2px 10px;
  margin-bottom: 8px;
}
.ad-count { font-size: 2.2rem; font-weight: 800; color: var(--brand); line-height: 1.1; }
.ad-note { font-size: .78rem; color: var(--muted); margin: 6px 0 0; }
.modal .btn { width: 100%; margin-top: 8px; }
.pro-teaser {
  margin-top: 14px;
  font-size: .78rem;
  color: var(--muted);
  background: #fbfaf7;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
}

/* ===== Footer ===== */
.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: .8rem;
  padding: 22px 12px 30px;
  border-top: 1px solid var(--line);
  background: var(--card);
}

/* logo gallery */
.logo-gallery { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.logo-gallery img { width: 38px; height: 38px; border-radius: 10px; cursor: pointer; border: 2px solid transparent; transition: transform .12s; }
.logo-gallery img:hover { transform: scale(1.08); }
.logo-gallery img.active { border-color: #E0452F; }

/* map modal */
.modal-wide { max-width: 560px; width: 94vw; }
.map-div { height: 340px; border-radius: 12px; margin: 10px 0; z-index: 0; }
.map-coords { font-size: 13px; color: #555; direction: ltr; text-align: center; margin: 6px 0 10px; }
.map-pin { font-size: 28px; line-height: 32px; text-align: center; }
