/* ---------- Interfața aplicației ---------- */
:root {
  --ink: #2E2A26;
  --muted: #6B645C;
  --line: #DDD5C8;
  --bg: #F4EFE6;
  --card: #FFFDF9;
  --brand: #5F7058;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Jost', system-ui, sans-serif;
}
.topbar {
  display: flex; flex-wrap: wrap; gap: 12px 40px; align-items: flex-end;
  padding: 28px 32px 8px;
}
.topbar h1 {
  margin: 2px 0 0; font-family: 'Cormorant Garamond', serif; font-weight: 500; font-size: 40px; line-height: 1;
}
.eyebrow { font-size: 12px; letter-spacing: .22em; font-weight: 500; color: var(--brand); }
.lead { margin: 0; max-width: 620px; line-height: 1.5; color: var(--muted); }

.layout {
  display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start;
  padding: 20px 32px 48px;
}
.panel {
  flex: 1 1 340px; max-width: 420px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px; display: flex; flex-direction: column; gap: 16px;
  position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto;
}
fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
legend { font-family: 'Cormorant Garamond', serif; font-size: 21px; font-weight: 600; margin-bottom: 4px; padding: 0; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); flex: 1 1 0; min-width: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > label { min-width: 140px; }
input, select, textarea {
  font: inherit; font-size: 15px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  padding: 9px 10px; min-height: 42px; width: 100%;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
.hint { margin: 0; font-size: 12px; color: var(--muted); }

.btn, .btn-secondary {
  font: inherit; font-size: 14px; min-height: 40px; padding: 0 16px; border-radius: 999px; cursor: pointer;
}
.btn { background: var(--ink); color: #fff; border: 1px solid var(--ink); }
.btn:hover { background: #45403A; }
.btn-secondary { background: transparent; color: var(--ink); border: 1px solid #B9B0A2; }
.btn-secondary:hover { background: #EDE6DA; }
.btn:disabled { opacity: .55; cursor: progress; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }

.previews {
  flex: 999 1 560px; min-width: 0;
  display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start;
}
.preview {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.preview-wide { flex-basis: 100%; }
.preview-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.preview-head h2 { margin: 0; font-size: 15px; font-weight: 500; }
.muted { color: var(--muted); font-weight: 400; }
.stage { display: flex; gap: 16px; flex-wrap: wrap; }
.scaler { position: relative; overflow: hidden; box-shadow: 0 8px 24px rgba(46,42,38,.12); flex: none; }
.scaler > .piece { position: absolute; left: 0; top: 0; transform-origin: 0 0; }

/* Filigran pe previzualizare */
.scaler { user-select: none; -webkit-user-select: none; }
.scaler::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='140'%3E%3Ctext x='10' y='90' transform='rotate(-28 110 70)' font-family='Arial,sans-serif' font-size='17' font-weight='700' letter-spacing='3' fill='%232E2A26' fill-opacity='0.22'%3EPREVIZUALIZARE%3C/text%3E%3C/svg%3E");
  background-repeat: repeat;
}

/* Bara de activare */
.access {
  margin: 8px 32px 0; padding: 18px 20px; border-radius: 14px; border: 1px solid var(--line); background: var(--card);
  display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center;
}
.access h2 { margin: 0; font-family: 'Cormorant Garamond', serif; font-size: 24px; font-weight: 600; }
.access p { margin: 4px 0 0; font-size: 14px; color: var(--muted); line-height: 1.45; max-width: 560px; }
.access form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-left: auto; }
.access form label { min-width: 220px; }
.access .status { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; text-align: right; }
.access .status b { font-size: 16px; }
.access.on { border-color: var(--brand); }
.badge { display: inline-block; font-size: 11px; letter-spacing: .14em; font-weight: 500; padding: 4px 10px; border-radius: 999px; background: #EDE6DA; color: var(--ink); }
.err { color: #9A2A1F; font-size: 13px; margin: 0; width: 100%; }
.btn-generate { min-height: 46px; padding: 0 22px; font-size: 15px; }
.privacy { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }

/* Fereastra de confirmare */
dialog {
  border: 0; border-radius: 16px; padding: 24px; max-width: 460px; width: calc(100% - 32px);
  color: var(--ink); background: var(--card); box-shadow: 0 24px 60px rgba(0,0,0,.25);
}
dialog::backdrop { background: rgba(46,42,38,.45); }
dialog h3 { margin: 0 0 8px; font-family: 'Cormorant Garamond', serif; font-size: 26px; font-weight: 600; }
dialog p { margin: 0 0 12px; line-height: 1.5; font-size: 15px; }
dialog ul { margin: 0 0 14px; padding-left: 18px; line-height: 1.6; font-size: 14px; }
dialog .check { flex-direction: row; align-items: flex-start; gap: 10px; color: var(--ink); font-size: 14px; margin-bottom: 16px; }
dialog .check input { width: 20px; min-height: 20px; height: 20px; margin: 2px 0 0; flex: none; }
dialog .btns { justify-content: flex-end; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
#toast.show { opacity: 1; }

#print-root { display: none; }
#render-root { position: fixed; left: -20000px; top: 0; }

#print-block { display: none; }

@media (max-width: 760px) {
  .topbar, .layout { padding-left: 16px; padding-right: 16px; }
  .access { margin: 8px 16px 0; }
  .access form, .access .status { margin-left: 0; align-items: flex-start; text-align: left; }
  .panel { position: static; max-height: none; max-width: none; }
}

/* ---------- Print ----------
   Pagina nu se printează. Excepție: modul de test local, unde „kitul final” se face cu printul browserului. */
@media print {
  html, body { margin: 0 !important; padding: 0 !important; background: #fff !important; }
  body > *:not(#print-root):not(#print-block):not(style):not(script) { display: none !important; }
  body:not(.final-print) #print-root { display: none !important; }
  body:not(.final-print) #print-block { display: block !important; padding: 80px 40px; font: 18px/1.5 system-ui, sans-serif; text-align: center; }
  body.final-print #print-root { display: block !important; }
}


/* Formular: fotografie, bife, meniu */
.opt { font-family: 'Jost', sans-serif; font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.photo-pick { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.photo-thumb {
  width: 72px; height: 72px; border-radius: 50%; flex: none; border: 1px dashed #B9B0A2;
  background: #F4EFE6 center / cover no-repeat;
}
.photo-thumb.has { border-style: solid; border-color: var(--brand); }
.file-btn { flex-direction: row; display: inline-flex; align-items: center; color: var(--ink); font-size: 14px; position: relative; overflow: hidden; flex: none; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }
.file-btn:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.checks { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.checks-title { font-size: 13px; color: var(--muted); }
.check-inline { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
.check-inline input { width: 18px; height: 18px; min-height: 18px; margin: 0; flex: none; }
input[type=range] { padding: 0; min-height: 32px; accent-color: var(--brand); }
.meniu-list { display: flex; flex-direction: column; gap: 10px; }
.fel { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #FBF8F3; }
.fel .fel-cat { grid-column: 1; }
.fel .fel-desc { grid-column: 1 / -1; }
.fel .fel-del { grid-column: 2; grid-row: 1; align-self: end; width: 42px; padding: 0; }
.fel-num { font-size: 12px; color: var(--muted); }
.meniu-actions { align-items: center; }
.fel .fel-alt { grid-column: 1 / -1; }
.mese-list { display: flex; flex-direction: column; gap: 8px; }
.masa { border: 1px solid var(--line); border-radius: 10px; background: #FBF8F3; }
.masa > summary {
  cursor: pointer; list-style: none; padding: 12px 14px; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 15px; font-weight: 500;
}
.masa > summary::-webkit-details-marker { display: none; }
.masa > summary::after { content: '▾'; color: var(--muted); transition: transform .15s; }
.masa[open] > summary::after { transform: rotate(180deg); }
.masa > summary .muted { font-size: 13px; margin-left: auto; }
.masa-body { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.guest-row { display: flex; gap: 8px; align-items: center; }
.guest-row .guest-num { width: 22px; flex: none; font-size: 12px; color: var(--muted); text-align: right; }
.guest-row input { flex: 1 1 auto; min-width: 0; }
.guest-row .guest-del { width: 42px; padding: 0; flex: none; }
.masa-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Mesaje pentru nași */
.mesaje { display: flex; flex-direction: column; gap: 8px; }
.mesaj-opt {
  flex-direction: row; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #FBF8F3; color: var(--ink); cursor: pointer;
}
.mesaj-opt:has(input:checked) { border-color: var(--brand); background: #F3F1EA; box-shadow: inset 0 0 0 1px var(--brand); }
.mesaj-opt input { width: 18px; height: 18px; min-height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--brand); }
.mesaj-opt b { display: block; font-size: 14px; font-weight: 500; margin-bottom: 3px; }
.mesaj-opt .txt { font-size: 13px; line-height: 1.45; color: var(--muted); }

.row > label.prefix { flex: 0 0 150px; min-width: 120px; }
#rsvp-hint a { color: var(--brand); font-weight: 500; }
