:root {
  --pd-black: #1c1c1c;
  --pd-ink: #121212;
  --pd-orange: #f18637;
  --pd-orange-2: #f59a00;
  --pd-muted: #a1a0a0;
  --pd-gray: #f4f4f4;
  --pd-gray-2: #f0f0f0;
  --pd-line: #ebebeb;
  --pd-white: #ffffff;
  --pd-radius: 30px;
  --pd-radius-sm: 20px;
  --pd-font: "Montserrat", Arial, sans-serif;
  --pd-grad: linear-gradient(0.75turn, #f18637 0%, #f59a00 100%);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--pd-font);
  color: var(--pd-ink);
  background: var(--pd-white);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--pd-orange); text-decoration: none; }
a:hover { opacity: 0.85; }

.shell {
  width: min(1160px, calc(100% - 2rem));
  margin: 0 auto;
}

/* Header */
.top {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(255, 255, 255, 0.85);
  border-bottom: 1px solid transparent;
}

.top__inner {
  width: min(1160px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 0.9rem 0 0.85rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
}
.brand:hover { opacity: 1; }
.brand__logo {
  height: 34px;
  width: auto;
  display: block;
}
.brand__tag {
  font-size: 12px;
  font-weight: 500;
  color: var(--pd-muted);
  line-height: 1.2;
}

.top-actions {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.phone-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--pd-ink);
  white-space: nowrap;
}
.phone-link:hover { color: var(--pd-orange); opacity: 1; }

