/* ========= UI aplikasi: login, editor, admin ========= */
:root {
  --ui-bg: #f5f3ef; --ui-card: #fff; --ui-text: #1f1d1a; --ui-muted: #6f6a62; --ui-line: #e6e1d8;
  --ui-primary: #8a5a44; --ui-primary-2: #6f4634; --ui-blue: #2563eb; --ui-green: #16a34a; --ui-red: #dc2626; --ui-amber: #d97706;
  --ui-radius: 12px; --ui-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body.ui { font-family: var(--ui-font); background: var(--ui-bg); color: var(--ui-text); font-size: 14px; line-height: 1.5; }
[hidden] { display: none !important; }
a { color: var(--ui-blue); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }

/* ----- Kawalan asas ----- */
.u-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--ui-line); background: #fff; color: var(--ui-text); font: 600 13px/1 var(--ui-font); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.u-btn:hover { border-color: #cfc7ba; background: #faf8f5; }
.u-btn:disabled { opacity: .5; cursor: not-allowed; }
.u-btn.primary { background: var(--ui-primary); border-color: var(--ui-primary); color: #fff; }
.u-btn.primary:hover { background: var(--ui-primary-2); }
.u-btn.green { background: #25d366; border-color: #25d366; color: #fff; }
.u-btn.danger { color: var(--ui-red); }
.u-btn.ghost { border-color: transparent; background: transparent; }
.u-btn.sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.u-btn.block { width: 100%; }
.u-btn svg { width: 16px; height: 16px; }
.u-input, .u-select, .u-textarea { width: 100%; font: 15px/1.4 var(--ui-font); color: var(--ui-text); background: #fff; border: 1px solid var(--ui-line); border-radius: 10px; padding: 9px 11px; outline: none; }
.u-input:focus, .u-select:focus, .u-textarea:focus { border-color: var(--ui-blue); box-shadow: 0 0 0 3px #2563eb22; }
.u-textarea { resize: vertical; min-height: 70px; }
.u-field { display: flex; flex-direction: column; gap: 5px; }
.u-field > span { font-size: 12px; font-weight: 600; color: var(--ui-muted); }
.u-field small { color: var(--ui-muted); font-size: 11.5px; }
.u-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.u-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.u-check { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; padding: 4px 0; }
.u-check input { width: 18px; height: 18px; accent-color: var(--ui-primary); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: #faf8f5; border: 1px solid var(--ui-line); border-radius: 10px; font-weight: 600; cursor: pointer; }
.switch input { appearance: none; width: 40px; height: 22px; border-radius: 99px; background: #d6d0c5; position: relative; cursor: pointer; transition: background .2s; flex: none; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked { background: var(--ui-green); }
.switch input:checked::after { transform: translateX(18px); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; background: #eee9e1; color: var(--ui-muted); white-space: nowrap; }
.chip.live { background: #dcfce7; color: #15803d; }
.chip.draf { background: #fef3c7; color: #b45309; }
.chip.baru { background: #e0e7ff; color: #4338ca; }
.chip.tamat, .chip.nyahaktif { background: #fee2e2; color: #b91c1c; }
.u-card { background: var(--ui-card); border: 1px solid var(--ui-line); border-radius: var(--ui-radius); padding: 16px; }
.muted { color: var(--ui-muted); }
.small { font-size: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.hstack { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.notice-box { padding: 12px 14px; border-radius: 10px; background: #eff6ff; color: #1e3a8a; font-size: 13px; border: 1px solid #bfdbfe; }
.notice-box.warn { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.notice-box.lock { background: #faf5ff; color: #6b21a8; border-color: #e9d5ff; }
.notice-box.err { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

#toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #1f1d1a; color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 13px; box-shadow: 0 8px 24px #0003; transition: opacity .3s, transform .3s; }
.toast.err { background: var(--ui-red); }
.toast.ok { background: var(--ui-green); }
.toast.out { opacity: 0; transform: translateY(-6px); }

/* ----- Modal ----- */
.modal-back { position: fixed; inset: 0; background: #0007; z-index: 150; display: grid; place-items: center; padding: 16px; }
.modal { background: #fff; border-radius: 16px; padding: 22px; width: 100%; max-width: 440px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px #0004; }
.modal h3 { font-size: 18px; margin-bottom: 8px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* ----- Login ----- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 10%, #f3e6d6, transparent 50%), radial-gradient(circle at 90% 90%, #e8dccc, transparent 50%), var(--ui-bg); }
.auth-card { width: 100%; max-width: 380px; background: #fff; border-radius: 20px; padding: 32px 26px; box-shadow: 0 20px 50px #5a3e2b1f; text-align: center; }
.auth-logo { width: 56px; height: 56px; margin: 0 auto 14px; }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-card p { color: var(--ui-muted); margin: 0 0 20px; }
.auth-card .u-input { text-align: center; font-size: 20px; letter-spacing: .12em; font-weight: 700; text-transform: uppercase; height: 54px; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.auth-card .u-btn { height: 48px; font-size: 15px; }
.auth-help { margin-top: 18px; font-size: 12.5px; color: var(--ui-muted); }

/* ========= EDITOR ========= */
body.editor { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
.ed-top { height: 58px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 14px; background: #fff; border-bottom: 1px solid var(--ui-line); z-index: 20; }
.ed-brand { font-weight: 800; font-size: 15px; color: var(--ui-primary); display: flex; align-items: center; gap: 8px; }
.ed-brand img { width: 28px; height: 28px; }
.ed-save { font-size: 12px; color: var(--ui-muted); display: flex; align-items: center; gap: 6px; }
.ed-save .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ui-green); }
.ed-save.dirty .dot { background: var(--ui-amber); }
.ed-save.saving .dot { background: var(--ui-blue); animation: blink 1s infinite; }
.ed-save.error .dot { background: var(--ui-red); }
@keyframes blink { 50% { opacity: .3; } }
.pub-count { font-size: 11px; font-weight: 700; opacity: .85; }

.ed-body { flex: 1; display: flex; min-height: 0; }
.ed-nav { width: 78px; flex: none; background: #fff; border-right: 1px solid var(--ui-line); display: flex; flex-direction: column; padding: 8px 6px; gap: 2px; overflow-y: auto; }
.ed-nav button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px; border: 0; background: none; border-radius: 10px; color: var(--ui-muted); font: 600 10.5px/1.15 var(--ui-font); cursor: pointer; text-align: center; position: relative; }
.ed-nav button svg { width: 21px; height: 21px; }
.ed-nav button:hover { background: #f5f2ed; color: var(--ui-text); }
.ed-nav button.on { background: #f3e9e2; color: var(--ui-primary); }
.ed-nav .lock-dot { position: absolute; top: 5px; right: 10px; font-size: 9px; }
.ed-panel { width: 360px; flex: none; background: #fff; border-right: 1px solid var(--ui-line); display: flex; flex-direction: column; min-height: 0; }
.ed-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px; border-bottom: 1px solid var(--ui-line); }
.ed-panel-head h2 { font-size: 16px; }
.ed-panel-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.ed-panel-close { display: none; }
.ed-section-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--ui-muted); margin-top: 6px; }

.ed-stage { flex: 1; min-width: 0; overflow-y: auto; background: #e9e4dc; background-image: radial-gradient(#d8d1c5 1px, transparent 1px); background-size: 18px 18px; padding: 26px 16px 60px; position: relative; }
.ed-hint { max-width: 420px; margin: 0 auto 12px; text-align: center; font-size: 12px; color: var(--ui-muted); background: #fffc; border-radius: 99px; padding: 6px 12px; }
.ed-phone { width: 400px; max-width: 100%; margin: 0 auto; border-radius: 30px; overflow: hidden; box-shadow: 0 0 0 8px #1f1d1a, 0 30px 60px #0004; background: #fff; }
.ed-stage.desktop .ed-phone { width: 100%; max-width: 900px; border-radius: 12px; box-shadow: 0 20px 50px #0003; }
.ed-stage.desktop .inv { max-width: 900px; }
.ed-viewtoggle { display: flex; justify-content: center; gap: 4px; margin-bottom: 12px; }
.ed-phone .inv { min-height: auto; }

/* Item senarai dalam panel */
.list-item { border: 1px solid var(--ui-line); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: #fcfbf9; }
.list-item-head { display: flex; align-items: center; gap: 4px; }
.list-item-head b { flex: 1; font-size: 12px; color: var(--ui-muted); }
.icon-only { width: 30px; height: 30px; padding: 0; border-radius: 8px; border: 1px solid var(--ui-line); background: #fff; cursor: pointer; display: grid; place-items: center; color: var(--ui-muted); font-size: 14px; }
.icon-only:hover { color: var(--ui-text); }
.icon-only.danger:hover { color: var(--ui-red); border-color: #fecaca; }

/* Template */
.cat-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.cat-chips button { border: 1px solid var(--ui-line); background: #fff; padding: 6px 12px; border-radius: 99px; font: 600 12px var(--ui-font); cursor: pointer; color: var(--ui-muted); }
.cat-chips button.on { background: var(--ui-text); color: #fff; border-color: var(--ui-text); }
.tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tpl-card { border: 2px solid var(--ui-line); border-radius: 12px; overflow: hidden; cursor: pointer; background: #fff; padding: 0; text-align: left; transition: border-color .15s, transform .15s; font-family: var(--ui-font); }
.tpl-card:hover { transform: translateY(-2px); border-color: #cfc7ba; }
.tpl-card.on { border-color: var(--ui-primary); box-shadow: 0 0 0 3px #8a5a4433; }
.tpl-thumb { height: 230px; overflow: hidden; position: relative; pointer-events: none; }
.tpl-thumb > .inv { position: absolute; top: 0; left: 0; width: calc(100% / .385); transform: scale(.385); transform-origin: top left; }
.tpl-meta { padding: 8px 10px; border-top: 1px solid var(--ui-line); }
.tpl-meta b { display: block; font-size: 12.5px; }
.tpl-meta span { font-size: 11px; color: var(--ui-muted); }

/* Gambar */
.img-row { display: flex; gap: 10px; align-items: center; }
.img-thumb { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; background: #eee9e1; flex: none; border: 1px solid var(--ui-line); }
.gal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gal-cell { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #eee9e1; }
.gal-cell img { width: 100%; height: 100%; object-fit: cover; }
.gal-cell .gal-actions { position: absolute; inset: auto 4px 4px 4px; display: flex; gap: 3px; justify-content: center; }
.gal-cell .gal-actions button { width: 26px; height: 26px; border-radius: 7px; border: 0; background: #000a; color: #fff; cursor: pointer; font-size: 12px; }
.range-row { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 8px; font-size: 12px; color: var(--ui-muted); }
.range-row input { width: 100%; accent-color: var(--ui-primary); }

/* Lagu */
.yt-preview { border-radius: 10px; overflow: hidden; aspect-ratio: 16/9; background: #000; }
.yt-preview iframe { width: 100%; height: 100%; border: 0; }
.song-card { display: flex; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--ui-line); border-radius: 10px; }
.song-card img { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; }

/* RSVP */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: #faf8f5; border: 1px solid var(--ui-line); border-radius: 10px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 11px; color: var(--ui-muted); font-weight: 600; }
.resp { border: 1px solid var(--ui-line); border-radius: 10px; padding: 10px 12px; display: flex; gap: 10px; align-items: flex-start; }
.resp-main { flex: 1; min-width: 0; }
.resp-main b { font-size: 13.5px; }
.resp-main p { margin: 2px 0 0; font-size: 12.5px; color: var(--ui-muted); white-space: pre-line; word-break: break-word; }
.resp.hidden-wish { opacity: .5; }

/* Kongsi */
.link-box { display: flex; gap: 6px; align-items: center; padding: 6px 6px 6px 12px; border: 1px solid var(--ui-line); border-radius: 10px; background: #faf8f5; }
.link-box code { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, monospace; }
.guest-links { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow-y: auto; }
.guest-link { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.guest-link span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ----- Mudah alih ----- */
@media (max-width: 900px) {
  .ed-top { height: 54px; padding: 0 10px; gap: 6px; }
  .ed-top .hide-m { display: none; }
  .ed-body { flex-direction: column; }
  .ed-stage { padding: 0 0 76px; background: #fff; }
  /* Edit atas kanvas: menu bawah disorok semasa menaip supaya kad guna skrin penuh */
  body.typing .ed-nav { transform: translateY(110%); }
  body.typing .ed-stage { padding-bottom: 0; }
  .ed-nav { transition: transform .2s ease; }
  .ed-top .hide-xs { display: none; }
  .ed-top .show-xs { display: inline; }
  .ed-phone { width: 100%; border-radius: 0; box-shadow: none; }
  .ed-hint, .ed-viewtoggle { display: none; }
  .ed-nav { position: fixed; left: 0; right: 0; bottom: 0; width: auto; height: auto; flex-direction: row; border-right: 0; border-top: 1px solid var(--ui-line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 30; overflow-x: auto; overflow-y: hidden; box-shadow: 0 -6px 20px #0001; }
  .ed-nav button { min-width: 0; flex: 1 1 0; padding: 7px 2px; font-size: 10px; }
  .ed-nav button svg { width: 20px; height: 20px; }
  .ed-panel { position: fixed; left: 0; right: 0; bottom: 0; width: auto; height: 78vh; height: 78dvh; border-radius: 18px 18px 0 0; border: 0; box-shadow: 0 -20px 50px #0003; z-index: 40; transform: translateY(105%); transition: transform .28s cubic-bezier(.3,.8,.3,1); }
  .ed-panel.open { transform: none; }
  .ed-panel-close { display: inline-flex; }
  .ed-panel-head::before { content: ''; position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: #d6d0c5; }
  .ed-panel-head { position: relative; padding-top: 18px; }
  .ed-scrim { position: fixed; inset: 0; background: #0004; z-index: 35; }
}
@media (min-width: 901px) { .ed-scrim { display: none; } }

/* ========= ADMIN ========= */
body.admin { min-height: 100vh; }
.ad-top { position: sticky; top: 0; z-index: 10; height: 58px; display: flex; align-items: center; gap: 12px; padding: 0 20px; background: #fff; border-bottom: 1px solid var(--ui-line); }
.ad-tabs { display: flex; gap: 4px; }
.ad-tabs button { border: 0; background: none; padding: 8px 12px; border-radius: 8px; font: 600 13px var(--ui-font); color: var(--ui-muted); cursor: pointer; }
.ad-tabs button.on { background: #f3e9e2; color: var(--ui-primary); }
.ad-main { max-width: 1280px; margin: 0 auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.ad-grid { display: grid; grid-template-columns: 380px 1fr; gap: 16px; align-items: start; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--ui-line); border-radius: var(--ui-radius); padding: 14px 16px; }
.kpi span { font-size: 12px; color: var(--ui-muted); font-weight: 600; }
.kpi b { display: block; font-size: 26px; margin-top: 2px; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--ui-line); border-radius: var(--ui-radius); }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ui-muted); padding: 10px 12px; border-bottom: 1px solid var(--ui-line); background: #faf8f5; white-space: nowrap; }
.t td { padding: 10px 12px; border-bottom: 1px solid #f0ece5; vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t tr:hover td { background: #fcfbf9; }
.code { font-family: ui-monospace, monospace; font-weight: 700; font-size: 12.5px; white-space: nowrap; }
.msg-preview { white-space: pre-wrap; background: #e7fbe9; border: 1px solid #c4ecc9; border-radius: 12px; padding: 12px; font-size: 13px; max-height: 260px; overflow-y: auto; }
.bar-list { display: flex; flex-direction: column; gap: 8px; }
.bar-item { display: grid; grid-template-columns: 120px 1fr 36px; align-items: center; gap: 10px; font-size: 13px; }
.bar-track { height: 10px; border-radius: 99px; background: #f0ece5; overflow: hidden; }
.bar-fill { height: 100%; background: var(--ui-primary); border-radius: 99px; }
.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: 34px; z-index: 20; background: #fff; border: 1px solid var(--ui-line); border-radius: 10px; box-shadow: 0 10px 30px #0002; padding: 6px; min-width: 200px; display: flex; flex-direction: column; }
.menu-pop button, .menu-pop a { text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; font: 500 13px var(--ui-font); color: var(--ui-text); cursor: pointer; text-decoration: none; }
.menu-pop button:hover, .menu-pop a:hover { background: #f5f2ed; }
.menu-pop .danger { color: var(--ui-red); }
@media (max-width: 960px) {
  .ad-grid { grid-template-columns: 1fr; }
  .ad-top { padding: 0 12px; }
  .ad-main { padding: 12px; }
  .hide-m { display: none; }
}

/* Landing */
.landing { min-height: 100vh; display: grid; place-items: center; padding: 24px; text-align: center; background: radial-gradient(circle at 30% 20%, #f3e6d6, transparent 55%), var(--ui-bg); }
.landing h1 { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 44px; color: var(--ui-primary); margin-bottom: 10px; }
.landing p { color: var(--ui-muted); max-width: 420px; margin: 0 auto 22px; font-size: 16px; }

/* ========= Dashboard customer ========= */
.db-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #fffffff2; border-bottom: 1px solid var(--ui-line); backdrop-filter: blur(8px); }
.db-top img { width: 28px; height: 28px; }
.db { max-width: 760px; margin: 0 auto; padding: 16px 14px 48px; display: flex; flex-direction: column; gap: 14px; }
.db-hero { display: flex; flex-direction: column; gap: 10px; }
.db-hero h1 { font-size: 24px; word-break: break-word; }
.db-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.db-actions .u-btn { height: 44px; font-size: 14px; }
.db-actions .u-btn.primary { flex: 1 1 100%; }
.db-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.db-stats .stat { background: #fff; }
.db-stats .stat:first-child { grid-column: 1 / -1; background: var(--ui-primary); border-color: var(--ui-primary); color: #fff; }
.db-stats .stat:first-child span { color: #ffffffcc; }
.db-stats .stat:first-child b { font-size: 30px; }
.db-tabs { display: flex; gap: 4px; padding: 4px; background: #ebe6de; border-radius: 12px; }
.db-tabs button { flex: 1; height: 38px; border: 0; border-radius: 9px; background: transparent; font: 700 13px var(--ui-font); color: var(--ui-muted); cursor: pointer; }
.db-tabs button.on { background: #fff; color: var(--ui-text); box-shadow: 0 1px 3px #0001; }
.db-kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.db-kv span { color: var(--ui-muted); }
.db-acct h3 { font-size: 15px; }
@media (min-width: 640px) {
  .db-stats { grid-template-columns: repeat(5, 1fr); }
  .db-stats .stat:first-child { grid-column: auto; }
  .db-actions .u-btn.primary { flex: 0 0 auto; }
}

/* ----- Soalan kali pertama (Majlis apa? / Jenis?) ----- */
.ob { display: flex; flex-direction: column; gap: 12px; padding-top: 8px; }
.ob h1 { font-size: 26px; }
.ob-step { margin: 0; font-size: 12px; font-weight: 700; color: var(--ui-primary); text-transform: uppercase; letter-spacing: .06em; }
.ob-sub { margin: 0 0 6px; }
.ob-cats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ob-cat { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px 14px; min-height: 132px; text-align: left; background: #fff; border: 1.5px solid var(--ui-line); border-radius: 16px; cursor: pointer; font-family: var(--ui-font); color: var(--ui-text); transition: border-color .15s, transform .15s; }
.ob-cat:hover, .ob-cat:focus-visible { border-color: var(--ui-primary); transform: translateY(-1px); }
.ob-cat b { font-size: 14.5px; line-height: 1.3; }
.ob-cat small { color: var(--ui-muted); font-size: 12px; line-height: 1.35; }
.ob-icon { font-size: 34px; line-height: 1; margin-bottom: 6px; }
.ob-cats .ob-cat:first-child { grid-column: 1 / -1; min-height: 0; flex-direction: row; align-items: center; gap: 14px; }
.ob-cats .ob-cat:first-child .ob-icon { margin: 0; font-size: 40px; }
.ob-kinds { display: flex; flex-direction: column; gap: 8px; }
.ob-kind { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 54px; padding: 12px 16px; background: #fff; border: 1.5px solid var(--ui-line); border-radius: 14px; font: 600 15px var(--ui-font); color: var(--ui-text); text-align: left; cursor: pointer; }
.ob-kind:hover, .ob-kind:focus-visible { border-color: var(--ui-primary); }
.ob-kind:disabled, .ob-cat:disabled { opacity: .6; cursor: wait; }
.ob-arrow { color: var(--ui-primary); font-size: 18px; }
@media (min-width: 640px) { .ob-cats { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 420px) { .ed-save .t { display: none; } }
.show-xs { display: none; }

/* ----- Mockup preview link WhatsApp (panel Kongsi) ----- */
.wa-chat { background: #efeae2; border-radius: 12px; padding: 14px 10px; display: flex; justify-content: flex-end; background-image: radial-gradient(#d9d2c5 1px, transparent 1px); background-size: 14px 14px; }
.wa-bubble { position: relative; max-width: 92%; background: #d9fdd3; border-radius: 10px 2px 10px 10px; padding: 4px 4px 18px; box-shadow: 0 1px 1px #0000001a; font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
.wa-card { display: flex; gap: 0; background: #cfeec9; border-radius: 7px; overflow: hidden; }
.wa-thumb { flex: 0 0 84px; height: 84px; background: #bfe3b8; display: grid; place-items: center; }
.wa-thumb img { width: 84px; height: 84px; object-fit: cover; object-position: 50% 45%; }
.wa-spin { width: 18px; height: 18px; border: 2px solid #0002; border-top-color: #0006; border-radius: 50%; animation: waspin .8s linear infinite; }
@keyframes waspin { to { transform: rotate(360deg); } }
.wa-meta { padding: 7px 10px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.wa-meta b { font-size: 13px; color: #111b21; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wa-meta p { margin: 0; font-size: 12px; color: #54656f; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wa-meta small { font-size: 11px; color: #667781; }
.wa-text { margin: 6px 6px 0; font-size: 13.5px; color: #111b21; white-space: pre-line; word-break: break-word; }
.wa-time { position: absolute; right: 8px; bottom: 3px; font-size: 10.5px; color: #667781; }
.wa-full img { width: 100%; max-width: 280px; margin: 0 auto; border-radius: 10px; box-shadow: 0 6px 20px #0002; }

/* ----- Tooltip (tip.js) ----- */
.tip { position: fixed; z-index: 400; max-width: 260px; padding: 7px 10px; border-radius: 8px; background: #1f1d1a; color: #fff; font: 500 12px/1.4 var(--ui-font); box-shadow: 0 8px 24px #0003; pointer-events: none; opacity: 0; transform: translateY(3px); transition: opacity .12s, transform .12s; }
.tip.on { opacity: 1; transform: none; }
.tip::after { content: ''; position: absolute; left: var(--ax, 50%); bottom: -5px; width: 10px; height: 10px; margin-left: -5px; background: inherit; transform: rotate(45deg); border-radius: 2px; }
.tip.below::after { bottom: auto; top: -5px; }
[data-tip] { -webkit-touch-callout: none; }
button[data-tip], .sec-hide, .add-slot, .row-x { -webkit-user-select: none; user-select: none; }
.help-dot { display: inline-grid; place-items: center; width: 15px; height: 15px; margin-left: 5px; border-radius: 50%; background: #e8e2d8; color: var(--ui-muted); font: 700 10px/1 var(--ui-font); font-style: normal; cursor: help; vertical-align: 1px; }
.canvas-note { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.mode-edit .pickable.flash { animation: flash 0.8s ease 3; }
@keyframes flash { 50% { outline: 3px solid #ef4444; outline-offset: 6px; background: #fee2e2; } }

/* ----- Pemilih design: kad + butang main animasi ----- */
.tpl-card { position: relative; }
.tpl-pick { display: block; width: 100%; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.tpl-play { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: #111c; color: #fff; font-size: 13px; cursor: pointer; display: grid; place-items: center; box-shadow: 0 4px 12px #0003; padding: 0 0 0 2px; }
.tpl-play:hover { background: var(--ui-primary); }
.tpl-fit { position: absolute; top: 8px; left: 8px; background: #166534; color: #fff; font: 700 10px/1 var(--ui-font); padding: 5px 7px; border-radius: 99px; pointer-events: none; }
.cat-chips.scroll-x { flex: none; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -2px; padding: 2px; }
.cat-chips.scroll-x::-webkit-scrollbar { display: none; }
.cat-chips.scroll-x button { flex: none; }
.anim-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.anim-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--ui-line); background: #fff; padding: 7px 11px; border-radius: 99px; font: 600 12px var(--ui-font); color: var(--ui-text); cursor: pointer; }
.anim-chip .anim-ic { font-size: 9px; color: var(--ui-primary); }
.anim-chip.on { background: var(--ui-text); color: #fff; border-color: var(--ui-text); }
.anim-chip.on .anim-ic { color: #fff; }

/* ----- Pemain animasi (iframe pratonton) ----- */
.player-back { position: fixed; inset: 0; z-index: 300; background: #0009; display: grid; place-items: center; padding: 12px; }
.player { background: #fff; border-radius: 18px; width: min(420px, 100%); max-height: calc(100dvh - 24px); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 60px #0006; }
.player-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--ui-line); }
.player-head b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-phone { flex: 1; min-height: 0; background: #111; }
.player-frame { display: block; width: 100%; height: min(720px, calc(100dvh - 150px)); border: 0; background: #fff; }
.player-actions { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--ui-line); }
.player-actions .u-btn { flex: 1; }
@media (max-width: 600px) {
  .player-back { padding: 0; place-items: stretch; }
  .player { width: 100%; max-height: none; height: 100dvh; border-radius: 0; }
  .player-frame { height: 100%; }
  .player-actions { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
}

/* ----- Pelaras gambar (crop.js) ----- */
html.cr-lock, html.cr-lock body { overflow: hidden; overscroll-behavior: none; }
.cr-back { position: fixed; inset: 0; z-index: 320; background: #0b0b0be6; display: grid; place-items: center; padding: 12px; }
.cr-box { width: min(500px, 100%); color: #fff; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.cr-head { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.cr-head b { font: 700 15px var(--ui-font); }
.cr-x { width: 36px; height: 36px; border-radius: 50%; border: 0; background: #ffffff1f; color: #fff; font-size: 15px; cursor: pointer; }
.cr-stage { display: grid; place-items: center; padding: 6px; }
.cr-frame { position: relative; overflow: hidden; background: #222; touch-action: none; cursor: grab; box-shadow: 0 0 0 2px #fff, 0 0 0 9999px #0000; border-radius: 10px; user-select: none; -webkit-user-select: none; }
.cr-frame.dragging { cursor: grabbing; }
.cr-img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; -webkit-user-drag: none; }
.cr-grid { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .2s;
  background: linear-gradient(90deg, transparent calc(33.33% - .5px), #fff8 calc(33.33% - .5px) calc(33.33% + .5px), transparent calc(33.33% + .5px) calc(66.66% - .5px), #fff8 calc(66.66% - .5px) calc(66.66% + .5px), transparent calc(66.66% + .5px)),
    linear-gradient(transparent calc(33.33% - .5px), #fff8 calc(33.33% - .5px) calc(33.33% + .5px), transparent calc(33.33% + .5px) calc(66.66% - .5px), #fff8 calc(66.66% - .5px) calc(66.66% + .5px), transparent calc(66.66% + .5px)); }
.cr-frame.dragging .cr-grid { opacity: 1; }
.cr-hint { margin: 0; font: 500 12.5px var(--ui-font); color: #fffc; text-align: center; }
.cr-zoom { width: min(360px, 100%); display: flex; align-items: center; gap: 10px; font: 700 18px var(--ui-font); color: #fffc; }
.cr-zoom input { flex: 1; accent-color: #fff; }
.cr-actions { width: 100%; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; padding-bottom: env(safe-area-inset-bottom); }
.cr-actions .u-btn { min-width: 110px; }
.cr-actions .u-btn:not(.primary) { background: #ffffff1f; color: #fff; border-color: #ffffff33; }

/* ========= ADMIN: telefon ========= */
.ad-report { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.ord-list { display: flex; flex-direction: column; gap: 10px; }
.ord-card { background: #fff; border: 1px solid var(--ui-line); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.ord-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ord-id { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.ord-act { display: flex; gap: 6px; flex: none; }
.ord-title { font-weight: 700; font-size: 14.5px; line-height: 1.3; }
.ord-meta { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--ui-muted); }
.ord-stats { display: flex; gap: 14px; font-size: 12px; color: var(--ui-muted); border-top: 1px dashed var(--ui-line); padding-top: 7px; margin-top: 2px; }
.ord-stats b { color: var(--ui-text); font-size: 13.5px; }
.ad-filter { display: flex; flex-direction: column; gap: 8px; }
.ad-filter .u-select { flex: 1; }
.sheet-scrim { position: fixed; inset: 0; z-index: 160; background: #0006; display: flex; align-items: flex-end; }
.sheet-scrim .menu-pop { position: static; width: 100%; border-radius: 18px 18px 0 0; padding: 8px 8px max(10px, env(safe-area-inset-bottom)); max-height: 80vh; overflow-y: auto; animation: sheetUp .2s ease-out; }
.sheet-scrim .menu-pop button { padding: 13px 14px; font-size: 15px; }
.menu-head { display: flex; flex-direction: column; gap: 2px; padding: 8px 14px 10px; border-bottom: 1px solid var(--ui-line); margin-bottom: 4px; }
.menu-cancel { margin-top: 4px; border-top: 1px solid var(--ui-line) !important; border-radius: 0 !important; text-align: center !important; font-weight: 700 !important; }
@keyframes sheetUp { from { transform: translateY(30%); opacity: .4; } }
@media (max-width: 760px) {
  body.admin { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .ad-top { height: 52px; }
  .ad-top .ed-brand span { display: inline; font-size: 14px; }
  /* Tab admin jadi bar bawah */
  .ad-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #fff; border-top: 1px solid var(--ui-line); padding: 6px 8px max(6px, env(safe-area-inset-bottom)); justify-content: space-around; gap: 6px; }
  .ad-tabs button { flex: 1; padding: 11px 6px; font-size: 13px; }
  .ad-main { padding: 12px; gap: 12px; }
  .kpis { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
  .kpi { padding: 10px 12px; border-radius: 12px; }
  .kpi span { font-size: 11px; display: block; line-height: 1.25; }
  .kpi b { font-size: 20px; }
  .ad-report { grid-template-columns: 1fr; }
  .bar-item { grid-template-columns: 96px 1fr 30px; font-size: 12px; }
  .ad-add { height: 46px; font-size: 15px; }
  .modal-back.sheet { align-items: end; padding: 0; }
  .modal-back.sheet .modal, .modal-back .modal { max-width: none; }
  .modal-back.sheet .modal { border-radius: 18px 18px 0 0; max-height: 92vh; padding: 18px 16px max(16px, env(safe-area-inset-bottom)); }
  .modal-back.sheet .modal > form { border: 0; padding: 0; box-shadow: none; }
  .modal .u-row { grid-template-columns: 1fr 1fr; }
  .msg-preview { max-height: 200px; }
  .admin .u-input, .admin .u-select, .admin .u-textarea { font-size: 16px; } /* elak iOS zoom */
}
