/* ==========================================================================
   Monetize.com — publisher dashboard (logged-in pages)
   Used by the /hub pages (src/app/hub). Scoped to the .db wrapper that
   src/app/hub/layout.tsx renders, so none of it reaches the marketing pages:
   the design's :root tokens and body.db rules live on .db here.
   ========================================================================== */

.db {
  --c-bg: #FCFCFE;
  --c-bg-2: #F5F5FA;
  --c-card: #FFFFFF;
  --c-ink: #161A2E;
  --c-ink-2: #5F6478;
  --c-line: #E6E7F0;
  --c-line-2: #D3D5E3;
  --c-accent: #3323C2;
  --c-accent-h: #2A1BA3;
  --c-accent-soft: #F0EFFC;
  --c-sage: #E4E2FA;
  --c-ok: #067647;
  --c-ok-bg: #ECFDF3;
  --c-warn-ink: #7A5200;
  --c-warn-bg: #FBF3E2;
  --c-err: #B42318;
  --c-err-bg: #FEF3F2;
  --c-code-bg: #161A2E;
  --c-code-ink: #E6E7F0;
  --f: "Inter", "Geist", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --t-h1: clamp(1.625rem, 3vw, 2rem);
  --t-h2: 1.125rem;
  --t-body: 1rem;
  --t-sm: .875rem;
  --t-xs: .75rem;
  --r-sm: 8px;
  --r: 12px;
  --sh-card: 0 1px 2px rgba(22, 26, 46, .04), 0 4px 14px -8px rgba(22, 26, 46, .10);
  --sh-pop: 0 12px 32px -12px rgba(22, 26, 46, .22);
  --wrap: 1240px;
  --gutter: clamp(16px, 4vw, 32px);
  --header-h: 68px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --focus: 0 0 0 3px rgba(51, 35, 194, .25);
}

/* ---------- Base ---------- */
.db {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--f);
  font-size: var(--t-body);
  line-height: 1.5;
  color: var(--c-ink);
  background: var(--c-bg-2);
  overflow-x: hidden;
}
.db img, .db svg { max-width: 100%; }
.db a { color: var(--c-accent); text-decoration: none; }
.db a:hover { color: var(--c-accent-h); text-decoration: underline; }
.db h1, .db h2, .db h3, .db p { margin: 0; }
:where(.db) :where(button, input, select, textarea) { font: inherit; color: inherit; }
.db :focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
.db-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.db-skip { position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 14px; background: var(--c-accent); color: #fff !important; border-radius: var(--r-sm); }
.db-skip:focus { top: 12px; }
.db-wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.db-icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Header (includes/db-header.php) ---------- */
.db-icon--fill { fill: currentColor; stroke: none; }
.db-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--c-line);
}
.db-header__bar { position: relative; display: flex; align-items: center; gap: 28px; min-height: var(--header-h); }
.db-logo { display: inline-flex; flex: none; padding-right: 28px; border-right: 1px solid var(--c-line); }
.db-logo img { display: block; height: 28px; width: auto; }
.db-nav { display: flex; align-items: center; margin-right: auto; min-width: 0; }
.db-nav__list { display: flex; align-items: center; gap: 4px; margin: 0; padding: 0; list-style: none; }
.db-nav__list a {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: var(--r-sm);
  font-size: .9375rem; font-weight: 500; color: var(--c-ink-2);
}
.db-nav__list a:hover { color: var(--c-ink); background: var(--c-bg-2); text-decoration: none; }
.db-nav__list a[aria-current="page"] { color: var(--c-accent); background: var(--c-accent-soft); font-weight: 600; }
.db-nav__list a[aria-current="page"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: calc((var(--header-h) - 38px) / -2 - 1px);
  height: 2px; border-radius: 2px; background: var(--c-accent);
}
.db-nav__account { display: none; }
.db-header__end { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.db-menu-toggle {
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0;
  border: 1px solid var(--c-line); border-radius: var(--r-sm); background: var(--c-card); cursor: pointer;
}
.db-menu-toggle .db-icon { width: 20px; height: 20px; }
.db-menu-toggle .db-icon--close { display: none; }
.db-menu-toggle[aria-expanded="true"] .db-icon--open { display: none; }
.db-menu-toggle[aria-expanded="true"] .db-icon--close { display: block; }

/* Account menu */
.db-account__btn { max-width: 240px; padding-left: 6px; border: 1px solid var(--c-line); border-radius: 999px; min-height: 40px; }
.db-account__btn:hover { background: var(--c-bg-2); }
.db-account__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.db-avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--c-sage); color: var(--c-accent); font-size: var(--t-xs); font-weight: 700;
}
.db-account__menu { min-width: 220px; }
.db-account__who { display: grid; gap: 2px; padding: 8px 10px 10px; margin: 0 0 6px; border-bottom: 1px solid var(--c-line); }
.db-account__who small, .db-nav__who small { font-size: var(--t-xs); color: var(--c-ink-2); }
.db-account__who strong, .db-nav__who strong { font-size: var(--t-sm); font-weight: 650; color: var(--c-ink); overflow-wrap: anywhere; }

