/* Tambahan khusus dashboard admin (memakai variabel dari style.css)
   Warna, font & sudut MENGIKUTI tema website (diisi admin.js → applyAdminTheme).
   Nilai di bawah hanya cadangan. */
body.admin {
  --primary: #2f8f4e; --primary-soft: #e3f3e8; --accent: #b6dd52; --on: #ffffff;
  --bg: #f1f4f1; --surface: #ffffff; --text: #17251c; --muted: #6a786f; --border: #e2e8e3;
  --radius: 14px; --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 6px 18px rgba(0, 0, 0, .05);
  --side: #183526; --side-text: #e8f1ea;
  --side-2: color-mix(in srgb, var(--side) 78%, var(--side-text));
  background: var(--bg); color: var(--text);
}
body.admin h1, body.admin h2, body.admin .brand { font-family: var(--font-title, inherit); }
body.admin .card { border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); background: var(--surface); }
body.admin .btn { border-radius: calc(var(--radius) * .7); color: var(--on); }
body.admin .btn-outline, body.admin .btn-ghost { color: var(--text); }
body.admin .btn-outline { color: var(--primary); }
body.admin .btn-danger { color: #fff; }
body.admin .pill.on { background: var(--primary-soft); color: var(--primary); }
body.admin .input { background: var(--surface); color: var(--text); }
body.admin table th { color: var(--muted); }

/* Login */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle at 20% 20%, var(--side-2) 0, transparent 40%),
    linear-gradient(135deg, var(--side), color-mix(in srgb, var(--side) 70%, #000));
}
.login-card { width: min(380px, 100%); padding: 32px; }
.login-card h1 { font-size: 1.4rem; margin-bottom: 4px; }
.login-card p { color: var(--muted); margin-bottom: 20px; font-size: .9rem; }
.error-text { color: #dc2626; font-size: .85rem; margin-bottom: 10px; }

/* Layout */
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--side); color: color-mix(in srgb, var(--side-text) 72%, var(--side)); padding: 22px 14px;
  display: flex; flex-direction: column; gap: 3px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--side-2) transparent;
}
.sidebar .brand { color: var(--side-text); padding: 2px 10px 22px; gap: 10px; }
.sidebar .brand .brand-dot { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); box-shadow: inset 0 0 0 7px var(--primary); }
.side-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: calc(var(--radius) * .7);
  color: color-mix(in srgb, var(--side-text) 72%, var(--side)); cursor: pointer; border: none; background: none;
  text-align: left; font-weight: 600; font-size: .92rem;
}
.side-link:hover { background: color-mix(in srgb, var(--side-text) 8%, transparent); color: var(--side-text); }
.side-link.active { background: var(--side-2); color: var(--side-text); box-shadow: inset 3px 0 0 var(--primary); }
.side-link .count { margin-left: auto; background: var(--primary); color: var(--on); font-size: .7rem; font-weight: 800; padding: 1px 8px; border-radius: 999px; }
.sidebar .spacer { flex: 1; min-height: 12px; }

.main { padding: 28px 32px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.55rem; letter-spacing: -.01em; }
.page-head p { color: var(--muted); font-size: .9rem; }
.panel { padding: 22px; margin-bottom: 18px; }
.panel h2 { font-size: 1.05rem; margin-bottom: 14px; }

/* Statistik (kartu dengan ikon bulat) */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { padding: 16px 18px; display: flex; align-items: center; gap: 14px; }
.stat-ico {
  width: 46px; height: 46px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%;
  background: var(--primary-soft); font-size: 1.25rem;
}
.stat .label { color: var(--muted); font-size: .82rem; font-weight: 600; }
.stat .value { font-size: 1.45rem; font-weight: 800; line-height: 1.2; }