/* Mode switch — like parent pill nav */
.mode-switch {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.25rem;
  border-radius: var(--pd-radius);
  background: var(--pd-gray-2);
}
.mode-switch__item {
  text-decoration: none;
  color: var(--pd-ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  padding: 0.55rem 1rem;
  border-radius: var(--pd-radius);
  transition: background-color 0.2s ease, color 0.2s ease;
}
.mode-switch__item:hover {
  opacity: 1;
  background: var(--pd-black);
  color: var(--pd-white);
}
.mode-switch__item.is-active {
  color: var(--pd-white);
  background-image: var(--pd-grad);
}
.mode-switch__item.is-active:hover {
  background-image: none;
  background-color: var(--pd-black);
}

/* Buttons */
.btn,
button {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: var(--pd-font);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.85rem 1.4rem;
  border-radius: var(--pd-radius);
  transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.btn-primary,
button[type="submit"] {
  color: var(--pd-white);
  background-image: var(--pd-grad);
}
.btn-primary:hover,
button[type="submit"]:hover {
  background-image: none;
  background-color: var(--pd-black);
  opacity: 1;
}

.btn-dark {
  color: var(--pd-white);
  background: var(--pd-black);
  border-radius: 50px;
}
.btn-dark:hover {
  background: var(--pd-orange);
  opacity: 1;
}

.btn-ghost {
  color: var(--pd-ink);
  background: var(--pd-gray-2);
}
.btn-ghost:hover {
  background: var(--pd-black);
  color: var(--pd-white);
  opacity: 1;
}

.inline { display: inline; margin: 0; }
.inline button {
  margin: 0;
  padding: 0.55rem 1rem;
  background: var(--pd-gray-2);
  color: var(--pd-ink);
  font-weight: 500;
}
.inline button:hover {
  background: var(--pd-black);
  color: var(--pd-white);
}

/* Main */
main {
  flex: 1;
  width: min(1160px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3.5rem;
}

.hero {
  display: grid;
  gap: 1.25rem;
  padding: 2.5rem 2rem;
  border-radius: var(--pd-radius);
  background: var(--pd-gray);
}
.hero h1 {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--pd-ink);
}
.hero p {
  margin: 0;
  max-width: 42rem;
  font-size: 1.05rem;
  color: #454545;
  font-weight: 500;
}
.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.hero__meta {
  font-size: 13px;
  font-weight: 500;
  color: var(--pd-muted);
}

.section-title {
  margin: 2.5rem 0 1rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--pd-ink);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.card {
  background: var(--pd-gray);
  border-radius: var(--pd-radius);
  padding: 1.5rem;
  display: grid;
  gap: 0.65rem;
}
.card h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}
.card p {
  margin: 0;
  color: #454545;
  font-weight: 500;
  font-size: 0.95rem;
}
.card__price {
  font-weight: 700;
  color: var(--pd-ink);
}
.card__price span {
  background-image: var(--pd-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.doc h1 { margin-top: 0; font-size: 1.8rem; }
.doc ul { line-height: 1.6; padding-left: 1.2rem; color: #454545; }

.muted { color: var(--pd-muted); font-weight: 500; }
.error { color: #6e1212; font-weight: 600; }

/* Login */
.login-box {
  max-width: 400px;
  margin: 2rem auto;
  padding: 1.75rem;
  background: var(--pd-gray);
  border-radius: var(--pd-radius);
}
.login-box h1 {
  margin: 0 0 1rem;
  font-size: 1.4rem;
}
.login-box label {
  display: block;
  margin: 0.85rem 0;
  font-size: 13px;
  font-weight: 600;
  color: #454545;
}
.login-box input {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--pd-line);
  border-radius: 16px;
  background: var(--pd-white);
  font-family: var(--pd-font);
  font-size: 15px;
  font-weight: 500;
  color: var(--pd-ink);
}
.login-box input:focus {
  outline: 2px solid color-mix(in srgb, var(--pd-orange) 45%, transparent);
  border-color: var(--pd-orange);
}
.login-box button { width: 100%; margin-top: 1rem; }
.login-box .muted { margin-top: 1rem; text-align: center; }

/* Admin */
body.admin { background: #fafafa; }
body.admin .top { background: rgba(255, 255, 255, 0.92); }
body.admin main ul { color: #454545; font-weight: 500; }

/* Footer */
.site-footer {
  margin-top: auto;
  background: var(--pd-black);
  color: var(--pd-white);
  padding: 2rem 0;
}
.site-footer a { color: var(--pd-white); }
.site-footer__inner {
  width: min(1160px, calc(100% - 2rem));
  margin: 0 auto;
  display: grid;
  gap: 0.75rem;
}
.site-footer__brand {
  font-weight: 700;
  font-size: 1rem;
}
.site-footer__meta {
  color: var(--pd-muted);
  font-size: 13px;
  font-weight: 500;
}
.site-footer__row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: center;
  justify-content: space-between;
}

@media (max-width: 720px) {
  .top__inner {
    grid-template-columns: 1fr;
    justify-items: start;
  }
  .top-actions { justify-content: flex-start; width: 100%; }
  .mode-switch { width: 100%; }
  .mode-switch__item { flex: 1; text-align: center; }
  .brand__tag { display: none; }
  .card-grid { grid-template-columns: 1fr; }
  .hero { padding: 1.5rem 1.15rem; }
}

/* Template constructor */
body.admin main:has(.tpl) {
  width: min(1160px, calc(100% - 2rem));
  max-width: none;
}
.tpl { display: grid; gap: 1rem; }
.tpl-tabs {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.25rem;
  border-radius: var(--pd-radius);
  background: var(--pd-gray-2);
  width: fit-content;
}
.tpl-tabs__item {
  color: var(--pd-ink);
  font-size: 14px;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border-radius: var(--pd-radius);
}
.tpl-tabs__item:hover { opacity: 1; background: #e6e6e6; }
.tpl-tabs__item.is-active {
  color: #fff;
  background-image: var(--pd-grad);
}
.tpl-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
.tpl-sidebar {
  background: var(--pd-gray);
  border-radius: var(--pd-radius);
  padding: 1rem;
}
.tpl-sidebar__title {
  margin: 0 0 0.85rem;
  font-size: 1rem;
}
.tpl-create {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--pd-line);
}
.tpl-create label,
.tpl-meta label,
.tpl-radius {
  display: grid;
  gap: 0.3rem;
  font-size: 12px;
  font-weight: 600;
  color: #454545;
}
.tpl-create input,
.tpl-create select,
.tpl-meta input,
.tpl-meta select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--pd-line);
  border-radius: 14px;
  font-family: var(--pd-font);
  font-size: 14px;
  font-weight: 500;
  background: #fff;
}
.tpl-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.tpl-list__item a {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0.55rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border-radius: 16px;
  color: var(--pd-ink);
  background: #fff;
  font-size: 13px;
}
.tpl-list__preview {
  width: 72px;
  border-radius: 10px;
  overflow: hidden;
  background: #f4f4f4;
  border: 1px solid var(--pd-line);
}
.tpl-list__preview svg {
  display: block;
  width: 100%;
  height: auto;
}
.tpl-list__meta {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}
.tpl-list__item a strong { font-size: 14px; }
.tpl-list__item a span { color: var(--pd-muted); font-weight: 500; }
.card-preview {
  border-radius: 18px;
  overflow: hidden;
  background: #eee;
  margin-bottom: 0.35rem;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
}
.card-preview img,
.card-preview svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #fff;
}
.card-preview--empty {
  font-size: 12px;
  padding: 0.75rem;
  text-align: center;
}
.tpl-list__item.is-active a {
  outline: 2px solid var(--pd-orange);
}
.tpl-list__empty { padding: 0.5rem; font-size: 13px; }
.tpl-main { min-width: 0; }
.tpl-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: end;
  margin-bottom: 0.85rem;
}
.tpl-meta label { min-width: 140px; }
.tpl-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.tpl-tools { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tool-btn.is-active {
  background: var(--pd-black) !important;
  color: #fff !important;
}
.tpl-props {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}
.tpl-radius {
  grid-template-columns: auto auto auto;
  align-items: center;
  gap: 0.4rem;
}
.tpl-hint { margin: 0 0 0.75rem; font-size: 13px; }
.tpl-canvas-wrap {
  width: 100%;
  box-sizing: border-box;
  background: var(--pd-gray);
  border-radius: var(--pd-radius);
  padding: 1rem;
  overflow: auto;
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.tpl-canvas-wrap canvas {
  display: block;
  max-width: 100%;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
}
.card.is-selected {
  outline: 2px solid var(--pd-orange);
}

/* Client flow */
.flow-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
  font-size: 13px;
  font-weight: 600;
  color: var(--pd-muted);
}
.flow-steps a { color: var(--pd-ink); }
.flow-steps .is-active {
  color: transparent;
  background-image: var(--pd-grad);
  -webkit-background-clip: text;
  background-clip: text;
}

.album-drop {
  display: grid;
  place-items: center;
  gap: 0.35rem;
  min-height: 140px;
  padding: 1.25rem;
  border-radius: var(--pd-radius);
  background: var(--pd-gray);
  border: 1.5px dashed #d0d0d0;
  cursor: pointer;
  text-align: center;
  margin-bottom: 0.85rem;
}
.album-drop.is-drag {
  border-color: var(--pd-orange);
  background: #fff4eb;
}
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
}
.album-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  max-height: 60vh;
  overflow: auto;
  padding-right: 0.25rem;
}
.album-item {
  position: relative;
  margin: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #ddd;
  aspect-ratio: 1;
}
.album-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.album-item__del {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  padding: 0;
  margin: 0;
  background: rgba(28, 28, 28, 0.75);
  color: #fff;
  font-size: 18px;
  line-height: 1;
}
.album-item--drag { cursor: grab; }
.album-zone-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background-image: linear-gradient(0.75turn, #f18637 0%, #f59a00 100%);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  z-index: 2;
}