/* ---------- Main / page head ---------- */
.db-main { flex: 1; padding: 28px 0 56px; }
.db-crumbs { margin-bottom: 12px; font-size: var(--t-sm); color: var(--c-ink-2); }
.db-crumbs ol { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.db-crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--c-line-2); }
.db-crumbs [aria-current] { color: var(--c-ink); }
.db-pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.db-pagehead h1 { font-size: var(--t-h1); line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
.db-pagehead__sub { margin-top: 6px; color: var(--c-ink-2); font-size: var(--t-sm); }
.db-filters { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Buttons ---------- */
.db-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  font-size: var(--t-sm); font-weight: 600; line-height: 1.2; white-space: nowrap;
  cursor: pointer; transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.db-btn:hover { text-decoration: none !important; }
.db-btn--primary { background: var(--c-accent); color: #fff !important; }
.db-btn--primary:hover { background: var(--c-accent-h); }
.db-btn--ghost { background: var(--c-card); border-color: var(--c-line-2); color: var(--c-ink) !important; }
.db-btn--ghost:hover { border-color: var(--c-accent); color: var(--c-accent) !important; }
.db-btn--plain { background: transparent; color: var(--c-ink) !important; }
.db-btn--plain:hover { background: var(--c-bg-2); }
.db-btn--danger { background: var(--c-err); color: #fff !important; }
.db-btn--danger:hover { background: #912018; }
.db-btn--sm { min-height: 34px; padding: 6px 12px; }
.db-btn[disabled] { opacity: .5; cursor: not-allowed; }
.db-btn .db-caret { width: 14px; height: 14px; transition: transform .15s var(--ease); }
.db-btn[aria-expanded="true"] .db-caret { transform: rotate(180deg); }
.db-iconbtn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--c-line); border-radius: var(--r-sm);
  background: var(--c-card); color: var(--c-ink-2); cursor: pointer;
}
.db-iconbtn:hover { color: var(--c-accent); border-color: var(--c-accent); }
.db-iconbtn--danger:hover { color: var(--c-err); border-color: var(--c-err); }
.db-iconbtn .db-icon { width: 16px; height: 16px; }

/* ---------- Dropdowns ---------- */
.db-dd { position: relative; }
.db-dd__menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30;
  min-width: 220px; max-width: min(340px, calc(100vw - 32px)); max-height: min(480px, 72vh); overflow: auto;
  padding: 6px; margin: 0; list-style: none;
  background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--r);
  box-shadow: var(--sh-pop);
}
.db-dd__menu[hidden] { display: none; }
.db-dd--end .db-dd__menu { left: auto; right: 0; }
.db-dd__item, .db-dd__opt {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: 0; border-radius: var(--r-sm);
  background: none; text-align: left; font-size: var(--t-sm); color: var(--c-ink) !important;
  cursor: pointer;
}
.db-dd__item:hover, .db-dd__opt:hover { background: var(--c-bg-2); text-decoration: none !important; }
.db-dd__item[aria-checked="true"] { color: var(--c-accent) !important; font-weight: 600; background: var(--c-accent-soft); }
.db-dd__opt input { width: 16px; height: 16px; margin: 0; accent-color: var(--c-accent); flex: none; }
.db-dd__opt span { overflow-wrap: anywhere; }
.db-dd__sep { height: 1px; margin: 6px 4px; background: var(--c-line); }
.db-dd__search { padding: 4px 4px 6px; position: sticky; top: -6px; background: var(--c-card); z-index: 1; }
.db-dd__search .db-input { min-height: 38px; padding: 7px 10px; font-size: var(--t-sm); }
.db-dd__empty { padding: 10px; font-size: var(--t-sm); color: var(--c-ink-2); }
.db-dd__menu li[hidden] { display: none; }
.db-dd__custom { display: grid; gap: 8px; padding: 8px 6px 4px; }
.db-dd__custom[hidden] { display: none; }
.db-dd__custom label { font-size: var(--t-xs); color: var(--c-ink-2); }
.db-dd__custom .db-input { min-height: 36px; padding: 6px 10px; }

/* ---------- Cards ---------- */
.db-card {
  background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--r);
  box-shadow: var(--sh-card);
}
.db-card__head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px; border-bottom: 1px solid var(--c-line);
}
.db-card__head h2 { font-size: var(--t-h2); font-weight: 650; }
.db-card__body { padding: 20px; }

