/* PSTRAK dashboards (shopper admin + platform owner). Brand: black, white, orange accent. */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --ink: #111111;
  --ink-2: #2A2A2A;
  --muted: #6E6E73;
  --line: #E7E5E1;
  --line-2: #D6D3CE;
  --bg: #F6F5F2;
  --card: #FFFFFF;
  --accent: #FF6A3D;
  --accent-soft: #FFF0EA;
  --ok: #157F4B;
  --ok-soft: #E7F5EE;
  --warn: #9A6200;
  --warn-soft: #FFF4DE;
  --bad: #C0362C;
  --bad-soft: #FDECEA;
  --info: #2457C5;
  --info-soft: #EAF0FD;
  --r: 12px;
  --r-sm: 8px;
  --font: 'Inter', 'IBM Plex Sans Arabic', system-ui, -apple-system, sans-serif;
  --font-ar: 'IBM Plex Sans Arabic', 'Inter', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
[dir=rtl] body, body[dir=rtl] { font-family: var(--font-ar); }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
.num, .money { font-variant-numeric: tabular-nums; font-family: 'Inter', var(--font-ar); }

/* layout */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #fff; padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.side .brand b { font-family: Inter; font-weight: 800; letter-spacing: .5px; font-size: 17px; }
.side .shopname { font-size: 12px; color: #A8A8AD; padding: 0 8px 14px; border-bottom: 1px solid #2A2A2A; margin-bottom: 10px; }
.side a.nav { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); text-decoration: none; color: #D7D7DB; font-weight: 500; }
.side a.nav:hover { background: #1E1E1E; color: #fff; }
.side a.nav.on { background: #fff; color: var(--ink); }
.side a.nav .ic { width: 18px; text-align: center; opacity: .9; }
.side .spacer { flex: 1; }
.side .foot { font-size: 12px; color: #8E8E93; padding: 10px 8px 0; border-top: 1px solid #2A2A2A; }
.main { padding: 26px 32px 60px; min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.top h1 { font-size: 22px; margin: 0; font-weight: 700; letter-spacing: -.2px; }
.top .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.grow { flex: 1; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.stack > * + * { margin-top: 14px; }
.hide { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt { margin-top: 14px; }
.right { text-align: end; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.card h2, .card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.card.flush { padding: 0; overflow: hidden; }
.card .card-h { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card .card-h h2 { margin: 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.stat .k { color: var(--muted); font-size: 12px; font-weight: 500; }
.stat .v { font-size: 24px; font-weight: 700; margin-top: 4px; font-family: Inter, var(--font-ar); letter-spacing: -.3px; }
.stat .v small { font-size: 13px; color: var(--muted); font-weight: 500; margin-inline-start: 4px; }
.stat.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.stat.dark .k { color: #A8A8AD; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: #fff; cursor: pointer; font-weight: 600; font-size: 13px; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.primary:hover { background: #000; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #EFEDE9; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.wa { background: #1FAF54; border-color: #1FAF54; color: #fff; }

/* forms */
label.f { display: block; }
label.f > span { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.in, select.in, textarea.in { width: 100%; height: 40px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: #fff; padding: 0 12px; outline: none; transition: border-color .15s; }
textarea.in { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.in:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(17,17,17,.06); }
.in.err { border-color: var(--bad); }
.ferr { color: var(--bad); font-size: 12px; margin-top: 4px; }
.form { display: grid; gap: 12px; }
.form.cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 3px; background: #fff; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 12px; color: var(--muted); }
.seg button.on { background: var(--ink); color: #fff; }
.search { position: relative; }
.search .in { padding-inline-start: 34px; }
.search::before { content: '⌕'; position: absolute; inset-inline-start: 12px; top: 8px; color: var(--muted); font-size: 16px; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: start; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #FBFAF8; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #FBFAF8; }
.tbl .num { text-align: end; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: #EFEDE9; color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.badge.plain::before { display: none; }
.b-requested { background: #F1EFEC; color: #5B5752; }
.b-purchased { background: var(--info-soft); color: var(--info); }
.b-in_transit { background: #F2ECFB; color: #6A3FB5; }
.b-arrived { background: var(--warn-soft); color: var(--warn); }
.b-out_for_delivery { background: var(--accent-soft); color: #C2461E; }
.b-delivered { background: var(--ok-soft); color: var(--ok); }
.b-cancelled { background: var(--bad-soft); color: var(--bad); }
.b-trial { background: var(--info-soft); color: var(--info); }
.b-active { background: var(--ok-soft); color: var(--ok); }
.b-trial_ended, .b-expired { background: var(--warn-soft); color: var(--warn); }
.b-suspended, .b-cancelled, .b-rejected { background: var(--bad-soft); color: var(--bad); }
.b-new { background: var(--accent-soft); color: #C2461E; }
.b-contacted { background: var(--info-soft); color: var(--info); }
.b-approved { background: var(--ok-soft); color: var(--ok); }

/* modal & toast */
.overlay { position: fixed; inset: 0; background: rgba(17,17,17,.45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 560px; padding: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.modal.wide { max-width: 820px; }
.modal h2 { margin: 0 0 16px; font-size: 18px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
#toast { position: fixed; bottom: 22px; inset-inline-start: 50%; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 8px; align-items: center; }
[dir=rtl] #toast { transform: translateX(50%); }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 500; box-shadow: 0 10px 30px rgba(0,0,0,.2); animation: tin .2s ease; }
.toast.bad { background: var(--bad); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

/* misc */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.banner { border-radius: var(--r); padding: 12px 16px; display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; font-weight: 500; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.info { background: var(--info-soft); color: var(--info); }
.pill-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.pill-tabs button { border: 1px solid var(--line-2); background: #fff; border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: 12px; cursor: pointer; }
.pill-tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.pill-tabs button .c { opacity: .6; margin-inline-start: 4px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.thumb { width: 44px; height: 44px; border-radius: 8px; background: #F1EFEC; object-fit: cover; flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); font-weight: 700; font-size: 12px; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; background: #fff; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; font-family: Inter; font-weight: 800; font-size: 13px; letter-spacing: -.5px; position: relative; flex: none; }
.logo-mark::after { content: ''; position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); right: 4px; bottom: 7px; }
.logo-mark.dark { background: var(--ink); color: #fff; }
.spin { width: 18px; height: 18px; border: 2px solid var(--line-2); border-top-color: var(--ink); border-radius: 50%; animation: sp .7s linear infinite; display: inline-block; }
@keyframes sp { to { transform: rotate(360deg); } }
.loading { display: flex; justify-content: center; padding: 60px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.chip { display: inline-flex; padding: 3px 8px; border-radius: 6px; background: #F1EFEC; font-size: 12px; font-weight: 500; }
.mobile-top { display: none; }

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  [dir=rtl] .side { transform: translateX(100%); }
  .side.open { transform: none !important; }
  .mobile-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 30; }
  .main { padding: 18px 14px 80px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .split, .form.cols { grid-template-columns: 1fr; }
  .tbl .hide-m { display: none; }
}