.flow-editor .editor {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
body:has(.flow-editor) main,
body:has(.flow-result) main {
  width: min(1280px, calc(100% - 1.25rem));
}
.editor-album {
  background: var(--pd-gray);
  border-radius: var(--pd-radius);
  padding: 1rem;
  position: sticky;
  top: 5.5rem;
}
.editor-album h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}
.editor-actions {
  flex-direction: column;
  align-items: stretch;
  margin-top: 0.85rem;
}
.editor-actions .btn,
.editor-actions button {
  width: 100%;
  text-align: center;
}
.editor-head h1 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}
.editor-stage {
  min-width: 0;
}
.editor-stage--solo {
  width: 100%;
}
.editor-canvas-wrap {
  margin-top: 0.75rem;
  width: 100% !important;
  height: auto !important;
  overflow: visible;
  background: transparent;
  border-radius: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.editor-canvas-wrap canvas {
  display: block;
  max-width: 100%;
  box-shadow: none;
}
.editor-canvas-wrap--result {
  background: var(--pd-gray);
  border-radius: var(--pd-radius);
  padding: 1rem;
}
.saved-collages {
  margin: 2rem 0 0.5rem;
}
@media (max-width: 900px) {
  .flow-editor .editor { grid-template-columns: 1fr; }
  .editor-album { position: static; }
}