/* ---------- Dashboard KPIs ---------- */
.db-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.db-kpi { padding: 18px 20px 20px; }
.db-kpi__label { font-size: var(--t-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--c-ink-2); }
.db-kpi__value { margin-top: 8px; font-size: clamp(1.5rem, 2.6vw, 1.875rem); font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.db-kpi__hint { margin-top: 6px; font-size: var(--t-xs); color: var(--c-ink-2); }
.db-status { margin-top: 16px; font-size: var(--t-sm); color: var(--c-ink-2); }

/* ---------- Layout grids ---------- */
.db-split { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.db-split--rev { grid-template-columns: 300px minmax(0, 1fr); }

/* ---------- Install steps ---------- */
.db-steps { margin: 0; padding: 8px 20px 20px; list-style: none; counter-reset: step; }
.db-step { position: relative; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--c-line); counter-increment: step; }
.db-step:last-child { border-bottom: 0; }
.db-step::before {
  content: counter(step);
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 1.5px solid var(--c-accent); border-radius: 50%;
  color: var(--c-accent); font-weight: 700;
}
.db-step h2 { font-size: 1.0625rem; font-weight: 650; color: var(--c-ink); line-height: 40px; }
.db-step__body { min-width: 0; }
.db-step__body > * + * { margin-top: 12px; }
.db-step p { color: var(--c-ink-2); font-size: .9375rem; }
.db-step code { font-family: var(--f-mono); font-size: .875em; background: var(--c-bg-2); padding: 1px 6px; border-radius: 6px; color: var(--c-ink); }
.db-code { position: relative; border-radius: var(--r); background: var(--c-code-bg); }
.db-step .db-code code { padding: 0; background: none; border-radius: 0; color: inherit; font-size: inherit; }
.db-code pre {
  margin: 0; padding: 18px 20px; padding-right: 96px; overflow-x: auto;
  font-family: var(--f-mono); font-size: .875rem; line-height: 1.7; color: var(--c-code-ink);
  white-space: pre-wrap; word-break: break-all;
}
.db-code .db-tok-tag { color: #FF8FA3; }
.db-code .db-tok-attr { color: #FFD479; }
.db-code .db-tok-val { color: #9BE9A8; }
.db-code__copy {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px; padding: 6px 10px; border: 1px solid rgba(255,255,255,.18); border-radius: var(--r-sm);
  background: rgba(255,255,255,.06); color: #fff; font-size: var(--t-xs); font-weight: 600; cursor: pointer;
}
.db-code__copy:hover { background: rgba(255,255,255,.14); }
.db-code__copy .db-icon { width: 14px; height: 14px; }
.db-inline { display: flex; gap: 0; }
.db-inline .db-input { border-top-right-radius: 0; border-bottom-right-radius: 0; min-width: 0; }
.db-inline .db-btn { border-top-left-radius: 0; border-bottom-left-radius: 0; min-height: 44px; }
.db-help { padding: 20px; text-align: center; }
.db-help h2 { font-size: var(--t-h2); font-weight: 650; }
.db-help p { margin-top: 6px; font-size: var(--t-sm); color: var(--c-ink-2); }
.db-help .db-btn { width: 100%; margin-top: 16px; }
.db-help__mail { display: block; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--c-line); font-size: var(--t-sm); }
.db-help__mail strong { display: block; color: var(--c-ink); font-weight: 600; }

/* ---------- Forms ---------- */
.db-field { display: grid; gap: 6px; min-width: 0; }
.db-field > label, .db-legend { font-size: var(--t-sm); font-weight: 600; color: var(--c-ink); }
.db-input, .db-select {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--c-line-2); border-radius: var(--r-sm); background: var(--c-card);
  font-size: .9375rem;
}
.db-select {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%235F6478' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.db-input:focus, .db-select:focus { outline: none; border-color: var(--c-accent); box-shadow: var(--focus); }
.db-input[aria-invalid="true"] { border-color: var(--c-err); }
.db-input::placeholder { color: #8A8FA3; }
.db-check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--t-sm); cursor: pointer; }
.db-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--c-accent); flex: none; }
.db-hint { font-size: var(--t-xs); color: var(--c-ink-2); }
.db-error { font-size: var(--t-sm); color: var(--c-err); }
.db-error:empty { display: none; }
.db-fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.db-fieldset legend { padding: 0; margin-bottom: 4px; }
.db-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); gap: 8px; margin-top: 12px; }
.db-choice {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--c-line); border-radius: var(--r-sm); font-size: var(--t-sm); cursor: pointer;
}
.db-choice:hover { border-color: var(--c-line-2); background: var(--c-bg-2); }
.db-choice input { width: 16px; height: 16px; margin: 0; accent-color: var(--c-accent); flex: none; }
.db-choice span { min-width: 0; overflow-wrap: anywhere; line-height: 1.35; }
.db-choice:has(input:checked) { border-color: var(--c-accent); background: var(--c-accent-soft); color: var(--c-accent); font-weight: 600; }

