:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #16181d;
  --muted: #5f6672;
  --line: #e3e6eb;
  --brand: #d7262d;
  --brand-ink: #ffffff;
  --accent: #1f4fd8;
  --good: #137a3d;
  --warn: #9a5b00;
  --bad: #b3261e;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}
a { color: var(--accent); }
button, input, select { font: inherit; }

.hidden { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  background: var(--ink);
  color: #fff;
  padding: 0 20px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--brand); color: var(--brand-ink);
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
}
.brand small { font-weight: 500; color: #b9bec8; margin-left: 4px; }
.topbar .who { display: flex; align-items: center; gap: 12px; font-size: 14px; color: #d4d7dd; }
.topbar .who button { background: transparent; color: #fff; border: 1px solid #4a4f59; border-radius: 7px; padding: 6px 12px; cursor: pointer; }
.topbar .who button:hover { background: #2b2f37; }

/* ---------- layout ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.page-head h1 { font-size: 24px; margin: 0 0 2px; }
.page-head p { margin: 0; color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card + .card { margin-top: 16px; }
.card h2 { font-size: 17px; margin: 0 0 12px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 26px 0 10px; font-weight: 600; }

/* ---------- controls ---------- */
.range { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
select, input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=tel], input[type=search] {
  border: 1px solid #cfd4dc; border-radius: 8px; padding: 9px 11px; background: #fff; color: var(--ink); min-width: 0;
}
select:focus, input:focus, textarea:focus { outline: 2px solid #b8c7f3; border-color: var(--accent); }
.btn {
  border: 1px solid transparent; border-radius: 8px; padding: 9px 15px; cursor: pointer; font-weight: 600;
  background: var(--accent); color: #fff;
}
.btn:hover { filter: brightness(.95); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.secondary { background: #fff; color: var(--ink); border-color: #cfd4dc; }
.btn.danger { background: #fff; color: var(--bad); border-color: #efc6c3; }
.btn.small { padding: 5px 10px; font-size: 13px; font-weight: 500; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .label { font-size: 13px; color: var(--muted); }
.kpi .value { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- campaign list ---------- */
.campaigns { display: grid; gap: 12px; }
.campaign {
  display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: center;
  cursor: pointer; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; color: inherit;
}
.campaign:hover { border-color: #b8c7f3; }
a.campaign { text-decoration: none; }
.campaign .go { color: var(--muted); font-size: 13px; }
.campaign:hover .go { color: var(--accent); }
.campaign.active { border-color: var(--accent); box-shadow: 0 0 0 2px #dbe4fb; }
.campaign .name { font-weight: 650; font-size: 16px; }
.campaign .meta { color: var(--muted); font-size: 13px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.campaign .nums { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 6px; }
.campaign .num .k { font-size: 12px; color: var(--muted); }
.campaign .num .v { font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------- logo (set by the admin) ---------- */
.brand-pending [data-brand] { visibility: hidden; }
.brand-logo { display: block; height: 32px; width: auto; max-width: 180px; object-fit: contain; }
.login-box .brand-logo { height: 44px; max-width: 240px; }
.brand-preview {
  display: flex; align-items: center; gap: 10px; font-weight: 700; min-height: 64px;
  padding: 12px 14px; margin-bottom: 14px; border-radius: 8px; background: var(--ink); color: #fff;
}
.help { display: block; font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.field .help { margin: 0; font-size: 12px; }
#brandForm { margin-top: 16px; }

/* ---------- campaign page ---------- */
.back-link { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 14px; font-weight: 600; text-decoration: none; }
.back-link:hover { text-decoration: underline; }
.campaign-head { display: flex; align-items: center; gap: 16px; min-width: 0; }
.campaign-head .meta { color: var(--muted); font-size: 13px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.hero-thumb { width: 88px; height: 88px; cursor: zoom-in; }
.hero-thumb.no-pic { cursor: default; }

/* ---------- ad pictures ---------- */
.campaign.has-thumb { grid-template-columns: auto 1fr auto; }
.campaign.has-thumb .card-thumb { grid-row: 1 / span 2; }
.campaign.has-thumb .nums { grid-column: 2 / -1; }
.thumb {
  position: relative; flex: none; overflow: hidden; border-radius: 8px;
  background: #eef0f3; border: 1px solid var(--line);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-thumb { width: 104px; height: 104px; }
.row-thumb { width: 52px; height: 52px; cursor: zoom-in; }
.thumb.no-pic { display: grid; place-items: center; cursor: default; }
.thumb.no-pic span { font-size: 11px; color: var(--muted); text-align: center; padding: 4px; }
.row-thumb.no-pic span { display: none; }
.thumb .play {
  position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border-radius: 50%; background: rgba(0, 0, 0, .55);
}
.thumb .play::after {
  content: ""; position: absolute; left: 13px; top: 10px;
  border-left: 11px solid #fff; border-top: 7px solid transparent; border-bottom: 7px solid transparent;
}
.row-thumb .play { width: 22px; height: 22px; margin: -11px 0 0 -11px; }
.row-thumb .play::after { left: 8px; top: 6px; border-left-width: 8px; border-top-width: 5px; border-bottom-width: 5px; }
.thumb .more {
  position: absolute; right: 4px; bottom: 4px; font-size: 11px; font-weight: 600;
  background: rgba(0, 0, 0, .65); color: #fff; border-radius: 999px; padding: 1px 7px;
}
.ad-cell { display: flex; align-items: center; gap: 12px; min-width: 200px; }

.viewer { position: fixed; inset: 0; z-index: 50; background: rgba(10, 12, 16, .78); display: grid; place-items: center; padding: 20px; }
.viewer-box { position: relative; background: #fff; border-radius: 12px; padding: 10px; max-width: min(92vw, 640px); }
.viewer-box img { display: block; max-width: 100%; max-height: 78vh; border-radius: 8px; margin: 0 auto; }
.viewer-name { font-size: 14px; color: var(--muted); padding: 8px 4px 2px; }
.viewer-close {
  position: absolute; top: -14px; right: -14px; width: 32px; height: 32px; border-radius: 50%;
  border: 0; background: #fff; color: var(--ink); font-size: 20px; line-height: 1; cursor: pointer;
  box-shadow: var(--shadow);
}

.status { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #eef0f3; color: var(--muted); }
.status.ACTIVE { background: #e3f3e8; color: var(--good); }
.status.PAUSED, .status.CAMPAIGN_PAUSED, .status.ADSET_PAUSED { background: #fdf1dc; color: var(--warn); }
.status.DISAPPROVED, .status.WITH_ISSUES, .status.PENDING_BILLING_INFO { background: #fbe4e2; color: var(--bad); }
.status.PENDING_REVIEW, .status.IN_PROCESS, .status.PREAPPROVED { background: #e8eefc; color: #1d3a8a; }

/* ---------- chart ---------- */
.chart-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .axis text { font-size: 11px; fill: var(--muted); }
.chart .grid line { stroke: var(--line); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; white-space: normal; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; background: #fafbfc; }
tr:last-child td { border-bottom: 0; }

/* ---------- messages ---------- */
.notice { padding: 12px 14px; border-radius: 8px; background: #eef3ff; color: #1d3a8a; font-size: 14px; }
.notice.error { background: #fbe9e7; color: var(--bad); }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.loading { color: var(--muted); padding: 20px 0; }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #16181d 0%, #2a2e36 55%, #3a1517 100%); }
.login-box { width: 100%; max-width: 380px; background: #fff; border-radius: 14px; padding: 28px; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.login-box .brand { color: var(--ink); margin-bottom: 18px; }
.login-box h1 { font-size: 21px; margin: 0 0 4px; }
.login-box p { color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; }
.field input { width: 100%; }
.login-box .btn { width: 100%; padding: 11px; }
.form-msg { min-height: 20px; font-size: 14px; color: var(--bad); margin-top: 10px; }

/* ---------- admin ---------- */
.grid-2 { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.client-row { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: #fff; }
.client-row + .client-row { margin-top: 10px; }
.client-row .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.client-row .name { font-weight: 650; }
.client-row .email { color: var(--muted); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #eef3ff; color: #1d3a8a; border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 13px; }
.chip button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 5px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.add-campaign { display: flex; gap: 6px; flex-wrap: wrap; }
.add-campaign select, .add-campaign input { flex: 1 1 180px; }
.inactive { opacity: .6; }

@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .wrap { padding: 16px 16px 50px; }
  .topbar { padding: 0 16px; }
  .brand small { display: none; }
  .topbar .who { gap: 8px; }
  .topbar .who button { padding: 5px 9px; font-size: 13px; white-space: nowrap; }
  #userName { display: none; }
  .topbar .brand-logo { height: 28px; max-width: 110px; }
  .kpi .value { font-size: 20px; }
  .card-thumb { width: 72px; height: 72px; }
  .campaign.has-thumb { grid-template-columns: auto 1fr; }
  .campaign.has-thumb .card-thumb { grid-row: auto; }
  .campaign.has-thumb .go { display: none; }
  .hero-thumb { width: 64px; height: 64px; }
  .page-head h1 { font-size: 21px; }
  .campaign.has-thumb .nums { grid-column: 1 / -1; }
}

/* ---------- app navigation ---------- */
/* Desktop: fixed menu on the left, under the top bar. */
.app-nav {
  position: fixed; top: 58px; left: 0; bottom: 0; width: 224px; z-index: 9;
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 20px 12px; display: flex; flex-direction: column; gap: 4px;
}
.nav-title { font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); padding: 0 12px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px;
  color: var(--ink); text-decoration: none; font-weight: 550; font-size: 15px;
}
.nav-item svg { width: 21px; height: 21px; flex: none; color: var(--muted); }
.nav-item:hover { background: #f1f3f6; }
.nav-item.active { background: #eef3ff; color: var(--accent); }
.nav-item.active svg { color: var(--accent); }
.nav-item.nav-admin { margin-top: auto; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; padding-top: 14px; }
body.has-nav main.wrap { margin-left: calc(224px + max(0px, (100vw - 224px - 1180px) / 2)); }

/* Mobile and tablet: tab bar at the bottom of the screen. */
@media (max-width: 900px) {
  .app-nav {
    top: auto; right: 0; width: auto; height: calc(62px + env(safe-area-inset-bottom));
    padding: 4px 6px env(safe-area-inset-bottom); flex-direction: row; gap: 0;
    border-right: 0; border-top: 1px solid var(--line); box-shadow: 0 -2px 10px rgba(16, 24, 40, .06);
  }
  .nav-title, .nav-item.nav-admin { display: none; }
  .nav-item {
    flex: 1; flex-direction: column; justify-content: center; gap: 3px; padding: 6px 4px;
    font-size: 12px; font-weight: 600; color: var(--muted); border-radius: 10px;
  }
  .nav-item:hover { background: transparent; }
  .nav-item.active { background: transparent; }
  .nav-item svg { width: 24px; height: 24px; }
  body.has-nav main.wrap { margin-left: auto; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}

/* ---------- all ads ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.toolbar input[type=search] { flex: 1 1 220px; border: 1px solid #cfd4dc; border-radius: 8px; padding: 9px 11px; background: #fff; }
.ad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.ad-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.ad-card .ad-pic { width: 100%; height: auto; aspect-ratio: 4 / 3; border: 0; border-radius: 0; cursor: zoom-in; }
.ad-card .ad-pic.no-pic { cursor: default; }
.ad-card .body { padding: 12px 14px 14px; display: grid; gap: 8px; }
.ad-card .title { font-weight: 650; line-height: 1.3; }
.ad-card .sub { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.ad-card .sub a { color: var(--muted); }
.ad-card .stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.ad-card .stats .k { font-size: 12px; color: var(--muted); }
.ad-card .stats .v { font-weight: 650; font-variant-numeric: tabular-nums; }
.type-tag { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: #eef0f3; color: var(--muted); }
@media (max-width: 520px) {
  .ad-grid { grid-template-columns: 1fr; gap: 10px; }
  .ad-card { flex-direction: row; }
  .ad-card .ad-pic { width: 112px; min-height: 112px; aspect-ratio: auto; flex: none; align-self: stretch; }
  .ad-card .body { padding: 10px 12px; gap: 6px; min-width: 0; }
  .ad-card .stats { gap: 4px 8px; padding-top: 6px; }
}

/* ---------- payment ---------- */
.pay-hero { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 22px; }
.pay-hero .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.pay-hero .big { font-size: 34px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.5px; line-height: 1.15; margin-top: 4px; }
.pay-hero .eq { font-size: 26px; color: var(--muted); }
.pay-hero .right { text-align: right; }
.rate-line { border-top: 1px dashed var(--line); grid-column: 1 / -1; padding-top: 12px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; color: var(--muted); font-size: 14px; }
.rate-line strong { color: var(--ink); }
.pay-status { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.pay-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.pay-box .label { font-size: 13px; color: var(--muted); font-weight: 600; }
.pay-box .amount { font-size: 26px; font-weight: 750; font-variant-numeric: tabular-nums; margin-top: 4px; }
.pay-box.paid .amount { color: var(--good); }
.pay-box.due .amount { color: var(--bad); }
.pay-box.due.clear .amount { color: var(--good); }
.pay-box .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pay-box .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.btn.pay { background: var(--good); padding: 11px 22px; font-size: 15px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.history { display: grid; gap: 0; }
.history .item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.history .item:last-child { border-bottom: 0; }
.history .what { font-weight: 600; }
.history .info { font-size: 13px; color: var(--muted); }
.history .amt { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.status.approved { background: #e3f3e8; color: var(--good); }
.status.pending { background: #fdf1dc; color: var(--warn); }
.status.rejected { background: #fbe4e2; color: var(--bad); }
@media (max-width: 620px) {
  .pay-hero { grid-template-columns: 1fr; gap: 6px; padding: 18px; }
  .pay-hero .eq { display: none; }
  .pay-hero .right { text-align: left; border-top: 1px solid var(--line); padding-top: 10px; }
  .pay-hero .big { font-size: 28px; }
  .pay-status { grid-template-columns: 1fr; }
}

/* ---------- pay (choose method) ---------- */
.due-banner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.due-banner .amount { font-size: 28px; font-weight: 750; color: var(--bad); font-variant-numeric: tabular-nums; }
.methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.method {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 10px; cursor: pointer;
  background: var(--surface); border: 2px solid var(--line); border-radius: 12px; font: inherit; font-weight: 650; color: var(--ink);
}
.method:hover { border-color: #b8c7f3; }
.method.active { border-color: var(--accent); box-shadow: 0 0 0 3px #dbe4fb; }
.method .logo { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; }
.method .logo.bkash { background: #e2136e; }
.method .logo.nagad { background: #ec6a1f; }
.method .logo.bank { background: #1f4fd8; }
.method .logo svg { width: 26px; height: 26px; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.copy-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: #f6f7f9; border-radius: 8px; border: 1px solid var(--line); }
.copy-row + .copy-row { margin-top: 8px; }
.copy-row .k { font-size: 12px; color: var(--muted); }
.copy-row .v { font-weight: 700; font-size: 17px; font-variant-numeric: tabular-nums; word-break: break-all; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid .field input, .form-grid .field textarea { width: 100%; }
textarea { border: 1px solid #cfd4dc; border-radius: 8px; padding: 9px 11px; font: inherit; resize: vertical; }
.success { text-align: center; padding: 30px 18px; }
.success .tick { width: 56px; height: 56px; border-radius: 50%; background: #e3f3e8; color: var(--good); display: grid; place-items: center; margin: 0 auto 12px; font-size: 28px; font-weight: 800; }
@media (max-width: 520px) {
  .methods { gap: 8px; }
  .method { padding: 14px 6px; font-size: 14px; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ---------- admin: payments ---------- */
.client-row .rate { font-size: 13px; color: var(--muted); margin-top: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.client-row .rate strong { color: var(--ink); }
.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font: inherit; font-size: 13px; text-decoration: underline; }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; margin-left: 4px; }
.pay-panel { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.pay-panel .history .item { padding: 10px 0; flex-wrap: wrap; }
.pay-sum { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 6px; }
.pay-sum div { background: #f6f7f9; border-radius: 8px; padding: 8px 10px; display: grid; }
.pay-sum span { font-size: 12px; color: var(--muted); }
.pay-sum strong { font-variant-numeric: tabular-nums; }
.pending-card { border-color: #f0d9a8; background: #fffaf0; margin-bottom: 16px; }
.pending-card .history .item { flex-wrap: wrap; }
.pm { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px 12px; margin: 0 0 12px; display: grid; gap: 8px; }
.pm legend { padding: 0 4px; font-weight: 650; font-size: 14px; }
.pm legend label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.pm input[type=text], .pm input[type=tel] { width: 100%; }
.pm-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.pm-row.two { grid-template-columns: 1fr 1fr; }
#methodsForm { margin-top: 16px; }
#methodsForm textarea { width: 100%; }
@media (max-width: 620px) { .pay-sum { grid-template-columns: 1fr 1fr; } }

/* ---------- carousel ads (cards side by side, like on Facebook) ---------- */
.thumb .stack {
  position: absolute; right: 4px; top: 4px; min-width: 22px; height: 20px; padding: 0 6px 0 18px;
  border-radius: 6px; background: rgba(0, 0, 0, .62); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}
.thumb .stack::before {
  content: ""; position: absolute; left: 5px; top: 5px; width: 8px; height: 8px;
  border: 1.5px solid #fff; border-radius: 2px; box-shadow: 2px -2px 0 -0.5px rgba(0,0,0,.62), 2px -2px 0 1px #fff;
}
.row-thumb .stack { right: 2px; top: 2px; height: 16px; font-size: 10px; padding: 0 4px 0 15px; }
.row-thumb .stack::before { left: 4px; top: 4px; width: 6px; height: 6px; }
.ad-card .cstrip-wrap { aspect-ratio: auto; background: #f6f7f9; cursor: default; position: relative; }
.cstrip {
  display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 10px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.cstrip::-webkit-scrollbar { display: none; }
.ccard {
  flex: 0 0 78%; margin: 0; scroll-snap-align: start; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden; cursor: zoom-in;
}
.thumb .ccard img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; background: #eef0f3; }
.ccard figcaption { font-size: 13px; font-weight: 600; padding: 7px 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cnav {
  position: absolute; top: calc(50% - 30px); width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .95); box-shadow: var(--shadow); font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink);
}
.cnav.prev { left: 6px; }
.cnav.next { right: 6px; }
@media (hover: none) { .cnav { display: none; } }
@media (max-width: 520px) {
  .ad-card.has-carousel { flex-direction: column; }
  .ad-card.has-carousel .ad-pic { width: 100%; min-height: 0; }
  .ccard { flex-basis: 72%; }
}
.viewer-stage { position: relative; }
.vnav {
  position: absolute; top: calc(50% - 20px); width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .92); box-shadow: var(--shadow); font-size: 26px; line-height: 1; cursor: pointer; color: var(--ink);
}
.vnav.prev { left: 8px; }
.vnav.next { right: 8px; }

/* ---------- profile ---------- */
.profile-card { display: flex; align-items: center; gap: 16px; }
.avatar {
  width: 64px; height: 64px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: #eef3ff; color: var(--accent); font-size: 24px; font-weight: 750;
}
.profile-card .who-name { font-size: 20px; font-weight: 700; line-height: 1.2; }
.profile-card .who-mail { color: var(--muted); font-size: 14px; word-break: break-all; }
.role-tag { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: #eef0f3; color: var(--muted); }
.menu-list { display: grid; }
.menu-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font-weight: 550; background: none; border-left: 0; border-right: 0; border-top: 0;
  width: 100%; text-align: left; font: inherit; cursor: pointer;
}
.menu-row:last-child { border-bottom: 0; }
.menu-row svg { width: 22px; height: 22px; color: var(--muted); flex: none; }
.menu-row .txt { flex: 1; display: grid; }
.menu-row .txt small { color: var(--muted); font-weight: 400; font-size: 13px; }
.menu-row .chev { color: var(--muted); font-size: 20px; }
.menu-row:hover { background: #fafbfc; }
.menu-row.danger, .menu-row.danger svg { color: var(--bad); }
.pw-form { display: grid; gap: 0; max-width: 460px; }
.pw-form .field input { width: 100%; }
.show-pw { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin: -4px 0 14px; cursor: pointer; }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.profile-grid > .card + .card { margin-top: 0; }
@media (max-width: 900px) { .profile-grid { grid-template-columns: 1fr; } }

/* ---------- pay: amount the client chooses ---------- */
.amount-card .label { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }
.amount-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; flex-wrap: wrap; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px dashed var(--line); }
.due-total { font-size: 26px; font-weight: 750; color: var(--bad); font-variant-numeric: tabular-nums; }
.amount-input { position: relative; margin-top: 6px; max-width: 320px; }
.amount-input span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 22px; font-weight: 700; color: var(--muted); }
.amount-input input { width: 100%; font-size: 24px; font-weight: 750; padding: 10px 14px 10px 36px; border-radius: 10px; font-variant-numeric: tabular-nums; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.quick button { border: 1px solid #cfd4dc; background: #fff; border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; color: var(--ink); }
.quick button.on { border-color: var(--accent); background: #eef3ff; color: var(--accent); }
.sent-line { background: #f6f7f9; border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.opt { font-weight: 400; color: var(--muted); font-size: 12px; }
.method .logo.img { background: #fff; border: 1px solid var(--line); overflow: hidden; }
.method .logo.img img { width: 100%; height: 100%; object-fit: contain; }
.method-head { display: flex; align-items: center; gap: 10px; }
.method-head-logo { width: 34px; height: 34px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.proof-pick { display: flex; align-items: center; gap: 12px; padding: 14px; border: 2px dashed #cfd4dc; border-radius: 10px; cursor: pointer; background: #fafbfc; }
.proof-pick:hover { border-color: var(--accent); background: #f5f8ff; }
.proof-pick svg { width: 28px; height: 28px; color: var(--accent); flex: none; }
.proof-pick span { display: grid; }
.proof-pick small { color: var(--muted); font-size: 12.5px; }
.proof-pick.busy { opacity: .6; pointer-events: none; }
.proof-preview { display: flex; align-items: flex-end; gap: 12px; }
.proof-preview img { max-width: 160px; max-height: 200px; border-radius: 8px; border: 1px solid var(--line); object-fit: contain; background: #f6f7f9; }

/* ---------- client pages: a slightly bigger logo, centred on phones ---------- */
body.has-nav:not(.admin) .topbar .brand-logo { height: 40px; max-width: 220px; }
body.has-nav:not(.admin) .topbar .brand-mark { width: 34px; height: 34px; font-size: 15px; }
@media (max-width: 900px) {
  body.has-nav:not(.admin) .topbar { justify-content: center; }
  body.has-nav:not(.admin) .topbar .brand small { display: none; }
  body.has-nav:not(.admin) .topbar .brand-logo { height: 40px; max-width: 200px; }
}

/* ---------- payment method logos (filled in by Portal.usePayLogos) ---------- */
[data-mlogo]:not(.ml-ready) { visibility: hidden; }
[data-mlogo].has-img { background: #fff !important; border: 1px solid var(--line); overflow: hidden; padding: 0 !important; color: transparent; }
[data-mlogo].has-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.mlogo-only:not(.has-img) { display: none !important; }
.method-head-logo { display: inline-block; flex: none; }

/* ---------- fund (money paid beyond the bill) ---------- */
.pay-status.three { grid-template-columns: 1fr 1fr 1.3fr; }
.pay-box.fund { border-color: #bfe3cc; background: #f3fbf6; }
.pay-box.fund .amount { color: var(--good); }
.due-total.zero { color: var(--good); }
.fund-chip { display: flex; flex-direction: column; align-items: flex-end; background: #f3fbf6; border: 1px solid #bfe3cc; border-radius: 10px; padding: 6px 12px; }
.fund-chip span { font-size: 12px; color: var(--muted); font-weight: 600; }
.fund-chip strong { color: var(--good); font-size: 18px; font-variant-numeric: tabular-nums; }
.history .item { justify-content: flex-start; }
.history .item .amt { margin-left: auto; }
.hist-main { min-width: 0; }
.hist-ico { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px; background: #6b7280; flex: none; }
.hist-ico.m-bkash { background: #e2136e; }
.hist-ico.m-nagad { background: #ec6a1f; }
.hist-ico.m-bank { background: #1f4fd8; }
.hist-ico.m-cash { background: #137a3d; }
@media (max-width: 900px) { .pay-status.three { grid-template-columns: 1fr 1fr; } .pay-status.three .due { grid-column: 1 / -1; } }
@media (max-width: 620px) { .pay-status.three { grid-template-columns: 1fr; } }

.res-kind { color: var(--muted); font-size: 11px; font-weight: 500; }
