body { background: #F5F5F7; color: #1D1D1F; font-size: 15px; }
[hidden] { display: none !important; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(245, 245, 247, .78);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.topbar-inner { max-width: 1040px; margin: 0 auto; height: 56px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; }
.brand { font-size: 24px; text-decoration: none; }
.topbar-user { display: flex; align-items: center; gap: 14px; font-size: 14px; color: #6E6E73; min-width: 0; }
.topbar-inner { gap: 16px; }
#userName { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
@media (max-width: 480px) {
  .topbar .brand { font-size: 20px; flex-shrink: 0; }
  .topbar-user { gap: 10px; font-size: 13px; }
  #userName { max-width: 72px; }
  .topbar .btn-sm { padding: 0 12px; min-height: 34px; }
}
.btn-ghost { border-color: rgba(0,0,0,.12); color: #1D1D1F; }
.btn-primary { background: #1D1D1F; color: #fff; }
.btn-danger { background: transparent; color: #D70015; border-color: rgba(215,0,21,.3); }
.btn-danger:hover { background: rgba(215,0,21,.06); }
.btn:disabled { opacity: .35; cursor: default; }
.btn-link { background: none; border: 0; padding: 0; color: #0066CC; cursor: pointer; font-size: 14px; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: #D70015; }

.view { max-width: 1040px; margin: 0 auto; padding: 40px 20px 120px; }

/* ---------- Auth ---------- */
.auth { max-width: 400px; margin: 40px auto 0; text-align: center; }
.auth h1 { font-size: 34px; letter-spacing: -0.03em; margin: 0 0 8px; font-weight: 600; }
.auth > p { color: #6E6E73; margin: 0 0 30px; }
.auth .panel { text-align: left; }
.auth .switch { margin-top: 20px; font-size: 14px; color: #6E6E73; }

.forgot-link { text-align: center; margin: 16px 0 0; font-size: 14px; }
.forgot-link a, .auth .switch a { color: #0066CC; }
.user-link { color: #1D1D1F; text-decoration: none; }
.user-link:hover { text-decoration: underline; }
.notice { background: #FFF8E6; border-bottom: 1px solid #F5E3B3; font-size: 14px; color: #6B4E00; }
.notice-inner { max-width: 1040px; margin: 0 auto; padding: 10px 20px; display: flex; gap: 12px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.panel.narrow { max-width: 520px; }

/* ---------- Panel & form ---------- */
.panel { background: #fff; border-radius: 20px; padding: 26px; border: 1px solid rgba(0,0,0,.04); }
.panel + .panel { margin-top: 18px; }
.panel h2 { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 4px; }
.panel .hint { color: #6E6E73; font-size: 13px; margin: 0 0 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > span { font-size: 13px; font-weight: 500; color: #6E6E73; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid rgba(0,0,0,.12);
  background: #FBFBFD; outline: none; font-size: 15px; resize: vertical;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: #0071E3; box-shadow: 0 0 0 4px rgba(0,113,227,.15); background: #fff; }
.prefix { display: flex; align-items: stretch; }
.prefix span { display: flex; align-items: center; padding: 0 12px; border: 1px solid rgba(0,0,0,.12); border-right: 0; border-radius: 12px 0 0 12px; background: #F5F5F7; color: #6E6E73; font-size: 14px; white-space: nowrap; }
.prefix input { border-radius: 0 12px 12px 0 !important; }
.error { color: #D70015; font-size: 14px; margin: 0 0 14px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.full { width: 100%; }

/* ---------- Daftar undangan ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head h1 { font-size: 34px; letter-spacing: -0.03em; margin: 0; font-weight: 600; }
.page-head p { margin: 4px 0 0; color: #6E6E73; }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.inv-card { background: #fff; border-radius: 22px; overflow: hidden; border: 1px solid rgba(0,0,0,.04); display: flex; flex-direction: column; transition: transform .4s var(--ease), box-shadow .4s var(--ease); }
.inv-card:hover { transform: translateY(-3px); box-shadow: 0 20px 40px -20px rgba(0,0,0,.2); }
.inv-cover {
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  height: 130px; display: grid; place-items: center; background: var(--bg); color: var(--text);
  background-image: radial-gradient(120% 90% at 50% 0%, var(--accent-soft), transparent 70%);
  font-family: var(--serif); font-size: 30px; text-align: center; padding: 0 16px;
}
.inv-body { padding: 20px 22px 22px; display: grid; gap: 14px; flex: 1; }
.inv-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.inv-url { font-size: 13px; color: #6E6E73; word-break: break-all; }
.badge { font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 99px; background: #F5F5F7; color: #6E6E73; white-space: nowrap; }
.badge.live { background: #E3F9E8; color: #1A7F37; }
.stats { display: flex; gap: 18px; font-size: 13px; color: #6E6E73; }
.stats strong { display: block; font-size: 20px; color: #1D1D1F; font-weight: 600; letter-spacing: -0.02em; }
.inv-actions { display: flex; gap: 8px; margin-top: auto; }
.inv-actions .btn { flex: 1; }
.empty { text-align: center; padding: 70px 20px; background: #fff; border-radius: 22px; color: #6E6E73; }
.empty h2 { color: #1D1D1F; margin: 0 0 6px; font-size: 22px; }
.empty p { margin: 0 0 22px; }
.owner { font-size: 12px; color: #86868B; }

/* ---------- Editor ---------- */
.editor-head { position: sticky; top: 56px; z-index: 30; background: rgba(245,245,247,.86); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); margin: -40px -20px 26px; padding: 18px 20px 14px; }
.editor-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.editor-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.editor-title a { color: #0066CC; text-decoration: none; font-size: 14px; white-space: nowrap; }
.editor-title h1 { font-size: 22px; margin: 0; letter-spacing: -0.02em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editor-btns { display: flex; gap: 8px; align-items: center; }
.save-state { font-size: 13px; color: #86868B; margin-right: 4px; }
.tabs { display: inline-flex; gap: 2px; margin-top: 14px; padding: 3px; background: rgba(0,0,0,.06); border-radius: 12px; overflow-x: auto; max-width: 100%; }
.tabs button { border: 0; background: transparent; padding: 7px 16px; border-radius: 9px; font-size: 14px; font-weight: 500; color: #424245; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: #fff; color: #1D1D1F; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.item { border: 1px solid rgba(0,0,0,.08); border-radius: 16px; padding: 18px; margin-bottom: 12px; position: relative; }
.item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 13px; font-weight: 600; color: #6E6E73; }
.add-btn { width: 100%; border: 1.5px dashed rgba(0,0,0,.16); background: transparent; border-radius: 14px; padding: 12px; font-size: 14px; font-weight: 500; color: #424245; cursor: pointer; }
.add-btn:hover { border-color: #1D1D1F; }

.upload { display: flex; align-items: center; gap: 16px; }
.upload .thumb { width: 72px; height: 72px; border-radius: 14px; background: #F5F5F7 center / cover no-repeat; flex-shrink: 0; border: 1px solid rgba(0,0,0,.06); display: grid; place-items: center; color: #86868B; font-size: 12px; }
.upload .thumb.wide { width: 128px; }
.upload-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.gallery-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-bottom: 14px; }
.gallery-edit figure { margin: 0; aspect-ratio: 1; border-radius: 14px; background: #F5F5F7 center / cover no-repeat; position: relative; }
.gallery-edit button { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 15px; line-height: 1; }

/* Tema */
.theme-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.theme-pick button {
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  border: 2px solid transparent; border-radius: 18px; padding: 0; overflow: hidden; cursor: pointer; background: #fff; text-align: left;
  box-shadow: 0 0 0 1px rgba(0,0,0,.08); transition: transform .3s var(--ease);
}
.theme-pick button:hover { transform: translateY(-2px); }
.theme-pick button[aria-pressed="true"] { border-color: #0071E3; box-shadow: none; }
.theme-pick .sw { height: 100px; display: grid; place-items: center; background: var(--bg); color: var(--text); font-family: var(--serif); font-size: 24px; background-image: radial-gradient(120% 90% at 50% 0%, var(--accent-soft), transparent 70%); }
.theme-pick .sw i { color: var(--accent); font-size: .7em; padding: 0 4px; }
.theme-pick .nm { display: block; padding: 10px 12px; font-size: 14px; font-weight: 500; }

/* Gaya tata letak */
.layout-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.layout-pick button { border: 2px solid transparent; border-radius: 18px; padding: 0 0 12px; overflow: hidden; cursor: pointer; background: #fff; text-align: left; box-shadow: 0 0 0 1px rgba(0,0,0,.08); transition: transform .3s var(--ease); }
.layout-pick button:hover { transform: translateY(-2px); }
.layout-pick button[aria-pressed="true"] { border-color: #0071E3; box-shadow: none; }
.layout-pick .nm { display: block; padding: 10px 12px 0; font-size: 14px; font-weight: 600; }
.layout-pick .ds { display: block; padding: 2px 12px 0; font-size: 12px; color: #6E6E73; }
.lay-thumb {
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  height: 150px; background: var(--bg); color: var(--text); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background-image: radial-gradient(120% 90% at 50% 0%, var(--accent-soft), transparent 70%); position: relative; padding: 14px;
}
.lay-thumb .orn { width: 70%; height: auto; color: var(--accent); }
.lay-names { font-family: var(--serif); font-size: 30px; line-height: 1; }
.lay-names i { color: var(--accent); font-size: .6em; padding: 0 4px; }
.L-editorial { align-items: flex-start; justify-content: flex-end; }
.L-editorial .lay-names { font-family: var(--sans); font-weight: 600; letter-spacing: -0.05em; font-size: 38px; border-bottom: 1px solid currentColor; padding-bottom: 8px; }
.L-editorial .lay-names i { font-family: var(--serif); font-weight: 400; }
.L-botanica .lay-names { font-style: italic; }
.L-nusantara { box-shadow: inset 0 0 0 6px var(--bg), inset 0 0 0 7px var(--accent); }
.L-nusantara .lay-names { text-transform: uppercase; letter-spacing: .06em; font-size: 24px; }
.seg-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-pick button { border: 1px solid rgba(0,0,0,.12); background: #FBFBFD; border-radius: 99px; padding: 8px 16px; font-size: 14px; cursor: pointer; }
.seg-pick button[aria-pressed="true"] { background: #1D1D1F; color: #fff; border-color: #1D1D1F; }

/* Admin */
.admin-link { font-weight: 600; }
.admin-tabs { margin: 0 0 22px; }
.tile small { display: block; margin-top: 2px; font-size: 12px; color: #86868B; }
.tile span + strong { margin-top: 4px; font-size: clamp(18px, 4.6vw, 24px); }
.tile { min-width: 0; overflow-wrap: anywhere; }
.tiles .tile strong { font-variant-numeric: tabular-nums; }
.badge.warn, .warn-text { color: #B25000; }
.badge.warn { background: #FFF1E0; }
.warn-panel { background: #FFF8E6; border: 1px solid #F5E3B3; color: #6B4E00; margin-bottom: 18px; }
.muted-cell { color: #86868B; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.table small { color: #86868B; }
.prefix-row { display: flex; gap: 8px; }
.prefix-row .select { flex: 0 0 72px; }
.checks { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; }
.checks label { display: flex; gap: 6px; align-items: center; }
.promo-row { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 4px 0 8px; font-size: 14px; flex-wrap: wrap; }
.promo-row input { padding: 9px 14px; border-radius: 12px; border: 1px solid rgba(0,0,0,.12); background: #FBFBFD; text-transform: uppercase; width: 220px; }

/* Grafik pendapatan */
.chart { position: relative; }
.chart svg { width: 100%; height: auto; max-width: 100%; display: block; overflow: visible; }
.chart .grid { stroke: rgba(0,0,0,.06); stroke-width: 1; }
.chart .base { stroke: rgba(0,0,0,.18); stroke-width: 1; }
.chart .ax { font-size: 11px; fill: #86868B; font-variant-numeric: tabular-nums; }
.chart .mark { fill: #B7791F; transition: opacity .15s; }
.chart .hit { fill: transparent; }
.chart:hover .bar .mark { opacity: .55; }
.chart .bar.on .mark, .chart .bar:focus .mark { opacity: 1; }
.chart .bar:focus { outline: none; }
.chart .bar:focus .hit { stroke: #0071E3; stroke-width: 1.5; }
.chart .tip { position: absolute; top: -6px; width: 170px; background: #1D1D1F; color: #fff; font-size: 12px; line-height: 1.45; padding: 8px 10px; border-radius: 10px; pointer-events: none; box-shadow: 0 8px 20px -8px rgba(0,0,0,.4); }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: #86868B; font-size: 14px; pointer-events: none; }

/* Pratinjau langsung */
.editor-grid.with-preview { display: grid; grid-template-columns: minmax(0, 1fr) 344px; gap: 28px; align-items: start; }
.editor-main { min-width: 0; }
.pv { --pvh: min(680px, calc(100vh - 230px)); position: sticky; top: 176px; }
.pv-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.pv-seg { display: inline-flex; padding: 3px; background: rgba(0,0,0,.06); border-radius: 10px; }
.pv-seg button { border: 0; background: transparent; padding: 5px 14px; border-radius: 8px; font-size: 13px; font-weight: 500; color: #424245; cursor: pointer; }
.pv-seg button[aria-pressed="true"] { background: #fff; color: #1D1D1F; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.pv-live { font-size: 12px; color: #86868B; display: flex; align-items: center; gap: 6px; }
.pv-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #34C759; }
.pv-phone { width: 344px; padding: 10px; border-radius: 46px; background: #1D1D1F; box-shadow: 0 0 0 1px rgba(0,0,0,.2), 0 30px 60px -30px rgba(0,0,0,.5); }
.pv-screen { width: 324px; height: var(--pvh); border-radius: 36px; overflow: hidden; background: #fff; }
.pv-screen iframe { width: 390px; height: calc(var(--pvh) / 0.8308); border: 0; display: block; transform: scale(0.8308); transform-origin: 0 0; }
.pv-close, .pv-fab { display: none; }

@media (max-width: 1099px) {
  .editor-grid.with-preview { display: block; }
  .pv { display: none; }
  .pv.open { display: flex; flex-direction: column; position: fixed; inset: 0; z-index: 90; background: #F5F5F7; padding: 12px 12px max(12px, env(safe-area-inset-bottom)); }
  .pv.open .pv-close { display: inline-flex; }
  .pv.open .pv-live { display: none; }
  .pv.open .pv-phone { flex: 1; width: 100%; padding: 0; background: none; box-shadow: none; border-radius: 0; display: flex; }
  .pv.open .pv-screen { width: 100%; height: auto; flex: 1; border-radius: 18px; box-shadow: 0 0 0 1px rgba(0,0,0,.08); }
  .pv.open .pv-screen iframe { width: 100%; height: 100%; transform: none; }
  .pv-fab { display: inline-flex; position: fixed; right: 18px; bottom: max(18px, env(safe-area-inset-bottom)); z-index: 45; box-shadow: 0 12px 30px -10px rgba(0,0,0,.45); }
}

/* Tabel */
.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar input { flex: 1 1 200px; padding: 10px 14px; border-radius: 12px; border: 1px solid rgba(0,0,0,.12); background: #FBFBFD; outline: none; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: #86868B; text-transform: uppercase; letter-spacing: .06em; padding: 0 10px 10px; }
.table td { padding: 12px 10px; border-top: 1px solid rgba(0,0,0,.06); vertical-align: top; }
.table .acts { white-space: nowrap; text-align: right; }
.table .acts > * + * { margin-left: 14px; }
.table tr.muted td { opacity: .45; }
.table .msg { color: #6E6E73; max-width: 360px; }
.sent { color: #1A7F37; font-size: 12px; }
.table-wrap { overflow-x: auto; }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.tile { background: #fff; border-radius: 18px; padding: 18px 20px; }
.tile strong { display: block; font-size: 30px; font-weight: 600; letter-spacing: -0.03em; }
.tile span { font-size: 13px; color: #6E6E73; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.toggle { position: relative; width: 51px; height: 31px; flex-shrink: 0; }
.toggle input { position: absolute; opacity: 0; inset: 0; cursor: pointer; z-index: 1; margin: 0; }
.toggle span { position: absolute; inset: 0; border-radius: 99px; background: #E9E9EB; transition: background .25s; }
.toggle span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .25s var(--ease); }
.toggle input:checked + span { background: #34C759; }
.toggle input:checked + span::after { transform: translateX(20px); }
.toggle input:focus-visible + span { outline: 2px solid #0071E3; outline-offset: 2px; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.32); display: grid; place-items: center; padding: 20px; animation: fade .2s; }
.modal-card { background: #fff; border-radius: 24px; padding: 28px; width: min(460px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 30px 60px -20px rgba(0,0,0,.4); }
.modal-card h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -0.02em; }
.modal-card > p { color: #6E6E73; margin: 0 0 20px; }
@keyframes fade { from { opacity: 0; } }

/* Paket */
.plan-line { font-size: 13px; color: #6E6E73; }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 18px 0 12px; }
.plan { background: #fff; border-radius: 22px; padding: 28px 24px 24px; display: flex; flex-direction: column; position: relative; border: 2px solid transparent; }
.plan.popular { border-color: #1D1D1F; }
.plan.current { border-color: #34C759; }
.plan-tag { position: absolute; top: -12px; left: 24px; background: #1D1D1F; color: #fff; font-size: 12px; font-weight: 500; padding: 4px 12px; border-radius: 99px; }
.plan h3 { margin: 0 0 6px; font-size: 20px; letter-spacing: -0.02em; }
.plan-price { margin: 0; font-size: 30px; font-weight: 600; letter-spacing: -0.03em; }
.plan-diff { margin: 2px 0 0; font-size: 13px; color: #1A7F37; font-weight: 500; }
.plan ul { list-style: none; padding: 0; margin: 20px 0 24px; display: grid; gap: 9px; font-size: 14px; color: #424245; flex: 1; }
.plan li::before { content: "✓"; color: #34C759; font-weight: 600; margin-right: 8px; }
.pay-methods { text-align: center; margin-bottom: 18px; }
.pay-box { border: 1.5px solid #0071E3; margin-bottom: 18px; }
.select { padding: 9px 12px; border-radius: 12px; border: 1px solid rgba(0,0,0,.12); background: #FBFBFD; }

.loading { text-align: center; color: #86868B; padding: 80px 0; }

@media (max-width: 640px) {
  .grid2 { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .plans { grid-template-columns: 1fr; gap: 22px; }
  .layout-pick { grid-template-columns: 1fr 1fr; }
  .view { padding: 28px 16px 100px; }
  .editor-head { margin: -28px -16px 20px; padding: 14px 16px 12px; }
  .panel { padding: 20px 18px; }
  .page-head h1 { font-size: 28px; }
  .save-state { display: none; }
  .table .hide-sm { display: none; }
}