/* Searchable select */
.db-combo { position: relative; min-width: 0; }
.db-combo__native { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; opacity: 0; pointer-events: none; }
.db-combo__btn { display: flex; align-items: center; text-align: left; }
.db-combo__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.db-combo__btn.is-placeholder .db-combo__text { color: var(--c-ink-2); }
.db-combo.is-open .db-combo__btn { border-color: var(--c-accent); box-shadow: var(--focus); }
.db-combo__pop {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 35;
  min-width: 220px; padding: 6px;
  background: var(--c-card); border: 1px solid var(--c-line); border-radius: var(--r); box-shadow: var(--sh-pop);
}
.db-combo__pop[hidden] { display: none; }
.db-combo__search { position: relative; }
.db-combo__search .db-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--c-ink-2); pointer-events: none; }
.db-combo__input {
  width: 100%; min-height: 38px; padding: 7px 10px 7px 34px;
  border: 1px solid var(--c-line-2); border-radius: var(--r-sm); background: var(--c-card); font-size: var(--t-sm);
}
.db-combo__input:focus { outline: none; border-color: var(--c-accent); box-shadow: var(--focus); }
.db-combo__list { max-height: 260px; overflow-y: auto; margin: 6px 0 0; padding: 0; list-style: none; overscroll-behavior: contain; }
.db-combo__list [role=option] { padding: 9px 10px; border-radius: var(--r-sm); font-size: var(--t-sm); cursor: pointer; overflow-wrap: anywhere; }
.db-combo__list [role=option][hidden] { display: none; }
.db-combo__list [role=option]:hover, .db-combo__list [role=option].is-active { background: var(--c-bg-2); }
.db-combo__list [role=option][aria-selected="true"] { color: var(--c-accent); font-weight: 600; background: var(--c-accent-soft); }
.db-combo__empty { padding: 10px; font-size: var(--t-sm); color: var(--c-ink-2); }
.db-dialog .db-combo__pop { position: static; margin-top: 6px; box-shadow: none; }

/* Messages */
.db-msg { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-sm); font-size: var(--t-sm); }
.db-msg[hidden] { display: none; }
.db-msg--ok { background: var(--c-ok-bg); color: var(--c-ok); }
.db-msg--warn { background: var(--c-warn-bg); color: var(--c-warn-ink); }
.db-msg--err { background: var(--c-err-bg); color: var(--c-err); }
.db-msg--info { background: var(--c-accent-soft); color: var(--c-accent-h); }

