/* AAC Affiliate Hub — tema purple */
:root {
  --bg: #F6F4FA;
  --surface: #FFFFFF;
  --ink: #1E1B2E;
  --muted: #5B5670;
  --line: #E6E1EF;
  --primary: #6D28D9;
  --primary-dark: #5B21B6;
  --primary-soft: #EFE9FC;
  --primary-ink: #4C1D95;
  --comm-bg: #FFF1E6;
  --comm-ink: #9A3412;
  --heart: #E11D48;
  --ok-bg: #DCFCE7; --ok-ink: #166534;
  --warn-bg: #FEF3C7; --warn-ink: #92400E;
  --bad-bg: #FEE2E2; --bad-ink: #991B1B;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(30, 27, 46, .06), 0 4px 16px rgba(30, 27, 46, .04);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid #A78BFA; outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---- butang & input ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 14px; border: 1px solid transparent; font-weight: 800; font-size: 15px; cursor: pointer; text-decoration: none; transition: background .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-soft { background: var(--primary-soft); color: var(--primary-ink); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: #CFC6E0; color: var(--ink); }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 13px; border-radius: 12px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn { width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-size: 14px; font-weight: 700; }
.field .hint { font-size: 12px; color: var(--muted); }
.input, .select, .textarea { width: 100%; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-size: 16px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-soft); }
.textarea { min-height: 96px; resize: vertical; }
.phone-row { display: flex; gap: 8px; }
.phone-row .prefix { padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; }
.phone-row .input { flex: 1; min-width: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: 14px; cursor: pointer; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.choice[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); }

/* ---- susun atur ---- */
.app-header { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.app-header .inner { max-width: 1200px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; letter-spacing: .3px; }
.brand-name { font-weight: 800; font-size: 17px; }
.top-nav { display: none; gap: 4px; }
.top-nav a { padding: 10px 16px; border-radius: 999px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 14px; }
.top-nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary-ink); }
.header-actions { display: flex; gap: 8px; align-items: center; }

.container { max-width: 1200px; margin: 0 auto; padding: 20px 20px 110px; }
.stack { display: flex; flex-direction: column; gap: 18px; }

.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); display: flex; justify-content: space-around; padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 64px; min-height: 50px; justify-content: center; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 700; }
.bottom-nav a[aria-current="page"] { color: var(--primary); }

@media (min-width: 860px) {
  .top-nav { display: flex; }
  .bottom-nav { display: none; }
  .container { padding-bottom: 48px; }
}

