/* KPhotobooth — shared styles */
:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --surface-2: #f0ede6;
  --ink: #1c1d2b;
  --muted: #6b6d7c;
  --line: #e3dfd5;
  --brand: #2340a8;
  --brand-ink: #ffffff;
  --brand-soft: #e6ebfb;
  --accent: #e2557a;
  --ok: #1f8a4c;
  --ok-soft: #e1f4e8;
  --warn: #b7791f;
  --warn-soft: #fbf0db;
  --bad: #c23a3a;
  --bad-soft: #fbe4e4;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 20, 40, .06), 0 8px 24px rgba(20, 20, 40, .06);
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Pacifico", "Brush Script MT", cursive;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14151d;
    --surface: #1d1f2a;
    --surface-2: #262838;
    --ink: #f1f1f5;
    --muted: #a0a2b4;
    --line: #33364a;
    --brand: #7d97ff;
    --brand-ink: #10122a;
    --brand-soft: #262f57;
    --ok-soft: #173826;
    --warn-soft: #3b2f17;
    --bad-soft: #3d1d1d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img, canvas, video { max-width: 100%; display: block; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
.container { width: min(1180px, 100% - 32px); margin-inline: auto; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.logo { font-family: var(--display); font-size: 1.6rem; color: var(--brand); text-decoration: none; margin-right: auto; }
.logo span { color: var(--accent); }
.nav-links { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-links a {
  text-decoration: none; color: var(--ink); padding: 8px 12px; border-radius: 999px; font-weight: 500; font-size: .92rem;
}
.nav-links a:hover { background: var(--surface-2); }
.nav-links a[aria-current="page"] { background: var(--brand); color: var(--brand-ink); }
@media (max-width: 640px) {
  .nav { padding: 8px 0; gap: 6px; }
  .nav-links { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .nav-links a { white-space: nowrap; }
}

.site-footer { border-top: 1px solid var(--line); margin-top: 64px; padding: 28px 0; color: var(--muted); font-size: .88rem; }

/* ---------- Buttons / inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 9px 16px; border-radius: 999px; font: inherit; font-weight: 500; font-size: .92rem;
  cursor: pointer; text-decoration: none; transition: transform .08s, background .15s, border-color .15s;
}
.btn:hover { border-color: var(--brand); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-danger { color: var(--bad); }
.btn-lg { padding: 13px 26px; font-size: 1.02rem; }
.btn-sm { padding: 5px 11px; font-size: .82rem; }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

label.field { display: grid; gap: 4px; font-size: .85rem; font-weight: 500; }
input[type=text], input[type=tel], input[type=number], input[type=search], input[type=password], select, textarea {
  font: inherit; font-size: .92rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
input[type=range] { width: 100%; accent-color: var(--brand); }
input[type=color] { width: 40px; height: 32px; border: none; background: none; padding: 0; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; color: var(--ink); font: inherit; font-size: .85rem; font-weight: 500;
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: var(--shadow); color: var(--brand); }

/* ---------- Cards / panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.section { padding: 40px 0 8px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head p { margin: 0; }
.step-num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-size: .85rem; margin-right: 8px; vertical-align: 2px; }

/* ---------- Hero ---------- */
.hero { padding: 64px 0 32px; display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.hero h1 { font-family: var(--display); font-weight: 400; font-size: clamp(2.6rem, 7vw, 4.4rem); color: var(--brand); margin-bottom: .2em; }
.hero .tag { font-size: 1.15rem; color: var(--muted); margin-bottom: 1.4em; }
.badge { display: inline-block; background: var(--brand-soft); color: var(--brand); padding: 4px 12px; border-radius: 999px; font-size: .8rem; font-weight: 600; margin-bottom: 14px; }
.hero-strips { display: flex; justify-content: center; gap: 18px; }
.hero-strips canvas { width: 150px; height: auto; border-radius: 6px; box-shadow: 0 16px 40px rgba(20, 20, 60, .22); }
.hero-strips canvas:nth-child(1) { transform: rotate(-6deg) translateY(10px); }
.hero-strips canvas:nth-child(2) { transform: rotate(5deg); }
@media (max-width: 800px) { .hero { grid-template-columns: 1fr; padding-top: 32px; text-align: center; } .hero .btn-row { justify-content: center; } }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.step .ico { font-size: 1.8rem; }
.step h3 { margin-top: 8px; }
.step p { color: var(--muted); margin: 0; font-size: .92rem; }

.cta { text-align: center; background: var(--brand); color: var(--brand-ink); border-radius: 24px; padding: 44px 20px; margin-top: 48px; }
.cta h2 { font-family: var(--display); font-weight: 400; font-size: 2.2rem; }
.cta .btn { background: var(--brand-ink); color: var(--brand); border-color: transparent; }

.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq details p { margin: 10px 0 0; color: var(--muted); }

/* ---------- Layout grid ---------- */
.layout-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; }
.layout-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
  cursor: pointer; display: flex; flex-direction: column; gap: 10px; text-align: left; font: inherit; color: inherit;
  transition: transform .12s, box-shadow .12s, border-color .12s; position: relative;
}
.layout-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--brand); }
.layout-card.selected { border-color: var(--brand); outline: 2px solid var(--brand); }
.layout-card .thumb { height: 220px; display: grid; place-items: center; background: var(--surface-2); border-radius: 10px; padding: 10px; }
.layout-card .thumb canvas, .layout-card .thumb img { max-height: 200px; width: auto; box-shadow: 0 4px 14px rgba(0, 0, 0, .15); }
.layout-card .name { font-weight: 600; }
.layout-card .meta { font-size: .8rem; color: var(--muted); }
.layout-card .del { position: absolute; top: 8px; right: 8px; }
.chip { display: inline-block; font-size: .72rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }

/* ---------- Booth ---------- */
.booth { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .booth { grid-template-columns: 1fr; } }
.cam-wrap { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; }
.cam-wrap video { width: 100%; height: 100%; object-fit: cover; }
.cam-wrap.mirror video { transform: scaleX(-1); }
.countdown { position: absolute; inset: 0; display: grid; place-items: center; font-size: 8rem; font-weight: 700; color: #fff; text-shadow: 0 4px 30px rgba(0, 0, 0, .5); pointer-events: none; }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.flash.go { animation: flash .45s ease-out; }
@keyframes flash { 0% { opacity: .95; } 100% { opacity: 0; } }
.cam-msg { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; text-align: center; padding: 24px; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.shot { position: relative; border-radius: 10px; overflow: hidden; background: var(--surface-2); aspect-ratio: 4 / 3; border: 2px solid transparent; }
.shot.picked { border-color: var(--accent); }
.shot img { width: 100%; height: 100%; object-fit: cover; }
.shot .n { position: absolute; left: 6px; top: 6px; background: rgba(0, 0, 0, .6); color: #fff; font-size: .75rem; border-radius: 6px; padding: 1px 7px; }
.shot .acts { position: absolute; right: 6px; bottom: 6px; display: flex; gap: 4px; }
.shot .acts .btn { background: rgba(255, 255, 255, .92); color: #111; }
.side-stack { display: grid; gap: 14px; }

/* ---------- Editor ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .editor { grid-template-columns: 1fr; } }
.stage {
  background: repeating-conic-gradient(var(--surface-2) 0% 25%, var(--surface) 0% 50%) 50% / 24px 24px;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; place-items: center; min-height: 420px;
}
.stage canvas { max-height: 78vh; width: auto; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); touch-action: none; cursor: grab; }
.stage canvas.doodle-mode { cursor: crosshair; }
.tools .tabs { margin-bottom: 14px; }
.tool-group { display: grid; gap: 12px; }
.tool-group h4 { margin: 4px 0 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.swatch[aria-pressed="true"] { outline: 3px solid var(--brand); outline-offset: 2px; }
.stickers { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.stickers button { font-size: 1.5rem; background: var(--surface-2); border: 0; border-radius: 10px; padding: 6px 0; cursor: pointer; }
.stickers button:hover { background: var(--brand-soft); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.hint { font-size: .8rem; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }

/* ---------- Upload ---------- */
.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px; text-align: center; background: var(--surface);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone.over, .dropzone:hover { border-color: var(--brand); background: var(--brand-soft); }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.thumbs .t { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; border: 2px solid transparent; cursor: pointer; background: var(--surface-2); }
.thumbs .t img { width: 100%; height: 100%; object-fit: cover; }
.thumbs .t .x { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .65); color: #fff; cursor: pointer; font-size: .8rem; line-height: 1; }
.thumbs .t .res { position: absolute; left: 0; right: 0; bottom: 0; font-size: .65rem; background: rgba(0, 0, 0, .55); color: #fff; text-align: center; }

.sheet-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .sheet-layout { grid-template-columns: 1fr; } }
.sheet-stage { background: var(--surface-2); border-radius: var(--radius); padding: 20px; display: grid; place-items: center; border: 1px solid var(--line); }
.sheet-stage canvas { max-height: 80vh; width: auto; background: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); touch-action: none; }
.download-bar { position: sticky; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding: 14px 0; margin-top: 32px; box-shadow: 0 -8px 24px rgba(0, 0, 0, .06); }
.download-bar .container { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* ---------- Modal ---------- */
dialog {
  border: 0; border-radius: 18px; padding: 0; background: var(--surface); color: var(--ink);
  width: min(560px, calc(100% - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}
dialog.wide { width: min(980px, calc(100% - 24px)); }
dialog::backdrop { background: rgba(10, 10, 30, .55); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 20px; display: grid; gap: 14px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.slot-canvas-wrap { background: var(--surface-2); border-radius: 12px; padding: 10px; display: grid; place-items: center; }
.slot-canvas-wrap canvas { max-height: 60vh; width: auto; cursor: crosshair; touch-action: none; }
.preset-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; }
@media (max-width: 760px) { .preset-grid { grid-template-columns: 1fr; } }

/* ---------- Customer table ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .v { font-size: 1.6rem; font-weight: 700; }
.stat .l { font-size: .8rem; color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { max-width: 280px; }
.toolbar select { width: auto; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; min-width: 980px; font-size: .9rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td .tn { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; cursor: zoom-in; background: var(--surface-2); }
td input, td select { min-width: 110px; padding: 6px 8px; }
.status-btns { display: inline-flex; gap: 4px; flex-wrap: nowrap; }
.status-btns button { white-space: nowrap; }
.status-btns button { border: 1px solid var(--line); background: var(--surface); font: inherit; font-size: .78rem; font-weight: 600; padding: 5px 10px; border-radius: 999px; cursor: pointer; color: var(--muted); }
.status-btns button[data-s="paid"][aria-pressed="true"] { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.status-btns button[data-s="not_paid"][aria-pressed="true"] { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.status-btns button[data-s="later"][aria-pressed="true"] { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }

.lock { max-width: 380px; margin: 80px auto; text-align: center; }

/* ---------- Toast ---------- */
.toast-box { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: .9rem; box-shadow: var(--shadow); animation: up .25s ease-out; }
.toast.err { background: var(--bad); color: #fff; }
@keyframes up { from { transform: translateY(10px); opacity: 0; } }

/* ---------- utilities (no inline styles: CSP blocks them) ---------- */
.mt-10 { margin-top: 10px; }
.mt-18 { margin-top: 18px; }
.spread { justify-content: space-between; }
.w-70 { width: 70px !important; min-width: 0 !important; }
.w-90 { width: 90px !important; min-width: 0 !important; }
.bad { color: var(--bad); }
.spacer { flex: 1; }
.viewer-img { max-height: 70vh; width: auto; margin: 0 auto; }