/* ---------- Merchants ---------- */
.db-search { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: end; }
.db-search__row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.db-search__actions { display: flex; gap: 8px; }
.db-merchants { margin-top: 24px; }
.db-merchants .db-card__head h2 { color: var(--c-ink); }
.db-merchants__meta { font-size: var(--t-sm); color: var(--c-ink-2); }
.db-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 0; padding: 20px; list-style: none; }
.db-grid > li { display: flex; min-width: 0; }
.db-merchant {
  display: flex; flex-direction: column; width: 100%; min-width: 0; overflow: hidden; padding: 0;
  border: 1px solid var(--c-line); border-radius: var(--r); background: var(--c-card);
  text-align: center; cursor: pointer;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease);
}
.db-merchant:hover { border-color: var(--c-accent); box-shadow: var(--sh-card); transform: translateY(-1px); }
.db-merchant:focus-visible { border-color: var(--c-accent); box-shadow: var(--focus); border-radius: var(--r); }
.db-merchant__logo {
  display: grid; place-items: center; height: 104px; padding: 16px 20px;
  background: #fff; border-bottom: 1px solid var(--c-line);
}
.db-merchant__logo, .db-md__logo { position: relative; }
.db-merchant__logo img { display: block; max-width: 100%; max-height: 64px; width: auto; height: auto; object-fit: contain; }
.db-merchant__logo img.is-loading, .db-md__logo img.is-loading { position: absolute; width: 1px; height: 1px; opacity: 0; }
.db-merchant__mono {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: var(--r);
  background: var(--c-accent-soft); border: 1px solid var(--c-sage);
  color: var(--c-accent); font-weight: 700; font-size: 1.0625rem; letter-spacing: .02em;
}
.db-merchant__mono[hidden] { display: none; }
.db-merchant__body { display: grid; gap: 2px; padding: 12px 14px 14px; flex: 1; align-content: start; }
.db-merchant__name { font-weight: 650; font-size: .9375rem; color: var(--c-ink); overflow-wrap: anywhere; }
.db-merchant__site { font-size: var(--t-xs); color: var(--c-accent); overflow-wrap: anywhere; }
.db-merchant__meta { font-size: var(--t-xs); color: var(--c-ink-2); overflow-wrap: anywhere; }
.db-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--c-accent-soft); color: var(--c-accent); font-size: 11px; font-weight: 600;
}
.db-badge[hidden] { display: none; }

/* Merchant details dialog */
.db-md { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 20px; align-items: start; }
.db-md__logo { display: grid; place-items: center; height: 120px; padding: 16px; border: 1px solid var(--c-line); border-radius: var(--r); background: #fff; }
.db-md__logo img { max-width: 100%; max-height: 80px; object-fit: contain; }
.db-md__title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.db-md__title h3 { font-size: 1.25rem; font-weight: 700; overflow-wrap: anywhere; }
.db-md dl { display: grid; gap: 10px; margin: 14px 0 0; }
.db-md dl > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; font-size: var(--t-sm); }
.db-md dt { color: var(--c-ink-2); font-weight: 600; }
.db-md dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.db-btn[hidden] { display: none; }
.db-empty { padding: 40px 20px; text-align: center; color: var(--c-ink-2); }
.db-empty strong { display: block; color: var(--c-ink); margin-bottom: 4px; }
.db-more { display: flex; justify-content: center; padding: 0 20px 20px; }
.db-more[hidden] { display: none; }