/* ---- hero ---- */
.hero { display: grid; gap: 16px; }
.hero-main { background: var(--surface); border-radius: 24px; padding: 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.hero h1 { margin: 0; font-size: 23px; line-height: 1.2; font-weight: 800; }
.hero p { margin: 0; color: var(--muted); }
@media (max-width: 859px) { .hero-main { padding: 18px; gap: 12px; } .hero p { display: none; } .steps { padding: 14px; border-radius: 20px; } }
.search { display: flex; align-items: center; gap: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 0 14px; min-height: 54px; }
.search input { flex: 1; min-width: 0; border: none; outline: none; background: transparent; font-size: 16px; }
.steps { background: var(--primary-soft); border-radius: 24px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.steps h2 { margin: 0; font-size: 16px; color: var(--primary-ink); }
.steps ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.steps li { background: var(--surface); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; }
.steps li span { width: 24px; height: 24px; border-radius: 999px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; }
@media (min-width: 860px) {
  .hero { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
  .hero-main { padding: 32px; }
  .hero h1 { font-size: 38px; }
  .steps { padding: 24px; }
  .steps ol { grid-template-columns: 1fr; }
  .steps li { flex-direction: row; align-items: center; gap: 10px; font-size: 14px; padding: 12px; }
}

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.toolbar .right { display: flex; gap: 8px; align-items: center; }
.toolbar .select { width: auto; min-height: 42px; padding: 0 14px; border-radius: 999px; font-size: 14px; font-weight: 700; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.section-title h2 { margin: 0; font-size: 18px; font-weight: 800; }
.count { font-size: 13px; color: var(--muted); }

/* ---- kad produk ---- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; } }
.card { background: var(--surface); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.thumb { position: relative; aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .tag { position: absolute; left: 8px; bottom: 8px; background: #fff; font-size: 11px; font-weight: 800; padding: 4px 8px; border-radius: 999px; }
.thumb .cat { position: absolute; left: 8px; top: 8px; background: rgba(255,255,255,.9); font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 999px; }
.heart { position: absolute; top: 8px; right: 8px; width: 38px; height: 38px; border-radius: 999px; border: none; background: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex-grow: 1; }
.card-title { font-weight: 800; font-size: 14px; line-height: 1.3; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { font-size: 12px; color: var(--muted); }
.comm { align-self: flex-start; background: var(--comm-bg); color: var(--comm-ink); font-size: 12px; font-weight: 800; padding: 4px 8px; border-radius: 8px; }
.card .btn { margin-top: auto; min-height: 44px; font-size: 13px; border-radius: 12px; padding: 0 10px; }
@media (min-width: 640px) { .card-title { font-size: 16px; } .card-body { padding: 14px 16px 16px; gap: 8px; } .comm { font-size: 13px; } .card .btn { font-size: 14px; } }

.status { display: inline-flex; align-items: center; font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 999px; }
.status.pending { background: var(--warn-bg); color: var(--warn-ink); }
.status.approved { background: var(--primary-soft); color: var(--primary-ink); }
.status.shipped { background: var(--ok-bg); color: var(--ok-ink); }
.status.rejected { background: var(--bad-bg); color: var(--bad-ink); }

.list { display: flex; flex-direction: column; gap: 10px; }
.row-card { background: var(--surface); border-radius: 16px; padding: 14px; display: flex; gap: 12px; align-items: center; box-shadow: var(--shadow); }
.row-card .mini { width: 56px; height: 56px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.row-card .mini img { width: 100%; height: 100%; object-fit: cover; }
.row-card .grow { flex: 1; min-width: 0; }
.row-card .t { font-weight: 800; }
.row-card .s { font-size: 13px; color: var(--muted); }

.panel { background: var(--surface); border-radius: 20px; padding: 20px; box-shadow: var(--shadow); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty .ico { width: 72px; height: 72px; border-radius: 999px; background: var(--primary-soft); display: flex; align-items: center; justify-content: center; }
.empty b { color: var(--ink); font-size: 17px; }
.skeleton { background: linear-gradient(90deg, #EEE9F6 25%, #F6F2FB 50%, #EEE9F6 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 18px; aspect-ratio: 3 / 4; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* ---- lembaran bawah / modal ---- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(30,27,46,.45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 480px; background: var(--surface); border-radius: 24px 24px 0 0; padding: 12px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; max-height: 92vh; overflow-y: auto; }
.sheet .grab { width: 44px; height: 5px; border-radius: 999px; background: var(--line); align-self: center; }
.sheet h2 { margin: 0; font-size: 19px; }
.sheet p { margin: 0; color: var(--muted); }
@media (min-width: 640px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 24px; padding: 24px; } .sheet .grab { display: none; } }

.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 60; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 700; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.18); max-width: calc(100% - 40px); text-align: center; }
@media (min-width: 860px) { .toast { bottom: 32px; } }
.alert { background: var(--bad-bg); color: var(--bad-ink); padding: 12px 14px; border-radius: 12px; font-size: 14px; font-weight: 600; }

.footer-note { font-size: 12px; color: var(--muted); text-align: center; padding: 8px 0; }
.footer-note a { color: var(--muted); }

/* ---- halaman borang (daftar / masuk) ---- */
.auth { min-height: 100vh; display: flex; flex-direction: column; max-width: 460px; margin: 0 auto; padding: 20px; }
.auth-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.progress { display: flex; gap: 6px; margin-top: 16px; }
.progress span { flex: 1; height: 6px; border-radius: 999px; background: #DDD6EA; }
.progress span.on { background: var(--primary); }
.auth-body { flex: 1; padding: 24px 0; display: flex; flex-direction: column; gap: 18px; }
.auth-body h1 { margin: 0 0 6px; font-size: 26px; line-height: 1.2; }
.auth-body .lead { margin: 0; color: var(--muted); }
.auth-foot { display: flex; flex-direction: column; gap: 10px; padding-bottom: 16px; }
.cat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cat-opt { min-height: 58px; display: flex; align-items: center; gap: 10px; padding: 0 12px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; cursor: pointer; text-align: left; }
.cat-opt[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.cat-opt i { width: 28px; height: 28px; border-radius: 10px; flex-shrink: 0; }
.consent { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; }
.consent input { width: 22px; height: 22px; margin: 0; flex-shrink: 0; accent-color: var(--primary); }
.divider { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.done-ico { width: 92px; height: 92px; border-radius: 999px; background: var(--primary-soft); display: flex; align-items: center; justify-content: center; margin: 40px auto 0; }

/* ---- admin ---- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button { min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 800; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--surface); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 28px; font-weight: 800; }
.stat span { font-size: 13px; color: var(--muted); font-weight: 600; }
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: #FBFAFD; }
tr:last-child td { border-bottom: none; }
.form-grid { display: grid; gap: 14px; }
@media (min-width: 720px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid .full { grid-column: 1 / -1; } }
.check { display: flex; gap: 10px; align-items: center; font-weight: 700; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.btn-soft[disabled] { opacity: 1; cursor: default; }