/* Tabel */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
td .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { font-size: .72rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; display: inline-block; }
.pill.on { background: #dcfce7; color: #15803d; }
.pill.off { background: #f1f2f6; color: var(--muted); }

/* Toggle switch */
.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.switch-row:last-child { border-bottom: none; }
.switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #d4d6e0; border-radius: 999px; cursor: pointer; transition: .2s; }
.switch span::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(20px); }

.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type=color] { width: 46px; height: 42px; border: 1px solid var(--border); border-radius: 10px; padding: 3px; background: #fff; cursor: pointer; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 18, 35, .5); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { width: min(620px, 100%); max-height: 92vh; overflow-y: auto; padding: 26px; }
.modal h2 { margin-bottom: 18px; }
.plan-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 8px; }
.variant-edit {
  display: grid; gap: 8px; padding: 14px; margin-bottom: 12px;
  border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 12px; background: var(--bg);
}
.variant-edit textarea.input { min-height: 70px; }
.ve-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ve-head .input { flex: 1; min-width: 180px; font-weight: 700; }
.ve-out { display: flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.ve-prices { display: grid; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.fb-admin { padding: 16px 18px; margin-bottom: 12px; }
.fb-admin .top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.fb-admin textarea { min-height: 60px; margin-top: 10px; }
.fb-admin .actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

.img-preview {
  border: 2px dashed var(--border); border-radius: 12px; background: var(--bg) center / cover no-repeat;
  display: grid; place-items: center; color: var(--muted); font-size: .85rem;
}
.banner-prev { aspect-ratio: 3 / 1; }
.avatar-prev { width: 110px; height: 110px; border-radius: 50%; font-size: 2.6rem; }
.img-actions { display: flex; gap: 8px; }
code { background: var(--bg); padding: 1px 5px; border-radius: 5px; font-size: .85em; }

/* ================= TEMPLATE PESAN WHATSAPP ================= */
.order-msg-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; align-items: start; }
.token-row { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 6px; }
.token {
  font: 600 .76rem ui-monospace, Consolas, monospace; padding: 3px 8px; cursor: pointer;
  border-radius: 6px; border: 1px solid var(--border); background: var(--primary-soft); color: var(--primary);
}
.token:hover { border-color: var(--primary); }
.input.mono { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; line-height: 1.5; }
.wa-preview {
  padding: 14px; border-radius: 12px; min-height: 120px;
  background: #e5ddd5 radial-gradient(#0000000a 1px, transparent 1px) 0 0 / 12px 12px;
}
.wa-bubble {
  margin-left: auto; max-width: 92%; padding: 8px 10px 10px; border-radius: 10px 0 10px 10px;
  background: #dcf8c6; color: #111; font-size: .85rem; line-height: 1.45; box-shadow: 0 1px 1px #0002; word-break: break-word;
}
@media (max-width: 860px) { .order-msg-grid { grid-template-columns: 1fr; } }

/* ================= KUSTOMISASI TEMA ================= */
.sub-h { font-size: .92rem; margin: 18px 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.preset-list { display: grid; gap: 14px; }
.preset-group-title { font-size: .82rem; font-weight: 800; margin-bottom: 6px; }
.preset-group-title small { font-weight: 600; color: var(--muted); }
.preset-row { display: flex; gap: 8px; flex-wrap: wrap; }
.preset .sw b { position: absolute; left: 0; top: 0; bottom: 0; width: 9px; border-radius: 7px 0 0 7px; }
.preset {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; cursor: pointer; font-weight: 700;
  border: 2px solid var(--border); border-radius: 12px; background: var(--surface);
}
.preset:hover { border-color: var(--primary); }
.preset .sw { position: relative; width: 44px; height: 32px; border-radius: 8px; flex-shrink: 0; border: 1px solid var(--border); }
.preset .sw i { position: absolute; display: block; border-radius: 4px; }
.preset .sw i:first-child { left: 5px; top: 5px; width: 22px; height: 20px; border: 2px solid; }
.preset .sw i:last-child { right: 5px; bottom: 5px; width: 12px; height: 12px; border-radius: 50%; }
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 12px; }
.theme-preview { margin-top: 14px; }
.tp-page { padding: 18px; border-radius: 12px; }
.tp-win { max-width: 340px; margin: 0 auto; border: 3px solid; overflow: hidden; }
.tp-title { padding: 8px 12px; font-weight: 700; font-size: .9rem; }
.tp-body { padding: 14px; }
.tp-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 2px solid; }
.tp-btn { align-self: flex-start; margin-top: 6px; padding: 6px 14px; font-weight: 800; font-size: .82rem; }
.tp-badge { position: absolute; top: 10px; right: 10px; padding: 2px 10px; border-radius: 999px; font-size: .7rem; font-weight: 800; }