/* ---------- Sites table ---------- */
.db-disclosure p { color: var(--c-ink-2); font-size: .9375rem; }
.db-disclosure a { display: inline-block; margin-top: 12px; font-weight: 600; }
.db-table-wrap { width: 100%; overflow-x: auto; }
.db-table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
.db-table th, .db-table td { padding: 14px 16px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--c-line); }
.db-table th { font-size: var(--t-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--c-ink-2); background: var(--c-bg-2); white-space: nowrap; }
.db-table tbody tr:last-child td { border-bottom: 0; }
.db-table tbody tr:hover { background: #FAFAFD; }
.db-table__domain { font-weight: 600; overflow-wrap: anywhere; }
.db-table__actions { display: flex; gap: 6px; justify-content: flex-end; }
.db-table th:last-child { text-align: right; }
.db-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.db-tag { padding: 2px 8px; border-radius: 6px; background: var(--c-bg-2); border: 1px solid var(--c-line); font-size: var(--t-xs); white-space: nowrap; }

/* ---------- Dialogs ---------- */
.db-dialog {
  width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px);
  padding: 0; border: 0; border-radius: var(--r); background: var(--c-card); color: var(--c-ink);
  box-shadow: var(--sh-pop);
}
.db-dialog--sm { width: min(500px, calc(100vw - 24px)); }
.db-dialog::backdrop { background: rgba(22, 26, 46, .45); }
.db-dialog__form { display: flex; flex-direction: column; max-height: inherit; margin: 0; }
.db-dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--c-line); }
.db-dialog__head h2 { font-size: var(--t-h2); font-weight: 650; }
.db-dialog__body { padding: 20px; overflow-y: auto; }
.db-dialog__body > * + * { margin-top: 16px; }
.db-dialog__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--c-line); background: var(--c-bg); border-radius: 0 0 var(--r) var(--r); }
.db-dialog__foot .db-dots { margin-right: auto; }
.db-wizard__step[hidden] { display: none; }
.db-wizard__step h3 { font-size: 1.0625rem; font-weight: 650; }
.db-wizard__step > p { color: var(--c-ink-2); font-size: var(--t-sm); margin-top: 4px; }
.db-dots { display: flex; gap: 6px; }
.db-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--c-line-2); }
.db-dots span[aria-current="step"] { background: var(--c-accent); width: 20px; border-radius: 4px; }
.db-done { text-align: center; padding: 12px 0; }
.db-done__icon { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--c-ok-bg); color: var(--c-ok); }
.db-done__icon .db-icon { width: 28px; height: 28px; }
.db-done h3 { margin-top: 12px; }
.db-keys { display: grid; gap: 0; margin: 0; border: 1px solid var(--c-line); border-radius: var(--r); overflow: hidden; }
.db-keys > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: center; padding: 14px 16px; }
.db-keys > div + div { border-top: 1px solid var(--c-line); }
.db-keys dt { font-size: var(--t-sm); font-weight: 600; color: var(--c-ink-2); }
.db-keys dd { margin: 0; min-width: 0; font-size: .9375rem; overflow-wrap: anywhere; }
.db-key { display: flex; align-items: center; gap: 8px; min-width: 0; }
.db-key code { flex: 1; min-width: 0; padding: 8px 10px; border-radius: var(--r-sm); background: var(--c-bg-2); font-family: var(--f-mono); font-size: var(--t-sm); overflow-wrap: anywhere; user-select: all; }
.db-key code.is-missing { font-family: var(--f); color: var(--c-ink-2); user-select: auto; }

