/* Etalase — stylesheet aplikasi.
   Sumber: docs/reference/preview.html + design system admin Chameleon Cloth (design.md, admin.css).
   Tema putih saja: tidak ada dark mode. Radius ≤ 6px, tanpa bayangan dekoratif.

   Isi:
   1. Token
   2. Dasar
   3. Layout (shell, sidebar, topbar, konten)
   4. Komponen (tombol, input, range, notice, alert, menu pengguna)
   5. Ringkasan & panel
   6. Tabel & daftar muat otomatis
   7. Drawer & dialog
   8. Form
   9. Badge
   10. Toast
   11. Gambar: thumb, galeri, pratinjau postingan, lightbox
   12. Halaman masuk (login / undangan)
   13. Utilitas
   14. Responsif */

/* ============ 1. Token ============ */
:root {
  --bg: #f6f7f8; --surface: #ffffff; --surface-subtle: #f9fafb;
  --text: #18181b; --muted: #6b7280; --muted-strong: #4b5563; --placeholder: #9ca3af;
  --line: #e5e7eb; --line-strong: #d1d5db;
  --primary: #18181b; --primary-hover: #303036; --on-primary: #ffffff;
  --blue: #2563eb;
  --success: #16803b; --success-bg: #ecfdf3;
  --warning: #9a6700; --warning-bg: #fff8c5; --warning-mark: #e08700;
  --danger: #cf222e; --danger-bg: #fff1f2;
  --info-bg: #eef5ff; --accent-soft: #f0f6ff; --focus-ring: rgba(37, 99, 235, .12);
  --sidebar-bg: #f0f1f2; --topbar-bg: rgba(255, 255, 255, .92); --nav-label: #656c76; --count-bg: #e8ebef;
  --row-hover: rgba(0, 0, 0, .04); --row-hover-faint: rgba(0, 0, 0, .035); --hover-soft: #eef0f2;
  --selected-soft: #e8eaed; --checked-line: #73777f; --checked-bg: #f5f6f7; --track-bg: #eceef1;
  --backdrop: rgba(17, 24, 39, .36); --overlay-strong: rgba(24, 24, 27, .88);
  --bar: #d3d6db; --bar-strong: #18181b; --skeleton: #eceef1;
  --icon-invert: 0;
  --radius: 6px; --sidebar: 220px; --topbar: 52px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

/* ============ 2. Dasar ============ */
html { box-sizing: border-box; height: 100%; -webkit-text-size-adjust: 100%; }
*, *::before, *::after { box-sizing: inherit; }
body { height: 100%; margin: 0; background: var(--bg); color: var(--text); font-size: 13px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.ico { width: 15px; height: 15px; display: block; flex: none; filter: invert(var(--icon-invert)); opacity: .72; }
.mono { font-family: var(--mono); }
.skip-link { position: absolute; left: 8px; top: -40px; z-index: 200; padding: 8px 12px; border-radius: 5px; background: var(--primary); color: var(--on-primary); font-size: 12px; font-weight: 600; }
.skip-link:focus { top: 8px; }

/* ============ 3. Layout ============ */
.app-shell { height: 100%; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); overflow: hidden; }
.sidebar { height: 100%; min-height: 0; display: grid; grid-template-rows: auto 1fr auto; background: var(--sidebar-bg); border-right: 1px solid var(--line); }
.sidebar__brand { height: var(--topbar); display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 16px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; letter-spacing: -.01em; }
.brand__mark { width: 22px; height: 22px; border-radius: 5px; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.sidebar__nav { min-height: 0; padding: 12px 8px; overflow-y: auto; }
.nav-group { display: grid; gap: 2px; }
.nav-group + .nav-group { margin-top: 12px; }
.nav-label { margin: 0 8px 5px; color: var(--nav-label); font-size: 10px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.nav-item { min-height: 32px; display: flex; align-items: center; gap: 9px; padding: 0 8px; border-radius: 5px; color: var(--muted-strong); font-size: 12px; }
.nav-item:hover { background: var(--row-hover); color: var(--text); }
.nav-item.is-active { background: var(--surface); color: var(--text); font-weight: 600; }
.nav-item__count { min-width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; margin-left: auto; padding: 0 5px; border-radius: 5px; background: var(--count-bg); color: var(--muted-strong); font-size: 9px; font-weight: 700; font-variant-numeric: tabular-nums; }
.nav-item__count:empty { display: none; }
.nav-item.is-active .nav-item__count { background: var(--primary); color: var(--surface); }
.sidebar__footer { padding: 9px 8px; border-top: 1px solid var(--line); }
.profile { display: flex; align-items: center; gap: 9px; padding: 3px 8px; min-width: 0; }
.profile > span:last-child { min-width: 0; }
.profile strong { display: block; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile small { display: block; color: var(--muted-strong); font-size: 10px; } /* 4.5:1 di atas --sidebar-bg [UI-4] */
.avatar { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 5px; background: var(--selected-soft); color: var(--muted-strong); font-size: 11px; font-weight: 700; }
.avatar--sm { width: 24px; height: 24px; font-size: 10px; }
.sidebar__brand .sidebar__close { display: none; }
.sidebar-backdrop { display: none; }

.app-content { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.app-topbar { min-height: var(--topbar); display: flex; align-items: center; gap: 10px; padding: 6px 22px; background: var(--topbar-bg); border-bottom: 1px solid var(--line); }
.app-topbar__title { min-width: 0; }
.app-topbar__title h1:focus { outline: none; } /* menerima fokus program saat pindah halaman (bukan kontrol) [A11Y-1] */
.breadcrumb { margin: 0 0 1px; color: var(--muted); font-size: 10px; }
.app-topbar h1 { margin: 0; font-size: 14px; letter-spacing: -.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.menu-toggle { display: none; width: 32px; height: 32px; flex: none; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); cursor: pointer; }
.dashboard-main { position: relative; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: 20px 22px 40px; }
.dashboard-main:focus { outline: none; }
.content-section + .content-section { margin-top: 22px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-heading h2 { margin: 0; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.section-heading p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.section-heading__actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.view-loading { padding: 40px 0; color: var(--muted); font-size: 11px; text-align: center; }

/* ============ 4. Komponen ============ */
/* Tombol */
.button { height: 36px; padding: 0 14px; border: 1px solid transparent; border-radius: 5px; cursor: pointer; font-size: 12px; font-weight: 650; display: inline-flex; align-items: center; justify-content: center; gap: 7px; white-space: nowrap; background: transparent; }
.button--primary { background: var(--primary); color: var(--on-primary); }
.button--primary:hover { background: var(--primary-hover); }
.button--primary .ico { filter: invert(1); opacity: 1; }
.button--secondary { border-color: var(--line-strong); background: var(--surface); color: var(--muted-strong); }
.button--secondary:hover { background: var(--surface-subtle); }
.button--danger { border-color: var(--line-strong); background: var(--surface); color: var(--danger); }
.button--danger:hover { background: var(--danger-bg); }
.button--danger-solid { background: var(--danger); color: #fff; }
.button--danger-solid:hover { background: #b31d28; }
.button--text { background: transparent; color: var(--muted-strong); }
.button--text:hover { background: var(--hover-soft); }
.button--sm { height: 30px; padding: 0 10px; font-size: 11px; }
.button--block { width: 100%; }
.button:disabled { opacity: .42; cursor: not-allowed; }
.button[aria-busy="true"] { opacity: .7; cursor: progress; }
.button .spin, .spin { width: 10px; height: 10px; flex: none; display: inline-block; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.icon-button { width: 28px; height: 28px; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: 4px; background: transparent; cursor: pointer; }
.icon-button:hover { background: var(--hover-soft); }
.icon-button:disabled { opacity: .35; cursor: not-allowed; }
.table-link { color: var(--blue); font-size: 11px; font-weight: 600; white-space: nowrap; background: none; border: 0; padding: 0; cursor: pointer; }
.table-link:hover { text-decoration: underline; }

/* Input */
input[type="text"], input[type="search"], input[type="number"], input[type="date"], input[type="datetime-local"], input[type="time"],
input[type="email"], input[type="password"], input[type="url"], select, textarea {
  height: 36px; width: 100%; min-width: 0; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 5px; outline: none;
  background: var(--surface); color: var(--text); font-size: 12px; transition: border-color 120ms ease, box-shadow 120ms ease;
}
input::placeholder, textarea::placeholder { color: var(--muted); } /* 4.8:1 di atas putih; --placeholder hanya untuk garis [UI-4] */
input:hover, select:hover, textarea:hover { border-color: var(--placeholder); }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 2px var(--focus-ring); }
input[readonly] { background: var(--surface-subtle); color: var(--muted-strong); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
input[aria-invalid="true"]:focus { border-color: var(--danger); box-shadow: 0 0 0 2px rgba(207, 34, 46, .12); }
textarea { height: auto; min-height: 118px; padding: 8px 10px; resize: vertical; font-family: var(--mono); font-size: 11.5px; line-height: 1.5; }
input[type="checkbox"], input[type="radio"] { width: 15px; height: 15px; margin: 0; accent-color: var(--primary); cursor: pointer; vertical-align: middle; }

/* Range: grup tombol segmented (filter, pilihan cepat) */
.range { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border-radius: 5px; background: var(--track-bg); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.range::-webkit-scrollbar { display: none; }
.range button { height: 28px; padding: 0 10px; border: 0; border-radius: 4px; background: transparent; color: var(--muted-strong); font-size: 11px; font-weight: 650; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.range button[aria-pressed="true"] { background: var(--surface); color: var(--text); }
.range button:disabled { opacity: .4; cursor: not-allowed; }
.range .n { font-size: 10px; color: var(--muted-strong); font-variant-numeric: tabular-nums; }

/* Notice & alert */
.notice { display: flex; gap: 9px; align-items: flex-start; padding: 9px 12px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--info-bg); color: var(--muted-strong); font-size: 11px; }
.notice .ico { margin-top: 1px; width: 14px; height: 14px; }
.alert { margin: 0; padding: 9px 11px; border-radius: 5px; font-size: 11px; background: var(--surface-subtle); color: var(--muted-strong); }
.alert--info { background: var(--info-bg); color: var(--blue); }
.alert--success { background: var(--success-bg); color: var(--success); }
.alert--warning { background: var(--warning-bg); color: var(--warning); }
.alert--danger { background: var(--danger-bg); color: var(--danger); }
.alert b { font-weight: 650; }

/* Menu pengguna (topbar) */
.user-menu { position: relative; }
.user-menu__button { height: 34px; display: inline-flex; align-items: center; gap: 8px; padding: 0 8px 0 4px; border: 1px solid transparent; border-radius: 5px; background: transparent; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--muted-strong); }
.user-menu__button:hover, .user-menu__button[aria-expanded="true"] { background: var(--hover-soft); }
.user-menu__name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu__caret { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid var(--muted); }
.menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 200px; padding: 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.menu__head { padding: 8px 10px 9px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.menu__head strong { display: block; font-size: 12px; }
.menu__head small { display: block; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.menu__item { width: 100%; min-height: 34px; display: flex; align-items: center; gap: 9px; padding: 0 10px; border: 0; border-radius: 4px; background: none; color: var(--muted-strong); font-size: 12px; text-align: left; cursor: pointer; }
.menu__item:hover { background: var(--hover-soft); color: var(--text); }
/* Fokus keyboard memakai outline biru seperti kontrol lain (latar abu saja hanya 1,14:1) [A11Y-6]. */
.menu__item:focus-visible { background: var(--hover-soft); color: var(--text); outline: 2px solid var(--blue); outline-offset: -2px; }
.menu__item--danger { color: var(--danger); }

/* ============ 5. Ringkasan & panel ============ */
.summary-grid { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.summary-item { min-width: 0; display: grid; gap: 3px; align-content: start; padding: 14px 16px; background: var(--surface); }
.summary-item__label { color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
.summary-item strong { font-size: 18px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.summary-item small { color: var(--muted); font-size: 10px; }
.dashboard-detail-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 14px; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); overflow: hidden; }
.panel__head { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.panel__head h3 { margin: 0; font-size: 12px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.panel__head small { color: var(--muted); font-size: 10px; }
.panel__body { padding: 12px 14px; }
.panel__sub { padding: 10px 14px 4px; color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; border-top: 1px solid var(--line); }
.chart-wrap { position: relative; padding: 12px 14px 8px; }
.chart-wrap canvas { display: block; width: 100%; height: 210px; }
.chart-tip { position: absolute; pointer-events: none; background: var(--overlay-strong); color: #fff; font-size: 10px; font-weight: 600; padding: 4px 7px; border-radius: 4px; white-space: nowrap; transform: translate(-50%, -100%); }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 10px; padding: 9px 14px; }
.bar-row + .bar-row { border-top: 1px solid var(--line); }
.bar-row__name { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 500; min-width: 0; }
.bar-row__val { font-size: 11px; color: var(--muted-strong); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-row__val b { color: var(--text); font-weight: 650; }
.track { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--track-bg); overflow: hidden; }
.track i { display: block; height: 100%; border-radius: 2px; background: var(--bar-strong); }
.attention { list-style: none; margin: 0; padding: 0; }
.attention li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; }
.attention li + li { border-top: 1px solid var(--line); }
.attention strong { display: block; font-size: 12px; font-weight: 600; }
.attention small { display: block; color: var(--muted); font-size: 11px; }
.attention .table-link { margin-left: auto; padding-left: 8px; }
.dot { width: 6px; height: 6px; flex: none; border-radius: 3px; margin-top: 5px; background: var(--warning-mark); }
.dot--danger { background: var(--danger); }
.dot--info { background: var(--blue); }
.dot--success { background: var(--success); }

/* ============ 6. Tabel & daftar muat otomatis ============ */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.search { position: relative; flex: 1 1 260px; max-width: 360px; min-width: 0; }
.search .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; opacity: .5; pointer-events: none; }
.search input { padding-left: 31px; }
.sort-select { width: auto; min-width: 200px; flex: 0 0 auto; }
.bulkbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 5px 6px 5px 12px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--accent-soft); }
.bulkbar strong { font-size: 12px; margin-right: auto; }
.data-table-wrap { position: relative; container-type: inline-size; overflow-x: auto; scroll-padding-inline: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.data-table-wrap--flush { border: 0; border-radius: 0; }
.data-table { width: 100%; border-collapse: collapse; min-width: var(--minw, 860px); }
.data-table th { padding: 8px 10px; background: var(--surface-subtle); color: var(--muted); font-size: 10px; font-weight: 650; text-align: left; white-space: nowrap; }
.data-table td { height: 48px; padding: 6px 10px; border-top: 1px solid var(--line); color: var(--muted-strong); font-size: 11px; vertical-align: middle; }
.data-table thead + tbody tr:first-child td { border-top: 1px solid var(--line); }
.data-table .numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table tbody tr.row { cursor: pointer; }
.data-table tbody tr.row:hover td { background: var(--row-hover-faint); }
.data-table tbody tr.is-selected td { background: var(--accent-soft); }
.data-table tr.group td { height: auto; padding: 6px 10px; background: var(--surface-subtle); color: var(--muted); font-size: 10px; font-weight: 650; }
.data-table .empty td { height: auto; padding: 36px 16px; text-align: center; color: var(--muted); }
/* Tabel lebih lebar dari layar HP: pesan kosong/error menempel di area yang terlihat, bukan di tengah tabel [UI-2]. */
.data-table tr.empty td { padding-left: 0; padding-right: 0; }
.data-table tr.empty .empty-state { position: sticky; left: 0; width: min(100%, calc(100vw - 34px)); width: min(100%, 100cqi); }
.data-table__actions { width: 44px; text-align: right !important; white-space: nowrap; }
.col-check { width: 36px; padding-right: 0 !important; }
.sort { border: 0; background: none; padding: 0; color: inherit; font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.sort:hover { color: var(--text); }
.sort .ar { font-size: 9px; opacity: .6; }
.product-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.product-cell .pc { min-width: 0; display: grid; }
.product-cell strong { color: var(--text); font-size: 11px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 360px; }
.product-cell small { color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 360px; }
.product-cell small.err { color: var(--danger); }
.sku-code { font-family: var(--mono); font-size: 10px; color: var(--muted-strong); white-space: nowrap; }
.channels { display: inline-flex; gap: 6px; align-items: center; }
.channels .ico { width: 14px; height: 14px; opacity: .8; }
.ref { display: inline-flex; align-items: center; gap: 6px; }
.ref .ico { width: 13px; height: 13px; }
.feed-end { min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 11px; text-align: center; }
.feed-end--error { color: var(--danger); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 2px 0; color: var(--muted); font-size: 11px; }

/* Skeleton (memuat) */
.skeleton-row td { height: 48px; }
.sk { display: block; height: 10px; border-radius: 3px; background: var(--skeleton); animation: pulse 1.4s ease-in-out infinite; }
.sk--w40 { width: 40%; } .sk--w60 { width: 60%; } .sk--w80 { width: 80%; }
@keyframes pulse { 50% { opacity: .55; } }

/* Status kosong & error */
.empty-state { display: grid; justify-items: center; gap: 6px; padding: 32px 16px; text-align: center; color: var(--muted); }
.empty-state .ico { width: 22px; height: 22px; opacity: .45; }
.empty-state strong { color: var(--text); font-size: 12px; font-weight: 650; }
.empty-state p { margin: 0; max-width: 46ch; font-size: 11px; line-height: 1.5; }
.empty-state .button { margin-top: 6px; }
.error-state strong { color: var(--danger); }

/* ============ 7. Drawer & dialog ============ */
.drawer-wrap { position: fixed; inset: 0; z-index: 50; }
.drawer-backdrop { position: absolute; inset: 0; background: var(--backdrop); animation: fade .16s ease; }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(460px, 100%); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--surface); border-left: 1px solid var(--line); animation: slide .2s cubic-bezier(.2, .8, .2, 1); }
.drawer--wide { width: min(640px, 100%); }
.drawer__head { min-height: var(--topbar); display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px 8px 18px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); border-bottom: 1px solid var(--line); }
.drawer__head > div { min-width: 0; }
.drawer__head > .icon-button, .drawer__head [data-close] { flex: none; } /* × tidak menyusut oleh judul panjang [A11Y-5] */
.drawer__head h2 { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.drawer__body { overflow-y: auto; overscroll-behavior: contain; padding: 16px 18px; display: grid; grid-auto-rows: max-content; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
.drawer__foot { display: flex; gap: 6px; justify-content: flex-end; align-items: center; flex-wrap: wrap; padding: 10px 18px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
.drawer__foot:empty { display: none; }
.drawer__foot .hint { margin-right: auto; color: var(--muted); font-size: 11px; }
.dialog-wrap { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; }
.dialog-wrap .drawer-backdrop { z-index: 0; }
.dialog { position: relative; z-index: 1; width: min(400px, 100%); display: grid; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); animation: fade .16s ease; }
.dialog h2 { margin: 0; font-size: 14px; }
.dialog p { margin: 0; color: var(--muted-strong); font-size: 12px; line-height: 1.5; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
@keyframes slide { from { transform: translateX(16px); opacity: .5; } }
@keyframes sheet { from { transform: translateY(24px); opacity: .5; } }
@keyframes fade { from { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ 8. Form ============ */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field .label { font-size: 11px; font-weight: 600; color: var(--muted-strong); }
.field__hint { color: var(--muted); font-size: 10.5px; }
.field__error { margin: 0; color: var(--danger); font-size: 11px; }
.field__error:empty { display: none; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.input-group { position: relative; display: flex; }
.input-group input { padding-right: 40px; }
.input-group .icon-button { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.choices { display: grid; gap: 6px; }
.choices--row { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.choice { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 5px; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--checked-line); background: var(--checked-bg); }
.choice:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.choice .ico { width: 16px; height: 16px; }
.choice strong { display: block; font-size: 12px; font-weight: 600; }
.choice small { display: block; color: var(--muted); font-size: 10px; }
.choice:has(input:checked) small { color: var(--muted-strong); } /* 4,47:1 → ≥ 6,9:1 di --checked-bg [A11Y-7] */
.vars { display: flex; gap: 4px; flex-wrap: wrap; }
.var { height: 24px; padding: 0 7px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-subtle); font-family: var(--mono); font-size: 10px; color: var(--muted-strong); cursor: pointer; }
.var:hover { border-color: var(--line-strong); color: var(--text); }
.preview-box { white-space: pre-wrap; overflow-wrap: anywhere; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-subtle); font-size: 11.5px; line-height: 1.5; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.facts > div { min-width: 0; display: grid; gap: 2px; padding: 8px 10px; background: var(--surface); }
.facts span { font-size: 10px; color: var(--muted); font-weight: 600; }
.facts b { font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.facts .wide { grid-column: 1 / -1; }
.plan { border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.plan > div { display: flex; gap: 10px; align-items: center; padding: 7px 10px; font-size: 11px; }
.plan > div + div { border-top: 1px solid var(--line); }
.plan .when { font-family: var(--mono); color: var(--muted); width: 116px; flex: none; font-size: 10.5px; }
.plan .what { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.media-grid > * { aspect-ratio: 1; max-width: 100%; border-radius: 4px; border: 1px solid var(--line); background: var(--surface-subtle); display: grid; place-items: center; align-content: center; gap: 4px; font-size: 10px; color: var(--muted); text-align: center; }
.media-grid > .has { background: var(--info-bg); border-color: transparent; }
.media-grid label { border-style: dashed; cursor: pointer; }
.media-grid label:hover { border-color: var(--line-strong); color: var(--text); }
.inline { display: flex; gap: 6px; align-items: center; }
.dropzone { display: grid; justify-items: center; gap: 6px; padding: 28px 16px; border: 1px dashed var(--line-strong); border-radius: 6px; text-align: center; cursor: pointer; color: var(--muted); font-size: 11px; }
.dropzone strong { color: var(--text); font-size: 12px; }
.dropzone .ico { width: 20px; height: 20px; }
.dropzone.is-over { border-color: var(--blue); background: var(--accent-soft); }
.steps { display: flex; gap: 4px; }
.steps i { height: 3px; flex: 1; border-radius: 2px; background: var(--track-bg); }
.steps i.on { background: var(--primary); }
.map-table { width: 100%; border-collapse: collapse; border: 1px solid var(--line); border-radius: 6px; }
.map-table td, .map-table th { padding: 6px 8px; border-top: 1px solid var(--line); font-size: 11px; text-align: left; }
.map-table th { border-top: 0; background: var(--surface-subtle); color: var(--muted); font-size: 10px; font-weight: 650; }
.map-table select { height: 30px; font-size: 11px; }
.map-table .ex { color: var(--muted); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checklist label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; cursor: pointer; }
.checklist label + label { border-top: 1px solid var(--line); }
.checklist input { margin-top: 1px; }
.checklist strong { display: block; font-size: 12px; font-weight: 600; }
.checklist small { display: block; color: var(--muted); font-size: 11px; }
.checklist label:has(input:checked) strong { color: var(--muted); text-decoration: line-through; }

/* ============ 9. Badge ============ */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 4px; font-size: 10px; font-weight: 650; white-space: nowrap; background: var(--surface-subtle); color: var(--muted-strong); }
.badge--neutral { background: var(--track-bg); color: var(--muted-strong); }
.badge--success { background: var(--success-bg); color: var(--success); }
.badge--warning { background: var(--warning-bg); color: var(--warning); }
.badge--danger { background: var(--danger-bg); color: var(--danger); }
.badge--info { background: var(--info-bg); color: var(--blue); }
.badge--spin::before { content: ""; width: 7px; height: 7px; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }

/* ============ 10. Toast ============ */
.toast-stack { position: fixed; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); right: 18px; z-index: 100; width: min(calc(100% - 36px), 340px); display: grid; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 11px; align-items: center; padding: 10px 6px 10px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); animation: fade .16s ease; }
.toast__indicator { align-self: stretch; border-radius: 0 3px 3px 0; background: var(--success); }
.toast--info .toast__indicator { background: var(--blue); }
.toast--warning .toast__indicator { background: var(--warning-mark); }
.toast--danger .toast__indicator { background: var(--danger); }
.toast--neutral .toast__indicator { background: var(--muted); }
.toast__text { min-width: 0; font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.toast__text small { display: block; color: var(--muted); font-weight: 400; font-size: 11px; }
.toast__actions { display: flex; align-items: center; gap: 2px; }
.toast__close { width: 26px; height: 26px; font-size: 16px; line-height: 1; color: var(--muted); }

/* ============ 11. Gambar ============ */
.thumb, .thumb-ph { width: 34px; height: 34px; flex: none; overflow: hidden; border-radius: 4px; background: var(--surface-subtle); border: 1px solid var(--line); display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; padding: 0; }
.thumb .ico, .thumb-ph .ico { width: 14px; height: 14px; opacity: .4; }
.thumb img, .thumb-ph img { width: 100%; height: 100%; display: block; object-fit: cover; }
.thumb.has-img, .thumb-ph.has-img { background: var(--surface); }
.thumb.has-media, .thumb-ph.has-media { background: var(--info-bg); border-color: transparent; }
button.thumb, button.thumb-ph { cursor: zoom-in; }
.data-table .thumb, .data-table .thumb-ph, .thumb--md { width: 44px; height: 44px; }
.thumb.sm, .thumb-ph.sm, .data-table .thumb.sm, .data-table .thumb-ph.sm { width: 32px; height: 32px; }
.img-pop { position: fixed; z-index: 60; width: 260px; height: 260px; padding: 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); pointer-events: none; }
.img-pop img { width: 100%; height: 100%; display: block; object-fit: contain; border-radius: 4px; }
.gallery { display: grid; gap: 8px; }
.gallery__main { position: relative; width: 100%; max-width: 100%; aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-subtle); cursor: zoom-in; padding: 0; }
.gallery__main.is-empty { cursor: default; }
.gallery__main.is-over { border-color: var(--blue); background: var(--accent-soft); }
.gallery__main img { width: 100%; height: 100%; display: block; object-fit: contain; }
.gallery__empty { display: grid; justify-items: center; gap: 6px; max-width: 260px; padding: 16px; color: var(--muted); font-size: 11px; text-align: center; }
.gallery__empty .ico { width: 22px; height: 22px; opacity: .45; }
.gallery__badge { position: absolute; left: 8px; top: 8px; padding: 2px 6px; border-radius: 4px; background: var(--overlay-strong); color: #fff; font-size: 10px; font-weight: 650; }
.gallery__strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.gallery__strip > * { width: 60px; height: 60px; flex: none; padding: 0; overflow: hidden; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-subtle); cursor: pointer; }
.gallery__strip > button { grid-template: minmax(0, 1fr) / minmax(0, 1fr); } /* foto 4:5 utuh, tidak terpotong [UI-5] */
.gallery__strip button[aria-pressed="true"] { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.gallery__strip img { width: 100%; height: 100%; display: block; object-fit: cover; }
.gallery__strip label { border-style: dashed; color: var(--muted); font-size: 10px; gap: 2px; align-content: center; }
.gallery__strip label:hover { border-color: var(--line-strong); color: var(--text); }
.gallery__meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 10px; }
.post-mock { overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.post-mock__head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 11px; font-weight: 650; }
.post-mock__head .avatar { width: 24px; height: 24px; font-size: 10px; }
.post-mock__img { width: 100%; max-width: 100%; aspect-ratio: 4 / 5; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); overflow: hidden; place-items: center; background: var(--surface-subtle); border-block: 1px solid var(--line); }
.post-mock__img.fb { aspect-ratio: 1; }
.post-mock__img img { width: 100%; height: 100%; display: block; object-fit: cover; }
.post-mock__cap { padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11.5px; line-height: 1.5; }
/* Lightbox sengaja gelap (latar foto), bukan tema gelap. */
.lightbox { position: fixed; inset: 0; z-index: 90; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: #0b0c0e; color: #fff; animation: fade .16s ease; }
.lightbox__bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top, 0px)); font-size: 12px; }
.lightbox__bar strong { min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox__stage { min-height: 0; display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; align-items: center; }
.lightbox__img { min-height: 0; min-width: 0; height: 100%; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; overflow: hidden; padding: 8px 0; box-sizing: border-box; } /* foto selalu muat di layar [UI-1] */
.lightbox__stage img { max-width: 100%; max-height: 100%; margin: auto; display: block; object-fit: contain; }
.lightbox button { width: 40px; height: 40px; flex: none; display: grid; place-items: center; margin: auto; padding: 0; border: 1px solid rgba(255, 255, 255, .18); border-radius: 5px; background: rgba(255, 255, 255, .06); color: #fff; font-size: 18px; cursor: pointer; }
.lightbox__bar button { margin: 0 0 0 auto; } /* tombol Tutup di pojok kanan [UI-1] */
.lightbox button:hover { background: rgba(255, 255, 255, .14); }
.lightbox button:disabled { opacity: .3; cursor: not-allowed; }
.lightbox__foot { padding: 10px 14px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); text-align: center; color: rgba(255, 255, 255, .7); font-size: 11px; }

/* ============ 12. Halaman masuk ============ */
.auth-page { min-height: 100%; display: grid; grid-template-rows: 1fr auto; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.login-panel { width: min(100%, 376px); padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.login-panel__brand { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-weight: 650; }
.login-panel__title { margin: 0 0 18px; font-size: 15px; font-weight: 650; line-height: 1.3; letter-spacing: -.015em; }
.login-panel__lead { margin: -10px 0 16px; color: var(--muted); font-size: 12px; }
.login-form { display: grid; gap: 15px; }
.login-form .field > label { font-size: 12px; }
.auth-footer { padding: 14px 20px 18px; color: var(--muted); font-size: 11px; text-align: center; }

/* ============ 13. Utilitas ============ */
.muted { color: var(--muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.stack { display: grid; gap: 8px; }
.row-flex { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ============ 14. Responsif ============ */
@media (max-width: 1100px) {
  .summary-grid { --cols: 3 !important; }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; width: min(260px, 85vw); transform: translateX(-100%); transition: transform .2s ease; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .sidebar.is-open { transform: none; }
  .sidebar-backdrop.is-open { display: block; position: fixed; inset: 0; z-index: 35; background: var(--backdrop); }
  .menu-toggle, .sidebar__brand .sidebar__close { display: inline-grid; }
  .sidebar__brand .sidebar__close { width: 36px; height: 36px; }
  .nav-item { min-height: 40px; }
  .dashboard-detail-grid { grid-template-columns: minmax(0, 1fr); }
  .summary-grid { --cols: 2 !important; }
  .summary-item:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .app-topbar { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .dashboard-main { padding: 16px max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px)); }
  .user-menu__name { display: none; }
  .user-menu__button { height: 36px; padding: 0 6px 0 4px; }
  .section-heading__actions { width: 100%; }
  .section-heading__actions .button { flex: 1; }
  .search { max-width: none; flex-basis: 100%; }
  .sort-select { flex: 1 1 auto; min-width: 0; }
  .field-row { grid-template-columns: 1fr; }
  .button { min-height: 36px; }
  .button--sm { height: 36px; }
  .icon-button { width: 36px; height: 36px; }
  /* Target sentuh ≥ 36px [UX-4][UI-3] */
  .menu-toggle { width: 36px; height: 36px; }
  .range button { height: 36px; }
  .var { height: 36px; padding: 0 10px; }
  .table-link { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; min-width: 36px; } /* [A11Y-5] */
  .col-check input[type="checkbox"] { width: 18px; height: 18px; }
  .data-table--sticky .col-check { position: sticky; left: 0; z-index: 1; background: var(--surface); }
  .data-table--sticky .col-product { position: sticky; left: 36px; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--line); }
  .data-table--sticky th.col-check, .data-table--sticky th.col-product { background: var(--surface-subtle); }
  .data-table--sticky tr.is-selected .col-check, .data-table--sticky tr.is-selected .col-product { background: var(--accent-soft); }
  .product-cell strong, .product-cell small { max-width: 170px; }
  /* Drawer menjadi sheet bawah */
  .drawer, .drawer--wide { top: auto; left: 0; width: 100%; max-height: calc(100% - 24px - env(safe-area-inset-top, 0px)); border-left: 0; border-top: 1px solid var(--line); border-radius: 6px 6px 0 0; animation: sheet .2s cubic-bezier(.2, .8, .2, 1); }
  .drawer__head { padding-top: 8px; }
  .toast-stack { top: auto; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); right: 16px; width: calc(100% - 32px); }
  /* Saat sheet bawah terbuka, posisi toast dihitung ui.mjs (positionToasts) agar tidak menutupi kepala/kaki sheet. */
  .lightbox__stage { grid-template-columns: 36px minmax(0, 1fr) 36px; }
  .lightbox button { width: 36px; height: 36px; }
  .auth-main { align-items: start; padding: 42px 16px 24px; }
}
@media (max-width: 480px) {
  .summary-item strong { font-size: 16px; }
  .media-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (hover: none) {
  .img-pop { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
