*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --gold: #b98a3b; --gold-l: #e5d5a3; --gold-ll: #f6f4f0;
  --green-l: #E1F5EE; --green: #0F6E56;
  --red-l: #FCEBEB; --red: #A32D2D; --red-b: #F09595;
  --r: 8px; --rl: 12px;
  --topbar-h: 52px;
  --canvas-h: 520px;
  --bottom-h: 300px;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f6f4f0;
  color: #1a1a1a;
  font-size: 14px;
}

/* TOPBAR */
#topbar {
  background: #fff;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
#topbar h1 { font-size: 14px; font-weight: 700; white-space: nowrap; margin-right: 4px; }
.btn {
  padding: 6px 13px; font-size: 12px; border-radius: 20px; cursor: pointer;
  border: 1px solid rgba(0,0,0,0.2); background: #fff; color: #1a1a1a;
  font-family: inherit; white-space: nowrap; flex-shrink: 0; line-height: 1.4;
}
.btn:hover { background: #f0ede8; }
.btn.pri { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.pri:hover { background: #8a6520; }
#stats { font-size: 12px; color: #888; margin-left: auto; white-space: nowrap; flex-shrink: 0; }

/* DESKTOP LAYOUT */
#desktop { display: block; }
#canvas-wrap {
  height: var(--canvas-h);
  min-height: 160px;
  background: #f6f4f0;
  overflow: auto;
  position: relative;
}
#canvas-inner { position: relative; width: 3200px; height: 100%; }
#canvas-resizer {
  height: 8px;
  background: rgba(0,0,0,0.06);
  border-top: 1px solid rgba(0,0,0,0.1);
  border-bottom: 1px solid rgba(0,0,0,0.1);
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  user-select: none;
}
#canvas-resizer:hover { background: rgba(156,107,46,0.12); }
#canvas-resizer::after { content: ''; display: block; width: 32px; height: 3px; border-radius: 2px; background: rgba(0,0,0,0.2); }

.tbl-wrap { position: absolute; display: flex; flex-direction: column; align-items: center; user-select: none; }
.tbl-label { display: none; }
.tbl-count { display: none; }

#bottom {
  min-height: var(--bottom-h);
  display: grid;
  grid-template-columns: 220px 1fr 240px;
  border-top: 1px solid rgba(0,0,0,0.08);
  align-items: start;
}
.col { display: flex; flex-direction: column; border-right: 1px solid rgba(0,0,0,0.08); }
.col:last-child { border-right: none; }
.col-hdr { padding: 10px 14px; border-bottom: 1px solid rgba(0,0,0,0.08); background: #fff; flex-shrink: 0; }
.col-hdr h2 { font-size: 11px; font-weight: 700; color: #999; text-transform: uppercase; letter-spacing: 0.07em; margin: 0; }
.col-body { padding: 10px; display: flex; flex-direction: column; gap: 5px; background: #faf9f7; }

#gsearch {
  width: 100%; padding: 6px 9px; font-size: 12px; border-radius: var(--r);
  border: 1px solid rgba(0,0,0,0.15); background: #f5f4f1; color: #1a1a1a;
  font-family: inherit; margin-top: 6px; display: block;
}
.gcard { background: #fff; border: 1px solid rgba(0,0,0,0.08); border-radius: var(--r); padding: 7px 9px; cursor: grab; user-select: none; }
.gcard:hover { border-color: rgba(0,0,0,0.2); }
.gcard.dragging { opacity: 0.3; }
.gcard-name { font-size: 12px; font-weight: 600; margin-bottom: 3px; }
.tags { display: flex; gap: 3px; flex-wrap: wrap; }
.tag { font-size: 9px; padding: 2px 5px; border-radius: 10px; background: #f0e6d3; color: #8a6520; font-weight: 600; }

.fld { margin-bottom: 8px; }
.fld label { font-size: 10px; color: #aaa; display: block; margin-bottom: 2px; }
.fld input, .fld select {
  width: 100%; padding: 5px 8px; font-size: 12px; border-radius: var(--r);
  border: 1px solid rgba(0,0,0,0.15); background: #f5f4f1; color: #1a1a1a; font-family: inherit;
}
.delbtn {
  width: 100%; margin-top: 6px; padding: 5px; font-size: 11px; border-radius: var(--r);
  cursor: pointer; border: 1px solid var(--red-b); background: transparent; color: var(--red); font-family: inherit;
}
.delbtn:hover { background: var(--red-l); }
#upload-zone {
  border: 1.5px dashed rgba(0,0,0,0.2); border-radius: var(--r); padding: 10px;
  text-align: center; font-size: 11px; color: #888; cursor: pointer; line-height: 1.6; margin-top: 4px;
}
#upload-zone:hover { border-color: var(--gold); background: var(--gold-l); }

.sl-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 8px; border-radius: var(--r); font-size: 11px; background: #fff; margin-bottom: 3px; }
.sl-row.filled { background: var(--gold-l); color: var(--gold); }
.rmbtn { font-size: 10px; color: var(--red); cursor: pointer; border: none; background: none; font-family: inherit; flex-shrink: 0; }

/* Add guest form */
#add-guest-form {
  padding: 10px;
  border-top: 1px solid rgba(0,0,0,0.08);
  background: #faf9f7;
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}
#add-guest-form input {
  width: 100%; padding: 6px 9px; font-size: 12px; border-radius: var(--r);
  border: 1px solid rgba(0,0,0,0.15); background: #fff; color: #1a1a1a; font-family: inherit;
}
#ag-save {
  width: 100%; padding: 7px; font-size: 12px; border-radius: var(--r);
  cursor: pointer; background: var(--gold); border: none; color: #fff;
  font-family: inherit; font-weight: 600; margin-top: 2px;
}
#ag-save:hover { background: #8a6520; }

/* MOBILE */
#mobile { display: none; }
#mob-tabs { display: flex; border-bottom: 1px solid rgba(0,0,0,0.08); background: #fff; }
.mob-tab {
  flex: 1; padding: 11px 8px; font-size: 13px; text-align: center; cursor: pointer;
  color: #888; border-bottom: 2px solid transparent; font-family: inherit;
  background: none; border-top: none; border-left: none; border-right: none;
}
.mob-tab.active { color: var(--gold); border-bottom-color: var(--gold); font-weight: 700; }
#mob-content { overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; height: calc(100vh - var(--topbar-h) - 46px); }

.mob-tcard { background: #fff; border: 1px solid rgba(0,0,0,0.08); border-radius: var(--rl); overflow: hidden; }
.mob-thdr { padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.mob-thdr:hover { background: #f5f4f1; }
.mob-ttitle { font-size: 14px; font-weight: 700; }
.mob-tmeta { font-size: 12px; color: #aaa; margin-top: 1px; }
.mob-tbody { border-top: 1px solid rgba(0,0,0,0.08); padding: 10px 14px; display: none; flex-direction: column; gap: 4px; }
.mob-tbody.open { display: flex; }
.mob-srow { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: var(--r); font-size: 13px; background: #f5f4f1; }
.mob-srow.filled { background: var(--gold-l); color: var(--gold); }
.mob-sbtn { font-size: 11px; padding: 3px 9px; border-radius: var(--r); cursor: pointer; border: 1px solid rgba(0,0,0,0.15); background: #fff; color: #1a1a1a; font-family: inherit; }
.mob-sbtn.danger { color: var(--red); border-color: var(--red-b); }
.mob-gcard { background: #fff; border: 1px solid rgba(0,0,0,0.08); border-radius: var(--rl); padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.mob-gname { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.mob-placebtn { padding: 7px 14px; font-size: 12px; border-radius: var(--r); cursor: pointer; background: var(--gold); border: none; color: #fff; font-family: inherit; white-space: nowrap; flex-shrink: 0; }

/* MODAL */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,0.35); display: flex; align-items: center; justify-content: center; z-index: 9999; }
.modal { background: #fff; border-radius: var(--rl); padding: 22px; width: min(340px, 92vw); border: 1px solid rgba(0,0,0,0.15); box-shadow: 0 8px 32px rgba(0,0,0,0.15); }
.modal h3 { font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.mfld { margin-bottom: 10px; }
.mfld label { font-size: 12px; color: #888; display: block; margin-bottom: 3px; }
.mfld input, .mfld select { width: 100%; padding: 7px 10px; font-size: 13px; border-radius: var(--r); border: 1px solid rgba(0,0,0,0.15); background: #f5f4f1; color: #1a1a1a; font-family: inherit; }
.mbtns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.mbtns button { padding: 7px 16px; font-size: 13px; border-radius: var(--r); cursor: pointer; border: 1px solid rgba(0,0,0,0.15); background: #f5f4f1; color: #1a1a1a; font-family: inherit; }
.mbtns button.ok { background: var(--gold); border-color: var(--gold); color: #fff; }
.mbtns button.danger { background: var(--red); border-color: var(--red); color: #fff; }

/* Range slider */
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 2px; background: #e0d9cf; outline: none; margin: 6px 0; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--gold); cursor: pointer; border: none; }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--gold); cursor: pointer; border: none; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: #e0d9cf; }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: #e0d9cf; }

@media (max-width: 600px) {
  #desktop { display: none; }
  #mobile { display: block; }
  #topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; }
}

