/* ============================================================
   PerpectHub — Dashboard (app/ + admin/)
   ============================================================ */
:root {
  --gold: #c9a227; --gold-2: #e6c76a;
  --cream: #faf6ef; --cream-2: #f3ecdd;
  --navy: #101a2b; --navy-2: #1d2b45;
  --ink: #23272e; --muted: #6b7280;
  --line: #e8e2d6;
  --radius: 16px;
  --shadow: 0 8px 24px rgba(16, 26, 43, .07);
  --shadow-lg: 0 20px 50px rgba(16, 26, 43, .14);
  --font-head: "Playfair Display", Georgia, serif;
  --font-body: "Poppins", system-ui, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--cream); color: var(--ink); font-size: 15px; line-height: 1.6; }
img { max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--navy); }

/* ---------- Layout ---------- */
.dash { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
@media (max-width: 900px) { .dash { grid-template-columns: 1fr; } }
.sidebar { background: var(--navy); color: #cdd5e1; padding: 26px 18px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
@media (max-width: 900px) { .sidebar { position: relative; height: auto; } }
.side-brand { font-family: var(--font-head); font-weight: 700; font-size: 1.2rem; color: #fff; margin-bottom: 30px; padding-left: 8px; }
.side-brand span { color: var(--gold-2); }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; font-size: .9rem; color: #aab4c4; transition: all .2s; margin-bottom: 4px; }
.side-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.side-nav a.active { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: var(--navy); font-weight: 600; }
.side-foot { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 16px; font-size: .82rem; }
.side-user { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; color: #fff; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--gold), var(--rose, #b76e79)); display: grid; place-items: center; color: #fff; font-weight: 700; font-family: var(--font-head); }
.main { padding: 30px clamp(18px, 4vw, 44px); max-width: 1160px; min-width: 0; overflow-x: hidden; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 14px; margin-bottom: 26px; }
.page-head h1 { font-size: 1.55rem; }
.page-head p { color: var(--muted); font-size: .88rem; }

/* ---------- Cards, stats ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 24px; }
.card h2.card-title { font-size: 1.05rem; margin-bottom: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 16px; margin-bottom: 26px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat b { display: block; font-family: var(--font-head); font-size: 1.7rem; color: var(--navy); }
.stat span { font-size: .8rem; color: var(--muted); }
.stat .up { color: #1d7a3e; font-size: .74rem; font-weight: 600; }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: 12px; border: 1.5px solid transparent; font-size: .87rem; font-weight: 500; cursor: pointer; transition: all .2s; font-family: var(--font-body); }
.btn-primary { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #fff; box-shadow: 0 6px 16px rgba(201, 162, 39, .3); }
.btn-primary:hover { transform: translateY(-1px); }
.btn-outline { border-color: var(--gold); color: #a5831c; background: #fff; }
.btn-outline:hover { background: rgba(201, 162, 39, .08); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-ghost:hover { color: var(--ink); border-color: #c9c3b6; }
.btn-danger { background: #fdecec; color: #b23a3a; border-color: #f3c6c6; }
.btn-danger:hover { background: #b23a3a; color: #fff; }
.btn-sm { padding: 7px 14px; font-size: .8rem; border-radius: 10px; }
.btn-block { width: 100%; }
label { display: block; font-size: .82rem; font-weight: 500; margin-bottom: 12px; color: var(--navy-2); }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="time"],
input[type="url"], input[type="number"], input[type="file"], select, textarea {
  width: 100%; margin-top: 5px; padding: 10px 13px; border-radius: 10px; border: 1.5px solid var(--line);
  font-family: var(--font-body); font-size: .88rem; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); }
fieldset { border: none; margin-bottom: 10px; }
legend { font-family: var(--font-head); font-weight: 600; font-size: 1rem; color: var(--navy); margin-bottom: 12px; padding-top: 6px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.alert { padding: 12px 16px; border-radius: 12px; font-size: .87rem; margin-bottom: 18px; }
.alert-ok { background: #e8f5ec; color: #1d7a3e; border: 1px solid #bfe4cb; }
.alert-err { background: #fdecec; color: #b23a3a; border: 1px solid #f3c6c6; }
.alert-warn { background: #fdf6e3; color: #9a7b16; border: 1px solid #f0e0ac; }
.alert-info { background: #eaf1fb; color: #2b5fa7; border: 1px solid #c6d9f2; }

/* ===================== TAB DEKORASI ===================== */
.deco-current { display: flex; align-items: center; gap: 12px; }
.deco-thumb { height: 64px; width: auto; max-width: 220px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.deco-thumb-bg { height: 64px; width: 96px; background-size: cover; background-position: center; }
.deco-thumb-lg { height: 74px; width: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.deco-thumb-lg img { max-height: 100%; max-width: 88%; object-fit: contain; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .86rem; }
.tbl th { text-align: left; padding: 12px 14px; background: var(--cream-2); color: var(--navy-2); font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.tbl td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl tr:hover td { background: #fdfbf6; }
.tbl .td-actions { white-space: nowrap; text-align: right; }
.badge { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: .72rem; font-weight: 600; }
.badge-ok { background: #e8f5ec; color: #1d7a3e; }
.badge-warn { background: #fdf6e3; color: #9a7b16; }
.badge-err { background: #fdecec; color: #b23a3a; }
.badge-info { background: #e8f0fd; color: #2a5db0; }
.badge-muted { background: #f1efe9; color: #8a8577; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 2px solid var(--line); margin-bottom: 22px; }
.tabs a { padding: 10px 18px; font-size: .88rem; font-weight: 500; color: var(--muted); border-radius: 12px 12px 0 0; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tabs a:hover { color: var(--navy); background: #fdfbf6; }
.tabs a.active { color: #a5831c; border-bottom-color: var(--gold); font-weight: 600; }

/* ---------- Templates picker ---------- */
.tpl-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.tpl-pick { border: 2px solid var(--line); border-radius: 14px; overflow: hidden; cursor: pointer; transition: all .2s; background: #fff; position: relative; }
.tpl-pick:hover { border-color: #d8cfae; }
.tpl-pick.selected { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, .18); }
.tpl-pick .tp-thumb { height: 170px; display: flex; align-items: flex-end; padding: 12px; color: #fff; }
.tpl-pick .tp-thumb b { font-family: var(--font-script); font-weight: 400; font-size: 1.35rem; text-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.tpl-pick .tp-name { padding: 10px 12px; font-size: .8rem; font-weight: 600; color: var(--navy); }
.tpl-pick .tp-lock { position: absolute; top: 8px; right: 8px; background: rgba(16, 26, 43, .78); color: #ffd76a; font-size: .68rem; padding: 3px 9px; border-radius: 999px; }
.tpl-pick.locked { opacity: .62; }

/* ---------- Guests ---------- */
.invite-code-box { background: var(--cream-2); border: 1px dashed #d8cfae; border-radius: 12px; padding: 16px; font-size: .84rem; }
.qr-thumb { width: 44px; height: 44px; border-radius: 8px; background: #fff; border: 1px solid var(--line); }
.copyable { cursor: pointer; }
.copyable:hover { color: var(--gold); }

/* ---------- Uploads ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.photo-item { position: relative; border-radius: 12px; overflow: hidden; aspect-ratio: 1; border: 1px solid var(--line); }
.photo-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-item .ph-del { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: none; background: rgba(178, 58, 58, .9); color: #fff; cursor: pointer; font-size: .8rem; display: grid; place-items: center; }
.photo-item .ph-cap { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(16, 26, 43, .72); color: #fff; font-size: .68rem; padding: 4px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dropzone { border: 2px dashed #d8cfae; border-radius: 14px; padding: 30px; text-align: center; color: var(--muted); font-size: .86rem; cursor: pointer; transition: all .2s; background: #fffdf8; }
.dropzone:hover, .dropzone.drag { border-color: var(--gold); background: #fdf8ec; }

/* ---------- Billing ---------- */
.tier-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 26px; }
@media (max-width: 760px) { .tier-cards { grid-template-columns: 1fr; } }
.tier-card { border: 1.5px solid var(--line); border-radius: var(--radius); padding: 22px; background: #fff; position: relative; }
.tier-card.current { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, .15); }
.tier-card h3 { font-size: 1rem; }
.tier-card .tp-price { font-family: var(--font-head); font-size: 1.5rem; color: var(--navy); margin: 6px 0 14px; }
.tier-card ul { list-style: none; font-size: .8rem; color: var(--muted); }
.tier-card li { padding: 3px 0 3px 20px; position: relative; }
.tier-card li::before { content: "✓"; position: absolute; left: 0; color: var(--gold); }
.pay-panel { margin-top: 8px; }

/* ---------- Modal & misc ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(16, 26, 43, .55); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal { background: #fff; border-radius: 20px; padding: 30px; width: min(480px, 100%); box-shadow: var(--shadow-lg); max-height: 90vh; overflow: auto; }
.modal h3 { margin-bottom: 14px; }
.hidden { display: none !important; }
.right { text-align: right; }
.mt { margin-top: 18px; }
.mb { margin-bottom: 18px; }
.owner-ribbon { position: fixed; top: 12px; right: 12px; z-index: 200; background: var(--navy); color: var(--gold-2); font-size: .72rem; padding: 7px 14px; border-radius: 999px; box-shadow: var(--shadow); }
.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-state .es-ico { font-size: 2.6rem; margin-bottom: 10px; }

/* ============================================================
   Dashboard redesign — hero, kartu undangan, kategori, upgrade
   ============================================================ */
.hero-dash {
  display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: stretch;
  background: linear-gradient(135deg, var(--navy) 0%, #1d2b45 100%);
  border-radius: 22px; padding: 30px 32px; margin-bottom: 26px;
  color: #f3ecdd; box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.hero-dash::after { content: ""; position: absolute; right: -70px; top: -70px; width: 240px; height: 240px;
  border-radius: 50%; border: 1.5px solid rgba(230, 199, 106, .25); }
.hero-dash::before { content: ""; position: absolute; right: -30px; top: -30px; width: 160px; height: 160px;
  border-radius: 50%; border: 1.5px solid rgba(230, 199, 106, .18); }
.hd-hi { font-size: .84rem; opacity: .8; margin-bottom: 4px; }
.hd-left h1 { color: #fff; font-size: 1.9rem; margin-bottom: 4px; }
.hd-sub { opacity: .75; font-size: .9rem; margin-bottom: 20px; }
.hd-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hd-tier { background: rgba(255, 255, 255, .07); border: 1px solid rgba(230, 199, 106, .3);
  border-radius: 16px; padding: 18px; backdrop-filter: blur(4px); display: flex; flex-direction: column; gap: 10px; }
.hd-tier-head { display: flex; gap: 10px; align-items: center; color: #fff; }
.hd-tier-head small { display: block; opacity: .7; font-size: .74rem; }
.tier-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.tier-dot.t1 { background: #9aa4b5; } .tier-dot.t2 { background: #e6c76a; } .tier-dot.t3 { background: #7fd1c0; }
.hd-tier-note { font-size: .78rem; opacity: .8; flex: 1; }
.btn-gold { background: linear-gradient(135deg, #c9a227, #e6c76a); color: #101a2b; border: none; font-weight: 600; }

@media (max-width: 760px) {
  .hero-dash { grid-template-columns: 1fr; padding: 24px 20px; }
  .hd-left h1 { font-size: 1.5rem; }
}

/* stat icons */
.stat { position: relative; }
.stat-ico { position: absolute; top: 18px; right: 18px; font-size: 1.3rem; opacity: .85; }

/* section head */
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 8px 0 16px; }
.section-head h2 { font-size: 1.2rem; }

/* invitation cards */
.inv-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); gap: 18px; }
.inv-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  box-shadow: var(--shadow); transition: transform .25s, box-shadow .25s; }
.inv-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.ic-cover { height: 130px; position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 14px 16px; color: #fff; }
.ic-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 20%, rgba(0,0,0,.4)); }
.ic-cat { position: absolute; top: 12px; left: 12px; z-index: 1; background: rgba(255,255,255,.92); color: var(--navy);
  font-size: .66rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; }
.ic-names { position: relative; z-index: 1; font-family: var(--font-head); font-size: 1.35rem; text-shadow: 0 2px 8px rgba(0,0,0,.4); }
.ic-date { position: relative; z-index: 1; font-size: .74rem; opacity: .95; }
.ic-body { padding: 14px 16px 16px; }
.ic-title-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.ic-title-row b { font-size: .95rem; color: var(--navy); }
.ic-slug { font-size: .76rem; color: var(--muted); margin-bottom: 10px; word-break: break-all; }
.ic-stats { display: flex; gap: 14px; font-size: .76rem; color: var(--muted); padding: 8px 0 12px; border-top: 1px dashed var(--line); }
.ic-actions { display: flex; gap: 8px; }

/* category picker */
.lbl-block { font-weight: 600; margin-bottom: 10px; color: var(--navy); }
.cat-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 10px; }
.cat-opt { position: relative; border: 2px solid var(--line); border-radius: 14px; padding: 14px 10px;
  text-align: center; cursor: pointer; transition: all .2s; background: #fff; margin: 0; }
.cat-opt input { position: absolute; opacity: 0; pointer-events: none; }
.cat-opt .co-ico { font-size: 1.5rem; display: block; margin-bottom: 4px; }
.cat-opt b { display: block; font-size: .84rem; color: var(--navy); }
.cat-opt small { display: block; font-size: .68rem; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.cat-opt:hover { border-color: #d8cfae; }
.cat-opt.selected { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, .16); background: #fffdf6; }

/* tier cards (billing) */
.tier-card.featured { border-color: var(--gold); box-shadow: 0 18px 44px rgba(201, 162, 39, .16); position: relative; }
.tier-pop { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--gold); color: #fff;
  font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 5px 16px; border-radius: 999px; white-space: nowrap; }
.tier-card .tp-price small { display: block; font-size: .74rem; color: var(--muted); font-family: var(--font-body); font-weight: 400; }

/* payment steps */
.pay-steps { display: grid; gap: 18px; }
.pay-step { display: flex; gap: 14px; }
.ps-num { flex: 0 0 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #fff; display: grid; place-items: center; font-weight: 700; font-family: var(--font-head); }
.pay-accounts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
@media (max-width: 560px) { .pay-accounts { grid-template-columns: 1fr; } }
.pay-acc { border: 1.5px dashed #d8cfae; border-radius: 12px; padding: 12px 14px; cursor: pointer; background: #fffdf8;
  display: grid; gap: 2px; position: relative; }
.pay-acc:hover { border-color: var(--gold); }
.pa-bank { font-size: .72rem; color: var(--muted); font-weight: 600; }
.pay-acc b { font-size: 1.05rem; color: var(--navy); font-family: var(--font-head); letter-spacing: .03em; }
.pay-acc small { font-size: .72rem; color: var(--muted); }
.pa-copy { position: absolute; top: 10px; right: 12px; font-size: .68rem; color: #a5831c; }

/* quota bars */
.qrow { margin-bottom: 14px; }
.q-label { display: flex; justify-content: space-between; font-size: .84rem; margin-bottom: 6px; }
.q-label b { color: var(--navy); }
.qbar { height: 8px; background: var(--cream-2); border-radius: 999px; overflow: hidden; }
.qbar i { display: block; height: 100%; border-radius: 999px; transition: width .4s ease; }

/* sidebar tier chip */
.tier-chip-link { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px;
  border-radius: 10px; background: rgba(255,255,255,.06); margin-top: 12px; }
.tier-chip-link:hover { background: rgba(255,255,255,.12); }
.tier-chip { font-size: .74rem; font-weight: 600; }
.tier-chip.t1 { color: #9aa4b5; } .tier-chip.t2 { color: #e6c76a; } .tier-chip.t3 { color: #7fd1c0; }
.tier-chip-link small { color: #e6c76a; font-size: .7rem; }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ============================================================
   Live Preview Panel (WYSIWYG)
   ============================================================ */
.pv-toggle {
  position: fixed; bottom: 18px; right: 18px; z-index: 90;
  padding: 12px 22px; border-radius: 999px; border: none; cursor: pointer;
  background: linear-gradient(135deg, #c9a227, #e6c76a); color: #101a2b;
  font-family: var(--font-body); font-weight: 600; font-size: .88rem;
  box-shadow: 0 10px 26px rgba(201, 162, 39, .4); transition: transform .2s;
}
.pv-toggle:hover { transform: translateY(-2px); }
.pv-panel {
  position: fixed; bottom: 0; right: 0; z-index: 89;
  width: min(430px, 100vw); height: min(78vh, 780px);
  background: #fff; border: 1px solid var(--line); border-right: 0; border-bottom: 0;
  border-radius: 22px 0 0 0; box-shadow: -18px -8px 50px rgba(16, 26, 43, .22);
  display: flex; flex-direction: column;
  transform: translateX(105%); transition: transform .38s cubic-bezier(.22, .8, .3, 1);
}
.pv-panel.pv-open { transform: translateX(0); }
.pv-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--line); background: var(--cream-2);
  border-radius: 22px 0 0 0; font-size: .88rem; color: var(--navy);
}
.pv-status { font-size: .74rem; padding: 3px 10px; border-radius: 999px; background: #f1efe9; }
.pv-status.pv-ok { background: #e8f5ec; color: #1d7a3e; }
.pv-status.pv-wait { background: #fdf6e3; color: #9a7b16; }
.pv-status.pv-err { background: #fdecec; color: #b23a3a; }
.pv-panel iframe { flex: 1; width: 100%; border: 0; background: #faf6ef; border-radius: 0 0 0 22px; }
@media (max-width: 640px) {
  .pv-panel { width: 100vw; height: 82vh; border-radius: 0; }
  .pv-head { border-radius: 0; }
  .pv-panel iframe { border-radius: 0; }
  .pv-toggle { bottom: 12px; right: 12px; }
}