/* logo kecil di tabel aplikasi */
.tbl-icon { display: inline-grid; place-items: center; width: 26px; height: 26px; vertical-align: middle; margin-right: 4px; }
.tbl-icon .app-logo { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; }

/* pilihan tema tampilan (gambar mini tiap tata letak) */
.layout-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.layout-opt { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 12px; cursor: pointer;
  border: 2px solid var(--border); border-radius: 12px; background: var(--surface); }
.layout-opt input { position: absolute; opacity: 0; }
.layout-opt:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.layout-opt:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.layout-opt small { color: var(--muted); font-size: .78rem; line-height: 1.35; }
.lo-thumb { position: relative; height: 84px; border-radius: 8px; background: #333; margin-bottom: 6px; overflow: hidden; }
.lo-thumb i, .lo-thumb em { position: absolute; display: block; }
.lo-window i { left: 14%; right: 14%; background: #1e1e1e; border: 2px solid #fff; border-radius: 5px; border-top: 7px solid #444; }
.lo-window i:first-child { top: 8px; height: 28px; }
.lo-window i:last-child { top: 42px; height: 34px; }
.lo-diary { outline: 1px dashed #999; outline-offset: -5px; }
.lo-diary i { top: 10px; bottom: 10px; background: #1d1d1d; border: 1px solid #666; border-radius: 4px; }
.lo-diary i:first-child { left: 9px; width: 30%; }
.lo-diary i:nth-child(2) { left: 46%; right: 18px; }
.lo-diary em { right: 8px; top: 16px; width: 10px; height: 34px; background: repeating-linear-gradient(var(--primary) 0 8px, transparent 8px 11px); }
.lo-dashboard i:first-child { left: 0; top: 0; bottom: 0; width: 28%; background: #1e1e1e; border-right: 2px solid #555; }
.lo-dashboard i:last-child { left: 34%; right: 6%; top: 10px; height: 16px; background: repeating-linear-gradient(90deg, #444 0 22%, transparent 22% 26%); border-radius: 3px; }
.lo-dashboard::after { content: ''; position: absolute; left: 34%; right: 6%; top: 32px; bottom: 8px; background: #1e1e1e; border-radius: 4px; }
.lo-pop i { left: 14%; right: 14%; background: #2a2a2a; border: 2px solid #f4f4f4; border-top: 8px solid var(--primary); border-radius: 3px; box-shadow: 4px 4px 0 #000; }
.lo-pop i:first-child { top: 7px; height: 28px; }
.lo-pop i:last-child { top: 42px; height: 32px; }
.lo-store { background: #fbeee4; }
.lo-store i:first-child { left: 0; right: 0; top: 0; height: 42px; background: #9f2b2f; border-radius: 0 0 14px 14px; }
.lo-store i:nth-child(2) { left: 12%; right: 12%; top: 34px; bottom: 0; background: #fff; border-radius: 10px 10px 0 0; box-shadow: 0 -2px 6px #0002; }
.lo-store em { left: 16%; top: 8px; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2px solid #f2b134; }
.lo-komik { background: #f1ece0; background-image: linear-gradient(#0001 1px, transparent 1px), linear-gradient(90deg, #0001 1px, transparent 1px); background-size: 8px 8px; }
.lo-komik i { left: 12%; right: 16%; background: #fbf8f0; border: 2px solid #141414; box-shadow: 4px 4px 0 #141414; }
.lo-komik i:first-child { top: 8px; height: 26px; }
.lo-komik i:nth-child(2) { top: 44px; height: 30px; }
.lo-komik em { left: 16%; top: 14px; width: 20px; height: 10px; background: #d7262b; transform: skew(-12deg); }
.lo-xp { background: linear-gradient(#7fb4f0 0 55%, #3c9a2a 56% 100%); }
.lo-xp i:first-child { left: 18%; right: 14%; top: 8px; height: 50px; background: #ece9d8; border: 2px solid #1d4fc4; border-top: 9px solid #2058d6; border-radius: 4px 4px 2px 2px; }
.lo-xp i:nth-child(2) { left: 0; right: 0; bottom: 0; height: 11px; background: #2058d6; }
.lo-xp em { left: 0; bottom: 0; width: 26px; height: 11px; background: #3c9a2a; border-radius: 0 6px 6px 0; }

/* pengingat perubahan yang belum dipublikasikan */
.publish-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 18px; border-radius: 12px;
  background: #fff7e6; border: 1px solid #fcd38a; color: #7a4b00;
}
.publish-bar span { display: block; font-size: .85rem; }
.publish-bar code { background: #0000000f; color: inherit; }
.steps { margin: 0 0 16px 20px; color: var(--text); font-size: .9rem; }
.steps li { margin: 4px 0; }

/* ================= REKAPAN ORDER ================= */
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); }
.month-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.month-tab {
  border: 1px solid var(--border); background: var(--surface); padding: 7px 14px; border-radius: 10px 10px 4px 4px;
  font-weight: 700; font-size: .85rem; cursor: pointer; color: var(--muted);
}
.month-tab.active { background: var(--primary); color: var(--on); border-color: var(--primary); }
.recap-totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.total-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); text-align: center; }
.total-card .tc-head { padding: 7px 10px; font-weight: 800; font-size: .82rem; letter-spacing: .04em; color: #222; }
.total-card .tc-val { padding: 14px 10px; font-size: 1.35rem; font-weight: 800; }
.t-sell .tc-head { background: #ffd966; }
.t-cost .tc-head { background: #8e7cc3; color: #fff; }
.t-income .tc-head { background: #93c47d; }
.recap-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.recap-toolbar .input:first-child { flex: 1; min-width: 200px; }
.recap-table { font-size: .86rem; }
.recap-table th, .recap-table td { padding: 9px 8px; }
.recap-table .nowrap { white-space: nowrap; }
.recap-table .num { text-align: right; white-space: nowrap; }
.recap-table .center { text-align: center; }
.recap-table .acc { word-break: break-all; min-width: 140px; }
.recap-table .neg { color: #dc2626; }
.recap-table tbody tr:nth-child(even) { background: var(--bg); }
.row.three { grid-template-columns: repeat(3, 1fr); }
.income-preview { margin: -4px 0 12px; padding: 10px 12px; border-radius: 10px; background: var(--bg); font-size: .88rem; }
.privacy-note { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.ticker-preview { padding: 10px 12px; border-radius: 10px; background: #1e1e1e; color: #f4f4f4; font-size: .85rem; min-height: 42px; }
.ticker-preview b { color: var(--primary); }

/* ================= LOYALTY CARD ================= */
.loyalty-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.loyalty-card { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.loyalty-card.ready { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.lc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lc-head b { font-size: 1.05rem; text-transform: capitalize; }
.lc-count { font-weight: 800; color: var(--primary); }
.ready-pill { background: var(--primary); color: var(--on); }
.lc-stamps { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.stamp {
  aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; font-size: .8rem; font-weight: 700;
  border: 2px dashed var(--border); color: var(--muted); background: var(--bg);
}
.stamp.on { border: 2px solid var(--primary); background: var(--primary-soft); font-size: 1.15rem; }
.lc-extra { font-size: .8rem; font-weight: 700; color: var(--primary); }
.lc-meta { font-size: .8rem; color: var(--muted); line-height: 1.5; }
.loyalty-card .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.loyalty-card .actions .btn:last-child { margin-left: auto; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* emoji Twemoji */
img.emoji { display: inline-block; width: 1em; height: 1em; margin: 0 .05em 0 .1em; vertical-align: -0.12em; }

/* ================= LOGO APLIKASI ================= */
.logo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.logo-tile {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); text-align: center;
}
.logo-tile b { font-size: .8rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lt-img, .logo-prev {
  width: 48px; height: 48px; display: grid; place-items: center; font-size: 1.8rem; flex-shrink: 0;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--border); overflow: hidden;
}
.lt-img .app-logo, .logo-prev .app-logo { width: 80%; height: 80%; object-fit: contain; border-radius: 8px; }
.lt-actions { display: flex; gap: 2px; }
.lt-actions .btn { padding: 4px 7px; }
.logo-edit { display: flex; gap: 12px; align-items: flex-start; }
.logo-prev { width: 64px; height: 64px; }

/* ================= INFO APLIKASI (penjelasan) ================= */
.explain-admin-list { display: grid; gap: 10px; }
.explain-row { display: grid; grid-template-columns: 90px 1fr auto; gap: 14px; align-items: center; padding: 12px 14px; }
.xr-thumb {
  width: 90px; height: 64px; border-radius: 8px; background: var(--bg) center / cover no-repeat;
  display: grid; place-items: center; font-size: 1.6rem; border: 1px solid var(--border);
}
.xr-text { font-size: .82rem; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.explain-prev { aspect-ratio: 16 / 9; background-size: contain; }

/* ================= KARTU STAMP (gambar + nama) ================= */
.card-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.card-slot { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.cs-img {
  width: 100%; aspect-ratio: 16 / 10; border-radius: 10px; border: 2px dashed var(--border);
  background: var(--bg) center / contain no-repeat; display: grid; place-items: center; font-size: 1.6rem; color: var(--muted);
}
.cs-actions { display: flex; gap: 6px; }
.name-pos-wrap { border: 1px solid var(--border); border-radius: 12px; padding: 10px; background: var(--bg); margin-bottom: 12px; }
#namePosCanvas { display: block; width: 100%; max-width: 640px; height: auto; margin: 0 auto; cursor: crosshair; border-radius: 8px; }
.name-design { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 12px; align-items: end; }
.name-design input[type=color] { width: 100%; height: 42px; border: 1px solid var(--border); border-radius: 10px; padding: 3px; background: var(--surface); }
.lc-card-img { width: 100%; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); min-height: 80px; }

/* ================= PROMO ================= */
.promo-admin-list { display: grid; gap: 10px; }
.promo-row { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 14px 16px; }
.promo-row .pr-icon { width: 40px; height: 40px; display: grid; place-items: center; font-size: 1.5rem; }
.promo-row .pr-icon .app-logo { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
.promo-row s { color: var(--muted); }
.promo-row .pr-price { color: var(--primary); font-weight: 800; }

@media (max-width: 760px) {
  .recap-totals, .row.three { grid-template-columns: 1fr; }
  .promo-row { grid-template-columns: auto 1fr; }
  .promo-row .actions { grid-column: 1 / -1; }
}

.mobile-bar { display: none; }

/* isi admin tidak boleh lebih lebar dari layar (tabel lebar cukup di-scroll di dalam kartunya) */
.layout > div { min-width: 0; }
.table-wrap { max-width: 100%; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; width: min(270px, 82vw); z-index: 40;
    transform: translateX(-100%); transition: transform .25s; box-shadow: none;
  }
  .sidebar.open { transform: none; box-shadow: 8px 0 30px #0005; }
  /* latar gelap saat menu terbuka — ketuk untuk menutup */
  body.menu-open::after { content: ''; position: fixed; inset: 0; z-index: 35; background: #0007; }
  .mobile-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
  .main { padding: 18px 14px; }
  .plan-row { grid-template-columns: 1fr 1fr auto; }
  .page-head .head-actions { width: 100%; }
  .page-head .head-actions .btn { flex: 1; justify-content: center; }
}

/* Rekapan order di HP: tiap baris jadi kartu kecil yang rapi */
@media (max-width: 640px) {
  .recap-table thead { display: none; }
  .recap-table, .recap-table tbody { display: block; }
  .recap-table tr {
    display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 12px; margin-bottom: 10px;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  }
  .recap-table tbody tr:nth-child(even) { background: var(--surface); }
  .recap-table td { display: block; padding: 0; border: none; text-align: left !important; min-width: 0; white-space: normal !important; }
  .recap-table td::before {
    content: attr(data-label); display: block; font-size: .68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  }
  .recap-table td.wide { grid-column: 1 / -1; }
  .recap-table td.row-actions { grid-column: 1 / -1; }
  .recap-table td.row-actions::before { display: none; }
  .recap-table td.empty { grid-column: 1 / -1; }
  .recap-table .acc { min-width: 0; }
  .recap-totals .tc-val { font-size: 1.15rem; padding: 10px; }
}
