@import url('https://fonts.googleapis.com/css2?family=Caprasimo:wght@400&family=Figtree:wght@400;600;700&display=swap');

:root {
  --color-bg: #f5ead8;
  --color-surface: #ebddc5;
  --color-text: #201e1d;
  --color-accent: #c67139;
  --color-accent-2: #7a8a5e;
  --color-divider: color-mix(in srgb, #201e1d 16%, transparent);

  --color-neutral-100: #f9f4ed;
  --color-neutral-200: #eee7db;
  --color-neutral-300: #dcd3c4;
  --color-neutral-400: #c0b6a5;
  --color-neutral-500: #a19786;
  --color-neutral-600: #82796a;
  --color-neutral-700: #645c50;
  --color-neutral-800: #474238;
  --color-neutral-900: #2e2b25;

  --color-accent-100: #fff2eb;
  --color-accent-200: #ffe1d0;
  --color-accent-300: #ffc6a5;
  --color-accent-400: #f6a06b;
  --color-accent-500: #d67f48;
  --color-accent-600: #b2622d;
  --color-accent-700: #8c491a;
  --color-accent-800: #643312;
  --color-accent-900: #402310;

  --color-accent-2-100: #f0fae1;
  --color-accent-2-200: #e1eecc;
  --color-accent-2-300: #ccdbb2;
  --color-accent-2-400: #aebf92;
  --color-accent-2-500: #8fa073;
  --color-accent-2-600: #728157;
  --color-accent-2-700: #56633f;
  --color-accent-2-800: #3d472b;
  --color-accent-2-900: #272e1b;

  --color-danger: #b23a2d;
  --color-danger-bg: #fbe6e2;

  --font-heading: "Caprasimo", system-ui, sans-serif;
  --font-heading-weight: 400;
  --font-body: "Figtree", system-ui, sans-serif;

  --space-1: 4.4px;
  --space-2: 8.8px;
  --space-3: 13.2px;
  --space-4: 17.6px;
  --space-6: 26.4px;
  --space-8: 35.2px;

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 28px;

  --shadow-sm: 0 1px 2px color-mix(in srgb, #2e2b25 14%, transparent);
  --shadow-md: 0 3px 10px color-mix(in srgb, #2e2b25 16%, transparent);
  --shadow-lg: 0 12px 32px color-mix(in srgb, #2e2b25 22%, transparent);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 var(--space-2);
}
h1 { font-size: 34px; }
h2 { font-size: 26px; }

p { margin: 0 0 var(--space-3); }
a { color: var(--color-accent); text-underline-offset: 3px; }
img { display: block; max-width: 100%; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.text-muted { color: color-mix(in srgb, var(--color-text) 55%, transparent); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; text-decoration: none;
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 16px; line-height: 1.2; color: var(--color-text);
  background: transparent; border: 1px solid transparent;
  padding: 14px 22px; border-radius: 999px;
  min-height: 56px;
}
.btn svg { display: block; flex: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--color-accent); color: var(--color-bg); }
.btn-primary:hover:not(:disabled) { background: var(--color-accent-600); }
.btn-primary:active:not(:disabled) { background: var(--color-accent-700); }
.btn-secondary { border-color: var(--color-divider); }
.btn-secondary:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.btn-ghost { color: var(--color-accent); background: none; padding-inline: 4px; min-height: auto; }
.btn-ghost:hover { background: color-mix(in srgb, var(--color-accent) 10%, transparent); }
.btn-block { width: 100%; }
.btn-icon { width: 48px; height: 48px; padding: 0; min-height: auto; }

/* ---- forms ---- */
.field { margin-bottom: var(--space-4); }
.field > label {
  display: block; font-size: 15px; font-weight: 600; margin-bottom: 8px;
}
.input {
  width: 100%; min-height: 58px; padding: 12px 18px; font: inherit;
  font-size: 17px; color: var(--color-text); caret-color: var(--color-accent);
  background: var(--color-surface);
  border: 1px solid var(--color-divider); border-radius: 999px;
}
.input:hover { border-color: color-mix(in srgb, var(--color-text) 45%, transparent); }
.input:focus-visible { border-color: var(--color-accent); }

/* ---- cards ---- */
.card {
  background: var(--color-surface);
  border-radius: calc(var(--radius-lg) * 1.15);
}
.card-title { font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: 20px; line-height: 1.2; }
.card-body { margin: 0; font-size: 14px; opacity: 0.8; }
.card-kicker { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-accent); }
.elev-sm { box-shadow: var(--shadow-sm); }
.elev-md { box-shadow: var(--shadow-md); }

/* ---- tags ---- */
.tag {
  display: inline-flex; align-items: center; font-size: 12px;
  letter-spacing: 0.02em; padding: 5px 13px; border-radius: 999px; font-weight: 600;
}
.tag-accent { background: var(--color-accent-100); color: var(--color-accent-800); }
.tag-accent-2 { background: var(--color-accent-2-100); color: var(--color-accent-2-800); }
.tag-neutral { background: var(--color-neutral-100); color: var(--color-neutral-800); }

/* ---- tables ---- */
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th {
  text-align: left; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: color-mix(in srgb, var(--color-text) 60%, transparent);
  padding: var(--space-2); border-bottom: 1px solid var(--color-divider);
}
.table td { padding: 14px var(--space-2); border-bottom: 1px solid color-mix(in srgb, var(--color-text) 8%, transparent); }
.table tbody tr:hover { background: color-mix(in srgb, var(--color-text) 4%, transparent); }
.table-scroll { width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; }

/* ---- layout shell ---- */
header.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px; position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(8px);
}
header.topbar .brand {
  min-height: 44px; display: inline-flex; align-items: center;
  font-family: var(--font-heading); font-size: 20px; color: var(--color-text); text-decoration: none;
}
header.topbar nav a {
  min-height: 44px; display: inline-flex; align-items: center;
  color: var(--color-text); text-decoration: none; font-size: 15px; margin-left: 20px; opacity: 0.75;
}
header.topbar nav a:hover { color: var(--color-accent); opacity: 1; }

main { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 24px 20px 70px; }

.shell {
  width: 100%; max-width: 480px;
  margin-top: 16px;
}
.shell.wide { max-width: 780px; }

.page-card {
  background: var(--color-surface);
  border-radius: calc(var(--radius-lg) * 1.15);
  padding: 36px;
}

.hero-block {
  aspect-ratio: 16/9;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #e8c39a 0%, #c67139 100%);
  margin-bottom: 26px;
}

/* ---- photographic home page ---- */
.home-main {
  display: block;
  padding: 24px clamp(14px, 3vw, 42px) 42px;
}
.home-shell { width: 100%; max-width: 1440px; margin: 0 auto; }
.home-hero {
  position: relative; min-height: min(790px, calc(100svh - 126px)); overflow: hidden;
  border-radius: 36px; background: #6d7e83; box-shadow: var(--shadow-lg);
}
.home-hero-photo {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 58%;
}
.home-hero::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(17, 22, 20, .64) 0%, rgba(17, 22, 20, .18) 52%, rgba(17, 22, 20, .08) 100%),
    linear-gradient(0deg, rgba(17, 22, 20, .46) 0%, transparent 54%);
}
.home-hero-content {
  position: relative; z-index: 1; min-height: inherit; padding: clamp(28px, 5vw, 76px);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
  align-items: end; gap: clamp(34px, 6vw, 90px);
}
.home-copy { color: #fff; max-width: 760px; padding-bottom: 16px; text-shadow: 0 2px 18px rgba(0, 0, 0, .34); }
.home-kicker {
  display: inline-flex; margin-bottom: 15px; padding: 7px 14px; border: 1px solid rgba(255,255,255,.4);
  border-radius: 999px; background: rgba(27, 35, 31, .25); backdrop-filter: blur(8px);
  font-size: 12px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase;
}
.home-copy h1 { max-width: 780px; margin-bottom: 18px; font-size: clamp(44px, 6vw, 86px); line-height: .98; letter-spacing: -.035em; }
.home-copy p { max-width: 620px; margin: 0; font-size: clamp(18px, 2vw, 24px); line-height: 1.4; }
.home-form-card {
  padding: clamp(24px, 3vw, 38px); border: 1px solid rgba(255,255,255,.5); border-radius: 30px;
  background: color-mix(in srgb, var(--color-bg) 94%, transparent); backdrop-filter: blur(14px);
  box-shadow: 0 24px 60px rgba(19, 25, 22, .28);
}
.home-form-card h2 { margin: 14px 0 8px; font-size: clamp(28px, 3vw, 36px); }
.home-form-intro { margin-bottom: 24px; color: var(--color-neutral-700); }
.home-form-card .input { background: rgba(255,255,255,.72); }
.home-form-card .btn-primary { box-shadow: 0 8px 20px color-mix(in srgb, var(--color-accent) 32%, transparent); }
.home-continue { margin: 18px 0 0; text-align: center; font-size: 14px; color: var(--color-neutral-700); }
.home-mini-steps {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 24px 0 0; padding: 18px 0 0;
  border-top: 1px solid var(--color-divider); list-style: none;
}
.home-mini-steps li { text-align: center; color: var(--color-neutral-700); font-size: 11px; line-height: 1.25; }
.home-mini-steps span {
  width: 24px; height: 24px; margin: 0 auto 6px; display: grid; place-items: center;
  border-radius: 50%; background: var(--color-accent-2-100); color: var(--color-accent-2-800); font-weight: 800;
}

/* ---- step indicator ---- */
.steps-wrap { max-width: 460px; margin: 0 auto 40px; }
.steps-flow-label { text-align: center; margin-bottom: 18px; }
.steps { display: flex; justify-content: space-between; gap: 6px; }
.step { flex: 1; text-align: center; }
.step .badge {
  width: 48px; height: 48px; border-radius: 999px; margin: 0 auto 8px;
  display: grid; place-items: center; font-family: var(--font-heading); font-size: 21px;
  background: var(--color-neutral-200); color: var(--color-neutral-700);
}
.step .label { font-size: 14px; font-weight: 600; color: var(--color-neutral-600); }
.step.is-done .badge { background: var(--color-accent-2); color: var(--color-bg); }
.step.is-done .label { color: var(--color-text); }
.step.is-now .badge { background: var(--color-accent); color: var(--color-bg); }
.step.is-now .label { color: var(--color-accent-700); }

/* ---- messages ---- */
.error {
  background: var(--color-danger-bg); color: var(--color-danger);
  padding: 12px 18px; border-radius: var(--radius-md); font-size: 14px; margin-top: 16px;
}
.success-msg {
  background: var(--color-accent-2-100); color: var(--color-accent-2-800);
  padding: 12px 18px; border-radius: var(--radius-md); font-size: 14px; margin-top: 16px;
}
.info-box {
  display: flex; gap: 16px; align-items: flex-start;
  background: var(--color-accent-100); border-radius: var(--radius-lg);
  padding: 22px 24px; margin-top: 22px;
}
.info-box .icon { color: var(--color-accent); flex: none; margin-top: 2px; }
.info-box p { margin: 0; }

/* ---- upload instructions ---- */
.instructions { display: flex; flex-direction: column; gap: 18px; padding: 24px 26px; margin-bottom: 24px; }
.instructions .step-row { display: flex; gap: 16px; align-items: center; }
.instructions .num {
  flex: none; width: 40px; height: 40px; border-radius: 999px;
  background: var(--color-accent); color: var(--color-bg);
  display: grid; place-items: center; font-family: var(--font-heading); font-size: 19px;
}

/* ---- photo grids ---- */
.photo-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px; margin-bottom: 24px;
}
.photo-grid .thumb {
  position: relative; aspect-ratio: 1; border-radius: var(--radius-md); overflow: hidden;
  background: var(--color-neutral-200);
}
.photo-grid .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-grid .thumb .del {
  position: absolute; top: 6px; right: 6px; width: 28px; height: 28px;
  background: color-mix(in srgb, var(--color-neutral-900) 60%, transparent);
  color: #fff; border: none; border-radius: 999px; font-size: 18px; line-height: 1;
  cursor: pointer; padding: 0;
}
.section-heading {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}
.section-heading h4 { font-size: 18px; margin: 0; }