/* ---------- Disclosure page ---------- */
.db-doc { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.db-toc { position: sticky; top: calc(var(--header-h) + 16px); padding: 16px; }
.db-toc h2 { font-size: var(--t-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--c-ink-2); margin-bottom: 8px; }
.db-toc ol { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.db-toc a { display: block; padding: 8px 10px; border-radius: var(--r-sm); color: var(--c-ink-2); font-size: var(--t-sm); font-weight: 500; }
.db-toc a:hover { color: var(--c-accent); background: var(--c-bg-2); text-decoration: none; }
.db-toc a[aria-current="true"] { color: var(--c-accent); background: var(--c-accent-soft); }
.db-prose { padding: 8px 28px 28px; }
.db-prose section { padding-top: 24px; scroll-margin-top: calc(var(--header-h) + 16px); }
.db-prose section + section { margin-top: 8px; border-top: 1px solid var(--c-line); }
.db-prose h2 { font-size: 1.25rem; font-weight: 700; line-height: 1.3; text-wrap: balance; }
.db-prose h3 { margin-top: 20px; font-size: 1rem; font-weight: 650; }
.db-prose p, .db-prose li { max-width: 72ch; color: var(--c-ink-2); font-size: .9375rem; line-height: 1.7; }
.db-prose p { margin-top: 12px; }
.db-prose ul { margin: 12px 0 0; padding-left: 20px; display: grid; gap: 8px; }
.db-prose li::marker { color: var(--c-accent); }
.db-prose strong { color: var(--c-ink); }
.db-prose a { overflow-wrap: anywhere; }
.db-links { display: grid; gap: 8px; margin: 12px 0 0; padding: 0 !important; list-style: none; }
.db-links li { max-width: none; }
.db-links a { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--c-line); border-radius: var(--r-sm); color: var(--c-ink); font-weight: 500; }
.db-links a:hover { border-color: var(--c-accent); color: var(--c-accent); text-decoration: none; }
.db-links small { color: var(--c-ink-2); font-size: var(--t-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.db-note { margin-top: 16px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--c-warn-bg); color: var(--c-warn-ink) !important; font-size: var(--t-sm) !important; }
.db-quote { margin: 16px 0 0; padding: 16px 18px; border-left: 3px solid var(--c-accent); border-radius: 0 var(--r-sm) var(--r-sm) 0; background: var(--c-bg-2); }
.db-quote p { margin: 0; color: var(--c-ink); font-size: .9375rem; }
.db-required { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding: 14px 16px; border: 1px solid var(--c-sage); border-radius: var(--r-sm); background: var(--c-accent-soft); }
.db-required p { margin: 0; max-width: none; color: var(--c-accent-h); font-weight: 600; }

/* ---------- Toast ---------- */
.db-toast {
  position: fixed; left: 50%; bottom: 20px; z-index: 60; transform: translate(-50%, 16px);
  max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: var(--r-sm);
  background: var(--c-ink); color: #fff; font-size: var(--t-sm); box-shadow: var(--sh-pop);
  opacity: 0; pointer-events: none; transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.db-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Footer (includes/db-footer.php) ---------- */
.db-footer { background: var(--c-card); border-top: 1px solid var(--c-line); }
.db-footer__top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 20px 40px; padding-top: 28px; padding-bottom: 20px; }
.db-footer__brand { display: grid; gap: 8px; }
.db-footer__logo img { display: block; height: 24px; width: auto; }
.db-footer__brand p { font-size: var(--t-sm); color: var(--c-ink-2); }
.db-footer__links { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0; padding: 0; list-style: none; }
.db-footer__links a { color: var(--c-ink-2); font-size: var(--t-sm); font-weight: 500; }
.db-footer__links a:hover { color: var(--c-accent); }
.db-footer__bottom {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; padding-bottom: 20px;
  background: linear-gradient(var(--c-line), var(--c-line)) center top / calc(100% - 2 * var(--gutter)) 1px no-repeat;
}
.db-footer__bottom small { color: var(--c-ink-2); font-size: var(--t-xs); }
.db-footer__social { display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; }
.db-footer__social a { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--c-line); border-radius: 50%; color: var(--c-ink-2); }
.db-footer__social a:hover { color: var(--c-accent); border-color: var(--c-accent); }
.db-footer__social .db-icon { width: 16px; height: 16px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  .db-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .db-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .db-split, .db-split--rev { grid-template-columns: minmax(0, 1fr); }
  .db-doc { grid-template-columns: minmax(0, 1fr); }
  .db-toc { position: static; }
  .db-toc ol { display: flex; flex-wrap: wrap; gap: 6px; }
  .db-toc a { border: 1px solid var(--c-line); }
  .db-split--rev .db-disclosure { order: 2; }
}

@media (max-width: 860px) {
  .db-menu-toggle { display: inline-flex; }
  .db-header__bar { gap: 12px; }
  .db-logo { padding-right: 0; border-right: 0; }
  .db-account { display: none; }
  .db-nav {
    position: absolute; top: 100%; left: 0; right: 0; margin: 0;
    display: none; flex-direction: column; align-items: stretch; gap: 8px;
    padding: 8px var(--gutter) 16px;
    background: var(--c-card); border-bottom: 1px solid var(--c-line); box-shadow: var(--sh-pop);
    max-height: calc(100vh - var(--header-h)); overflow-y: auto;
  }
  .db-nav.is-open { display: flex; }
  .db-nav__list { flex-direction: column; align-items: stretch; gap: 2px; }
  .db-nav__list a { display: flex; padding: 12px; font-size: 1rem; }
  .db-nav__list a[aria-current="page"]::after { left: 0; right: auto; top: 10px; bottom: 10px; width: 3px; height: auto; }
  .db-nav__account { display: flex; align-items: center; gap: 10px; padding: 14px 12px 4px; border-top: 1px solid var(--c-line); }
  .db-nav__who { display: grid; gap: 1px; min-width: 0; margin-right: auto; }
  .db-search { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .db-search .db-field:first-child { grid-column: 1 / -1; }
  .db-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .db-pagehead { align-items: flex-start; }
  .db-filters { width: 100%; }

}

@media (max-width: 640px) {
  /* Sites table becomes stacked cards */
  .db-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .db-table, .db-table tbody, .db-table tr, .db-table td { display: block; width: 100%; }
  .db-table tbody { display: grid; gap: 12px; padding: 16px; }
  .db-table tr { border: 1px solid var(--c-line); border-radius: var(--r); background: var(--c-card); }
  .db-table tbody tr:hover { background: var(--c-card); }
  .db-table td { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--c-line); }
  .db-table td::before { content: attr(data-label); font-size: var(--t-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--c-ink-2); }
  .db-table tbody tr td:last-child { border-bottom: 0; }
  .db-table__actions { justify-content: flex-start; }
}

@media (max-width: 560px) {
  .db-main { padding-top: 20px; }
  .db-logo img { height: 24px; }
  .db-filters > .db-dd { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .db-filters > .db-dd:last-child { flex-basis: 100%; }
  .db-filters .db-btn { width: 100%; justify-content: flex-start; }
  .db-filters .db-btn span { overflow: hidden; text-overflow: ellipsis; }
  .db-filters .db-btn .db-caret { margin-left: auto; }
  .db-filters .db-dd__menu { left: 0; right: auto; width: 100%; min-width: 220px; }
  .db-filters > .db-dd:nth-child(2) .db-dd__menu { left: auto; right: 0; }
  .db-kpis { gap: 12px; }
  .db-kpi { padding: 14px 16px 16px; }
  .db-search { grid-template-columns: minmax(0, 1fr); }
  .db-search__row { flex-direction: column; align-items: stretch; }
  .db-search__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .db-search__actions .db-btn { min-height: 44px; padding: 8px 12px; white-space: normal; }
  .db-grid { gap: 12px; padding: 16px; }
  .db-merchant__logo { height: 84px; padding: 12px 14px; }
  .db-merchant__logo img { max-height: 48px; }
  .db-prose { padding: 4px 16px 20px; }
  .db-md { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .db-md__logo { height: 96px; }
  .db-md dl > div, .db-keys > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .db-key { flex-wrap: wrap; }
  .db-key .db-btn { width: 100%; }
  .db-steps { padding: 0 16px 8px; }
  .db-step { grid-template-columns: 32px minmax(0, 1fr); gap: 12px; }
  .db-step::before { width: 32px; height: 32px; font-size: var(--t-sm); }
  .db-step h2 { line-height: 32px; font-size: 1rem; }
  .db-code pre { padding: 52px 16px 16px; font-size: .8125rem; }
  .db-inline { flex-direction: column; gap: 8px; }
  .db-inline .db-input, .db-inline .db-btn { border-radius: var(--r-sm); }
  .db-card__head, .db-card__body { padding-left: 16px; padding-right: 16px; }
  .db-card__head .db-btn { width: 100%; }
  .db-choices { grid-template-columns: minmax(0, 1fr); }
  .db-table td { grid-template-columns: 80px minmax(0, 1fr); }
  .db-dialog__foot .db-btn { flex: 1; }
  .db-dialog__foot .db-dots { flex-basis: 100%; justify-content: center; margin: 0 0 4px; }
  .db-footer__top { flex-direction: column; gap: 16px; }
  .db-footer__links { gap: 8px 16px; }
}

@media (max-width: 380px) {
  .db-kpis { grid-template-columns: minmax(0, 1fr); }
  .db-grid { grid-template-columns: minmax(0, 1fr); }
  .db-filters > .db-dd { flex-basis: 100%; }
  .db-filters > .db-dd:nth-child(2) .db-dd__menu { left: 0; right: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .db *, .db *::before, .db *::after { transition: none !important; animation: none !important; }
}

/* Next.js additions: notes for parts not connected yet, and the Account page (src/app/hub/account) */
.db-welcome { margin-bottom: 16px; }
.db-pending { margin-top: 16px; }
.db-merchants + .db-pending { margin-top: 16px; }
.db-account-page .hub { gap: 24px; }
@media (max-width: 860px) {
  /* The mobile account block has two buttons (Account, Sign out): they wrap below the name */
  .db-nav__account { flex-wrap: wrap; }
  .db-nav__who { flex: 1 1 calc(100% - 52px); }
}
/* Links inside running text are underlined, so they don't rely on colour alone (WCAG 1.4.1) */
.db-prose p a, .db-hint a, .db-card__body p a { text-decoration: underline; text-underline-offset: 2px; }
