/* InviteMuseLoria 7.0 — app styles */
:root {
  --mist: #f3f0f2;      /* app background */
  --surface: #ffffff;   /* panels */
  --desk: #e7e1e6;      /* the "desk" the invitation lies on */
  --ink: #2a2230;       /* text */
  --muted: #776c7a;     /* secondary text */
  --line: #e4dce3;      /* lines and borders */
  --mulberry: #7a3b5e;  /* brand colour, main buttons */
  --mulberry-soft: #f4e9ef;
  --sage: #3f7a5f;
  --danger: #a33a4a;
  --radius: 10px;
  --head: 56px;
  --ui: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --display: "Cormorant Garamond", Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--mist);
  color: var(--ink);
  font: 400 14px/1.45 var(--ui);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.hidden { display: none !important; }
body.mode-client .only-designer { display: none !important; }
body.mode-designer .only-client { display: none !important; }

/* ---------- form controls ---------- */
button, .button {
  font: 500 13px/1.2 var(--ui);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  transition: background .15s, border-color .15s;
}
button:hover, .button:hover { border-color: #cdbfcb; background: #fcfafb; }
button:disabled { opacity: .45; cursor: default; }
button.primary, .button.primary { background: var(--mulberry); border-color: var(--mulberry); color: #fff; }
button.primary:hover { background: #6a314f; }
button.ghost, .button.ghost { background: transparent; border-color: transparent; }
button.ghost:hover, .button.ghost:hover { background: rgba(122,59,94,.07); }
button.icon { min-width: 32px; padding: 6px; }
button.danger { color: var(--danger); }
button.active, .chip.active { background: var(--mulberry-soft); border-color: #d9b9ca; color: var(--mulberry); }
.full { width: 100%; }
.action { background: #fbf9fa; }
:focus-visible { outline: 2px solid var(--mulberry); outline-offset: 2px; }
input, select, textarea {
  font: 400 15px/1.35 var(--ui);
  color: var(--ink);
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
}
input:focus, select:focus, textarea:focus { border-color: var(--mulberry); outline: none; box-shadow: 0 0 0 3px rgba(122,59,94,.12); }
input[type=color] { padding: 3px; height: 38px; cursor: pointer; }
input[type=checkbox] { width: auto; accent-color: var(--mulberry); }
input[type=range] { padding: 0; border: 0; accent-color: var(--mulberry); }
textarea { resize: vertical; }
label { display: grid; gap: 5px; font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }
label.check { display: flex; align-items: flex-start; gap: 8px; color: var(--ink); font-size: 13px; }
label.check input { margin-top: 2px; }
.filepick { position: relative; overflow: hidden; }
label.button { display: inline-flex; margin: 0; font-size: 13px; color: var(--ink); }
.filepick input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.rowbuttons { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.rowbuttons button { flex: 1 1 auto; }
.muted { color: var(--muted); font-size: 12.5px; margin: 6px 0 10px; }
.warn { color: #9a5a1a; font-size: 12.5px; }
h3 { font: 600 13px/1.3 var(--ui); margin: 18px 0 8px; }

/* ---------- top bar ---------- */
.appbar {
  height: var(--head);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 5;
}
.logo { display: flex; align-items: center; gap: 9px; font: 600 23px/1 var(--display); letter-spacing: .2px; white-space: nowrap; }
.logo b { font-weight: 600; }
.logomark { color: var(--mulberry); font-size: 20px; }
.docname { display: flex; align-items: center; gap: 2px; color: var(--muted); max-width: 260px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.status { font-size: 12px; color: var(--muted); white-space: nowrap; }
.topactions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.actions-designer { display: inline-flex; gap: 6px; }
.langs { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.langs button { border: 0; border-radius: 0; min-height: 32px; padding: 6px 10px; font-weight: 600; }
.switch { font-size: 12.5px; color: var(--muted); }

/* ---------- 3-column layout ---------- */
.workspace {
  height: calc(100vh - var(--head));
  height: calc(100dvh - var(--head));
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 380px;
}
.panel { background: var(--surface); overflow-y: auto; padding: 20px 18px 28px; }
.panel.left { border-right: 1px solid var(--line); }
.panel.right { border-left: 1px solid var(--line); }
body.single-product.mode-client .workspace { grid-template-columns: minmax(0, 1fr) 400px; }
body.single-product.mode-client .panel.left { display: none; }

/* customer steps */
.step { font: 600 26px/1.15 var(--display); margin: 0 0 12px; letter-spacing: .1px; }
.client-export { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); }
.client-form .muted { margin-top: -4px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 12px; }
.chip { min-height: 30px; padding: 5px 11px; border-radius: 999px; font-size: 12.5px; }
.client-gallery input[type=search] { margin-bottom: 2px; }

/* gallery */
.ggrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ggrid.small { grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.gcard {
  display: flex; flex-direction: column; align-items: stretch; gap: 7px;
  padding: 0; border: 0; background: none; min-height: 0; text-align: left;
}
.gcard img {
  width: 100%; aspect-ratio: 5 / 7; object-fit: cover; border-radius: 4px;
  box-shadow: 0 1px 2px rgba(42,34,48,.12), 0 4px 12px rgba(42,34,48,.08);
  outline: 2px solid transparent; outline-offset: 3px; transition: outline-color .15s, transform .15s;
  background: #f6f3f5;
}
.gcard span { font-size: 12.5px; color: var(--ink); line-height: 1.25; }
.gcard:hover, .gcard.active { background: none; border: 0; }
.gcard:hover img { transform: translateY(-2px); }
.gcard.active img { outline-color: var(--mulberry); }
.gcard.active span { color: var(--mulberry); font-weight: 600; }
.gcard.small span { font-size: 11px; color: var(--muted); }
.gcard.checked span { color: var(--sage); }

/* ---------- preview ---------- */
.stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--desk); }
.canvaswell {
  flex: 1; min-height: 0; overflow: auto;
  display: grid; place-items: center;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255,255,255,.55), rgba(255,255,255,0) 65%),
    var(--desk);
}
.paperwrap {
  position: relative;
  box-shadow: 0 1px 1px rgba(42,34,48,.08), 0 10px 22px -6px rgba(42,34,48,.22), 0 30px 60px -20px rgba(42,34,48,.25);
  border-radius: 2px;
}
#editor { width: 100%; height: 100%; display: block; touch-action: none; cursor: text; border-radius: 2px; }
body.mode-designer #editor { cursor: default; }
.pages { justify-content: center; margin: 0; padding: 8px; }
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.toolbar button, .toolbar select { min-height: 32px; padding: 5px 10px; font-size: 12.5px; width: auto; }
.tcheck { display: flex; align-items: center; gap: 5px; margin: 0; color: var(--ink); font-size: 12.5px; }
.spacer { flex: 1; }
.zoomtext { font-size: 12px; color: var(--muted); min-width: 40px; text-align: center; }
.stagefoot { display: flex; justify-content: space-between; gap: 12px; padding: 6px 14px; font-size: 11.5px; color: var(--muted); background: var(--surface); border-top: 1px solid var(--line); }

/* ---------- customer form ---------- */
.fields { display: grid; gap: 2px; }
.field { color: var(--ink); font-size: 13px; font-weight: 500; }
.field input, .field textarea { font-size: 16px; }
.style-box { margin-top: 8px; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.style-box summary { cursor: pointer; font-weight: 500; }
.style-box[open] summary { margin-bottom: 10px; }
.lbl { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { width: 30px; height: 30px; min-height: 30px; padding: 0; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.swatch.active { box-shadow: 0 0 0 2px var(--mulberry); }
.swatch.reset { width: auto; border-radius: 999px; padding: 0 12px; font-size: 12px; background: #fff; }
.dl-buttons { display: grid; gap: 8px; margin-bottom: 12px; }
.dl { flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; min-height: 56px; text-align: left; }
.dl b { font-size: 15px; font-weight: 600; }
.dl small { font-size: 12px; opacity: .75; font-weight: 400; }
#clientExportMsg.bad { color: var(--danger); }

/* ---------- designer: library ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; }
.tabs button { flex: 1 1 auto; min-height: 32px; padding: 6px 8px; font-size: 12.5px; }
.library-items { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.template { flex-direction: column; align-items: stretch; padding: 6px; gap: 4px; text-align: left; }
.template-preview { width: 100%; height: auto; display: block; border-radius: 3px; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.template b { font-size: 12px; font-weight: 600; }
.template small { font-size: 11px; color: var(--muted); }
.deco-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.deco-card { position: relative; }
.deco { flex-direction: column; width: 100%; padding: 6px; gap: 2px; font-size: 11px; }
.decor-preview { width: 100%; height: auto; max-width: 80px; }
.fav-button { position: absolute; top: 3px; right: 3px; min-height: 22px; width: 22px; padding: 0; font-size: 12px; border: 0; background: transparent; }
.fav-button.is-fav { color: #c58b1e; }
.creative-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.creative-grid button { font-size: 12px; }
.design-editor { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; background: #fcfafb; }
.design-editor h3 { margin-top: 0; }
.design-editor button { margin-bottom: 8px; }
#dZoneBtn.active { background: #e6f3ee; border-color: #9fcdb9; color: var(--sage); }
.myasset-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.asset-card { border: 1px solid var(--line); border-radius: 8px; padding: 6px; display: grid; gap: 4px; }
.asset-card img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #f6f3f5; border-radius: 4px; }
.asset-info { font-size: 11px; }
.asset-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.asset-actions button { flex: 1; min-height: 28px; padding: 4px; font-size: 11px; }
.vault-list { display: grid; gap: 6px; margin-top: 8px; }
.vault-card { border: 1px solid var(--line); border-radius: 8px; padding: 8px; display: grid; gap: 4px; }
.vault-card small { color: var(--muted); }
.vault-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.vault-actions button { min-height: 28px; padding: 4px 8px; font-size: 11.5px; }

/* ---------- designer: properties ---------- */
.notice { background: var(--mulberry-soft); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px; }
.notice p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.selbar { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.selbar strong { flex: 1; font: 600 20px/1.2 var(--display); }
details.sub, details.tool { border-top: 1px solid var(--line); padding: 10px 0; }
details.sub summary, details.tool summary { cursor: pointer; font-weight: 600; font-size: 13px; padding: 4px 0; list-style-position: inside; }
details.sub[open] summary, details.tool[open] summary { margin-bottom: 10px; }
details.tool summary small { font-weight: 400; color: var(--muted); margin-left: 4px; }
.type-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.type-presets button { font-size: 11.5px; padding: 6px; }
.type-range-info { display: flex; justify-content: space-between; align-items: center; margin: -4px 0 10px; font-size: 12px; color: var(--muted); }
.layeractions { display: flex; gap: 6px; margin-bottom: 8px; }
.layeractions button { flex: 1; font-size: 12px; }
.layerlist { display: grid; gap: 3px; max-height: 280px; overflow: auto; }
.layer { justify-content: flex-start; min-height: 32px; padding: 5px 8px; font-size: 12.5px; border-color: transparent; background: #faf8f9; }
.layer.selected { background: var(--mulberry-soft); border-color: #d9b9ca; }
.layer .layername { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.palette-items { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.palette-card { flex-direction: column; gap: 5px; padding: 8px; font-size: 11.5px; }
.palette-swatches { display: flex; width: 100%; height: 14px; border-radius: 999px; overflow: hidden; }
.palette-swatches i { flex: 1; }
.suite-tab { min-height: 30px; padding: 5px 10px; font-size: 12px; border-radius: 999px; }
.suite-tab.active { background: var(--mulberry); border-color: var(--mulberry); color: #fff; }
.print-health { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #eee; }
.print-health.print-good { background: #e3f1ea; color: var(--sage); }
.print-health.print-warn { background: #fbf0dc; color: #8a5b12; }
.print-health.print-danger { background: #f7e1e4; color: var(--danger); }
.print-results { display: grid; gap: 4px; margin: 8px 0; }
.preflight-ok, .preflight-item { font-size: 12px; padding: 6px 8px; border-radius: 6px; background: #f6f3f5; }
.preflight-ok { background: #e3f1ea; color: var(--sage); }
.preflight-item.warning { background: #fbf0dc; }
.preflight-item.error { background: #f7e1e4; }

/* ---------- toast and dialog ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: #3b2d38; color: #fff; padding: 11px 16px; border-radius: 10px;
  font-size: 13.5px; z-index: 50; max-width: min(92vw, 480px); box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.modalshade { position: fixed; inset: 0; background: rgba(42,34,48,.4); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal { background: #fff; border-radius: 14px; padding: 20px; width: min(420px, 100%); }
.modalhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.modalhead h2 { font: 600 24px/1.2 var(--display); margin: 0; }
.exportactions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mobilenav { display: none; }

/* ---------- tablet ---------- */
@media (max-width: 1180px) {
  .workspace { grid-template-columns: 260px minmax(0, 1fr) 340px; }
  .docname { display: none; }
}

/* ---------- phone ---------- */
@media (max-width: 760px) {
  :root { --head: 52px; }
  body { overflow: auto; }
  .appbar { padding: 0 10px; gap: 8px; position: sticky; top: 0; }
  .logo { font-size: 19px; }
  .logo b { display: none; }
  .status, .switch { font-size: 11px; }
  .topactions { gap: 2px; }
  .topactions button span[data-i18n] { display: none; }
  .actions-designer { display: none !important; }
  .workspace { display: flex; flex-direction: column; height: auto; }
  .stage { order: -1; }
  .stage { position: sticky; top: var(--head); z-index: 3; height: 46vh; height: 46svh; border-bottom: 1px solid var(--line); }
  .toolbar { display: none !important; }
  .stagefoot { display: none !important; }
  .panel { border: 0 !important; padding: 16px 16px 96px; overflow: visible; }
  body.single-product.mode-client .workspace { display: flex; }
  body .panel.left, body .panel.right { display: none; }
  body[data-mtab="left"] .panel.left { display: block; }
  body[data-mtab="right"] .panel.right,
  body[data-mtab="form"] .panel.right,
  body[data-mtab="export"] .panel.right { display: block; }
  body[data-mtab="form"] .client-export { display: none; }
  body[data-mtab="export"] .client-form { display: none; }
  body[data-mtab="export"] .client-export { margin-top: 0; padding-top: 0; border-top: 0; }
  .ggrid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .step { font-size: 24px; }
  .mobilenav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: rgba(255,255,255,.96); backdrop-filter: blur(8px);
    border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    gap: 6px;
  }
  .mobilenav button { flex: 1; min-height: 44px; font-size: 14px; font-weight: 600; border-color: transparent; background: transparent; }
  .mobilenav button.active { background: var(--mulberry); color: #fff; }
  body.single-product .mobilenav .mt-design { display: none; }
  .toast { bottom: 76px; }
}
@media (max-width: 400px) {
  .ggrid { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

.fieldchecks { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; margin-bottom: 8px; }
.fieldchecks label.check { margin: 0 0 6px; font-size: 12.5px; }

/* warning when the app is opened by double-clicking index.html */
.filebar { background: #fbf0dc; color: #6b4a12; font-size: 13px; padding: 8px 16px; text-align: center; border-bottom: 1px solid #ecd9b0; }
body:has(.filebar) .workspace { height: calc(100dvh - var(--head) - 36px); }
#clientShareNow { min-height: 52px; font-size: 16px; }

/* shop */
.buybox { margin-bottom: 12px; }
.buybtn { min-height: 56px; font-size: 16.5px; }
.purchased { color: var(--sage); font-weight: 600; margin: 0 0 10px; }
.shopcsv { margin-bottom: 12px; }

/* customer text controls */
.moverow { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.moverow .lbl { flex: 1; margin: 0; }
.moverow button { width: 44px; height: 38px; border: 1px solid #ddd3da; background: #fff; border-radius: 10px; font-size: 15px; cursor: pointer; }
.moverow button:hover { border-color: #7a3b5e; }
.swatches input.swatch.pick { padding: 0; width: 36px; height: 36px; border-radius: 50%; overflow: hidden; cursor: pointer; background: conic-gradient(#e33, #ee3, #3c3, #3cc, #33e, #c3c, #e33); }
.swatches input.swatch.pick::-webkit-color-swatch-wrapper { padding: 0; }
.swatches input.swatch.pick::-webkit-color-swatch { border: 0; opacity: 0; }
.startover { margin-top: 12px; background: none; border: 0; color: #7a6570; text-decoration: underline; cursor: pointer; font: inherit; font-size: 13px; padding: 4px 0; }
.paperrow { display: block; margin-top: 10px; }

.selhint { margin: 10px 0 0; font-size: 13px; }
.selbox { margin: 12px 0; padding: 12px 14px; border: 2px solid #7a3b5e; border-radius: 14px; background: #fbf6f9; }
.selbox .selhead { font-size: 13px; margin-bottom: 8px; }
.selbox .selrow { display: flex; align-items: center; gap: 6px; margin: 8px 0; }
.selbox .selrow .lbl { flex: 1; margin: 0; }
.selbox .selgap { flex: 1; }
.selbox .selrow button { min-width: 40px; height: 38px; border: 1px solid #ddd3da; background: #fff; border-radius: 10px; font-size: 15px; cursor: pointer; }
.selbox .selrow button.active { border-color: #7a3b5e; background: #f1e3ea; }
.selbox input[type=color] { width: 40px; height: 38px; padding: 2px; border: 1px solid #ddd3da; border-radius: 10px; background: #fff; }
.selbox select { width: 100%; }
.selbox p.muted { font-size: 12.5px; margin: 6px 0 0; }
.addtext { width: 100%; margin: 10px 0 4px; padding: 10px; border: 1px dashed #b9a5b0; background: #fff; border-radius: 12px; cursor: pointer; font: inherit; color: #5d4353; }
.addtext:hover { border-color: #7a3b5e; }

/* selected text box editor (v8.1) */
.selbox textarea { width: 100%; min-height: 70px; margin: 2px 0 8px; }
.selbox .sellabel { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: #7a6570; margin: 6px 0 2px; }
.selbox .linkbtn { background: none; border: 0; color: #7a3b5e; font: inherit; font-weight: 600; text-transform: none; letter-spacing: 0; cursor: pointer; padding: 0; }
.selbox .selgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; margin-top: 8px; }
.selbox .selgrid .selrow { margin: 2px 0 6px; }
.selbox .selval { min-width: 38px; text-align: center; font-size: 14px; }
.selbox .seg { gap: 0; }
.selbox .seg button { border-radius: 0; margin-left: -1px; flex: 1; }
.selbox .seg button:first-child { border-radius: 10px 0 0 10px; margin-left: 0; }
.selbox .seg button:last-child { border-radius: 0 10px 10px 0; }
.selbox .selactions button { flex: 1; font-size: 13.5px; }
.selbox .selactions #selDelete { color: #a3263c; }
@media (max-width: 420px) { .selbox .selgrid { grid-template-columns: 1fr; } }
.selbox .selgrid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.selbox .selgrid .selrow { gap: 4px; }
.selbox .selgrid .selrow button { min-width: 34px; padding: 0 4px; }
.selbox .selgrid .selrow.seg { gap: 0; }
.selbox .selgrid input[type=color] { width: 36px; flex: none; }
.selbox .selval { min-width: 34px; }