/* ---- dropzone (drag target wrapping the choose-files button) ---- */
.dropzone { display: block; border-radius: 999px; }
.dropzone.drag { outline: 2px dashed var(--color-accent); outline-offset: 4px; }
.upload-progress { margin: 18px 0 4px; padding: 16px; border-radius: var(--radius-md); background: var(--color-neutral-100); }
.upload-progress-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 9px; font-weight: 700; }
.upload-progress small { display: block; margin-top: 8px; color: var(--color-neutral-700); }
.notice { margin: 18px 0 0; padding: 11px 14px; border-radius: var(--radius-md); background: #fff4d6; color: #684b00; font-size: 14px; }

/* ---- cover photo picker (admin) ---- */
.cover-picker {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 10px; max-height: 340px; overflow-y: auto; padding: 4px 4px 4px 0;
}
.cover-picker .opt {
  position: relative; aspect-ratio: 1; border-radius: var(--radius-md); overflow: hidden;
  cursor: pointer; border: 3px solid transparent; background: var(--color-neutral-200); padding: 0;
}
.cover-picker .opt img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-picker .opt.selected { border-color: var(--color-accent); }
.cover-picker .opt .check {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 999px;
  background: var(--color-accent); color: #fff; display: none; align-items: center; justify-content: center; font-size: 12px;
}
.cover-picker .opt.selected .check { display: flex; }
.cover-picker .opt.none {
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 11px; font-weight: 600; color: #3a2415; padding: 6px;
  background: linear-gradient(135deg, #e8c39a 0%, #c67139 100%);
}

/* ---- stat cards (admin) ---- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 30px; }
.stat-card { padding: 20px 22px; display: flex; flex-direction: column; gap: 4px; }
.stat-card .num { font-family: var(--font-heading); font-size: 38px; line-height: 1; color: var(--color-text); }

.progress-card { padding: 24px 26px; margin-bottom: 26px; }
.progress-top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.progress-top .title { font-family: var(--font-heading); font-size: 21px; }
.progress-bar-track { height: 14px; background: var(--color-neutral-200); border-radius: 999px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--color-accent); border-radius: 999px; }
.email-card {
  margin: 26px 0; padding: 18px; border: 1px solid var(--color-divider); border-radius: var(--radius-md);
  background: color-mix(in srgb, #fff 46%, transparent);
}
.email-card-copy { display: flex; gap: 12px; align-items: flex-start; }
.email-card-copy p { margin: 3px 0 0; font-size: 13px; }
.status-dot { flex: none; width: 11px; height: 11px; margin-top: 7px; border-radius: 50%; background: var(--color-neutral-400); box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-neutral-400) 18%, transparent); }
.status-dot.is-ok { background: var(--color-accent-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-accent-2) 18%, transparent); }
.status-dot.is-warning { background: #d39a24; box-shadow: 0 0 0 4px rgba(211, 154, 36, .16); }
.email-test { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin-top: 14px; }
.email-test .input { min-height: 46px; font-size: 15px; }
.btn-small { min-height: 42px; padding: 9px 15px; font-family: var(--font-body); font-size: 13px; font-weight: 700; }

/* ---- preview / crop screen ---- */
.preview-cover {
  width: 220px; aspect-ratio: 1/1.414; border-radius: var(--radius-md); position: relative; overflow: hidden;
  background: linear-gradient(160deg, #e8c9a0 0%, #c67139 100%);
  margin: 0 auto 8px;
}
.preview-cover .cover-photo {
  position: absolute; inset: 0; width: 100%; height: 100%; display: none;
  transition: transform 0.18s ease;
}
.preview-cover.has-photo .cover-photo { display: block; }
.preview-cover .cover-text {
  position: absolute; left: 0; right: 0; bottom: 22px; text-align: center; color: #3a2415; padding: 0 12px;
  z-index: 2; pointer-events: none;
}
.preview-cover .cover-text .title { font-family: var(--font-heading); font-size: 17px; line-height: 1.1; }
.preview-cover .cover-text .date { font-size: 10px; letter-spacing: 0.1em; margin-top: 6px; }
.preview-cover.has-photo .cover-text { color: #ffffff; }

.editor-help {
  display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; margin: 18px 0 8px;
  border-radius: var(--radius-md); background: color-mix(in srgb, var(--color-accent) 9%, #fff);
  font-size: 14px; line-height: 1.45;
}
.editor-help span { color: color-mix(in srgb, var(--color-text) 70%, transparent); }
.save-state { min-height: 22px; margin-bottom: 12px; text-align: right; font-size: 12px; color: var(--color-neutral-600); }
.save-state.is-saved { color: #35705a; }
.save-state.is-error { color: #a53838; }
.removed-photos {
  margin: 0 0 24px; padding: 14px; border: 1px solid color-mix(in srgb, var(--color-accent) 28%, var(--color-divider));
  border-radius: 14px; background: color-mix(in srgb, var(--color-accent) 6%, #fff);
}
.removed-photos-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 10px; font-size: 13px; }
.removed-photos-grid { display: flex; gap: 9px; overflow-x: auto; padding-bottom: 3px; }
.removed-photo-item { position: relative; flex: 0 0 82px; aspect-ratio: 1; overflow: hidden; border-radius: 10px; background: var(--color-neutral-200); }
.removed-photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0.72; }
.removed-photo-item button {
  position: absolute; left: 5px; right: 5px; bottom: 5px; border: 0; border-radius: 999px; padding: 5px;
  background: rgba(255,255,255,.94); color: var(--color-accent); font: inherit; font-size: 9px; font-weight: 800; cursor: pointer;
}

.page-heading {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px;
}
.page-settings { display: flex; align-items: center; gap: 12px; }
.grid-picker { display: flex; align-items: center; gap: 8px; }
.grid-picker-label { font-size: 11px; color: var(--color-neutral-600); }
.grid-picker .segmented button { min-width: 38px; }
.grid-picker .segmented button:disabled { opacity: 0.35; cursor: not-allowed; }
.background-control { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--color-neutral-600); }
.background-control input, .element-controls input[type="color"] {
  width: 30px; height: 30px; padding: 2px; border: 1px solid var(--color-neutral-200); border-radius: 9px; background: #fff; cursor: pointer;
}
.background-control input { width: 38px; height: 38px; }
.pdf-outdated { margin-top: 14px; }

.layout-pages { display: flex; flex-direction: column; gap: 30px; margin-bottom: 30px; }
.layout-page { padding: 18px; border: 1px solid var(--color-divider); border-radius: 18px; background: color-mix(in srgb, var(--color-neutral-200) 38%, #fff); }
.layout-page .page-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}
.page-tools {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 10px 0 12px;
  font-size: 11px; color: var(--color-neutral-600);
}
.page-tools button {
  border: 1px solid var(--color-divider); border-radius: 999px; background: #fff; color: var(--color-text);
  min-height: 40px; padding: 8px 12px; font: inherit; font-weight: 700; cursor: pointer;
}
.page-tools button:hover { border-color: var(--color-accent); color: var(--color-accent); }
.page-stage {
  position: relative; width: min(100%, 560px); aspect-ratio: 595.28 / 841.89; margin: 0 auto;
  overflow: hidden; background: #fff; box-shadow: 0 8px 28px rgba(58, 36, 21, 0.15); container-type: inline-size;
}
.page-stage .boxes {
  position: absolute; inset: 4.28% 6.05%; z-index: 1; min-width: 0; min-height: 0;
}
.layout-page.feature .boxes .crop-box { width: 100%; height: 100%; }
.layout-page.quad .boxes { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2%; }
.layout-page.six .boxes { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, 1fr); gap: 2%; }

.crop-box {
  position: relative; background-color: var(--color-neutral-200); border-radius: 10px; overflow: hidden;
  cursor: grab; box-shadow: inset 0 0 0 1px rgba(58, 36, 21, 0.06); transition: opacity 0.15s, box-shadow 0.15s;
}
.crop-box:active { cursor: grabbing; }
.crop-box.is-dragging { opacity: 0.4; }
.crop-box.is-drop-target { box-shadow: inset 0 0 0 4px var(--color-accent); }
.crop-photo {
  width: 100%; height: 100%; display: block; pointer-events: none;
  transition: transform 0.18s ease;
}
.focal-dot {
  position: absolute; width: 14px; height: 14px; border-radius: 999px;
  border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
  transform: translate(-50%, -50%); pointer-events: none; z-index: 2;
}
.crop-box .name-chip {
  position: absolute; left: 6px; bottom: 6px; font-size: 10px; padding: 3px 9px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.62); color: #fff; pointer-events: none; z-index: 3;
}
.empty-slot {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  border: 2px dashed color-mix(in srgb, var(--color-text) 22%, transparent); background: rgba(255, 255, 255, 0.35); cursor: default;
  color: color-mix(in srgb, var(--color-text) 52%, transparent); text-align: center; font-size: 11px;
}
.empty-slot button { border: 0; border-radius: 999px; padding: 7px 10px; background: #fff; color: var(--color-accent); font: inherit; font-weight: 700; cursor: pointer; }
.photo-actions {
  position: absolute; top: 7px; left: 50%; transform: translateX(-50%); z-index: 4;
  display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s ease;
}
.crop-box:hover .photo-actions, .crop-box:focus-within .photo-actions { opacity: 1; }
.photo-action {
  appearance: none; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.93);
  color: #3a2415; box-shadow: 0 2px 8px rgba(58, 36, 21, 0.18); min-height: 30px;
  padding: 5px 10px; font: inherit; font-size: 11px; font-weight: 700; cursor: pointer;
}
.photo-action:hover { background: #fff; color: var(--color-accent); }
.photo-menu-toggle { display: none; }
.cover-action { position: absolute; top: 8px; right: 8px; z-index: 4; }

.album-elements { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.album-element {
  position: absolute; transform: translate(-50%, -50%); pointer-events: auto; cursor: move; touch-action: none;
  max-width: 78%; text-align: center; user-select: none;
}
.album-element.is-moving { opacity: 0.78; }
.element-text .element-content {
  display: flex; flex-direction: column; align-items: center; gap: 0.32em;
  line-height: 1.1; overflow-wrap: anywhere; padding: 0.4em 0.55em;
  border-radius: 0.32em; background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 1px 8px rgba(29, 20, 14, 0.14);
}
.element-text { width: 78%; }
.element-title { display: block; font-weight: 800; line-height: 1.05; }
.element-description { display: block; font-size: 0.48em; font-weight: 400; line-height: 1.35; white-space: pre-line; }
.text-attached-photo { display: block; margin-top: 0.35em; overflow: hidden; flex: 0 0 auto; }
.text-attached-photo.shape-rounded { aspect-ratio: 10 / 7; border-radius: 0.28em; }
.text-attached-photo.shape-square, .text-attached-photo.shape-circle { aspect-ratio: 1; }
.text-attached-photo.shape-circle { border-radius: 50%; }
.text-attached-photo img { width: 100%; height: 100%; display: block; object-fit: cover; pointer-events: none; }
.font-sans { font-family: Arial, Helvetica, sans-serif; }
.font-serif { font-family: Georgia, 'Times New Roman', serif; }
.font-mono { font-family: 'Courier New', Courier, monospace; }
.element-emoji .element-content { display: block; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.18)); }
.element-photo { aspect-ratio: 1; padding: 0.7%; background: #fff; box-shadow: 0 4px 16px rgba(58, 36, 21, 0.24); border-radius: 3%; }
.element-photo > img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 2%; pointer-events: none; }
.element-controls {
  position: absolute; left: 50%; bottom: calc(100% + 7px); transform: translateX(-50%); display: flex; align-items: center; gap: 3px;
  padding: 3px; border-radius: 10px; background: rgba(38, 27, 20, 0.88); opacity: 0; transition: opacity 0.15s; white-space: nowrap;
}
.album-element:hover .element-controls, .album-element:focus-within .element-controls, .album-element.is-moving .element-controls { opacity: 1; }
.element-controls button {
  min-width: 25px; height: 25px; border: 0; border-radius: 7px; padding: 0 6px; background: #fff; color: #3a2415; font-size: 10px; font-weight: 800; cursor: pointer;
}
.element-controls input[type="color"] { width: 25px; height: 25px; border: 0; border-radius: 7px; }

.mini-photo-panel { width: min(760px, 100%); }
.mini-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; margin-top: 18px; max-height: 58vh; overflow-y: auto; }
.mini-photo-option { position: relative; aspect-ratio: 1; border: 2px solid transparent; border-radius: 12px; overflow: hidden; padding: 0; background: var(--color-neutral-200); cursor: pointer; }
.mini-photo-option:hover { border-color: var(--color-accent); }
.mini-photo-option img { width: 100%; height: 100%; display: block; object-fit: cover; }
.mini-photo-option span { position: absolute; left: 4px; right: 4px; bottom: 4px; padding: 3px; border-radius: 7px; background: rgba(0,0,0,.58); color: #fff; font-size: 9px; }
.text-dialog-panel { width: min(620px, 100%); }
.text-area { min-height: 110px; resize: vertical; border-radius: var(--radius-md); }
.text-style-row { display: grid; grid-template-columns: 1fr 110px; gap: 16px; align-items: end; }
.text-style-row .field { margin-bottom: 0; }
.text-color-large { width: 100%; height: 48px; padding: 3px; border: 1px solid var(--color-divider); border-radius: var(--radius-md); background: #fff; cursor: pointer; }
.attached-photo-editor { margin-top: 20px; padding: 14px; border: 1px solid var(--color-divider); border-radius: 14px; background: color-mix(in srgb, var(--color-neutral-200) 42%, #fff); }
.attached-photo-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.attached-photo-head p { margin: 3px 0 0; font-size: 12px; }
.attached-photo-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.attached-photo-settings { display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: center; margin-top: 14px; }
.attached-photo-settings[hidden] { display: none; }
.attached-photo-settings > img { width: 120px; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--color-neutral-200); }
.attached-photo-fields { display: grid; gap: 10px; }
.attached-photo-fields .field { margin: 0; }
.attached-photo-fields input[type="range"] { width: 100%; accent-color: var(--color-accent); }

.segmented {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--color-neutral-200);
}
.segmented button {
  border: 0; border-radius: 9px; background: transparent; color: var(--color-neutral-600);
  min-height: 38px; padding: 8px 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.segmented button.is-active { background: #fff; color: var(--color-text); box-shadow: 0 1px 4px rgba(58, 36, 21, 0.12); }
.segmented.compact button { padding: 6px 9px; font-size: 11px; }

body.dialog-open { overflow: hidden; }
.crop-dialog[hidden] { display: none; }
.crop-dialog { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 20px; }
.crop-dialog-backdrop { position: absolute; inset: 0; background: rgba(29, 20, 14, 0.68); backdrop-filter: blur(3px); }
.crop-dialog-panel {
  position: relative; width: min(680px, 100%); max-height: calc(100vh - 40px); overflow-y: auto;
  background: #fff; border-radius: 22px; padding: 24px; box-shadow: 0 24px 80px rgba(29, 20, 14, 0.35);
}
.crop-dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 18px; }
.crop-dialog-head h2 { margin: 0; font-size: 25px; }
.eyebrow { margin: 0 0 3px; color: var(--color-accent); text-transform: uppercase; letter-spacing: 0.09em; font-size: 10px; font-weight: 800; }
.dialog-close {
  width: 42px; height: 42px; border: 0; border-radius: 999px; background: var(--color-neutral-200);
  color: var(--color-text); font-size: 26px; line-height: 1; cursor: pointer;
}
.crop-stage {
  position: relative; width: min(100%, 440px); max-height: 55vh; margin: 0 auto 22px; overflow: hidden;
  border-radius: 14px; background: #eee8e1; cursor: crosshair; touch-action: none;
  box-shadow: 0 0 0 1px rgba(58, 36, 21, 0.12);
}
.crop-stage img { width: 100%; height: 100%; display: block; user-select: none; pointer-events: none; }
.crop-stage-help {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 20px);
  border-radius: 999px; padding: 6px 10px; background: rgba(0, 0, 0, 0.62); color: #fff;
  text-align: center; font-size: 11px; pointer-events: none; z-index: 3;
}
.crop-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: end; }
.crop-controls .field { margin: 0; }
.range-label { display: flex; justify-content: space-between; align-items: baseline; }
.range-label output { font-size: 12px; color: var(--color-neutral-600); }
.zoom-field input { width: 100%; accent-color: var(--color-accent); }
.zoom-field.is-disabled { opacity: 0.45; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

@media (hover: none), (max-width: 640px) {
  .element-controls { opacity: 1; }
  .photo-actions {
    top: 4px; left: 4px; right: 4px; transform: none; opacity: 1;
    justify-content: flex-end; gap: 3px;
  }
  .photo-menu-toggle {
    display: block; width: 36px; min-width: 36px; height: 36px; min-height: 36px;
    padding: 0; font-size: 16px;
  }
  .photo-actions:not(.is-open) .photo-action:not(.photo-menu-toggle) { display: none; }
  .photo-actions.is-open {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 3px; border-radius: 10px; background: rgba(38, 27, 20, .82);
  }
  .photo-actions.is-open .photo-action {
    width: auto; min-width: 0; height: 32px; min-height: 32px; padding: 0; font-size: 0;
  }
  .photo-actions.is-open .photo-action::after { font-size: 15px; line-height: 1; }
  .photo-actions.is-open .move-prev::after { content: "←"; }
  .photo-actions.is-open .edit-crop::after { content: "✥"; }
  .photo-actions.is-open .free-slot::after { content: "□"; }
  .photo-actions.is-open .exclude-photo::after { content: "×"; font-size: 20px; }
  .photo-actions.is-open .move-next::after { content: "→"; }
  .photo-actions.is-open .photo-menu-toggle::after { content: "•••"; font-size: 11px; }
}

/* ---- download cards ---- */
.download-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.download-card { padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.download-card .icon { color: var(--color-accent); }
.download-card.zip .icon { color: var(--color-accent-2); }
.download-card.zip .btn-primary { background: var(--color-accent-2); }
.download-card.zip .btn-primary:hover { background: var(--color-accent-2-600); }

.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }

.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid color-mix(in srgb, currentColor 30%, transparent);
  border-top-color: currentColor; border-radius: 50%;
  animation: spin 0.7s linear infinite; vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

footer { text-align: center; color: var(--color-neutral-600); font-size: 13px; padding: 20px; }

@media (max-width: 640px) {
  h1 { font-size: clamp(27px, 9vw, 34px); }
  h2 { font-size: 23px; }
  header.topbar { padding: 14px 16px; }
  header.topbar .brand { max-width: 58vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  header.topbar nav a { margin-left: 10px; font-size: 14px; }
  main { padding: 14px 10px 48px; }
  .shell { margin-top: 8px; }
  .steps-wrap { margin-bottom: 24px; }
  .step .badge { width: 40px; height: 40px; font-size: 18px; }
  .step .label { font-size: 12px; }
  .stat-row, .preview-grid, .download-grid { grid-template-columns: 1fr; }
  .page-card { padding: 24px 16px; border-radius: 22px; }
  .instructions { padding: 18px; }
  .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .cover-picker { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .table { min-width: 560px; }
  .actions { flex-direction: column-reverse; }
  .actions > .btn { width: 100%; }
  .email-test { grid-template-columns: 1fr; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-settings { width: 100%; justify-content: space-between; flex-wrap: wrap; }
  .layout-page { padding: 12px; }
  .empty-slot span { display: none; }
  .crop-controls { grid-template-columns: 1fr; }
  .text-style-row { grid-template-columns: 1fr 90px; }
  .attached-photo-head { align-items: flex-start; flex-direction: column; }
  .attached-photo-settings { grid-template-columns: 84px 1fr; }
  .attached-photo-settings > img { width: 84px; }
  .crop-dialog { padding: 10px; }
  .crop-dialog-panel { max-height: calc(100vh - 20px); padding: 18px; border-radius: 18px; }
  .crop-stage { max-height: 48vh; }
  .dialog-actions { position: sticky; bottom: -18px; margin-inline: -18px; padding: 14px 18px 18px; background: linear-gradient(transparent, #fff 18%); }
  .dialog-actions .btn { flex: 1; padding-inline: 12px; }
  .home-main { padding: 10px 8px 28px; }
  .home-hero { min-height: auto; border-radius: 24px; }
  .home-hero-photo { object-position: 56% center; }
  .home-hero::after {
    background: linear-gradient(0deg, rgba(17, 22, 20, .74) 0%, rgba(17, 22, 20, .16) 76%, rgba(17, 22, 20, .06) 100%);
  }
  .home-hero-content { min-height: auto; grid-template-columns: 1fr; gap: 24px; padding: 260px 10px 10px; }
  .home-copy { padding: 0 12px; }
  .home-copy h1 { margin-bottom: 12px; font-size: clamp(38px, 13vw, 58px); }
  .home-copy p { font-size: 17px; }
  .home-kicker { font-size: 10px; }
  .home-form-card { padding: 24px 18px; border-radius: 22px; }
  .home-form-card h2 { font-size: 28px; }
}

@media (max-width: 380px) {
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cover-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .step .label { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
